1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ProcessPanel } from 'store/process-panel/process-panel';
6 import { ProcessPanelAction, processPanelActions } from 'store/process-panel/process-panel-actions';
8 const initialState: ProcessPanel = {
9 containerRequestUuid: "",
13 export const processPanelReducer = (state = initialState, action: ProcessPanelAction): ProcessPanel =>
14 processPanelActions.match(action, {
15 SET_PROCESS_PANEL_CONTAINER_REQUEST_UUID: containerRequestUuid => ({
16 ...state, containerRequestUuid
18 SET_PROCESS_PANEL_FILTERS: statuses => {
19 const filters = statuses.reduce((filters, status) => ({ ...filters, [status]: true }), {});
20 return { ...state, filters };
22 TOGGLE_PROCESS_PANEL_FILTER: status => {
23 const filters = { ...state.filters, [status]: !state.filters[status] };
24 return { ...state, filters };