X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/5e8a5a1c42226e0dd3aceaf4825d870a3786c5d1..f0d3e4427d463f778beca4d3fe8330da963c9e5d:/src/store/favorite-panel/favorite-panel-middleware-service.ts diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts index 96f66647..acdc12b4 100644 --- a/src/store/favorite-panel/favorite-panel-middleware-service.ts +++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts @@ -16,7 +16,7 @@ import { OrderBuilder, OrderDirection } from "~/services/api/order-builder"; import { LinkResource } from "~/models/link"; import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/groups-service/groups-service"; import { resourcesActions } from "~/store/resources/resources-actions"; -import { snackbarActions } from '~/store/snackbar/snackbar-actions'; +import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts'; import { getDataExplorer } from "~/store/data-explorer/data-explorer-reducer"; import { loadMissingProcessesInformation } from "~/store/project-panel/project-panel-middleware-service"; @@ -50,7 +50,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic .addOrder(direction, "name", GroupContentsResourcePrefix.PROJECT); } try { - api.dispatch(progressIndicatorActions.START(this.getId())); + api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); const response = await this.services.favoriteService .list(this.services.authService.getUuid()!, { limit: dataExplorer.rowsPerPage, @@ -62,7 +62,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic .addILike("name", dataExplorer.searchValue) .getFilters() }); - api.dispatch(progressIndicatorActions.PERSIST_STOP(this.getId())); + api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); api.dispatch(resourcesActions.SET_RESOURCES(response.items)); await api.dispatch(loadMissingProcessesInformation(response.items)); api.dispatch(favoritePanelActions.SET_ITEMS({ @@ -73,13 +73,14 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic })); api.dispatch(updateFavorites(response.items.map(item => item.uuid))); } catch (e) { - api.dispatch(progressIndicatorActions.PERSIST_STOP(this.getId())); + api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); api.dispatch(favoritePanelActions.SET_ITEMS({ items: [], itemsAvailable: 0, page: 0, rowsPerPage: dataExplorer.rowsPerPage })); + api.dispatch(couldNotFetchFavoritesContents()); } } } @@ -89,3 +90,9 @@ const favoritesPanelDataExplorerIsNotSet = () => snackbarActions.OPEN_SNACKBAR({ message: 'Favorites panel is not ready.' }); + +const couldNotFetchFavoritesContents = () => + snackbarActions.OPEN_SNACKBAR({ + message: 'Could not fetch favorites contents.', + kind: SnackbarKind.ERROR + });