[ARVADOS-WORKBENCH2] updated: 1.1.4-675-g8d49328

Git user git at public.curoverse.com
Mon Aug 20 09:10:58 EDT 2018


Summary of changes:
 src/common/custom-theme.ts                         |   6 ++
 .../details-attribute/details-attribute.tsx        |  10 +-
 .../list-item-text-icon/list-item-text-icon.tsx    |   2 +-
 src/components/make-a-copy/make-a-copy.tsx         |  11 +-
 .../move-to-dialog.tsx}                            |  24 ++---
 src/components/tree/tree.tsx                       |  12 ++-
 src/index.tsx                                      |   2 +
 .../data-explorer/data-explorer-reducer.test.tsx   |   4 +-
 .../project-tree-picker-actions.ts                 |  46 ++++++++
 src/store/project/project-reducer.test.ts          |   2 +-
 src/store/tree-picker/tree-picker-actions.ts       |  10 +-
 src/store/tree-picker/tree-picker-reducer.test.ts  | 110 ++++++++++---------
 src/store/tree-picker/tree-picker-reducer.ts       |  41 +++----
 src/store/tree-picker/tree-picker.ts               |   6 +-
 src/validators/validators.tsx                      |   4 +-
 .../action-sets/collection-action-set.ts           |  13 ++-
 .../action-sets/collection-resource-action-set.ts  |  13 ++-
 .../context-menu/action-sets/project-action-set.ts |  17 ++-
 .../create-collection-dialog-with-selected.tsx     |   4 +-
 .../details-panel/collection-details.tsx           |   2 +-
 .../details-panel/details-panel.tsx                |   9 +-
 .../details-panel/process-details.tsx              |   2 +-
 .../details-panel/project-details.tsx              |   2 +-
 .../dialog-collection-create-selected.tsx          |   4 +-
 .../make-a-copy-dialog/make-a-copy-dialog.tsx      |  14 ++-
 .../move-to-dialog/move-to-dialog.tsx              |  29 +++++
 .../project-tree-picker/project-tree-picker.tsx    | 119 ++++++++++++++++-----
 .../project-tree/project-tree.test.tsx             |  14 +--
 src/views-components/tree-picker/tree-picker.ts    |  43 ++++----
 src/views/collection-panel/collection-panel.tsx    |  31 +++---
 src/views/workbench/workbench.tsx                  |   2 +
 31 files changed, 409 insertions(+), 199 deletions(-)
 copy src/components/{make-a-copy/make-a-copy.tsx => move-to-dialog/move-to-dialog.tsx} (69%)
 create mode 100644 src/store/project-tree-picker/project-tree-picker-actions.ts
 create mode 100644 src/views-components/move-to-dialog/move-to-dialog.tsx

       via  8d493281629ff304711a1175f59f6d477ae510e2 (commit)
       via  353c39122f1ebbcb47cf5ae4d2ea641b60439614 (commit)
       via  dffffdfbf3e0bce8a7cd4d6755d71d8084615b33 (commit)
       via  900081d75c21b924f4da42a94c1ca4ef7084a3df (commit)
       via  53022b7d9f1cad38d709f92e70b86f44cd436c18 (commit)
       via  33608c44bf33ab330ad1267ab8d56c08634673b5 (commit)
       via  31df208339af5e30665455e193cdbde90dabaf1d (commit)
       via  1bd016d1f30c72353e5e3b086dd9778b74efb516 (commit)
       via  e6ce4acd9ac2ed0d93e5aafe8df8fb1e16ee956d (commit)
       via  01e4b29eb65a760650476a8f5f059413130921f4 (commit)
       via  07d646d908bcbd2b3de9ad22c02a93b65d04af2a (commit)
       via  37421f3062f84e7a5ce81606eab758a43b987b27 (commit)
       via  f2b031de2183439f8aade2f290cd0e3f95f6438c (commit)
       via  67d63d61aa5a1f1bc1bb85bf6b788e6c0d21e298 (commit)
       via  8a057a6a69f4182cd3adc67c7d1071832ffeaa0b (commit)
       via  f0ac109691369516a5adf9370838cb4eacf16a45 (commit)
       via  1c1a44191e11b62a0640551ea73f2281b2ed9a7f (commit)
       via  5ca3e3c15a9741bd2e4dcaada9e7e0edc22306df (commit)
       via  42c529f08bbeccaeb0d4c07f639c74504569c621 (commit)
       via  8b501e5ced1608766db8d16022d34c1ad363fcc8 (commit)
      from  e2396eed71c581a862a151a8acd00abaae76a5e9 (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 8d493281629ff304711a1175f59f6d477ae510e2
Merge: e2396ee 353c391
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Aug 20 15:10:46 2018 +0200

    defaultvalue in input
    
    Feature #13988
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --cc src/components/make-a-copy/make-a-copy.tsx
index 58fd803,0000000..98be8ef
mode 100644,000000..100644
--- a/src/components/make-a-copy/make-a-copy.tsx
+++ b/src/components/make-a-copy/make-a-copy.tsx
@@@ -1,50 -1,0 +1,57 @@@
 +// Copyright (C) The Arvados Authors. All rights reserved.
 +//
 +// SPDX-License-Identifier: AGPL-3.0
 +import * as React from "react";
 +import { Field, InjectedFormProps, WrappedFieldProps } from "redux-form";
 +import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress } from "@material-ui/core";
 +import { WithDialogProps } from "~/store/dialog/with-dialog";
 +import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
 +import { MAKE_A_COPY_VALIDATION, COPY_NAME_VALIDATION } from "~/validators/validators";
 +import { TextField } from '~/components/text-field/text-field';
