Merge branch '21621-io-panel-json-tab-copy' into main. Closes #21621
[arvados.git] / services / workbench2 / src / views-components / context-menu / action-sets / permission-edit-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContextMenuActionSet, ContextMenuActionNames } from 'views-components/context-menu/context-menu-action-set';
6 import { CanReadIcon, CanManageIcon, CanWriteIcon } from 'components/icon/icon';
7 import { editPermissionLevel } from 'store/group-details-panel/group-details-panel-actions';
8 import { PermissionLevel } from 'models/permission';
9
10 export const permissionEditActionSet: ContextMenuActionSet = [
11     [
12         {
13             name: ContextMenuActionNames.READ,
14             icon: CanReadIcon,
15             execute: (dispatch, resources) => {
16                 resources.forEach((resource) => dispatch<any>(editPermissionLevel(resource.uuid, PermissionLevel.CAN_READ)));
17             },
18         },
19         {
20             name: ContextMenuActionNames.WRITE,
21             icon: CanWriteIcon,
22             execute: (dispatch, resources) => {
23                 resources.forEach((resource) => dispatch<any>(editPermissionLevel(resource.uuid, PermissionLevel.CAN_WRITE)));
24             },
25         },
26         {
27             name: ContextMenuActionNames.MANAGE,
28             icon: CanManageIcon,
29             execute: (dispatch, resources) => {
30                 resources.forEach((resource) => dispatch<any>(editPermissionLevel(resource.uuid, PermissionLevel.CAN_MANAGE)));
31             },
32         },
33     ],
34 ];