1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { reset } from 'redux-form';
7 import { bindDataExplorerActions } from "~/store/data-explorer/data-explorer-action";
8 import { dialogActions } from '~/store/dialog/dialog-actions';
9 import { Person } from '~/views-components/sharing-dialog/people-select';
11 export const GROUPS_PANEL_ID = "groupsPanel";
12 export const CREATE_GROUP_DIALOG = "createGroupDialog";
13 export const CREATE_GROUP_FORM = "createGroupForm";
14 export const CREATE_GROUP_NAME_FIELD_NAME = 'name';
15 export const CREATE_GROUP_USERS_FIELD_NAME = 'users';
17 export const GroupsPanelActions = bindDataExplorerActions(GROUPS_PANEL_ID);
19 export const loadGroupsPanel = () => GroupsPanelActions.REQUEST_ITEMS();
21 export const openCreateGroupDialog = () =>
22 (dispatch: Dispatch) => {
23 dispatch(dialogActions.OPEN_DIALOG({ id: CREATE_GROUP_DIALOG, data: {} }));
24 dispatch(reset(CREATE_GROUP_FORM));
27 export interface CreateGroupFormData {
28 [CREATE_GROUP_NAME_FIELD_NAME]: string;
29 [CREATE_GROUP_USERS_FIELD_NAME]: Person[];
32 export const createGroup = (data: CreateGroupFormData) =>
33 (dispatch: Dispatch) => {