- export const MakeACopyDialog = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
++
++export  interface CopyFormData {
++    name: string;
++    projectUuid: string;
++    uuid: string;
++}
++
++export const MakeACopyDialog = (props: WithDialogProps<string> & InjectedFormProps<CopyFormData>) =>
 +    <form>
 +        <Dialog open={props.open}
 +            disableBackdropClick={true}
 +            disableEscapeKeyDown={true}>
 +            <DialogTitle>Make a copy</DialogTitle>
 +            <DialogContent>
 +                <Field
-                     name="copyName"
++                    name="name"
 +                    component={TextField}
 +                    validate={COPY_NAME_VALIDATION}
 +                    label="Enter a new name for the copy" />
 +                <Field
 +                    name="projectUuid"
 +                    component={Picker}
 +                    validate={MAKE_A_COPY_VALIDATION} />
 +            </DialogContent>
 +            <DialogActions>
 +                <Button
 +                    variant='flat'
 +                    color='primary'
 +                    disabled={props.submitting}
 +                    onClick={props.closeDialog}>
 +                    Cancel
 +                    </Button>
 +                <Button
 +                    variant='contained'
 +                    color='primary'
 +                    type='submit'
 +                    onClick={props.handleSubmit}
 +                    disabled={props.pristine || props.invalid || props.submitting}>
 +                    {props.submitting ? <CircularProgress size={20} /> : 'Copy'}
 +                </Button>
 +            </DialogActions>
 +        </Dialog>
 +    </form>;
 +const Picker = (props: WrappedFieldProps) =>
 +    <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
 +        <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
 +    </div>; 
diff --cc src/components/tree/tree.tsx
index 3e8cf90,2632495..6b12753
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@@ -140,6 -140,10 +140,10 @@@ export const Tree = withStyles(styles)
              </List>;
          }
  
