From: Pawel Kowalczyk Date: Tue, 21 Aug 2018 10:01:44 +0000 (+0200) Subject: cr changes X-Git-Tag: 1.3.0~143^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/ad819c323f1623d357398e3b1344e0a8f1d38366 cr changes Feature #13988 Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk --- diff --git a/src/components/make-a-copy/make-a-copy.tsx b/src/components/project-copy/project-copy.tsx similarity index 88% rename from src/components/make-a-copy/make-a-copy.tsx rename to src/components/project-copy/project-copy.tsx index f1098ff4..34c8e6d1 100644 --- a/src/components/make-a-copy/make-a-copy.tsx +++ b/src/components/project-copy/project-copy.tsx @@ -15,7 +15,7 @@ export interface CopyFormData { uuid: string; } -export const MakeACopyDialog = (props: WithDialogProps & InjectedFormProps) => +export const ProjectCopy = (props: WithDialogProps & InjectedFormProps) =>
& InjectedFormPro type='submit' onClick={props.handleSubmit} disabled={props.pristine || props.invalid || props.submitting}> - {props.submitting ? : 'Copy'} - + {props.submitting && } + Copy +
; diff --git a/src/components/tree/tree.test.tsx b/src/components/tree/tree.test.tsx index 45981d89..50d1368a 100644 --- a/src/components/tree/tree.test.tsx +++ b/src/components/tree/tree.test.tsx @@ -7,7 +7,7 @@ import * as Enzyme from 'enzyme'; import * as Adapter from 'enzyme-adapter-react-16'; import ListItem from "@material-ui/core/ListItem/ListItem"; -import { Tree, TreeItem } from './tree'; +import { Tree, TreeItem, TreeItemStatus } from './tree'; import { ProjectResource } from '../../models/project'; import { mockProjectResource } from '../../models/test-utils'; import { Checkbox } from '@material-ui/core'; @@ -22,7 +22,7 @@ describe("Tree component", () => { id: "3", open: true, active: true, - status: 1, + status: TreeItemStatus.LOADED }; const wrapper = mount(
} @@ -39,7 +39,7 @@ describe("Tree component", () => { id: "3", open: true, active: true, - status: 1, + status: TreeItemStatus.LOADED, }; const wrapper = mount(
} @@ -56,7 +56,7 @@ describe("Tree component", () => { id: "3", open: true, active: true, - status: 1, + status: TreeItemStatus.LOADED }; const wrapper = mount( { id: "3", open: true, active: true, - status: 1, + status: TreeItemStatus.LOADED, }; const spy = jest.fn(); const onSelectionChanged = (event: any, item: TreeItem) => spy(item); diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx index 8a567397..8d657f8d 100644 --- a/src/components/tree/tree.tsx +++ b/src/components/tree/tree.tsx @@ -141,9 +141,13 @@ export const Tree = withStyles(styles)( } getProperArrowAnimation = (status: string, items: Array>) => { + return this.isSidePanelIconNotNeeded(status, items) ? : ; + } + + isSidePanelIconNotNeeded = (status: string, items: Array>) => { return status === TreeItemStatus.PENDING || - (status === TreeItemStatus.LOADED && !items) || - (status === TreeItemStatus.LOADED && items && items.length === 0) ? : ; + (status === TreeItemStatus.LOADED && !items) || + (status === TreeItemStatus.LOADED && items && items.length === 0); } getToggableIconClassNames = (isOpen?: boolean, isActive?: boolean) => { diff --git a/src/index.tsx b/src/index.tsx index f5b1464e..b368d3f8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -27,7 +27,6 @@ import { collectionFilesActionSet } from './views-components/context-menu/action import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set'; import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set'; import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set'; -import { initPickerProjectTree } from './store/project-tree-picker/project-tree-picker-actions'; const getBuildNumber = () => "BN-" + (process.env.BUILD_NUMBER || "dev"); const getGitCommit = () => "GIT-" + (process.env.GIT_COMMIT || "latest").substr(0, 7); @@ -53,8 +52,7 @@ fetchConfig() const store = configureStore(history, services); store.dispatch(initAuth()); - store.dispatch(getProjectList(services.authService.getUuid())); - store.dispatch(initPickerProjectTree()); + store.dispatch(getProjectList(services.authService.getUuid())); const TokenComponent = (props: any) => ; const WorkbenchComponent = (props: any) => ; diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts index e7a7ec86..3ad753fc 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts @@ -11,9 +11,9 @@ import { snackbarActions } from "../../snackbar/snackbar-actions"; import { dialogActions } from '../../dialog/dialog-actions'; import { getNodeValue } from "~/models/tree"; import { filterCollectionFilesBySelection } from './collection-panel-files-state'; -import { startSubmit, initialize, SubmissionError, stopSubmit } from 'redux-form'; -import { loadProjectTreePickerProjects } from '../../../views-components/project-tree-picker/project-tree-picker'; +import { startSubmit, initialize, stopSubmit } from 'redux-form'; import { getCommonResourceServiceError, CommonResourceServiceError } from "~/common/api/common-resource-service"; +import { resetPickerProjectTree } from '../../project-tree-picker/project-tree-picker-actions'; export const collectionPanelFilesAction = unionize({ SET_COLLECTION_FILES: ofType(), @@ -103,7 +103,7 @@ export const openCollectionPartialCopyDialog = () => projectUuid: '' }; dispatch(initialize(COLLECTION_PARTIAL_COPY, initialData)); - dispatch(loadProjectTreePickerProjects('')); + dispatch(resetPickerProjectTree()); dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_PARTIAL_COPY, data: {} })); } }; diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts index 0f0125c5..7d49e34c 100644 --- a/src/views-components/context-menu/action-sets/collection-action-set.ts +++ b/src/views-components/context-menu/action-sets/collection-action-set.ts @@ -8,7 +8,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions"; import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon"; import { openUpdater } from "~/store/collections/updater/collection-updater-action"; import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; -import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog"; +import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog"; import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog"; export const collectionActionSet: ContextMenuActionSet = [[ @@ -43,7 +43,7 @@ export const collectionActionSet: ContextMenuActionSet = [[ icon: CopyIcon, name: "Copy to project", execute: (dispatch, resource) => { - dispatch(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid})); + dispatch(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid})); } }, { diff --git a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts index cf05aeea..f988ee2b 100644 --- a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts +++ b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts @@ -8,7 +8,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions"; import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon"; import { openUpdater } from "~/store/collections/updater/collection-updater-action"; import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; -import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog"; +import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog"; import { openMoveToDialog } from '../../move-to-dialog/move-to-dialog'; export const collectionResourceActionSet: ContextMenuActionSet = [[ @@ -43,7 +43,7 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[ icon: CopyIcon, name: "Copy to project", execute: (dispatch, resource) => { - dispatch(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid})); + dispatch(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid})); }, }, { 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 f7fc4f5b..e5db66db 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 @@ -12,7 +12,7 @@ import { toggleFavorite } from "~/store/favorites/favorites-actions"; import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action"; import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog"; import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create"; -import { openMakeACopyDialog } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog"; +import { openProjectCopyDialog } from "~/views-components/project-copy-dialog/project-copy-dialog"; export const projectActionSet: ContextMenuActionSet = [[ { @@ -48,7 +48,7 @@ export const projectActionSet: ContextMenuActionSet = [[ icon: CopyIcon, name: "Copy to project", execute: (dispatch, resource) => { - dispatch(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid})); + dispatch(openProjectCopyDialog({name: resource.name, projectUuid: resource.uuid})); } } ]]; diff --git a/src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx b/src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx deleted file mode 100644 index 8dd19d92..00000000 --- a/src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 -import { Dispatch, compose } from "redux"; -import { withDialog } from "../../store/dialog/with-dialog"; -import { dialogActions } from "../../store/dialog/dialog-actions"; -import { MakeACopyDialog, CopyFormData } from "../../components/make-a-copy/make-a-copy"; -import { reduxForm, startSubmit, stopSubmit, initialize } from 'redux-form'; -import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions"; - -export const MAKE_A_COPY_DIALOG = 'makeACopyDialog'; -export const openMakeACopyDialog = (data: {projectUuid: string, name: string}) => - (dispatch: Dispatch) => { - dispatch(resetPickerProjectTree()); - const initialData: CopyFormData = {name: "Copy of: " + data.name, projectUuid: '', uuid: data.projectUuid}; - dispatch(initialize(MAKE_A_COPY_DIALOG, initialData)); - dispatch(dialogActions.OPEN_DIALOG({ id: MAKE_A_COPY_DIALOG, data: {} })); - }; -export const MakeACopyToProjectDialog = compose( - withDialog(MAKE_A_COPY_DIALOG), - reduxForm({ - form: MAKE_A_COPY_DIALOG, - onSubmit: (data, dispatch) => { - dispatch(startSubmit(MAKE_A_COPY_DIALOG)); - setTimeout(() => dispatch(stopSubmit(MAKE_A_COPY_DIALOG, { name: 'Invalid path' })), 2000); - } - }) -)(MakeACopyDialog); \ No newline at end of file diff --git a/src/views-components/project-copy-dialog/project-copy-dialog.tsx b/src/views-components/project-copy-dialog/project-copy-dialog.tsx new file mode 100644 index 00000000..489e4f55 --- /dev/null +++ b/src/views-components/project-copy-dialog/project-copy-dialog.tsx @@ -0,0 +1,29 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 +import { Dispatch, compose } from "redux"; +import { withDialog } from "../../store/dialog/with-dialog"; +import { dialogActions } from "../../store/dialog/dialog-actions"; +import { ProjectCopy, CopyFormData } from "../../components/project-copy/project-copy"; +import { reduxForm, startSubmit, stopSubmit, initialize } from 'redux-form'; +import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions"; + +export const PROJECT_COPY_DIALOG = 'projectCopy'; +export const openProjectCopyDialog = (data: { projectUuid: string, name: string }) => + (dispatch: Dispatch) => { + dispatch(resetPickerProjectTree()); + const initialData: CopyFormData = { name: `Copy of: ${data.name}`, projectUuid: '', uuid: data.projectUuid }; + dispatch(initialize(PROJECT_COPY_DIALOG, initialData)); + dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_COPY_DIALOG, data: {} })); + }; + +export const ProjectCopyDialog = compose( + withDialog(PROJECT_COPY_DIALOG), + reduxForm({ + form: PROJECT_COPY_DIALOG, + onSubmit: (data, dispatch) => { + dispatch(startSubmit(PROJECT_COPY_DIALOG)); + setTimeout(() => dispatch(stopSubmit(PROJECT_COPY_DIALOG, { name: 'Invalid path' })), 2000); + } + }) +)(ProjectCopy); \ No newline at end of file diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index d84119e2..f5f62a28 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -51,7 +51,7 @@ import { MoveToProjectDialog } from '../../views-components/move-to-dialog/move- import { COLLECTION_CREATE_DIALOG } from '~/views-components/dialog-create/dialog-collection-create'; 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 { MakeACopyToProjectDialog } from '~/views-components/make-a-copy-dialog/make-a-copy-dialog'; +import { ProjectCopyDialog } from '~/views-components/project-copy-dialog/project-copy-dialog'; import { CollectionPartialCopyDialog } from '../../views-components/collection-partial-copy-dialog/collection-partial-copy-dialog'; const DRAWER_WITDH = 240; @@ -250,7 +250,7 @@ export const Workbench = withStyles(styles)( - +