Skip to content

Commit

Permalink
add loading indicator for export csv (#2962)
Browse files Browse the repository at this point in the history
  • Loading branch information
irisyngao authored Feb 27, 2024
1 parent 261c7e6 commit 506a09c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-donkeys-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-query-builder': patch
---

add loading indicator for export csv
4 changes: 4 additions & 0 deletions packages/legend-query-builder/src/components/QueryBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
ModalFooterButton,
CalendarClockIcon,
ChatIcon,
PanelLoadingIndicator,
} from '@finos/legend-art';
import { QueryBuilderFilterPanel } from './filter/QueryBuilderFilterPanel.js';
import { QueryBuilderExplorerPanel } from './explorer/QueryBuilderExplorerPanel.js';
Expand Down Expand Up @@ -376,6 +377,9 @@ export const QueryBuilder = observer(
elementId={QUERY_BUILDER_COMPONENT_ELEMENT_ID.BACKDROP_CONTAINER}
/>
<div className="query-builder__body">
<PanelLoadingIndicator
isLoading={queryBuilderState.resultState.exportState.isInProgress}
/>
<div className="query-builder__content">
<div className="query-builder__header">
<div className="query-builder__header__statuses">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ export const QueryBuilderResultPanel = observer(
)}
</div>
<div className="panel__header__actions query-builder__result__header__actions">
{resultState.exportState.isInProgress && (
<div className="panel__header__title__label__status">
Exporting...
</div>
)}
{allowSettingLocalMode && (
<div className="query-builder__result__advanced__mode">
<div className="query-builder__result__advanced__mode__label">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type QueryBuilderDataGridConfig = {
export class QueryBuilderResultState {
readonly queryBuilderState: QueryBuilderState;
readonly executionPlanState: ExecutionPlanState;
readonly exportState = ActionState.create();

previewLimit = DEFAULT_LIMIT;
pressedRunQuery = ActionState.create();
Expand Down Expand Up @@ -228,6 +229,7 @@ export class QueryBuilderResultState {

*exportData(format: string): GeneratorFn<void> {
try {
this.exportState.inProgress();
this.queryBuilderState.applicationStore.notificationService.notifySuccess(
`Export ${format} will run in background`,
);
Expand Down Expand Up @@ -275,6 +277,7 @@ export class QueryBuilderResultState {
this.queryBuilderState.applicationStore.telemetryService,
reportWithState,
);
this.exportState.pass();
})
.catch((error) => {
assertErrorThrown(error);
Expand All @@ -284,6 +287,7 @@ export class QueryBuilderResultState {
);
});
} catch (error) {
this.exportState.fail();
assertErrorThrown(error);
this.queryBuilderState.applicationStore.logService.error(
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
Expand All @@ -292,6 +296,7 @@ export class QueryBuilderResultState {
this.queryBuilderState.applicationStore.notificationService.notifyError(
error,
);
this.exportState.complete();
}
}

Expand Down

0 comments on commit 506a09c

Please sign in to comment.