+         getProperArrowAnimation = (status: string, items: Array<TreeItem<T>>) => {
 -            return status === TreeItemStatus.PENDING || (status === TreeItemStatus.LOADED && !items) ? <span /> : <SidePanelRightArrowIcon />;
++            return status === TreeItemStatus.PENDING || (status === TreeItemStatus.LOADED && !items) || (status === TreeItemStatus.LOADED && items && items.length === 0) ? <span /> : <SidePanelRightArrowIcon />;
+         }
+ 
          getToggableIconClassNames = (isOpen?: boolean, isActive?: boolean) => {
              const { iconOpen, iconClose, active, toggableIcon } = this.props.classes;
              return classnames(toggableIcon, {
diff --cc src/index.tsx
index 443e76f,fcc02f1..f5b1464
--- a/src/index.tsx
+++ b/src/index.tsx
@@@ -27,6 -27,7 +27,7 @@@ import { collectionFilesActionSet } fro
  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 './views-components/project-tree-picker/project-tree-picker';
++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);
diff --cc src/store/project-tree-picker/project-tree-picker-actions.ts
index 0000000,0000000..86d9a18
new file mode 100644
--- /dev/null
+++ b/src/store/project-tree-picker/project-tree-picker-actions.ts
@@@ -1,0 -1,0 +1,46 @@@
++// Copyright (C) The Arvados Authors. All rights reserved.
++//
++// SPDX-License-Identifier: AGPL-3.0
++
++import { Dispatch } from "redux";
++import { RootState } from "~/store/store";
++import { ServiceRepository } from "~/services/services";
++import { TreePickerId, receiveTreePickerData } from "~/views-components/project-tree-picker/project-tree-picker";
++import { mockProjectResource } from "~/models/test-utils";
++import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
++
++export const resetPickerProjectTree = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
++    dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.PROJECTS}));
++    dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.SHARED_WITH_ME}));
++    dispatch<any>(treePickerActions.RESET_TREE_PICKER({pickerId: TreePickerId.FAVORITES}));
++
++    dispatch<any>(initPickerProjectTree());
++};
++
++export const initPickerProjectTree = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
++    const uuid = services.authService.getUuid();
++
++    dispatch<any>(getPickerTreeProjects(uuid));
++    dispatch<any>(getSharedWithMeProjectsPickerTree(uuid));
++    dispatch<any>(getFavoritesProjectsPickerTree(uuid));
++};
++
++const getPickerTreeProjects = (uuid: string = '') => {
++    return getProjectsPickerTree(uuid, TreePickerId.PROJECTS);
++};
++
++const getSharedWithMeProjectsPickerTree = (uuid: string = '') => {
++    return getProjectsPickerTree(uuid, TreePickerId.SHARED_WITH_ME);
++};
++
++const getFavoritesProjectsPickerTree = (uuid: string = '') => {
++    return getProjectsPickerTree(uuid, TreePickerId.FAVORITES);
++};
++
++const getProjectsPickerTree = (uuid: string, kind: string) => {
++    return receiveTreePickerData(
++        '',
++        [mockProjectResource({ uuid, name: kind })],
++        kind
++    );
++};
diff --cc src/store/tree-picker/tree-picker-actions.ts
index e3bebe1,e1e8d5c..34f1303
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@@ -6,10 -7,10 +7,11 @@@ import { default as unionize, ofType, U
  import { TreePickerNode } from "./tree-picker";
  
  export const treePickerActions = unionize({
-     LOAD_TREE_PICKER_NODE: ofType<{ id: string }>(),
-     LOAD_TREE_PICKER_NODE_SUCCESS: ofType<{ id: string, nodes: Array<TreePickerNode> }>(),
-     TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ id: string }>(),
-     TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ id: string }>()
+     LOAD_TREE_PICKER_NODE: ofType<{ nodeId: string, pickerId: string }>(),
+     LOAD_TREE_PICKER_NODE_SUCCESS: ofType<{ nodeId: string, nodes: Array<TreePickerNode>, pickerId: string }>(),
+     TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ nodeId: string, pickerId: string }>(),
 -    TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ nodeId: string, pickerId: string }>()
