import { dialogActions } from '../../dialog/dialog-actions';
import { getNodeValue } from "~/models/tree";
import { filterCollectionFilesBySelection } from './collection-panel-files-state';
-import { startSubmit, initialize, stopSubmit, reset } from 'redux-form';
-import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
+import { startSubmit, stopSubmit, reset } from 'redux-form';
import { getDialog } from "~/store/dialog/dialog-reducer";
-import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
export const collectionPanelFilesAction = unionize({
SET_COLLECTION_FILES: ofType<CollectionFilesTree>(),
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { dialogActions } from "~/store/dialog/dialog-actions";
+import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
+
+export const FILE_SELECTION = 'fileSelection';
+
+export const openFileSelectionDialog = () =>
+ (dispatch: Dispatch) => {
+ dispatch<any>(resetPickerProjectTree());
+ dispatch(dialogActions.OPEN_DIALOG({ id: FILE_SELECTION, data: {} }));
+ };
\ No newline at end of file
import { openProjectUpdateDialog } from '~/store/projects/project-update-actions';
import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
import { toggleProjectTrashed } from "~/store/trash/trash-actions";
+import { openFileSelectionDialog } from '../../../store/file-selection/file-selection-actions';
export const projectActionSet: ContextMenuActionSet = [[
{
{
icon: MoveToIcon,
name: "Move to",
- execute: (dispatch, resource) => dispatch<any>(openMoveProjectDialog(resource))
+ execute: (dispatch, resource) => dispatch<any>(openFileSelectionDialog())
},
{
icon: CopyIcon,
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { InjectedFormProps, Field } from 'redux-form';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { require } from '~/validators/require';
+import { WorkflowTreePickerField } from '~/views-components/workflow-tree-picker/workflow-tree-picker';
+
+type FileSelectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
+
+export const DialogFileSelection = (props: FileSelectionProps) =>
+ <FormDialog
+ dialogTitle='Choose a file'
+ formFields={FileSelectionFields}
+ submitLabel='Ok'
+ {...props}
+ />;
+
+const FileSelectionFields = () =>
+ <Field
+ name='tree'
+ validate={FILES_FIELD_VALIDATION}
+ component={WorkflowTreePickerField} />;
+
+const FILES_FIELD_VALIDATION = [require];
\ No newline at end of file
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog } from "~/store/dialog/with-dialog";
+import { FILE_SELECTION } from '~/store/file-selection/file-selection-actions';
+import { DialogFileSelection } from '~/views-components/dialog-file-selection/dialog-file-selection';
+import { dialogActions } from '~/store/dialog/dialog-actions';
+
+export const FileSelectionDialog = compose(
+ withDialog(FILE_SELECTION),
+ reduxForm({
+ form: FILE_SELECTION,
+ onSubmit: (data, dispatch) => {
+ dispatch(dialogActions.CLOSE_DIALOG({ id: FILE_SELECTION }));
+ return data;
+ }
+ })
+)(DialogFileSelection);
\ No newline at end of file
import { InjectedFormProps, Field } from 'redux-form';
import { WithDialogProps } from '~/store/dialog/with-dialog';
import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { WorkflowTreePickerField } from '~/views-components/workflow-tree-picker/workflow-tree-picker';
+import { ProjectTreePickerField } from '~/views-components/project-tree-picker/project-tree-picker';
import { MOVE_TO_VALIDATION } from '~/validators/validators';
import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
const MoveToDialogFields = () =>
<Field
name="ownerUuid"
- component={WorkflowTreePickerField}
+ component={ProjectTreePickerField}
validate={MOVE_TO_VALIDATION} />;
import { ServiceRepository } from "~/services/services";
import { FilterBuilder } from "~/services/api/filter-builder";
import { WrappedFieldProps } from 'redux-form';
-import { ResourceKind } from '~/models/resource';
+import { ResourceKind, extractUuidKind } from '~/models/resource';
import { GroupContentsResource } from '~/services/groups-service/groups-service';
+import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
type WorkflowTreePickerProps = Pick<MainWorkflowTreePickerProps, 'onContextMenu' | 'toggleItemActive' | 'toggleItemOpen'>;
return [TreePickerId.PROJECTS, TreePickerId.FAVORITES, TreePickerId.SHARED_WITH_ME].filter(nodeId => nodeId !== pickerId);
};
-export enum TreePickerId {
+enum TreePickerId {
PROJECTS = 'Projects',
SHARED_WITH_ME = 'Shared with me',
FAVORITES = 'Favorites'
export const loadProjectTreePicker = (nodeId: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ console.log(nodeId);
+ console.log(extractUuidKind(nodeId));
dispatch(workflowTreePickerActions.LOAD_TREE_PICKER_NODE({ nodeId, pickerId: TreePickerId.PROJECTS }));
const ownerUuid = nodeId.length === 0 ? services.authService.getUuid() || '' : nodeId;
.addEqual('ownerUuid', ownerUuid)
.getFilters();
- const { items } = await services.groupsService.contents(ownerUuid, { filters });
+ const { items } = (extractUuidKind(nodeId) === ResourceKind.COLLECTION)
+ ? dispatch<any>(loadCollectionFiles(nodeId))
+ : await services.groupsService.contents(ownerUuid, { filters });
- dispatch<any>(receiveTreePickerData(nodeId, items, TreePickerId.PROJECTS));
+ await dispatch<any>(receiveTreePickerData(nodeId, items, TreePickerId.PROJECTS));
};
export const loadFavoriteTreePicker = (nodeId: string) =>
};
const getProjectPickerIcon = (item: TreeItem<ProjectResource>) => {
- console.log(item);
switch (item.data.name) {
case TreePickerId.FAVORITES:
return FavoriteIcon;
case ResourceKind.COLLECTION:
return CollectionIcon;
case ResourceKind.PROJECT:
- return ProjectsIcon;
+ return ProjectIcon;
default:
return ProjectIcon;
}
hasMargin={true} />;
-export const receiveTreePickerData = (nodeId: string, items: GroupContentsResource[], pickerId: string) =>
+export const receiveTreePickerData = (nodeId: string, items: GroupContentsResource[] = [], pickerId: string) =>
(dispatch: Dispatch) => {
dispatch(workflowTreePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
nodeId,
<Grid container direction="column" item xs alignItems="center" justify="center" className={classes.root}>
<Grid item className={classes.container}>
<Typography variant="title" align="center" className={classes.title}>
- Welcome to the Arvados Wrokbench
+ Welcome to the Arvados Workbench
</Typography>
<Typography variant="body1" className={classes.content}>
The "Log in" button below will show you a Google sign-in page.
import { RunProcessPanel } from '~/views/run-process-panel/run-process-panel';
import SplitterLayout from 'react-splitter-layout';
import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
+import { FileSelectionDialog } from '~/views-components/dialog-forms/file-selection-dialog';
type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
<CurrentTokenDialog />
<FileRemoveDialog />
<FileRemoveDialog />
+ <FileSelectionDialog />
<FilesUploadCollectionDialog />
<MoveCollectionDialog />
<MoveProcessDialog />