1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from "redux";
6 import { ServiceRepository } from "services/services";
7 import { projectPanelActions } from "store/project-panel/project-panel-action-bind";
8 import { loadResource } from "store/resources/resources-actions";
9 import { RootState } from "store/store";
10 import { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
11 import { addDisabledButton, removeDisabledButton } from "store/multiselect/multiselect-actions";
13 export const freezeProject = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
14 dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.FREEZE_PROJECT))
15 const userUUID = getState().auth.user!.uuid;
17 const updatedProject = await services.projectService.update(uuid, {
18 frozenByUuid: userUUID,
21 dispatch(projectPanelActions.REQUEST_ITEMS());
22 dispatch<any>(loadResource(uuid, false));
23 dispatch<any>(removeDisabledButton(MultiSelectMenuActionNames.FREEZE_PROJECT))
24 return updatedProject;
27 export const unfreezeProject = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
28 dispatch<any>(addDisabledButton(MultiSelectMenuActionNames.FREEZE_PROJECT))
29 const updatedProject = await services.projectService.update(uuid, {
33 dispatch(projectPanelActions.REQUEST_ITEMS());
34 dispatch<any>(loadResource(uuid, false));
35 dispatch<any>(removeDisabledButton(MultiSelectMenuActionNames.FREEZE_PROJECT))
36 return updatedProject;