Merge branch '20990-name-btree' refs #20990
[arvados.git] / services / workbench2 / src / store / projects / project-lock-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from "redux";
6 import { ServiceRepository } from "services/services";
7 import { projectPanelActions } from "store/project-panel/project-panel-action";
8 import { loadResource } from "store/resources/resources-actions";
9 import { RootState } from "store/store";
10
11 export const freezeProject = (uuid: string) =>
12     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
13         const userUUID = getState().auth.user!.uuid;
14
15         const updatedProject = await services.projectService.update(uuid, {
16             frozenByUuid: userUUID
17         });
18
19         dispatch(projectPanelActions.REQUEST_ITEMS());
20         dispatch<any>(loadResource(uuid, false));
21         return updatedProject;
22     };
23
24 export const unfreezeProject = (uuid: string) =>
25     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
26
27         const updatedProject = await services.projectService.update(uuid, {
28             frozenByUuid: null
29         });
30
31         dispatch(projectPanelActions.REQUEST_ITEMS());
32         dispatch<any>(loadResource(uuid, false));
33         return updatedProject;
34     };