[ARVADOS-WORKBENCH2] updated: 1.3.0-90-g8b6f5c6
Git user
git at public.curoverse.com
Tue Dec 11 05:24:11 EST 2018
Summary of changes:
src/store/groups-panel/groups-panel-actions.ts | 37 ++++++++++++++++++++++----
1 file changed, 32 insertions(+), 5 deletions(-)
via 8b6f5c68fa40ad59092e1290dfd4261f0dfe643f (commit)
via fc1f170015c5ffd5f4ee5b990d530f3c9782f549 (commit)
from 4afdbe4d6f060423725d77fa7500d76d8e7e5f04 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 8b6f5c68fa40ad59092e1290dfd4261f0dfe643f
Merge: 4afdbe4 fc1f170
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Tue Dec 11 11:23:58 2018 +0100
merge-14505-admin-group-panel
Feature #14505
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --cc src/store/groups-panel/groups-panel-actions.ts
index e46ebd1,65ca66b..e5cb2d9
--- a/src/store/groups-panel/groups-panel-actions.ts
+++ b/src/store/groups-panel/groups-panel-actions.ts
@@@ -7,10 -7,8 +7,11 @@@ import { reset, startSubmit, stopSubmit
import { bindDataExplorerActions } from "~/store/data-explorer/data-explorer-action";
import { dialogActions } from '~/store/dialog/dialog-actions';
import { Person } from '~/views-components/sharing-dialog/people-select';
+import { RootState } from '~/store/store';
import { ServiceRepository } from '~/services/services';
+import { getResource } from '~/store/resources/resources';
+import { GroupResource } from '~/models/group';
+ import { getCommonResourceServiceError, CommonResourceServiceError } from '~/services/common-service/common-resource-service';
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
export const GROUPS_PANEL_ID = "groupsPanel";
@@@ -31,40 -27,38 +32,66 @@@ export const openCreateGroupDialog = (
dispatch(reset(CREATE_GROUP_FORM));
};
+export const openGroupAttributes = (uuid: string) =>
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const { resources } = getState();
+ const data = getResource<GroupResource>(uuid)(resources);
+ dispatch(dialogActions.OPEN_DIALOG({ id: GROUP_ATTRIBUTES_DIALOG, data }));
+ };
+
+export const removeGroup = (uuid: string) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+ await services.groupsService.delete(uuid);
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+ dispatch<any>(loadGroupsPanel());
+ };
+
+export const openRemoveGroupDialog = (uuid: string) =>
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(dialogActions.OPEN_DIALOG({
+ id: GROUP_REMOVE_DIALOG,
+ data: {
+ title: 'Remove group',
+ text: 'Are you sure you want to remove this group?',
+ confirmButtonLabel: 'Remove',
+ uuid
+ }
+ }));
+ };
+
export interface CreateGroupFormData {
[CREATE_GROUP_NAME_FIELD_NAME]: string;
- [CREATE_GROUP_USERS_FIELD_NAME]: Person[];
+ [CREATE_GROUP_USERS_FIELD_NAME]?: Person[];
}
- export const createGroup = (data: CreateGroupFormData) =>
- (dispatch: Dispatch) => {
- console.log(data);
+ export const createGroup = ({ name }: CreateGroupFormData) =>
+ async (dispatch: Dispatch, _: {}, { groupsService }: ServiceRepository) => {
+
+ dispatch(startSubmit(CREATE_GROUP_FORM));
+
+ try {
+
+ const newGroup = await groupsService.create({ name });
+
+ dispatch(dialogActions.CLOSE_DIALOG({ id: CREATE_GROUP_DIALOG }));
+ dispatch(reset(CREATE_GROUP_FORM));
+ dispatch(loadGroupsPanel());
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: `${newGroup.name} group has been created`,
+ kind: SnackbarKind.SUCCESS
+ }));
+
+ return newGroup;
+
+ } catch (e) {
+
+ const error = getCommonResourceServiceError(e);
+ if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
+ dispatch(stopSubmit(CREATE_GROUP_FORM, { name: 'Group with the same name already exists.' } as FormErrors));
+ }
+
+ return;
+
+ }
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list