From 3fa5f9908deb01a7d7fda3d66ded39e9e009a28e Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 26 Apr 2025 21:29:58 +1000 Subject: [PATCH 1/2] feature: add data loading --- src/dashboard/Data/Browser/Browser.react.js | 8 ++++++++ src/dashboard/Data/Browser/BrowserTable.react.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index 86c90182f9..db40a4a653 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -42,6 +42,7 @@ import generatePath from 'lib/generatePath'; import { withRouter } from 'lib/withRouter'; import { get } from 'lib/AJAX'; import BrowserFooter from './BrowserFooter.react'; +import LoaderDots from 'components/LoaderDots/LoaderDots.react'; // The initial and max amount of rows fetched by lazy loading const BROWSER_LAST_LOCATION = 'brower_last_location'; @@ -898,6 +899,10 @@ class Browser extends DashboardView { async fetchParseData(source, filters) { const { useMasterKey, skip, limit } = this.state; + this.setLoading(true); + this.setState({ + data: null, + }) const query = await queryFromFilters(source, filters); const sortDir = this.state.ordering[0] === '-' ? '-' : '+'; const field = this.state.ordering.substr(sortDir === '-' ? 1 : 0); @@ -927,6 +932,8 @@ class Browser extends DashboardView { this.setState({ isUnique, uniqueField }); const data = await promise; + + this.setLoading(false); return data; } @@ -2089,6 +2096,7 @@ class Browser extends DashboardView { classwiseCloudFunctions={this.state.classwiseCloudFunctions} callCloudFunction={this.fetchAggregationPanelData} isLoadingCloudFunction={this.state.isLoading} + isLoading={this.state.isLoading} setLoading={this.setLoading} AggregationPanelData={this.state.AggregationPanelData} setAggregationPanelData={this.setAggregationPanelData} diff --git a/src/dashboard/Data/Browser/BrowserTable.react.js b/src/dashboard/Data/Browser/BrowserTable.react.js index db9fae141f..94591a758c 100644 --- a/src/dashboard/Data/Browser/BrowserTable.react.js +++ b/src/dashboard/Data/Browser/BrowserTable.react.js @@ -560,7 +560,7 @@ export default class BrowserTable extends React.Component { onResize={this.props.handleResize} onAddColumn={this.props.onAddColumn} preventSchemaEdits={this.context.preventSchemaEdits} - isDataLoaded={!!this.props.data} + isDataLoaded={!this.props.isLoading} setSelectedObjectId={this.props.setSelectedObjectId} setCurrent={this.props.setCurrent} /> From b0984c47418d1f16a495cfa452d190ea14c18993 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 26 Apr 2025 22:02:15 +1000 Subject: [PATCH 2/2] Update Browser.react.js --- src/dashboard/Data/Browser/Browser.react.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index db40a4a653..5f3f1078ff 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -42,7 +42,6 @@ import generatePath from 'lib/generatePath'; import { withRouter } from 'lib/withRouter'; import { get } from 'lib/AJAX'; import BrowserFooter from './BrowserFooter.react'; -import LoaderDots from 'components/LoaderDots/LoaderDots.react'; // The initial and max amount of rows fetched by lazy loading const BROWSER_LAST_LOCATION = 'brower_last_location';