[ARVADOS-WORKBENCH2] created: 1.1.4-581-g42c529f
Git user
git at public.curoverse.com
Thu Aug 9 11:07:22 EDT 2018
at 42c529f08bbeccaeb0d4c07f639c74504569c621 (commit)
commit 42c529f08bbeccaeb0d4c07f639c74504569c621
Merge: 8b501e5 0f2d05e
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Thu Aug 9 17:06:53 2018 +0200
merge master
Feature #13902
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --cc src/views-components/context-menu/action-sets/project-action-set.ts
index 39359e2,4e7a600..06ffb9d
--- 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,13 -2,15 +2,16 @@@
//
// 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 { NewProjectIcon, 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";
export const projectActionSet: ContextMenuActionSet = [[{
icon: NewProjectIcon,
diff --cc src/views/workbench/workbench.tsx
index 090e40e,ab7ac38..c8d4474
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@@ -46,7 -47,8 +47,9 @@@ import { RenameFileDialog } from '../..
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 { MoveToProjectDialog } from '../../views-components/move-to-dialog/move-to-dialog';
+ 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;
commit 8b501e5ced1608766db8d16022d34c1ad363fcc8
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Thu Aug 9 16:30:33 2018 +0200
ui-move-to-popup-without-side-panel
Feature #13902
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/components/move-to-dialog/move-to-dialog.tsx b/src/components/move-to-dialog/move-to-dialog.tsx
new file mode 100644
index 0000000..df66c01
--- /dev/null
+++ b/src/components/move-to-dialog/move-to-dialog.tsx
@@ -0,0 +1,50 @@
+// 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 { ProjectTreePickerWithSidePanel } from "../../views-components/project-tree-picker/project-tree-picker";
+import { MOVE_TO_VALIDATION } from "../../validators/move-to/move-to-validator";
+
+export const MoveTo = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
+ <form>
+ <Dialog open={props.open}
+ disableBackdropClick={true}
+ disableEscapeKeyDown={true}>
+ <DialogTitle>Move to</DialogTitle>
+ <DialogContent>
+ <Field
+ name="projectUuid"
+ component={Picker}
+ validate={MOVE_TO_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} />
+ : 'Move'}
+ </Button>
+ </DialogActions>
+ </Dialog>
+ </form>;
+
+const Picker = (props: WrappedFieldProps) =>
+ <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
+ <ProjectTreePickerWithSidePanel onChange={projectUuid => props.input.onChange(projectUuid)} />
+ </div>;
\ No newline at end of file
diff --git a/src/validators/create-collection/create-collection-validator.tsx b/src/validators/create-collection/create-collection-validator.tsx
index 2d8e1f5..1ada691 100644
--- a/src/validators/create-collection/create-collection-validator.tsx
+++ b/src/validators/create-collection/create-collection-validator.tsx
@@ -6,4 +6,5 @@ import { require } from '../require';
import { maxLength } from '../max-length';
export const COLLECTION_NAME_VALIDATION = [require, maxLength(255)];
-export const COLLECTION_DESCRIPTION_VALIDATION = [maxLength(255)];
\ No newline at end of file
+export const COLLECTION_DESCRIPTION_VALIDATION = [maxLength(255)];
+export const COLLECTION_PROJECT_VALIDATION = [require];
\ No newline at end of file
diff --git a/src/validators/create-project/create-project-validator.tsx b/src/validators/create-project/create-project-validator.tsx
index ddea8be..928efdd 100644
--- a/src/validators/create-project/create-project-validator.tsx
+++ b/src/validators/create-project/create-project-validator.tsx
@@ -7,6 +7,3 @@ import { maxLength } from '../max-length';
export const PROJECT_NAME_VALIDATION = [require, maxLength(255)];
export const PROJECT_DESCRIPTION_VALIDATION = [maxLength(255)];
-export const COLLECTION_NAME_VALIDATION = [require, maxLength(255)];
-export const COLLECTION_DESCRIPTION_VALIDATION = [maxLength(255)];
-export const COLLECTION_PROJECT_VALIDATION = [require];
diff --git a/src/validators/move-to/move-to-validator.tsx b/src/validators/move-to/move-to-validator.tsx
new file mode 100644
index 0000000..eb30df3
--- /dev/null
+++ b/src/validators/move-to/move-to-validator.tsx
@@ -0,0 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { require } from '../require';
+
+export const MOVE_TO_VALIDATION = [require];
\ No newline at end of file
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 10da9ef..75ffdb3 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,6 +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 { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
export const collectionActionSet: ContextMenuActionSet = [[
{
@@ -27,8 +28,8 @@ export const collectionActionSet: ContextMenuActionSet = [[
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch, resource) => {
- // add code
+ execute: (dispatch) => {
+ dispatch<any>(openMoveToDialog());
}
},
{
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 e6356bb..f0e7efe 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,6 +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 { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
export const collectionResourceActionSet: ContextMenuActionSet = [[
{
@@ -27,8 +28,8 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch, resource) => {
- // add code
+ execute: (dispatch) => {
+ dispatch<any>(openMoveToDialog());
}
},
{
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 df298e4..39359e2 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
@@ -4,10 +4,11 @@
import { ContextMenuActionSet } from "../context-menu-action-set";
import { projectActions } from "../../../store/project/project-action";
-import { NewProjectIcon } from "../../../components/icon/icon";
+import { NewProjectIcon, 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";
export const projectActionSet: ContextMenuActionSet = [[{
icon: NewProjectIcon,
@@ -22,4 +23,10 @@ export const projectActionSet: ContextMenuActionSet = [[{
dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
});
}
-}]];
+}, {
+ icon: MoveToIcon,
+ name: "Move to",
+ execute: (dispatch) => {
+ dispatch<any>(openMoveToDialog());
+ }
+},]];
diff --git a/src/views-components/dialog-create/dialog-collection-create-selected.tsx b/src/views-components/dialog-create/dialog-collection-create-selected.tsx
index 5069db9..8fb6033 100644
--- a/src/views-components/dialog-create/dialog-collection-create-selected.tsx
+++ b/src/views-components/dialog-create/dialog-collection-create-selected.tsx
@@ -7,7 +7,7 @@ import { InjectedFormProps, Field, WrappedFieldProps } from "redux-form";
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, FormHelperText } from "@material-ui/core";
import { WithDialogProps } from "../../store/dialog/with-dialog";
import { TextField } from "../../components/text-field/text-field";
-import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "../../validators/create-project/create-project-validator";
+import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "../../validators/create-collection/create-collection-validator";
import { ProjectTreePicker } from "../project-tree-picker/project-tree-picker";
export const DialogCollectionCreateWithSelected = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
diff --git a/src/views-components/move-to-dialog/move-to-dialog.tsx b/src/views-components/move-to-dialog/move-to-dialog.tsx
new file mode 100644
index 0000000..74d5e50
--- /dev/null
+++ b/src/views-components/move-to-dialog/move-to-dialog.tsx
@@ -0,0 +1,28 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { withDialog } from "../../store/dialog/with-dialog";
+import { dialogActions } from "../../store/dialog/dialog-actions";
+import { MoveTo } from "../../components/move-to-dialog/move-to-dialog";
+import { loadProjectTreePickerProjects } from "../project-tree-picker/project-tree-picker";
+import { reduxForm, startSubmit, stopSubmit } from "redux-form";
+
+export const MOVE_TO_DIALOG = 'moveToDialog';
+
+export const openMoveToDialog = () =>
+ (dispatch: Dispatch) => {
+ dispatch<any>(loadProjectTreePickerProjects(''));
+ dispatch(dialogActions.OPEN_DIALOG({ id: MOVE_TO_DIALOG, data: {}}));
+ };
+
+export const [MoveToProjectDialog] = [MoveTo]
+ .map(withDialog(MOVE_TO_DIALOG))
+ .map(reduxForm({
+ form: MOVE_TO_DIALOG,
+ onSubmit: (data, dispatch) => {
+ dispatch(startSubmit(MOVE_TO_DIALOG));
+ setTimeout(() => dispatch(stopSubmit(MOVE_TO_DIALOG, { name: 'Invalid path' })), 2000);
+ }
+ }));
\ No newline at end of file
diff --git a/src/views-components/project-tree-picker/project-tree-picker.tsx b/src/views-components/project-tree-picker/project-tree-picker.tsx
index 1c343a2..49fb4d4 100644
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@ -19,7 +19,7 @@ import { FilterBuilder } from "../../common/api/filter-builder";
type ProjectTreePickerProps = Pick<TreeProps<ProjectResource>, 'toggleItemActive' | 'toggleItemOpen'>;
-const mapDispatchToProps = (dispatch: Dispatch, props: {onChange: (projectUuid: string) => void}): ProjectTreePickerProps => ({
+const mapDispatchToProps = (dispatch: Dispatch, props: { onChange: (projectUuid: string) => void }): ProjectTreePickerProps => ({
toggleItemActive: id => {
dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id }));
props.onChange(id);
@@ -32,15 +32,23 @@ const mapDispatchToProps = (dispatch: Dispatch, props: {onChange: (projectUuid:
});
export const ProjectTreePicker = connect(undefined, mapDispatchToProps)((props: ProjectTreePickerProps) =>
- <div style={{display: 'flex', flexDirection: 'column'}}>
- <Typography variant='caption' style={{flexShrink: 0}}>
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <Typography variant='caption' style={{ flexShrink: 0 }}>
Select a project
</Typography>
- <div style={{flexGrow: 1, overflow: 'auto'}}>
+ <div style={{ flexGrow: 1, overflow: 'auto' }}>
<TreePicker {...props} render={renderTreeItem} />
</div>
</div>);
+export const ProjectTreePickerWithSidePanel = connect(undefined, mapDispatchToProps)((props: ProjectTreePickerProps) =>
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
+ <div style={{ flexGrow: 1, overflow: 'auto' }}>
+ <TreePicker {...props} render={renderTreeItem} />
+ </div>
+ </div>
+);
+
// TODO: move action creator to store directory
export const loadProjectTreePickerProjects = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 8377744..090e40e 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -46,6 +46,7 @@ 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 { MoveToProjectDialog } from '../../views-components/move-to-dialog/move-to-dialog';
const DRAWER_WITDH = 240;
const APP_BAR_HEIGHT = 100;
@@ -236,6 +237,7 @@ export const Workbench = withStyles(styles)(
<CreateProjectDialog />
<CreateCollectionDialog />
<RenameFileDialog />
+ <MoveToProjectDialog />
<DialogCollectionCreateWithSelectedFile />
<FileRemoveDialog />
<MultipleFilesRemoveDialog />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list