++    TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ nodeId: string, pickerId: string }>(),
++    RESET_TREE_PICKER: ofType<{ pickerId: string }>()
  }, {
          tag: 'type',
          value: 'payload'
diff --cc src/store/tree-picker/tree-picker-reducer.ts
index 8d61714,6a87fb4..e7173d2
--- a/src/store/tree-picker/tree-picker-reducer.ts
+++ b/src/store/tree-picker/tree-picker-reducer.ts
@@@ -6,21 -6,18 +6,20 @@@ import { createTree, setNodeValueWith, 
  import { TreePicker, TreePickerNode } from "./tree-picker";
  import { treePickerActions, TreePickerAction } from "./tree-picker-actions";
  import { TreeItemStatus } from "~/components/tree/tree";
+ import { compose } from "redux";
  
- export const treePickerReducer = (state: TreePicker = createTree(), action: TreePickerAction) =>
+ export const treePickerReducer = (state: TreePicker = {}, action: TreePickerAction) =>
      treePickerActions.match(action, {
-         LOAD_TREE_PICKER_NODE: ({ id }) =>
-             setNodeValueWith(setPending)(id)(state),
-         LOAD_TREE_PICKER_NODE_SUCCESS: ({ id, nodes }) => {
-             const [newState] = [state]
-                 .map(receiveNodes(nodes)(id))
-                 .map(setNodeValueWith(setLoaded)(id));
-             return newState;
-         },
-         TOGGLE_TREE_PICKER_NODE_COLLAPSE: ({ id }) =>
-             setNodeValueWith(toggleCollapse)(id)(state),
-         TOGGLE_TREE_PICKER_NODE_SELECT: ({ id }) =>
-             mapTreeValues(toggleSelect(id))(state),
+         LOAD_TREE_PICKER_NODE: ({ nodeId, pickerId }) =>
+             updateOrCreatePicker(state, pickerId, setNodeValueWith(setPending)(nodeId)),
 -        LOAD_TREE_PICKER_NODE_SUCCESS: ({ nodeId, nodes, pickerId }) => 
 -            updateOrCreatePicker(state, pickerId, compose(receiveNodes(nodes)(nodeId),setNodeValueWith(setLoaded)(nodeId))),
 -        TOGGLE_TREE_PICKER_NODE_COLLAPSE: ({ nodeId, pickerId }) => 
++        LOAD_TREE_PICKER_NODE_SUCCESS: ({ nodeId, nodes, pickerId }) =>
++            updateOrCreatePicker(state, pickerId, compose(receiveNodes(nodes)(nodeId), setNodeValueWith(setLoaded)(nodeId))),
++        TOGGLE_TREE_PICKER_NODE_COLLAPSE: ({ nodeId, pickerId }) =>
+             updateOrCreatePicker(state, pickerId, setNodeValueWith(toggleCollapse)(nodeId)),
 -        TOGGLE_TREE_PICKER_NODE_SELECT: ({ nodeId, pickerId }) => 
++        TOGGLE_TREE_PICKER_NODE_SELECT: ({ nodeId, pickerId }) =>
+             updateOrCreatePicker(state, pickerId, mapTreeValues(toggleSelect(nodeId))),
++        RESET_TREE_PICKER: ({ pickerId }) => 
++            updateOrCreatePicker(state, pickerId, createTree),
          default: () => state
      });
  
diff --cc src/validators/validators.tsx
index f9dd354,389e8cd..106c74d
--- a/src/validators/validators.tsx
+++ b/src/validators/validators.tsx
@@@ -15,5 -15,4 +15,7 @@@ export const COLLECTION_NAME_VALIDATIO
  export const COLLECTION_DESCRIPTION_VALIDATION = [maxLength(255)];
  export const COLLECTION_PROJECT_VALIDATION = [require];
  
 -export const MOVE_TO_VALIDATION = [require];
 +export const COPY_NAME_VALIDATION = [require, maxLength(255)];
- export const MAKE_A_COPY_VALIDATION = [require, maxLength(255)];
++export const MAKE_A_COPY_VALIDATION = [require, maxLength(255)];
++
++export const MOVE_TO_VALIDATION = [require];
diff --cc src/views-components/context-menu/action-sets/collection-action-set.ts
index e2b579c,9c07fb0..2405906
--- 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 +8,9 @@@ import { toggleFavorite } from "~/store
  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 { openMakeACopyDialog, MAKE_A_COPY_DIALOG } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
+ import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
++import { reset } from 'redux-form';
  
  export const collectionActionSet: ContextMenuActionSet = [[
      {
@@@ -43,7 -41,9 +43,10 @@@
      {
          icon: CopyIcon,
          name: "Copy to project",
-         execute: dispatch => dispatch<any>(openMakeACopyDialog())
+         execute: (dispatch, resource) => {
 -            // add code
++            dispatch(reset(MAKE_A_COPY_DIALOG));
++            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
+         }
      },
      {
          icon: DetailsIcon,
diff --cc src/views-components/context-menu/action-sets/collection-resource-action-set.ts
index 846e3c9,337ca2f..ea61d26
--- 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 +8,9 @@@ import { toggleFavorite } from "~/store
  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 { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
++import { openMakeACopyDialog, MAKE_A_COPY_DIALOG } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
++import { openMoveToDialog } from '../../move-to-dialog/move-to-dialog';
++import { reset } from 'redux-form';
  
  export const collectionResourceActionSet: ContextMenuActionSet = [[
      {
@@@ -43,7 -41,9 +43,10 @@@
      {
          icon: CopyIcon,
          name: "Copy to project",
-         execute: dispatch => dispatch<any>(openMakeACopyDialog())
+         execute: (dispatch, resource) => {
 -            // add code
 -        }
++            dispatch(reset(MAKE_A_COPY_DIALOG));
++            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
++        },
      },
      {
          icon: DetailsIcon,
diff --cc src/views-components/context-menu/action-sets/project-action-set.ts
index 5903d87,efba457..d4a3fa1
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@@ -6,12 -6,12 +6,13 @@@ import { reset, initialize } from "redu
  
  import { ContextMenuActionSet } from "../context-menu-action-set";
  import { projectActions, PROJECT_FORM_NAME } from "~/store/project/project-action";
- import { NewProjectIcon, RenameIcon, CopyIcon } from "~/components/icon/icon";
 -import { NewProjectIcon, MoveToIcon, RenameIcon } from "~/components/icon/icon";
++import { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon } 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 { 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 { openMakeACopyDialog, MAKE_A_COPY_DIALOG } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
  
  export const projectActionSet: ContextMenuActionSet = [[
      {
@@@ -39,8 -39,8 +40,16 @@@
          }
      },
      {
+         icon: MoveToIcon,
+         name: "Move to",
 -        execute: dispatch => dispatch<any>(openMoveToDialog())
++        execute: dispatch => dispatch<any>(openMoveToDialog())       
+     },
++    {
 +        icon: CopyIcon,
 +        name: "Copy to project",
-         execute: dispatch => dispatch<any>(openMakeACopyDialog())
-     },
++        execute: (dispatch, resource) => {
++            dispatch(reset(MAKE_A_COPY_DIALOG));
++            dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
++        }
++    }
  ]];
diff --cc src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
index 46bc724,60ce05c..fb5f094
--- a/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
+++ b/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
@@@ -7,14 -7,12 +7,14 @@@ import { reduxForm, reset, startSubmit
  import { withDialog } from "~/store/dialog/with-dialog";
  import { dialogActions } from "~/store/dialog/dialog-actions";
  import { DialogCollectionCreateWithSelected } from "../dialog-create/dialog-collection-create-selected";
- import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
++import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions";
  
  export const DIALOG_COLLECTION_CREATE_WITH_SELECTED = 'dialogCollectionCreateWithSelected';
  
  export const createCollectionWithSelected = () =>
      (dispatch: Dispatch) => {
          dispatch(reset(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
-         dispatch<any>(loadProjectTreePickerProjects(''));
++        dispatch<any>(resetPickerProjectTree());
          dispatch(dialogActions.OPEN_DIALOG({ id: DIALOG_COLLECTION_CREATE_WITH_SELECTED, data: {} }));
      };
  
diff --cc src/views-components/make-a-copy-dialog/make-a-copy-dialog.tsx
index 9861173,0000000..8dd19d9
mode 100644,000000..100644
--- 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
@@@ -1,24 -1,0 +1,28 @@@
 +// 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 } from "../../components/make-a-copy/make-a-copy";
- import { reduxForm, startSubmit, stopSubmit } from "redux-form";
++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 = () =>
++export const MAKE_A_COPY_DIALOG = 'makeACopyDialog';
++export const openMakeACopyDialog = (data: {projectUuid: string, name: string}) =>
 +    (dispatch: Dispatch) => {
++        dispatch<any>(resetPickerProjectTree());
++        const initialData: CopyFormData = {name: "Copy of: " + data.name, projectUuid: '', uuid: data.projectUuid};
++        dispatch<any>(initialize(MAKE_A_COPY_DIALOG, initialData));
 +        dispatch(dialogActions.OPEN_DIALOG({ id: MAKE_A_COPY_DIALOG, data: {} }));
 +    };
-  export const MakeACopyToProjectDialog = compose(
++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);
diff --cc src/views-components/move-to-dialog/move-to-dialog.tsx
index 0000000,5939662..dbc402b
mode 000000,100644..100644
--- a/src/views-components/move-to-dialog/move-to-dialog.tsx
+++ b/src/views-components/move-to-dialog/move-to-dialog.tsx
@@@ -1,0 -1,27 +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 { MoveToDialog } from "../../components/move-to-dialog/move-to-dialog";
+ import { reduxForm, startSubmit, stopSubmit } from "redux-form";
++import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions";
+ 
+ export const MOVE_TO_DIALOG = 'moveToDialog';
+ 
+ export const openMoveToDialog = () =>
+     (dispatch: Dispatch) => {
++        dispatch<any>(resetPickerProjectTree());
+         dispatch(dialogActions.OPEN_DIALOG({ id: MOVE_TO_DIALOG, data: {} }));
+     };
+ 
+ export const MoveToProjectDialog = compose(
+     withDialog(MOVE_TO_DIALOG),
+     reduxForm({
+         form: MOVE_TO_DIALOG,
+         onSubmit: (data, dispatch) => {
+             dispatch(startSubmit(MOVE_TO_DIALOG));
+             setTimeout(() => dispatch(stopSubmit(MOVE_TO_DIALOG, { name: 'Invalid path' })), 2000);
+         }
+     })
+ )(MoveToDialog);
diff --cc src/views-components/project-tree-picker/project-tree-picker.tsx
index 9143c47,30acf2a..cc27806
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@@ -16,18 -16,20 +16,19 @@@ import { createTreePickerNode } from "~
  import { RootState } from "~/store/store";
  import { ServiceRepository } from "~/services/services";
  import { FilterBuilder } from "~/common/api/filter-builder";
 -import { mockProjectResource } from "~/models/test-utils";
  
- type ProjectTreePickerProps = Pick<TreeProps<ProjectResource>, 'toggleItemActive' | 'toggleItemOpen'>;
+ type ProjectTreePickerProps = Pick<TreePickerProps, 'toggleItemActive' | 'toggleItemOpen'>;
  
- const mapDispatchToProps = (dispatch: Dispatch, props: {onChange: (projectUuid: string) => void}): ProjectTreePickerProps => ({
-     toggleItemActive: id => {
-         dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id }));
-         props.onChange(id);
+ const mapDispatchToProps = (dispatch: Dispatch, props: { onChange: (projectUuid: string) => void }): ProjectTreePickerProps => ({
+     toggleItemActive: (nodeId, status, pickerId) => {
+         getNotSelectedTreePickerKind(pickerId)
+             .forEach(pickerId => dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ nodeId: '', pickerId })));
+         dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ nodeId, pickerId }));
+ 
+         props.onChange(nodeId);
      },
-     toggleItemOpen: (id, status) => {
-         status === TreeItemStatus.INITIAL
-             ? dispatch<any>(loadProjectTreePickerProjects(id))
-             : dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id }));
+     toggleItemOpen: (nodeId, status, pickerId) => {
+         dispatch<any>(toggleItemOpen(nodeId, status, pickerId));
      }
  });
  
@@@ -64,12 -129,44 +128,17 @@@ const renderTreeItem = (item: TreeItem<
          isActive={item.active}
          hasMargin={true} />;
  
+ 
  // TODO: move action creator to store directory
- const receiveProjectTreePickerData = (id: string, projects: ProjectResource[]) =>
+ export const receiveTreePickerData = (nodeId: string, projects: ProjectResource[], pickerId: string) =>
      (dispatch: Dispatch) => {
          dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
-             id,
-             nodes: projects.map(project => createTreePickerNode({ id: project.uuid, value: project }))
+             nodeId,
+             nodes: projects.map(project => createTreePickerNode({ nodeId: project.uuid, value: project })),
+             pickerId,
          }));
-         dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id }));
+ 
+         dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ nodeId, pickerId }));
      };
