[ARVADOS-WORKBENCH2] updated: 1.2.0-145-g1bda464
Git user
git at public.curoverse.com
Fri Aug 24 09:36:28 EDT 2018
Summary of changes:
src/store/collections/collection-create-actions.ts | 8 +-
src/store/project/project-action.ts | 14 ---
src/store/project/project-reducer.ts | 23 -----
src/store/projects/project-create-actions.ts | 56 +++++++++++
.../collection-partial-copy-dialog.tsx | 4 +-
.../context-menu/action-sets/project-action-set.ts | 6 +-
.../action-sets/root-project-action-set.ts | 8 +-
.../create-project-dialog.tsx | 44 --------
.../dialog-create/dialog-collection-create.tsx | 2 +-
.../dialog-create/dialog-project-create.tsx | 111 ++++-----------------
.../dialog-forms/create-project-dialog.ts | 19 ++++
.../dialog-update/dialog-collection-update.tsx | 2 +-
.../collection-form-fields.tsx | 0
.../form-fields/project-form-fields.tsx | 22 ++++
src/views/workbench/workbench.tsx | 13 ++-
15 files changed, 138 insertions(+), 194 deletions(-)
create mode 100644 src/store/projects/project-create-actions.ts
delete mode 100644 src/views-components/create-project-dialog/create-project-dialog.tsx
create mode 100644 src/views-components/dialog-forms/create-project-dialog.ts
rename src/views-components/{collection-form-fields => form-fields}/collection-form-fields.tsx (100%)
create mode 100644 src/views-components/form-fields/project-form-fields.tsx
via 1bda4645781ebb80f6d0db901f857abff088d749 (commit)
from 49e31d482873af1328b934bf8f07d8e1d00ce5b6 (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 1bda4645781ebb80f6d0db901f857abff088d749
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date: Fri Aug 24 15:36:19 2018 +0200
add dialog create project, form-fields, remove creator from store
Feature #14103
Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>
diff --git a/src/store/collections/collection-create-actions.ts b/src/store/collections/collection-create-actions.ts
index 2c339f2..d8d292c 100644
--- a/src/store/collections/collection-create-actions.ts
+++ b/src/store/collections/collection-create-actions.ts
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import { Dispatch } from "redux";
-import { reset, startSubmit, stopSubmit } from "redux-form";
+import { reset, startSubmit, stopSubmit, initialize } from 'redux-form';
import { RootState } from '~/store/store';
import { uploadCollectionFiles } from '~/store/collections/uploader/collection-uploader-actions';
import { projectPanelActions } from "~/store/project-panel/project-panel-action";
@@ -14,6 +14,7 @@ import { ServiceRepository } from '~/services/services';
import { getCommonResourceServiceError, CommonResourceServiceError } from "~/common/api/common-resource-service";
export interface CollectionCreateFormDialogData {
+ ownerUuid: string;
name: string;
description: string;
files: File[];
@@ -21,9 +22,10 @@ export interface CollectionCreateFormDialogData {
export const COLLECTION_CREATE_FORM_NAME = "collectionCreateFormName";
-export const openCollectionCreateDialog = () =>
+export const openCollectionCreateDialog = (ownerUuid: string) =>
(dispatch: Dispatch) => {
- dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_CREATE_FORM_NAME, data: {} }));
+ dispatch(initialize(COLLECTION_CREATE_FORM_NAME, { ownerUuid }));
+ dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_CREATE_FORM_NAME, data: { ownerUuid } }));
};
export const addCollection = (data: CollectionCreateFormDialogData) =>
diff --git a/src/store/project/project-action.ts b/src/store/project/project-action.ts
index 2017658..7af2aba 100644
--- a/src/store/project/project-action.ts
+++ b/src/store/project/project-action.ts
@@ -13,10 +13,6 @@ import { projectPanelActions } from "~/store/project-panel/project-panel-action"
import { updateDetails } from "~/store/details-panel/details-panel-action";
export const projectActions = unionize({
- OPEN_PROJECT_CREATOR: ofType<{ ownerUuid: string }>(),
- CLOSE_PROJECT_CREATOR: ofType<{}>(),
- CREATE_PROJECT: ofType<Partial<ProjectResource>>(),
- CREATE_PROJECT_SUCCESS: ofType<ProjectResource>(),
OPEN_PROJECT_UPDATER: ofType<{ uuid: string}>(),
CLOSE_PROJECT_UPDATER: ofType<{}>(),
UPDATE_PROJECT_SUCCESS: ofType<ProjectResource>(),
@@ -47,16 +43,6 @@ export const getProjectList = (parentUuid: string = '') =>
});
};
-export const createProject = (project: Partial<ProjectResource>) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const { ownerUuid } = getState().projects.creator;
- const projectData = { ownerUuid, ...project };
- dispatch(projectActions.CREATE_PROJECT(projectData));
- return services.projectService
- .create(projectData)
- .then(project => dispatch(projectActions.CREATE_PROJECT_SUCCESS(project)));
- };
-
export const updateProject = (project: Partial<ProjectResource>) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const { uuid } = getState().projects.updater;
diff --git a/src/store/project/project-reducer.ts b/src/store/project/project-reducer.ts
index bb07486..848aed4 100644
--- a/src/store/project/project-reducer.ts
+++ b/src/store/project/project-reducer.ts
@@ -11,16 +11,9 @@ import { ProjectResource } from "~/models/project";
export type ProjectState = {
items: Array<TreeItem<ProjectResource>>,
currentItemId: string,
- creator: ProjectCreator,
updater: ProjectUpdater
};
-interface ProjectCreator {
- opened: boolean;
- ownerUuid: string;
- error?: string;
-}
-
interface ProjectUpdater {
opened: boolean;
uuid: string;
@@ -98,14 +91,6 @@ function updateProjectTree(tree: Array<TreeItem<ProjectResource>>, projects: Pro
return items;
}
-const updateCreator = (state: ProjectState, creator: Partial<ProjectCreator>) => ({
- ...state,
- creator: {
- ...state.creator,
- ...creator
- }
-});
-
const updateProject = (state: ProjectState, updater?: Partial<ProjectUpdater>) => ({
...state,
updater: {
@@ -117,10 +102,6 @@ const updateProject = (state: ProjectState, updater?: Partial<ProjectUpdater>) =
const initialState: ProjectState = {
items: [],
currentItemId: "",
- creator: {
- opened: false,
- ownerUuid: ""
- },
updater: {
opened: false,
uuid: ''
@@ -130,10 +111,6 @@ const initialState: ProjectState = {
export const projectsReducer = (state: ProjectState = initialState, action: ProjectAction) => {
return projectActions.match(action, {
- OPEN_PROJECT_CREATOR: ({ ownerUuid }) => updateCreator(state, { ownerUuid, opened: true }),
- CLOSE_PROJECT_CREATOR: () => updateCreator(state, { opened: false }),
- CREATE_PROJECT: () => updateCreator(state, { error: undefined }),
- CREATE_PROJECT_SUCCESS: () => updateCreator(state, { opened: false, ownerUuid: "" }),
OPEN_PROJECT_UPDATER: ({ uuid }) => updateProject(state, { uuid, opened: true }),
CLOSE_PROJECT_UPDATER: () => updateProject(state, { opened: false, uuid: "" }),
UPDATE_PROJECT_SUCCESS: () => updateProject(state, { opened: false, uuid: "" }),
diff --git a/src/store/projects/project-create-actions.ts b/src/store/projects/project-create-actions.ts
new file mode 100644
index 0000000..d1bc827
--- /dev/null
+++ b/src/store/projects/project-create-actions.ts
@@ -0,0 +1,56 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { reset, startSubmit, stopSubmit, initialize } from 'redux-form';
+import { RootState } from '~/store/store';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { dialogActions } from "~/store/dialog/dialog-actions";
+import { projectPanelActions } from '~/store/project-panel/project-panel-action';
+import { getProjectList } from '~/store/project/project-action';
+import { getCommonResourceServiceError, CommonResourceServiceError } from '~/common/api/common-resource-service';
+import { ProjectResource } from '~/models/project';
+import { ServiceRepository } from '~/services/services';
+
+
+export interface ProjectCreateFormDialogData {
+ ownerUuid: string;
+ name: string;
+ description: string;
+}
+
+export const PROJECT_CREATE_FORM_NAME = 'projectCreateFormName';
+
+export const openProjectCreateDialog = (ownerUuid: string) =>
+ (dispatch: Dispatch) => {
+ dispatch(initialize(PROJECT_CREATE_FORM_NAME, { ownerUuid }));
+ dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_CREATE_FORM_NAME, data: {} }));
+ };
+
+export const addProject = (data: ProjectCreateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ await dispatch<any>(createProject(data));
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: "Project has been successfully created.",
+ hideDuration: 2000
+ }));
+ };
+
+
+const createProject = (project: Partial<ProjectResource>) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(startSubmit(PROJECT_CREATE_FORM_NAME));
+ try {
+ const newProject = await services.projectService.create(project);
+ dispatch<any>(getProjectList(newProject.ownerUuid));
+ dispatch(projectPanelActions.REQUEST_ITEMS());
+ dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_CREATE_FORM_NAME }));
+ dispatch(reset(PROJECT_CREATE_FORM_NAME));
+ } catch (e) {
+ const error = getCommonResourceServiceError(e);
+ if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
+ dispatch(stopSubmit(PROJECT_CREATE_FORM_NAME, { name: 'Project with the same name already exists.' }));
+ }
+ }
+ };
\ No newline at end of file
diff --git a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
index 00aa5ef..86fc360 100644
--- a/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
+++ b/src/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog.tsx
@@ -6,9 +6,9 @@ import * as React from "react";
import { compose } from "redux";
import { reduxForm, InjectedFormProps } from 'redux-form';
import { withDialog, WithDialogProps } from '~/store/dialog/with-dialog';
-import { CollectionPartialCopyFields } from '../collection-form-fields/collection-form-fields';
-import { FormDialog } from '~/components/form-dialog/form-dialog';
import { COLLECTION_PARTIAL_COPY, doCollectionPartialCopy, CollectionPartialCopyFormData } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { CollectionPartialCopyFields } from '~/views-components/form-fields/collection-form-fields';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
export const CollectionPartialCopyDialog = compose(
withDialog(COLLECTION_PARTIAL_COPY),
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index 8ae60c8..012beae 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -10,16 +10,16 @@ import { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon } from "~/components/i
import { ToggleFavoriteAction } from "../actions/favorite-action";
import { toggleFavorite } from "~/store/favorites/favorites-actions";
import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
-import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
import { openMoveProjectDialog } from '~/store/move-project-dialog/move-project-dialog';
+import { PROJECT_CREATE_FORM_NAME, openProjectCreateDialog } from '~/store/projects/project-create-actions';
export const projectActionSet: ContextMenuActionSet = [[
{
icon: NewProjectIcon,
name: "New project",
execute: (dispatch, resource) => {
- dispatch(reset(PROJECT_CREATE_DIALOG));
- dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+ dispatch(reset(PROJECT_CREATE_FORM_NAME));
+ dispatch<any>(openProjectCreateDialog(resource.uuid));
}
},
{
diff --git a/src/views-components/context-menu/action-sets/root-project-action-set.ts b/src/views-components/context-menu/action-sets/root-project-action-set.ts
index a5e2065..2c71abc 100644
--- a/src/views-components/context-menu/action-sets/root-project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/root-project-action-set.ts
@@ -6,17 +6,17 @@ import { reset } from "redux-form";
import { ContextMenuActionSet } from "../context-menu-action-set";
import { projectActions } from "~/store/project/project-action";
-import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
import { COLLECTION_CREATE_FORM_NAME, openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
import { NewProjectIcon, CollectionIcon } from "~/components/icon/icon";
+import { PROJECT_CREATE_FORM_NAME, openProjectCreateDialog } from '~/store/projects/project-create-actions';
export const rootProjectActionSet: ContextMenuActionSet = [[
{
icon: NewProjectIcon,
name: "New project",
execute: (dispatch, resource) => {
- dispatch(reset(PROJECT_CREATE_DIALOG));
- dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+ dispatch(reset(PROJECT_CREATE_FORM_NAME));
+ dispatch<any>(openProjectCreateDialog(resource.uuid));
}
},
{
@@ -24,7 +24,7 @@ export const rootProjectActionSet: ContextMenuActionSet = [[
name: "New Collection",
execute: (dispatch, resource) => {
dispatch(reset(COLLECTION_CREATE_FORM_NAME));
- dispatch<any>(openCollectionCreateDialog());
+ dispatch<any>(openCollectionCreateDialog(resource.uuid));
}
}
]];
diff --git a/src/views-components/create-project-dialog/create-project-dialog.tsx b/src/views-components/create-project-dialog/create-project-dialog.tsx
deleted file mode 100644
index 43f56ed..0000000
--- a/src/views-components/create-project-dialog/create-project-dialog.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { connect } from "react-redux";
-import { Dispatch } from "redux";
-import { SubmissionError } from "redux-form";
-
-import { RootState } from "~/store/store";
-import { DialogProjectCreate } from "../dialog-create/dialog-project-create";
-import { projectActions, createProject, getProjectList } from "~/store/project/project-action";
-import { projectPanelActions } from "~/store/project-panel/project-panel-action";
-import { snackbarActions } from "~/store/snackbar/snackbar-actions";
-
-const mapStateToProps = (state: RootState) => ({
- open: state.projects.creator.opened
-});
-
-const addProject = (data: { name: string, description: string }) =>
- (dispatch: Dispatch, getState: () => RootState) => {
- const { ownerUuid } = getState().projects.creator;
- return dispatch<any>(createProject(data)).then(() => {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Project has been successfully created.",
- hideDuration: 2000
- }));
- dispatch(projectPanelActions.REQUEST_ITEMS());
- dispatch<any>(getProjectList(ownerUuid));
- });
- };
-
-const mapDispatchToProps = (dispatch: Dispatch) => ({
- handleClose: () => {
- dispatch(projectActions.CLOSE_PROJECT_CREATOR());
- },
- onSubmit: (data: { name: string, description: string }) => {
- return dispatch<any>(addProject(data))
- .catch((e: any) => {
- throw new SubmissionError({ name: e.errors.join("").includes("UniqueViolation") ? "Project with this name already exists." : "" });
- });
- }
-});
-
-export const CreateProjectDialog = connect(mapStateToProps, mapDispatchToProps)(DialogProjectCreate);
diff --git a/src/views-components/dialog-create/dialog-collection-create.tsx b/src/views-components/dialog-create/dialog-collection-create.tsx
index 5d3bfd8..2fb007b 100644
--- a/src/views-components/dialog-create/dialog-collection-create.tsx
+++ b/src/views-components/dialog-create/dialog-collection-create.tsx
@@ -8,7 +8,7 @@ import { WithDialogProps } from '~/store/dialog/with-dialog';
import { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
import { collectionUploaderActions, UploadFile } from "~/store/collections/uploader/collection-uploader-actions";
import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { CollectionNameField, CollectionDescriptionField } from '~/views-components/collection-form-fields/collection-form-fields';
+import { CollectionNameField, CollectionDescriptionField } from '~/views-components/form-fields/collection-form-fields';
import { FileUpload } from '~/components/file-upload/file-upload';
// interface DialogCollectionDataProps {
diff --git a/src/views-components/dialog-create/dialog-project-create.tsx b/src/views-components/dialog-create/dialog-project-create.tsx
index e77114b..8c1d380 100644
--- a/src/views-components/dialog-create/dialog-project-create.tsx
+++ b/src/views-components/dialog-create/dialog-project-create.tsx
@@ -3,100 +3,23 @@
// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { reduxForm, Field } from 'redux-form';
-import { compose } from 'redux';
-import { TextField } from '~/components/text-field/text-field';
-import { Dialog, DialogActions, DialogContent, DialogTitle } from '@material-ui/core/';
-import { Button, StyleRulesCallback, WithStyles, withStyles, CircularProgress } from '@material-ui/core';
+import { InjectedFormProps } from 'redux-form';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { ProjectCreateFormDialogData } from '~/store/projects/project-create-actions';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { ProjectNameField, ProjectDescriptionField } from '~/views-components/form-fields/project-form-fields';
-import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from '~/validators/validators';
+type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<ProjectCreateFormDialogData>;
-type CssRules = "button" | "lastButton" | "formContainer" | "dialog" | "dialogTitle" | "createProgress" | "dialogActions";
+export const DialogProjectCreate = (props: DialogCollectionProps) =>
+ <FormDialog
+ dialogTitle='Create a project'
+ formFields={ProjectAddFields}
+ submitLabel='Create a Project'
+ {...props}
+ />;
-const styles: StyleRulesCallback<CssRules> = theme => ({
- button: {
- marginLeft: theme.spacing.unit
- },
- lastButton: {
- marginLeft: theme.spacing.unit,
- marginRight: "20px",
- },
- formContainer: {
- display: "flex",
- flexDirection: "column",
- marginTop: "20px",
- },
- dialogTitle: {
- paddingBottom: "0"
- },
- dialog: {
- minWidth: "600px",
- minHeight: "320px"
- },
- createProgress: {
- position: "absolute",
- minWidth: "20px",
- right: "95px"
- },
- dialogActions: {
- marginBottom: "24px"
- }
-});
-interface DialogProjectProps {
- open: boolean;
- handleClose: () => void;
- onSubmit: (data: { name: string, description: string }) => void;
- handleSubmit: any;
- submitting: boolean;
- invalid: boolean;
- pristine: boolean;
-}
-
-export const PROJECT_CREATE_DIALOG = "projectCreateDialog";
-
-export const DialogProjectCreate = compose(
- reduxForm({ form: PROJECT_CREATE_DIALOG }),
- withStyles(styles))(
- class DialogProjectCreate extends React.Component<DialogProjectProps & WithStyles<CssRules>> {
- render() {
- const { classes, open, handleClose, handleSubmit, onSubmit, submitting, invalid, pristine } = this.props;
-
- return (
- <Dialog
- open={open}
- onClose={handleClose}
- disableBackdropClick={true}
- disableEscapeKeyDown={true}>
- <div className={classes.dialog}>
- <form onSubmit={handleSubmit((data: any) => onSubmit(data))}>
- <DialogTitle id="form-dialog-title" className={classes.dialogTitle}>Create a
- project</DialogTitle>
- <DialogContent className={classes.formContainer}>
- <Field name="name"
- component={TextField}
- validate={PROJECT_NAME_VALIDATION}
- label="Project Name"/>
- <Field name="description"
- component={TextField}
- validate={PROJECT_DESCRIPTION_VALIDATION}
- label="Description - optional"/>
- </DialogContent>
- <DialogActions className={classes.dialogActions}>
- <Button onClick={handleClose} className={classes.button} color="primary"
- disabled={submitting}>CANCEL</Button>
- <Button type="submit"
- className={classes.lastButton}
- color="primary"
- disabled={invalid || submitting || pristine}
- variant="contained">
- CREATE A PROJECT
- </Button>
- {submitting && <CircularProgress size={20} className={classes.createProgress}/>}
- </DialogActions>
- </form>
- </div>
- </Dialog>
- );
- }
- }
-);
+const ProjectAddFields = () => <span>
+ <ProjectNameField />
+ <ProjectDescriptionField />
+</span>;
diff --git a/src/views-components/dialog-forms/create-project-dialog.ts b/src/views-components/dialog-forms/create-project-dialog.ts
new file mode 100644
index 0000000..2e87517
--- /dev/null
+++ b/src/views-components/dialog-forms/create-project-dialog.ts
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog } from "~/store/dialog/with-dialog";
+import { addProject, PROJECT_CREATE_FORM_NAME, ProjectCreateFormDialogData } from '~/store/projects/project-create-actions';
+import { DialogProjectCreate } from '~/views-components/dialog-create/dialog-project-create';
+
+export const CreateProjectDialog = compose(
+ withDialog(PROJECT_CREATE_FORM_NAME),
+ reduxForm<ProjectCreateFormDialogData>({
+ form: PROJECT_CREATE_FORM_NAME,
+ onSubmit: (data, dispatch) => {
+ dispatch(addProject(data));
+ }
+ })
+)(DialogProjectCreate);
\ No newline at end of file
diff --git a/src/views-components/dialog-update/dialog-collection-update.tsx b/src/views-components/dialog-update/dialog-collection-update.tsx
index 7b1d456..b98e0e8 100644
--- a/src/views-components/dialog-update/dialog-collection-update.tsx
+++ b/src/views-components/dialog-update/dialog-collection-update.tsx
@@ -7,7 +7,7 @@ import { InjectedFormProps } from 'redux-form';
import { WithDialogProps } from '~/store/dialog/with-dialog';
import { CollectionUpdateFormDialogData } from '~/store/collections/collection-update-actions';
import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { CollectionNameField, CollectionDescriptionField } from '~/views-components/collection-form-fields/collection-form-fields';
+import { CollectionNameField, CollectionDescriptionField } from '~/views-components/form-fields/collection-form-fields';
type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionUpdateFormDialogData>;
diff --git a/src/views-components/collection-form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx
similarity index 100%
rename from src/views-components/collection-form-fields/collection-form-fields.tsx
rename to src/views-components/form-fields/collection-form-fields.tsx
diff --git a/src/views-components/form-fields/project-form-fields.tsx b/src/views-components/form-fields/project-form-fields.tsx
new file mode 100644
index 0000000..967d3e5
--- /dev/null
+++ b/src/views-components/form-fields/project-form-fields.tsx
@@ -0,0 +1,22 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Field, WrappedFieldProps } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from "~/validators/validators";
+
+export const ProjectNameField = () =>
+ <Field
+ name='name'
+ component={TextField}
+ validate={PROJECT_NAME_VALIDATION}
+ label="Project Name" />;
+
+export const ProjectDescriptionField = () =>
+ <Field
+ name='description'
+ component={TextField}
+ validate={PROJECT_DESCRIPTION_VALIDATION}
+ label="Description - optional" />;
\ No newline at end of file
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index c6254a7..77fab3d 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -23,7 +23,6 @@ import { ItemMode, setProjectItem } from "~/store/navigation/navigation-action";
import { projectActions } from "~/store/project/project-action";
import { DetailsPanel } from '~/views-components/details-panel/details-panel';
import { ArvadosTheme } from '~/common/custom-theme';
-import { CreateProjectDialog } from "~/views-components/create-project-dialog/create-project-dialog";
import { detailsPanelActions, loadDetails } from "~/store/details-panel/details-panel-action";
import { contextMenuActions } from "~/store/context-menu/context-menu-actions";
@@ -37,17 +36,21 @@ import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-acti
import { CollectionPanel } from '../collection-panel/collection-panel';
import { loadCollection, loadCollectionTags } from '~/store/collection-panel/collection-panel-action';
import { getCollectionUrl } from '~/models/collection';
+
+import { PROJECT_CREATE_FORM_NAME, openProjectCreateDialog } from '~/store/projects/project-create-actions';
import { COLLECTION_CREATE_FORM_NAME, openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
+import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
+
import { UpdateProjectDialog } from '~/views-components/update-project-dialog/update-project-dialog';
+
import { ProjectPanel } from "~/views/project-panel/project-panel";
import { AuthService } from "~/services/auth-service/auth-service";
import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
import { DialogCollectionCreateWithSelectedFile } from '~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected';
-import { PROJECT_CREATE_DIALOG } from '~/views-components/dialog-create/dialog-project-create';
import { UploadCollectionFilesDialog } from '~/views-components/upload-collection-files-dialog/upload-collection-files-dialog';
import { CollectionPartialCopyDialog } from '../../views-components/collection-partial-copy-dialog/collection-partial-copy-dialog';
import { MoveProjectDialog } from '~/views-components/move-project-dialog/move-project-dialog';
@@ -380,13 +383,13 @@ export const Workbench = withStyles(styles)(
}
handleProjectCreationDialogOpen = (itemUuid: string) => {
- this.props.dispatch(reset(PROJECT_CREATE_DIALOG));
- this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid }));
+ this.props.dispatch(reset(PROJECT_CREATE_FORM_NAME));
+ this.props.dispatch<any>(openProjectCreateDialog(itemUuid));
}
handleCollectionCreationDialogOpen = (itemUuid: string) => {
this.props.dispatch(reset(COLLECTION_CREATE_FORM_NAME));
- this.props.dispatch<any>(openCollectionCreateDialog());
+ this.props.dispatch<any>(openCollectionCreateDialog(itemUuid));
}
openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: { name: string; uuid: string; description?: string; kind: ContextMenuKind; }) => {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list