1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ProgressIndicatorAction, progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
6 import { Dispatch } from 'redux';
7 import { RootState } from '~/store/store';
8 import { ServiceRepository } from '~/services/services';
10 export interface ProgressIndicatorState {
11 'sidePanelProgress': { started: boolean };
12 'contentProgress': { started: boolean };
13 // 'workbenchProgress': { started: boolean };
16 const initialState: ProgressIndicatorState = {
17 'sidePanelProgress': { started: false },
18 'contentProgress': { started: false },
19 // 'workbenchProgress': { started: false }
22 export enum ProgressIndicatorData {
23 SIDE_PANEL_PROGRESS = 'sidePanelProgress',
24 CONTENT_PROGRESS = 'contentProgress',
25 // WORKBENCH_PROGRESS = 'workbenchProgress',
28 export const progressIndicatorReducer = (state: ProgressIndicatorState = initialState, action: ProgressIndicatorAction) => {
29 return progressIndicatorActions.match(action, {
30 START_SUBMIT: ({ id }) => ({ ...state, [id]: { started: true } }),
31 STOP_SUBMIT: ({ id }) => ({
33 [id]: state[id] ? { ...state[id], started: false } : { started: false }
39 // export const getProgress = () =>
40 // (dispatch: Dispatch, getState: () => RootState) => {
41 // const progress = getState().progressIndicator;
42 // if (progress.sidePanelProgress.started || progress.contentProgress.started) {
43 // dispatch(progressIndicatorActions.START_SUBMIT({ id: ProgressIndicatorData.WORKBENCH_PROGRESS }));
45 // dispatch(progressIndicatorActions.STOP_SUBMIT({ id: ProgressIndicatorData.WORKBENCH_PROGRESS }));