From 22b7bf88fb799c912a813790301f715fb6b8ccf0 Mon Sep 17 00:00:00 2001 From: Pawel Kowalczyk Date: Wed, 8 Aug 2018 14:19:45 +0200 Subject: [PATCH] 13979-creating-project-name-of-previously-created-project-is-still-populating-name-field-when-creating-another Feature #13979 Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk --- src/common/config.ts | 2 +- src/components/text-field/text-field.tsx | 2 +- src/services/auth-service/auth-service.ts | 2 +- .../context-menu/action-sets/project-action-set.ts | 4 ++++ .../context-menu/action-sets/root-project-action-set.ts | 4 ++++ .../dialog-create/dialog-collection-create.tsx | 4 +++- src/views-components/dialog-create/dialog-project-create.tsx | 4 +++- .../dialog-update/dialog-collection-update.tsx | 2 +- src/views/workbench/workbench.tsx | 5 +++++ 9 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/common/config.ts b/src/common/config.ts index 775b1145..250c806c 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import Axios from "../../node_modules/axios"; +import Axios from "axios"; export const CONFIG_URL = process.env.REACT_APP_ARVADOS_CONFIG_URL || "/config.json"; diff --git a/src/components/text-field/text-field.tsx b/src/components/text-field/text-field.tsx index f7564f61..d9f11f43 100644 --- a/src/components/text-field/text-field.tsx +++ b/src/components/text-field/text-field.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import { WrappedFieldProps } from 'redux-form'; import { ArvadosTheme } from '../../common/custom-theme'; -import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '../../../node_modules/@material-ui/core'; +import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core'; type CssRules = 'textField'; diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts index f96edc79..dd47662a 100644 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { User } from "../../models/user"; -import { AxiosInstance } from "../../../node_modules/axios"; +import { AxiosInstance } from "axios"; export const API_TOKEN_KEY = 'apiToken'; export const USER_EMAIL_KEY = 'userEmail'; 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 df298e4b..4e7a6002 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 @@ -2,17 +2,21 @@ // // SPDX-License-Identifier: AGPL-3.0 +import { reset } from "redux-form"; + import { ContextMenuActionSet } from "../context-menu-action-set"; import { projectActions } from "../../../store/project/project-action"; import { NewProjectIcon } from "../../../components/icon/icon"; 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"; 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 })); } }, { 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 139bd26f..8c57f47f 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 @@ -2,14 +2,18 @@ // // SPDX-License-Identifier: AGPL-3.0 +import { reset } from "redux-form"; + import { ContextMenuActionSet } from "../context-menu-action-set"; import { projectActions } from "../../../store/project/project-action"; import { NewProjectIcon } from "../../../components/icon/icon"; +import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create"; 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 })); } }]]; diff --git a/src/views-components/dialog-create/dialog-collection-create.tsx b/src/views-components/dialog-create/dialog-collection-create.tsx index 0686904a..226b6460 100644 --- a/src/views-components/dialog-create/dialog-collection-create.tsx +++ b/src/views-components/dialog-create/dialog-collection-create.tsx @@ -53,11 +53,13 @@ interface DialogCollectionCreateProps { files: UploadFile[]; } +export const COLLECTION_CREATE_DIALOG = "collectionCreateDialog"; + export const DialogCollectionCreate = compose( connect((state: RootState) => ({ files: state.collections.uploader })), - reduxForm({ form: 'collectionCreateDialog' }), + reduxForm({ form: COLLECTION_CREATE_DIALOG }), withStyles(styles))( class DialogCollectionCreate extends React.Component> { render() { diff --git a/src/views-components/dialog-create/dialog-project-create.tsx b/src/views-components/dialog-create/dialog-project-create.tsx index 35fdca9f..50e4c980 100644 --- a/src/views-components/dialog-create/dialog-project-create.tsx +++ b/src/views-components/dialog-create/dialog-project-create.tsx @@ -55,8 +55,10 @@ interface DialogProjectProps { pristine: boolean; } +export const PROJECT_CREATE_DIALOG = "projectCreateDialog"; + export const DialogProjectCreate = compose( - reduxForm({ form: 'projectCreateDialog' }), + reduxForm({ form: PROJECT_CREATE_DIALOG }), withStyles(styles))( class DialogProjectCreate extends React.Component> { render() { diff --git a/src/views-components/dialog-update/dialog-collection-update.tsx b/src/views-components/dialog-update/dialog-collection-update.tsx index febe1124..f3f79fb6 100644 --- a/src/views-components/dialog-update/dialog-collection-update.tsx +++ b/src/views-components/dialog-update/dialog-collection-update.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import { reduxForm, Field } from 'redux-form'; import { compose } from 'redux'; import { ArvadosTheme } from '../../common/custom-theme'; -import { Dialog, DialogActions, DialogContent, DialogTitle, TextField, StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress } from '../../../node_modules/@material-ui/core'; +import { Dialog, DialogActions, DialogContent, DialogTitle, TextField, StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress } from '@material-ui/core'; import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION } from '../../validators/create-collection/create-collection-validator'; import { COLLECTION_FORM_NAME } from '../../store/collections/updater/collection-updater-action'; diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index a8552eef..fc716a56 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -13,6 +13,7 @@ import { RootState } from "../../store/store"; import { MainAppBar, MainAppBarActionProps, MainAppBarMenuItem } from '../../views-components/main-app-bar/main-app-bar'; import { Breadcrumb } from '../../components/breadcrumbs/breadcrumbs'; import { push } from 'react-router-redux'; +import { reset } from 'redux-form'; import { ProjectTree } from '../../views-components/project-tree/project-tree'; import { TreeItem } from "../../components/tree/tree"; import { getTreePath } from '../../store/project/project-reducer'; @@ -46,6 +47,8 @@ import { RenameFileDialog } from '../../views-components/rename-file-dialog/rena 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 { COLLECTION_CREATE_DIALOG } from '../../views-components/dialog-create/dialog-collection-create'; +import { PROJECT_CREATE_DIALOG } from '../../views-components/dialog-create/dialog-project-create'; const DRAWER_WITDH = 240; const APP_BAR_HEIGHT = 100; @@ -355,10 +358,12 @@ export const Workbench = withStyles(styles)( } handleProjectCreationDialogOpen = (itemUuid: string) => { + this.props.dispatch(reset(PROJECT_CREATE_DIALOG)); this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid })); } handleCollectionCreationDialogOpen = (itemUuid: string) => { + this.props.dispatch(reset(COLLECTION_CREATE_DIALOG)); this.props.dispatch(collectionCreateActions.OPEN_COLLECTION_CREATOR({ ownerUuid: itemUuid })); } -- 2.30.2