Merge branch 'master' into 14393-vocabulary
[arvados.git] / src / store / process-panel / process-panel-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { unionize, ofType, UnionOf } from "~/common/unionize";
6 import { loadProcess } from '~/store/processes/processes-actions';
7 import { Dispatch } from 'redux';
8 import { ProcessStatus } from '~/store/processes/process';
9
10 export const procesPanelActions = unionize({
11     SET_PROCESS_PANEL_FILTERS: ofType<string[]>(),
12     TOGGLE_PROCESS_PANEL_FILTER: ofType<string>(),
13 });
14
15 export type ProcessPanelAction = UnionOf<typeof procesPanelActions>;
16
17 export const toggleProcessPanelFilter = procesPanelActions.TOGGLE_PROCESS_PANEL_FILTER;
18
19 export const loadProcessPanel = (uuid: string) =>
20     (dispatch: Dispatch) => {
21         dispatch<any>(loadProcess(uuid));
22         dispatch(initProcessPanelFilters);
23     };
24
25 export const initProcessPanelFilters = procesPanelActions.SET_PROCESS_PANEL_FILTERS([
26     ProcessStatus.QUEUED,
27     ProcessStatus.COMPLETED,
28     ProcessStatus.FAILED,
29     ProcessStatus.RUNNING,
30     ProcessStatus.LOCKED,
31     ProcessStatus.CANCELLED
32 ]);