Merge branch '21815-trigrams-exclude-ids'
[arvados.git] / services / workbench2 / src / components / multiselect-toolbar / ms-kind-action-differentiator.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ResourceKind } from "models/resource";
6 import { MultiSelectMenuActionSet} from "views-components/multiselect-toolbar/ms-menu-actions";
7 import { msCollectionActionSet } from "views-components/multiselect-toolbar/ms-collection-action-set";
8 import { msProjectActionSet } from "views-components/multiselect-toolbar/ms-project-action-set";
9 import { msProcessActionSet } from "views-components/multiselect-toolbar/ms-process-action-set";
10 import { msWorkflowActionSet } from "views-components/multiselect-toolbar/ms-workflow-action-set";
11 import { UserDetailsActionSet } from "views-components/multiselect-toolbar/ms-user-details-action-set";
12
13 export function findActionByName(name: string, actionSet: MultiSelectMenuActionSet) {
14     return actionSet[0].find(action => action.name === name);
15 }
16
17 const { COLLECTION, PROCESS, PROJECT, WORKFLOW, USER } = ResourceKind;
18
19 export const kindToActionSet: Record<string, MultiSelectMenuActionSet> = {
20     [COLLECTION]: msCollectionActionSet,
21     [PROCESS]: msProcessActionSet,
22     [PROJECT]: msProjectActionSet,
23     [WORKFLOW]: msWorkflowActionSet,
24     [USER]: UserDetailsActionSet,
25 };