X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f5c0cb11102a006cda59711f29458b7569b9a21f..4d2ff0c66175bf47c5643e9500c2cc6d7caf8c8b:/src/store/process-panel/process-panel-actions.ts diff --git a/src/store/process-panel/process-panel-actions.ts b/src/store/process-panel/process-panel-actions.ts index 902a5c9c..2aa914af 100644 --- a/src/store/process-panel/process-panel-actions.ts +++ b/src/store/process-panel/process-panel-actions.ts @@ -5,9 +5,15 @@ import { unionize, ofType, UnionOf } from "~/common/unionize"; import { loadProcess } from '~/store/processes/processes-actions'; import { Dispatch } from 'redux'; +import { ProcessStatus } from '~/store/processes/process'; +import { RootState } from '~/store/store'; +import { ServiceRepository } from "~/services/services"; +import { navigateToCollection } from '~/store/navigation/navigation-action'; +import { snackbarActions } from '~/store/snackbar/snackbar-actions'; +import { SnackbarKind } from '../snackbar/snackbar-actions'; export const procesPanelActions = unionize({ - INIT_PROCESS_PANEL_FILTERS: ofType(), + SET_PROCESS_PANEL_FILTERS: ofType(), TOGGLE_PROCESS_PANEL_FILTER: ofType(), }); @@ -21,9 +27,21 @@ export const loadProcessPanel = (uuid: string) => dispatch(initProcessPanelFilters); }; -export const initProcessPanelFilters = procesPanelActions.INIT_PROCESS_PANEL_FILTERS([ - 'Queued', - 'Complete', - 'Active', - 'Failed' +export const navigateToOutput = (uuid: string) => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + try { + await services.collectionService.get(uuid); + dispatch(navigateToCollection(uuid)); + } catch { + dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This collection does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR })); + } + }; + +export const initProcessPanelFilters = procesPanelActions.SET_PROCESS_PANEL_FILTERS([ + ProcessStatus.QUEUED, + ProcessStatus.COMPLETED, + ProcessStatus.FAILED, + ProcessStatus.RUNNING, + ProcessStatus.LOCKED, + ProcessStatus.CANCELLED ]);