+ 
 -export const initPickerProjectTree = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
 -    const uuid = services.authService.getUuid();
 -
 -    dispatch<any>(getPickerTreeProjects(uuid));
 -    dispatch<any>(getSharedWithMeProjectsPickerTree(uuid));
 -    dispatch<any>(getFavoritesProjectsPickerTree(uuid));
 -};
 -
 -const getPickerTreeProjects = (uuid: string = '') => {
 -    return getProjectsPickerTree(uuid, TreePickerId.PROJECTS);
 -};
 -
 -const getSharedWithMeProjectsPickerTree = (uuid: string = '') => {
 -    return getProjectsPickerTree(uuid, TreePickerId.SHARED_WITH_ME);
 -};
 -
 -const getFavoritesProjectsPickerTree = (uuid: string = '') => {
 -    return getProjectsPickerTree(uuid, TreePickerId.FAVORITES);
 -};
 -
 -const getProjectsPickerTree = (uuid: string, kind: string) => {
 -    return receiveTreePickerData(
 -        '',
 -        [mockProjectResource({ uuid, name: kind })],
 -        kind
 -    );
 -};
+ 
diff --cc src/views/workbench/workbench.tsx
index b16d4b2,3e0ed55..084e9bb
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@@ -244,9 -244,9 +245,10 @@@ export const Workbench = withStyles(sty
                          <CreateProjectDialog />
                          <CreateCollectionDialog />
                          <RenameFileDialog />
+                         <MoveToProjectDialog />
                          <DialogCollectionCreateWithSelectedFile />
                          <FileRemoveDialog />
 +                        <MakeACopyToProjectDialog />
                          <MultipleFilesRemoveDialog />
                          <UpdateCollectionDialog />
                          <UploadCollectionFilesDialog />

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list