Rename createPermission function
[arvados.git] / src / store / compute-nodes / compute-nodes-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { computeNodesActions, ComputeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
6 import { NodeResource } from '~/models/node';
7
8 export type ComputeNodesState = NodeResource[];
9
10 const initialState: ComputeNodesState = [];
11
12 export const computeNodesReducer = (state: ComputeNodesState = initialState, action: ComputeNodesActions): ComputeNodesState =>
13     computeNodesActions.match(action, {
14         SET_COMPUTE_NODES: nodes => nodes,
15         REMOVE_COMPUTE_NODE: (uuid: string) => state.filter((computeNode) => computeNode.uuid !== uuid),
16         default: () => state
17     });