1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { computeNodesActions, ComputeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
6 import { NodeResource } from '~/models/node';
8 export type ComputeNodesState = NodeResource[];
10 const initialState: ComputeNodesState = [];
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),