From: Michal Klobukowski Date: Tue, 11 Dec 2018 07:37:11 +0000 (+0100) Subject: Add CreateGroupDialog X-Git-Tag: 1.4.0~71^2~18^2~35 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/0190f22c054d5257f67af66a9a1f1fa84e062fcc Add CreateGroupDialog Feature #14505 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/store/groups-panel/groups-panel-actions.ts b/src/store/groups-panel/groups-panel-actions.ts index 5adce5c6..28a1c07e 100644 --- a/src/store/groups-panel/groups-panel-actions.ts +++ b/src/store/groups-panel/groups-panel-actions.ts @@ -3,8 +3,15 @@ // SPDX-License-Identifier: AGPL-3.0 import { bindDataExplorerActions } from "~/store/data-explorer/data-explorer-action"; +import { dialogActions } from '~/store/dialog/dialog-actions'; export const GROUPS_PANEL_ID = "groupsPanel"; +export const CREATE_GROUP_DIALOG = "createGroupDialog"; +export const CREATE_GROUP_FORM = "createGroupForm"; + export const GroupsPanelActions = bindDataExplorerActions(GROUPS_PANEL_ID); export const loadGroupsPanel = () => GroupsPanelActions.REQUEST_ITEMS(); + +export const openCreateGroupDialog = () => + dialogActions.OPEN_DIALOG({ id: CREATE_GROUP_DIALOG, data: {} }); diff --git a/src/views-components/dialog-forms/create-group-dialog.tsx b/src/views-components/dialog-forms/create-group-dialog.tsx new file mode 100644 index 00000000..10d60c3a --- /dev/null +++ b/src/views-components/dialog-forms/create-group-dialog.tsx @@ -0,0 +1,32 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import * as React from 'react'; +import { compose } from "redux"; +import { reduxForm, InjectedFormProps } from 'redux-form'; +import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog"; +import { FormDialog } from '~/components/form-dialog/form-dialog'; +import { CREATE_GROUP_DIALOG, CREATE_GROUP_FORM } from '~/store/groups-panel/groups-panel-actions'; + +export const CreateGroupDialog = compose( + withDialog(CREATE_GROUP_DIALOG), + reduxForm<{}>({ + form: CREATE_GROUP_FORM, + onSubmit: (data, dispatch) => { return; } + }) +)( + (props: CreateGroupDialogComponentProps) => + +); + +type CreateGroupDialogComponentProps = WithDialogProps<{}> & InjectedFormProps<{}>; + +const CreateGroupFormFields = (props: CreateGroupDialogComponentProps) => + CreateGroupFormFields +; diff --git a/src/views/groups-panel/groups-panel.tsx b/src/views/groups-panel/groups-panel.tsx index 7f919d5a..39028ecf 100644 --- a/src/views/groups-panel/groups-panel.tsx +++ b/src/views/groups-panel/groups-panel.tsx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; +import { connect } from 'react-redux'; import { Grid, Button } from "@material-ui/core"; import { DataExplorer } from "~/views-components/data-explorer/data-explorer"; @@ -12,7 +13,7 @@ import { ResourceOwner } from '~/views-components/data-explorer/renderers'; import { AddIcon } from '~/components/icon/icon'; import { ResourceName } from '~/views-components/data-explorer/renderers'; import { createTree } from '~/models/tree'; -import { GROUPS_PANEL_ID } from '~/store/groups-panel/groups-panel-actions'; +import { GROUPS_PANEL_ID, openCreateGroupDialog } from '~/store/groups-panel/groups-panel-actions'; import { noop } from 'lodash/fp'; export enum GroupsPanelColumnNames { @@ -50,27 +51,33 @@ export interface GroupsPanelProps { onNewGroup: () => void; } -export class GroupsPanel extends React.Component { +export const GroupsPanel = connect( + null, + { + onNewGroup: openCreateGroupDialog + } +)( + class GroupsPanel extends React.Component { - render() { - return ( - - - - } /> - ); - } -} + + } /> + ); + } + }); diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 468797eb..2a773184 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -76,6 +76,7 @@ import { UserAttributesDialog } from '~/views-components/user-dialog/attributes- import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog'; import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog'; import { GroupsPanel } from '~/views/groups-panel/groups-panel'; +import { CreateGroupDialog } from '~/views-components/dialog-forms/create-group-dialog'; type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content'; @@ -172,6 +173,7 @@ export const WorkbenchPanel = +