[ARVADOS-WORKBENCH2] updated: 1.1.4-635-g37421f3
Git user
git at public.curoverse.com
Fri Aug 17 10:51:06 EDT 2018
Summary of changes:
.env | 2 +-
src/common/xml.ts | 8 +++
src/components/context-menu/context-menu.tsx | 32 ++++-----
src/components/move-to-dialog/move-to-dialog.tsx | 2 +-
src/components/tree/tree.tsx | 8 ++-
src/index.tsx | 2 +-
src/models/collection-file.ts | 19 +++++-
.../collection-manifest-mapper.test.ts | 21 ++++--
.../collection-service/collection-service.ts | 64 +++++++++++++++++-
src/services/services.ts | 2 +-
.../collection-panel/collection-panel-action.ts | 13 ++--
.../collection-panel-files-actions.ts | 75 +++++++++++++++++++++-
.../collection-panel-files-reducer.ts | 4 +-
.../collection-panel-files-state.ts | 13 +++-
src/store/tree-picker/tree-picker-actions.ts | 41 ++----------
src/store/tree-picker/tree-picker-reducer.test.ts | 32 ++++-----
src/store/tree-picker/tree-picker-reducer.ts | 24 +++----
.../action-sets/collection-action-set.ts | 4 +-
.../action-sets/collection-files-action-set.ts | 5 +-
.../collection-files-item-action-set.ts | 12 ++--
.../action-sets/collection-resource-action-set.ts | 4 +-
.../context-menu/action-sets/project-action-set.ts | 4 +-
.../context-menu/actions/download-action.tsx | 29 +++++++++
.../actions/download-collection-file-action.tsx | 25 ++++++++
.../context-menu/actions/favorite-action.tsx | 17 +++--
.../file-remove-dialog/file-remove-dialog.ts | 41 ++++++------
.../multiple-files-remove-dialog.ts | 31 ++-------
.../move-to-dialog/move-to-dialog.tsx | 15 +++--
.../project-tree-picker/project-tree-picker.tsx | 71 ++++++++++++++------
src/views-components/tree-picker/tree-picker.ts | 12 ++--
src/views/workbench/workbench.tsx | 6 +-
31 files changed, 418 insertions(+), 220 deletions(-)
create mode 100644 src/common/xml.ts
create mode 100644 src/views-components/context-menu/actions/download-action.tsx
create mode 100644 src/views-components/context-menu/actions/download-collection-file-action.tsx
via 37421f3062f84e7a5ce81606eab758a43b987b27 (commit)
via f2b031de2183439f8aade2f290cd0e3f95f6438c (commit)
via 67d63d61aa5a1f1bc1bb85bf6b788e6c0d21e298 (commit)
via 714e665e783490e3710a772bc54c2c062965e812 (commit)
via a71b18d036e642ace1ae4bdd06f7df8409faf1b4 (commit)
via 52481255ee28ad3e4e69cbdb8a03cbf63546a0ce (commit)
via 8500bc0465a1bea55bb6dee5c6b0740cf5dfba8e (commit)
via c11055f2d6ce8385088bc221eab1175e31777ec0 (commit)
via b0462bb88a89a78a8ed2b161d8dd7562d9ca28fa (commit)
via ea4ad5a3f95aa8c6fa36e4f02b50e19de3e7b8c4 (commit)
via 2808fb2da98a36cf6cf30a215e76aac88146af28 (commit)
via 67a259f2d6b350fd694a140b646cc07c50182f6e (commit)
via 9617303db6efc4ff82b0f46af9aa9080879cc553 (commit)
via 812e47f58549b4801a8fc5279bcf6cc6eec7925b (commit)
via c4e503180948300c3a6ef99e338d2e56b2931236 (commit)
via a2cb695cb495ad156634b2caa4363a0753981203 (commit)
via 2ddeeb1b278734e895128feb2caa2bf720192b3d (commit)
via 27cb820f897c08448f7495c57a8f2fc9cadaa2b4 (commit)
via 07dbadec1906eed46de8ecd89113a434d8340322 (commit)
via 571f9757f7bce4b151921368b4a4d4e97d22d055 (commit)
from 8a057a6a69f4182cd3adc67c7d1071832ffeaa0b (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 37421f3062f84e7a5ce81606eab758a43b987b27
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Aug 17 16:50:37 2018 +0200
cr changes v2
Feature #13902
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/views-components/move-to-dialog/move-to-dialog.tsx b/src/views-components/move-to-dialog/move-to-dialog.tsx
index 9c3a6bf..5939662 100644
--- a/src/views-components/move-to-dialog/move-to-dialog.tsx
+++ b/src/views-components/move-to-dialog/move-to-dialog.tsx
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { Dispatch } from "redux";
+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";
@@ -12,15 +12,16 @@ export const MOVE_TO_DIALOG = 'moveToDialog';
export const openMoveToDialog = () =>
(dispatch: Dispatch) => {
- dispatch(dialogActions.OPEN_DIALOG({ id: MOVE_TO_DIALOG, data: {}}));
+ dispatch(dialogActions.OPEN_DIALOG({ id: MOVE_TO_DIALOG, data: {} }));
};
-export const [MoveToProjectDialog] = [MoveToDialog]
- .map(withDialog(MOVE_TO_DIALOG))
- .map(reduxForm({
+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);
}
- }));
\ No newline at end of file
+ })
+)(MoveToDialog);
commit f2b031de2183439f8aade2f290cd0e3f95f6438c
Merge: 67d63d6 714e665
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Aug 17 16:17:03 2018 +0200
Merge branch 'master' into 13902-ui-move-to-popup
refs #13902
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
commit 67d63d61aa5a1f1bc1bb85bf6b788e6c0d21e298
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Aug 17 16:16:29 2018 +0200
cr changes
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
index 51f5fbf..2bfc2c3 100644
--- a/src/components/move-to-dialog/move-to-dialog.tsx
+++ b/src/components/move-to-dialog/move-to-dialog.tsx
@@ -10,7 +10,7 @@ import { WithDialogProps } from "~/store/dialog/with-dialog";
import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
import { MOVE_TO_VALIDATION } from "~/validators/validators";
-export const MoveTo = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
+export const MoveToDialog = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
<form>
<Dialog open={props.open}
disableBackdropClick={true}
diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index 06d7cbb..2632495 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -110,9 +110,7 @@ export const Tree = withStyles(styles)(
<i onClick={() => this.props.toggleItemOpen(it.id, it.status)}
className={toggableIconContainer}>
<ListItemIcon className={this.getToggableIconClassNames(it.open, it.active)}>
- {it.status === TreeItemStatus.PENDING
- || (it.status === TreeItemStatus.LOADED && !it.items)
- || (it.status === TreeItemStatus.LOADED && it.items && it.items.length === 0) ? <span /> : <SidePanelRightArrowIcon />}
+ {this.getProperArrowAnimation(it.status, it.items!)}
</ListItemIcon>
</i>
{this.props.showSelection &&
@@ -142,6 +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 />;
+ }
+
getToggableIconClassNames = (isOpen?: boolean, isActive?: boolean) => {
const { iconOpen, iconClose, active, toggableIcon } = this.props.classes;
return classnames(toggableIcon, {
diff --git a/src/index.tsx b/src/index.tsx
index 461904c..faaf6b8 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -27,7 +27,7 @@ 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/tree-picker/tree-picker-actions';
+import { initPickerProjectTree } from './views-components/project-tree-picker/project-tree-picker';
addMenuActionSet(ContextMenuKind.ROOT_PROJECT, rootProjectActionSet);
addMenuActionSet(ContextMenuKind.PROJECT, projectActionSet);
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index 5b29c4c..f3c3581 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -5,48 +5,15 @@
import { default as unionize, ofType, UnionOf } from "unionize";
import { TreePickerNode } from "./tree-picker";
-import { receiveTreePickerData, TreePickerKind } from "../../views-components/project-tree-picker/project-tree-picker";
-import { mockProjectResource } from "../../models/test-utils";
-import { Dispatch } from "redux";
-import { RootState } from "../store";
-import { ServiceRepository } from "../../services/services";
export const treePickerActions = unionize({
- LOAD_TREE_PICKER_NODE: ofType<{ id: string, pickerId: string }>(),
- LOAD_TREE_PICKER_NODE_SUCCESS: ofType<{ id: string, nodes: Array<TreePickerNode>, pickerId: string }>(),
- TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ id: string, pickerId: string }>(),
- TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ id: string, pickerId: string }>()
+ LOAD_TREE_PICKER_NODE: ofType<{ id: string, pickerKind: string }>(),
+ LOAD_TREE_PICKER_NODE_SUCCESS: ofType<{ id: string, nodes: Array<TreePickerNode>, pickerKind: string }>(),
+ TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ id: string, pickerKind: string }>(),
+ TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ id: string, pickerKind: string }>()
}, {
tag: 'type',
value: 'payload'
});
-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, TreePickerKind.PROJECTS);
-};
-
-const getSharedWithMeProjectsPickerTree = (uuid: string = '') => {
- return getProjectsPickerTree(uuid, TreePickerKind.SHARED_WITH_ME);
-};
-
-const getFavoritesProjectsPickerTree = (uuid: string = '') => {
- return getProjectsPickerTree(uuid, TreePickerKind.FAVORITES);
-};
-
-const getProjectsPickerTree = (uuid: string, kind: string) => {
- return receiveTreePickerData(
- '',
- [mockProjectResource({ uuid, name: kind })],
- kind
- );
-};
-
export type TreePickerAction = UnionOf<typeof treePickerActions>;
diff --git a/src/store/tree-picker/tree-picker-reducer.test.ts b/src/store/tree-picker/tree-picker-reducer.test.ts
index 2432b84..62367d5 100644
--- a/src/store/tree-picker/tree-picker-reducer.test.ts
+++ b/src/store/tree-picker/tree-picker-reducer.test.ts
@@ -11,7 +11,7 @@ import { TreeItemStatus } from "~/components/tree/tree";
describe('TreePickerReducer', () => {
it('LOAD_TREE_PICKER_NODE - initial state', () => {
const tree = createTree<TreePickerNode>();
- const newState = treePickerReducer({}, treePickerActions.LOAD_TREE_PICKER_NODE({ id: '1', pickerId: "projects" }));
+ const newState = treePickerReducer({}, treePickerActions.LOAD_TREE_PICKER_NODE({ id: '1', pickerKind: "projects" }));
expect(newState).toEqual({ 'projects': tree });
});
@@ -20,8 +20,8 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE({ id: '1', pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE({ id: '1', pickerKind: "projects" })));
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
@@ -31,7 +31,7 @@ describe('TreePickerReducer', () => {
it('LOAD_TREE_PICKER_NODE_SUCCESS - initial state', () => {
const subNode = createTreePickerNode({ id: '1.1', value: '1.1' });
- const newState = treePickerReducer({}, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [subNode], pickerId: "projects" }));
+ const newState = treePickerReducer({}, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [subNode], pickerKind: "projects" }));
expect(getNodeChildren('')(newState.projects)).toEqual(['1.1']);
});
@@ -41,8 +41,8 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '1', nodes: [subNode], pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '1', nodes: [subNode], pickerKind: "projects" })));
expect(getNodeChildren('1')(newState.projects)).toEqual(['1.1']);
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
@@ -55,8 +55,8 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerKind: "projects" })));
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
collapsed: false
@@ -68,9 +68,9 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id: '1', pickerKind: "projects" })));
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
collapsed: true
@@ -82,8 +82,8 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerKind: "projects" })));
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
selected: true
@@ -95,9 +95,9 @@ describe('TreePickerReducer', () => {
const [newState] = [{
projects: createTree<TreePickerNode>()
}]
- .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerId: "projects" })))
- .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerId: "projects" })));
+ .map(state => treePickerReducer(state, treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: '', nodes: [node], pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerKind: "projects" })))
+ .map(state => treePickerReducer(state, treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '1', pickerKind: "projects" })));
expect(getNodeValue('1')(newState.projects)).toEqual({
...createTreePickerNode({ id: '1', value: '1' }),
selected: false
diff --git a/src/store/tree-picker/tree-picker-reducer.ts b/src/store/tree-picker/tree-picker-reducer.ts
index cf67aa7..a2d7ef1 100644
--- a/src/store/tree-picker/tree-picker-reducer.ts
+++ b/src/store/tree-picker/tree-picker-reducer.ts
@@ -9,27 +9,27 @@ import { TreeItemStatus } from "~/components/tree/tree";
export const treePickerReducer = (state: TreePicker = {}, action: TreePickerAction) =>
treePickerActions.match(action, {
- LOAD_TREE_PICKER_NODE: ({ id, pickerId }) => {
- const picker = state[pickerId] || createTree();
+ LOAD_TREE_PICKER_NODE: ({ id, pickerKind }) => {
+ const picker = state[pickerKind] || createTree();
const updatedPicker = setNodeValueWith(setPending)(id)(picker);
- return { ...state, [pickerId]: updatedPicker };
+ return { ...state, [pickerKind]: updatedPicker };
},
- LOAD_TREE_PICKER_NODE_SUCCESS: ({ id, nodes, pickerId }) => {
- const picker = state[pickerId] || createTree();
+ LOAD_TREE_PICKER_NODE_SUCCESS: ({ id, nodes, pickerKind }) => {
+ const picker = state[pickerKind] || createTree();
const [updatedPicker] = [picker]
.map(receiveNodes(nodes)(id))
.map(setNodeValueWith(setLoaded)(id));
- return { ...state, [pickerId]: updatedPicker };
+ return { ...state, [pickerKind]: updatedPicker };
},
- TOGGLE_TREE_PICKER_NODE_COLLAPSE: ({ id, pickerId }) => {
- const picker = state[pickerId] || createTree();
+ TOGGLE_TREE_PICKER_NODE_COLLAPSE: ({ id, pickerKind }) => {
+ const picker = state[pickerKind] || createTree();
const updatedPicker = setNodeValueWith(toggleCollapse)(id)(picker);
- return { ...state, [pickerId]: updatedPicker };
+ return { ...state, [pickerKind]: updatedPicker };
},
- TOGGLE_TREE_PICKER_NODE_SELECT: ({ id, pickerId }) => {
- const picker = state[pickerId] || createTree();
+ TOGGLE_TREE_PICKER_NODE_SELECT: ({ id, pickerKind }) => {
+ const picker = state[pickerKind] || createTree();
const updatedPicker = mapTreeValues(toggleSelect(id))(picker);
- return { ...state, [pickerId]: updatedPicker };
+ return { ...state, [pickerKind]: updatedPicker };
},
default: () => state
});
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 e6dd686..9c07fb0 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
@@ -28,9 +28,7 @@ export const collectionActionSet: ContextMenuActionSet = [[
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch) => {
- dispatch<any>(openMoveToDialog());
- }
+ execute: dispatch => dispatch<any>(openMoveToDialog())
},
{
component: ToggleFavoriteAction,
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 fd2f8d7..337ca2f 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
@@ -28,9 +28,7 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch) => {
- dispatch<any>(openMoveToDialog());
- }
+ execute: dispatch => dispatch<any>(openMoveToDialog())
},
{
component: ToggleFavoriteAction,
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 ca9a4f6..efba457 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
@@ -41,8 +41,6 @@ export const projectActionSet: ContextMenuActionSet = [[
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch) => {
- dispatch<any>(openMoveToDialog());
- }
+ execute: dispatch => dispatch<any>(openMoveToDialog())
},
]];
diff --git a/src/views-components/move-to-dialog/move-to-dialog.tsx b/src/views-components/move-to-dialog/move-to-dialog.tsx
index 21aa515..9c3a6bf 100644
--- a/src/views-components/move-to-dialog/move-to-dialog.tsx
+++ b/src/views-components/move-to-dialog/move-to-dialog.tsx
@@ -5,7 +5,7 @@
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 { MoveToDialog } from "../../components/move-to-dialog/move-to-dialog";
import { reduxForm, startSubmit, stopSubmit } from "redux-form";
export const MOVE_TO_DIALOG = 'moveToDialog';
@@ -15,7 +15,7 @@ export const openMoveToDialog = () =>
dispatch(dialogActions.OPEN_DIALOG({ id: MOVE_TO_DIALOG, data: {}}));
};
-export const [MoveToProjectDialog] = [MoveTo]
+export const [MoveToProjectDialog] = [MoveToDialog]
.map(withDialog(MOVE_TO_DIALOG))
.map(reduxForm({
form: MOVE_TO_DIALOG,
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 e18af9e..ddf6843 100644
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@ -16,39 +16,40 @@ import { createTreePickerNode } from "~/store/tree-picker/tree-picker";
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<TreePickerProps, 'toggleItemActive' | 'toggleItemOpen'>;
const mapDispatchToProps = (dispatch: Dispatch, props: { onChange: (projectUuid: string) => void }): ProjectTreePickerProps => ({
- toggleItemActive: (id, status, pickerId) => {
- getNotSelectedTreePickerKind(pickerId)
- .forEach(pickerId => dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '', pickerId })));
- dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id, pickerId }));
+ toggleItemActive: (id, status, pickerKind) => {
+ getNotSelectedTreePickerKind(pickerKind)
+ .forEach(pickerKind => dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id: '', pickerKind })));
+ dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_SELECT({ id, pickerKind }));
props.onChange(id);
},
- toggleItemOpen: (id, status, pickerId) => {
- dispatch<any>(toggleItemOpen(id, status, pickerId));
+ toggleItemOpen: (id, status, pickerKind) => {
+ dispatch<any>(toggleItemOpen(id, status, pickerKind));
}
});
-const toggleItemOpen = (id: string, status: TreeItemStatus, pickerId: string) =>
+const toggleItemOpen = (id: string, status: TreeItemStatus, pickerKind: string) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
if (status === TreeItemStatus.INITIAL) {
- if (pickerId === TreePickerKind.PROJECTS) {
+ if (pickerKind === TreePickerKind.PROJECTS) {
dispatch<any>(loadProjectTreePickerProjects(id));
- } else if (pickerId === TreePickerKind.FAVORITES) {
+ } else if (pickerKind === TreePickerKind.FAVORITES) {
dispatch<any>(loadFavoriteTreePickerProjects(id === services.authService.getUuid() ? '' : id));
} else {
// TODO: load sharedWithMe
}
} else {
- dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));
+ dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerKind }));
}
};
-const getNotSelectedTreePickerKind = (pickerId: string) => {
- return [TreePickerKind.PROJECTS, TreePickerKind.FAVORITES, TreePickerKind.SHARED_WITH_ME].filter(id => id !== pickerId);
+const getNotSelectedTreePickerKind = (pickerKind: string) => {
+ return [TreePickerKind.PROJECTS, TreePickerKind.FAVORITES, TreePickerKind.SHARED_WITH_ME].filter(id => id !== pickerKind);
};
export enum TreePickerKind {
@@ -63,9 +64,9 @@ export const ProjectTreePicker = connect(undefined, mapDispatchToProps)((props:
Select a project
</Typography>
<div style={{ flexGrow: 1, overflow: 'auto' }}>
- <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerKind.PROJECTS} />
- <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerKind.SHARED_WITH_ME} />
- <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerKind.FAVORITES} />
+ <TreePicker {...props} render={renderTreeItem} pickerKind={TreePickerKind.PROJECTS} />
+ <TreePicker {...props} render={renderTreeItem} pickerKind={TreePickerKind.SHARED_WITH_ME} />
+ <TreePicker {...props} render={renderTreeItem} pickerKind={TreePickerKind.FAVORITES} />
</div>
</div>);
@@ -73,7 +74,7 @@ export const ProjectTreePicker = connect(undefined, mapDispatchToProps)((props:
// TODO: move action creator to store directory
export const loadProjectTreePickerProjects = (id: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId: TreePickerKind.PROJECTS }));
+ dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerKind: TreePickerKind.PROJECTS }));
const ownerUuid = id.length === 0 ? services.authService.getUuid() || '' : id;
@@ -91,12 +92,12 @@ export const loadFavoriteTreePickerProjects = (id: string) =>
const parentId = services.authService.getUuid() || '';
if (id === '') {
- dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: parentId, pickerId: TreePickerKind.FAVORITES }));
+ dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: parentId, pickerKind: TreePickerKind.FAVORITES }));
const { items } = await services.favoriteService.list(parentId);
dispatch<any>(receiveTreePickerData(parentId, items as ProjectResource[], TreePickerKind.FAVORITES));
} else {
- dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId: TreePickerKind.FAVORITES }));
+ dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerKind: TreePickerKind.FAVORITES }));
const filters = new FilterBuilder()
.addEqual('ownerUuid', id)
.getFilters();
@@ -130,14 +131,42 @@ const renderTreeItem = (item: TreeItem<ProjectResource>) =>
// TODO: move action creator to store directory
-export const receiveTreePickerData = (id: string, projects: ProjectResource[], pickerId: string) =>
+export const receiveTreePickerData = (id: string, projects: ProjectResource[], pickerKind: string) =>
(dispatch: Dispatch) => {
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
id,
nodes: projects.map(project => createTreePickerNode({ id: project.uuid, value: project })),
- pickerId,
+ pickerKind,
}));
- dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerId }));
+ dispatch(treePickerActions.TOGGLE_TREE_PICKER_NODE_COLLAPSE({ id, pickerKind }));
};
+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, TreePickerKind.PROJECTS);
+};
+
+const getSharedWithMeProjectsPickerTree = (uuid: string = '') => {
+ return getProjectsPickerTree(uuid, TreePickerKind.SHARED_WITH_ME);
+};
+
+const getFavoritesProjectsPickerTree = (uuid: string = '') => {
+ return getProjectsPickerTree(uuid, TreePickerKind.FAVORITES);
+};
+
+const getProjectsPickerTree = (uuid: string, kind: string) => {
+ return receiveTreePickerData(
+ '',
+ [mockProjectResource({ uuid, name: kind })],
+ kind
+ );
+};
+
diff --git a/src/views-components/tree-picker/tree-picker.ts b/src/views-components/tree-picker/tree-picker.ts
index fb05b81..73e0a99 100644
--- a/src/views-components/tree-picker/tree-picker.ts
+++ b/src/views-components/tree-picker/tree-picker.ts
@@ -10,13 +10,13 @@ import { getNodeValue, getNodeChildren, Tree as Ttree, createTree } from "~/mode
import { Dispatch } from "redux";
export interface TreePickerProps {
- pickerId: string;
- toggleItemOpen: (id: string, status: TreeItemStatus, pickerId: string) => void;
- toggleItemActive: (id: string, status: TreeItemStatus, pickerId: string) => void;
+ pickerKind: string;
+ toggleItemOpen: (id: string, status: TreeItemStatus, pickerKind: string) => void;
+ toggleItemActive: (id: string, status: TreeItemStatus, pickerKind: string) => void;
}
const mapStateToProps = (state: RootState, props: TreePickerProps): Pick<TreeProps<any>, 'items'> => {
- const tree = state.treePicker[props.pickerId] || createTree();
+ const tree = state.treePicker[props.pickerKind] || createTree();
return {
items: getNodeChildren('')(tree)
.map(treePickerToTreeItems(tree))
@@ -25,8 +25,8 @@ const mapStateToProps = (state: RootState, props: TreePickerProps): Pick<TreePro
const mapDispatchToProps = (dispatch: Dispatch, props: TreePickerProps): Pick<TreeProps<any>, 'onContextMenu' | 'toggleItemOpen' | 'toggleItemActive'> => ({
onContextMenu: () => { return; },
- toggleItemActive: (id, status) => props.toggleItemActive(id, status, props.pickerId),
- toggleItemOpen: (id, status) => props.toggleItemOpen(id, status, props.pickerId)
+ toggleItemActive: (id, status) => props.toggleItemActive(id, status, props.pickerKind),
+ toggleItemOpen: (id, status) => props.toggleItemOpen(id, status, props.pickerKind)
});
export const TreePicker = connect(mapStateToProps, mapDispatchToProps)(Tree);
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list