Change default table view to be displayed only after data fetch
[arvados-workbench2.git] / src / store / trash-panel / trash-panel-middleware-service.ts
index 6e8fa542478766368968e0912fc636da5f4c9b6b..968656d91b81b4ab0dd1422f2e2ec0dd0de0b050 100644 (file)
@@ -21,6 +21,7 @@ import { ProjectPanelColumnNames } from "~/views/project-panel/project-panel";
 import { updateFavorites } from "~/store/favorites/favorites-actions";
 import { snackbarActions } from "~/store/snackbar/snackbar-actions";
 import { updateResources } from "~/store/resources/resources-actions";
+import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
 
 export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
@@ -47,6 +48,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
         }
 
         try {
+            api.dispatch(progressIndicatorActions.START(this.getId()));
             const userUuid = this.services.authService.getUuid()!;
             const listResults = await this.services.groupsService
                 .contents(userUuid, {
@@ -61,6 +63,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
                     recursive: true,
                     includeTrash: true
                 });
+            api.dispatch(progressIndicatorActions.PERSIST_STOP(this.getId()));
 
             const items = listResults.items.map(it => it.uuid);
 
@@ -71,6 +74,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
             api.dispatch<any>(updateFavorites(items));
             api.dispatch(updateResources(listResults.items));
         } catch (e) {
+            api.dispatch(progressIndicatorActions.PERSIST_STOP(this.getId()));
             api.dispatch(couldNotFetchTrashContents());
         }
     }