merge master
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Thu, 27 Sep 2018 14:12:37 +0000 (16:12 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Thu, 27 Sep 2018 14:12:37 +0000 (16:12 +0200)
Feature #13857

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

31 files changed:
package.json
src/components/file-upload/file-upload.css [deleted file]
src/components/file-upload/file-upload.tsx
src/components/rich-text-editor-link/rich-text-editor-link.tsx [new file with mode: 0644]
src/components/text-field/text-field.tsx
src/index.tsx
src/store/breadcrumbs/breadcrumbs-actions.ts
src/store/context-menu/context-menu-actions.ts
src/store/navigation/navigation-action.ts
src/store/processes/process-command-actions.ts
src/store/progress-indicator/progress-indicator-reducer.ts
src/store/projects/project-update-actions.ts
src/store/rich-text-editor-dialog/rich-text-editor-dialog-actions.tsx [new file with mode: 0644]
src/store/side-panel-tree/side-panel-tree-actions.ts
src/store/trash/trash-actions.ts
src/store/workbench/workbench-actions.ts
src/validators/validators.tsx
src/views-components/context-menu/action-sets/trashed-collection-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/context-menu.tsx
src/views-components/details-panel/project-details.tsx
src/views-components/form-fields/project-form-fields.tsx
src/views-components/process-command-dialog/process-command-dialog.tsx
src/views-components/progress/content-progress.tsx [deleted file]
src/views-components/progress/side-panel-progress.tsx [deleted file]
src/views-components/progress/workbench-progress.tsx [deleted file]
src/views-components/rich-text-editor-dialog/rich-text-editor-dialog.tsx [new file with mode: 0644]
src/views-components/snackbar/snackbar.tsx
src/views/collection-panel/collection-panel.tsx
src/views/workbench/workbench.tsx
typings/global.d.ts
yarn.lock

index 620ff5a6d03a6d7d616ab9d32b0ec2f47c0530ac..64ea1d1a4dcef19aad3f4072b5295c4b4f01b2e0 100644 (file)
@@ -9,22 +9,25 @@
     "@types/react-copy-to-clipboard": "4.2.6",
     "@types/react-dropzone": "4.2.2",
     "@types/redux-form": "7.4.5",
+    "@types/shell-quote": "1.6.0",
     "axios": "0.18.0",
     "classnames": "2.2.6",
     "lodash": "4.17.10",
-    "react": "16.4.2",
+    "react": "16.5.2",
     "react-copy-to-clipboard": "5.0.1",
-    "react-dom": "16.4.2",
+    "react-dom": "16.5.2",
     "react-dropzone": "5.0.1",
     "react-redux": "5.0.7",
     "react-router": "4.3.1",
     "react-router-dom": "4.3.1",
     "react-router-redux": "5.0.0-alpha.9",
+    "react-rte": "0.16.1",
     "react-scripts-ts": "2.17.0",
     "react-splitter-layout": "3.0.1",
     "react-transition-group": "2.4.0",
     "redux": "4.0.0",
     "redux-thunk": "2.3.0",
+    "shell-quote": "1.6.1",
     "unionize": "2.1.2",
     "uuid": "3.3.2"
   },
diff --git a/src/components/file-upload/file-upload.css b/src/components/file-upload/file-upload.css
deleted file mode 100644 (file)
index 0d74b89..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-.dropzone-border-left {
-    left: -1px;
-    top: -1px;
-    bottom: -1px;
-    width: 2px;
-    content: "";
-    position: absolute;
-    transform: scaleY(0);
-    transition: transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
-    pointer-events: none;
-    background-color: #6a1b9a;
-}
-
-.dropzone-border-right {
-    right: -1px;
-    top: -1px;
-    bottom: -1px;
-    width: 2px;
-    content: "";
-    position: absolute;
-    transform: scaleY(0);
-    transition: transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
-    pointer-events: none;
-    background-color: #6a1b9a;
-}
-
-.dropzone-border-top {
-    left: 0;
-    right: 0;
-    top: -1px;
-    height: 2px;
-    content: "";
-    position: absolute;
-    transform: scaleX(0);
-    transition: transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
-    pointer-events: none;
-    background-color: #6a1b9a;
-}
-
-.dropzone-border-bottom {
-    left: 0;
-    right: 0;
-    bottom: -1px;
-    height: 2px;
-    content: "";
-    position: absolute;
-    transform: scaleX(0);
-    transition: transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
-    pointer-events: none;
-    background-color: #6a1b9a;
-}
-
-.dropzone-border-left-active {
-    transform: scaleY(1);
-}
-
-.dropzone-border-right-active {
-    transform: scaleY(1);
-}
-
-.dropzone-border-top-active {
-    transform: scaleX(1);
-}
-
-.dropzone-border-bottom-active {
-    transform: scaleX(1);
-}
index 0f87b1e9e35a18b5417063759c70f06e35641531..41054df43f9da6c6d76fb446a118dc15781606bd 100644 (file)
@@ -17,10 +17,9 @@ import { CloudUploadIcon } from "../icon/icon";
 import { formatFileSize, formatProgress, formatUploadSpeed } from "~/common/formatters";
 import { UploadFile } from '~/store/file-uploader/file-uploader-actions';
 
-type CssRules = "root" | "dropzone" | "dropzoneWrapper" | "container" | "uploadIcon";
-
-import './file-upload.css';
-import { DOMElement, RefObject } from "react";
+type CssRules = "root" | "dropzone" | "dropzoneWrapper" | "container" | "uploadIcon"
+    | "dropzoneBorder" | "dropzoneBorderLeft" | "dropzoneBorderRight" | "dropzoneBorderTop" | "dropzoneBorderBottom"
+    | "dropzoneBorderHorzActive" | "dropzoneBorderVertActive";
 
 const styles: StyleRulesCallback<CssRules> = theme => ({
     root: {
@@ -36,6 +35,47 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
         position: "relative",
         border: "1px solid rgba(0, 0, 0, 0.42)"
     },
+    dropzoneBorder: {
+        content: "",
+        position: "absolute",
+        transition: "transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms",
+        pointerEvents: "none",
+        backgroundColor: "#6a1b9a"
+    },
+    dropzoneBorderLeft: {
+        left: -1,
+        top: -1,
+        bottom: -1,
+        width: 2,
+        transform: "scaleY(0)",
+    },
+    dropzoneBorderRight: {
+        right: -1,
+        top: -1,
+        bottom: -1,
+        width: 2,
+        transform: "scaleY(0)",
+    },
+    dropzoneBorderTop: {
+        left: 0,
+        right: 0,
+        top: -1,
+        height: 2,
+        transform: "scaleX(0)",
+    },
+    dropzoneBorderBottom: {
+        left: 0,
+        right: 0,
+        bottom: -1,
+        height: 2,
+        transform: "scaleX(0)",
+    },
+    dropzoneBorderHorzActive: {
+        transform: "scaleY(1)"
+    },
+    dropzoneBorderVertActive: {
+        transform: "scaleX(1)"
+    },
     container: {
         height: "100%"
     },
@@ -67,13 +107,13 @@ export const FileUpload = withStyles(styles)(
         render() {
             const { classes, onDrop, disabled, files } = this.props;
             return <div className={"file-upload-dropzone " + classes.dropzoneWrapper}>
-                <div className={classnames("dropzone-border-left", { "dropzone-border-left-active": this.state.focused })}/>
-                <div className={classnames("dropzone-border-right", { "dropzone-border-right-active": this.state.focused })}/>
-                <div className={classnames("dropzone-border-top", { "dropzone-border-top-active": this.state.focused })}/>
-                <div className={classnames("dropzone-border-bottom", { "dropzone-border-bottom-active": this.state.focused })}/>
+                <div className={classnames(classes.dropzoneBorder, classes.dropzoneBorderLeft, { [classes.dropzoneBorderHorzActive]: this.state.focused })}/>
+                <div className={classnames(classes.dropzoneBorder, classes.dropzoneBorderRight, { [classes.dropzoneBorderHorzActive]: this.state.focused })}/>
+                <div className={classnames(classes.dropzoneBorder, classes.dropzoneBorderTop, { [classes.dropzoneBorderVertActive]: this.state.focused })}/>
+                <div className={classnames(classes.dropzoneBorder, classes.dropzoneBorderBottom, { [classes.dropzoneBorderVertActive]: this.state.focused })}/>
                 <Dropzone className={classes.dropzone}
                     onDrop={files => onDrop(files)}
-                    onClick={(e) => {
+                    onClick={() => {
                         const el = document.getElementsByClassName("file-upload-dropzone")[0];
                         const inputs = el.getElementsByTagName("input");
                         if (inputs.length > 0) {
diff --git a/src/components/rich-text-editor-link/rich-text-editor-link.tsx b/src/components/rich-text-editor-link/rich-text-editor-link.tsx
new file mode 100644 (file)
index 0000000..2d6a5b4
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { Dispatch } from 'redux';
+import { connect } from 'react-redux';
+import { withStyles, StyleRulesCallback, WithStyles, Typography } from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { openRichTextEditorDialog } from '~/store/rich-text-editor-dialog/rich-text-editor-dialog-actions';
+
+type CssRules = "root";
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        color: theme.palette.primary.main,
+        cursor: 'pointer'
+    }
+});
+
+interface RichTextEditorLinkData {
+    title: string;
+    label: string;
+    content: string;
+}
+
+interface RichTextEditorLinkActions {
+    onClick: (title: string, content: string) => void;
+}
+
+type RichTextEditorLinkProps = RichTextEditorLinkData & RichTextEditorLinkActions & WithStyles<CssRules>;
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+    onClick: (title: string, content: string) => dispatch<any>(openRichTextEditorDialog(title, content))
+});
+
+export const RichTextEditorLink = connect(undefined, mapDispatchToProps)(
+    withStyles(styles)(({ classes, title, content, label, onClick }: RichTextEditorLinkProps) =>
+        <Typography component='span' className={classes.root}
+            onClick={() => onClick(title, content) }>
+            {label}
+        </Typography>
+    ));
\ No newline at end of file
index b5671dbb08c962b8bae3458738fdf634b57bc382..076889eabb4b9af6acb630d243e9db9829a47950 100644 (file)
@@ -6,6 +6,7 @@ import * as React from 'react';
 import { WrappedFieldProps } from 'redux-form';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import RichTextEditor from 'react-rte';
 
 type CssRules = 'textField';
 
@@ -27,3 +28,30 @@ export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyl
         fullWidth={true}
         {...props.input}
     />);
+
+
+interface RichEditorTextFieldData {
+    label?: string;
+}
+
+type RichEditorTextFieldProps = RichEditorTextFieldData & WrappedFieldProps & WithStyles<CssRules>;
+
+export const RichEditorTextField = withStyles(styles)(
+    class RichEditorTextField extends React.Component<RichEditorTextFieldProps> {
+        state = {
+            value: RichTextEditor.createValueFromString(this.props.input.value, 'html')
+        };
+
+        onChange = (value: any) => {
+            this.setState({ value });
+            this.props.input.onChange(value.toString('html'));
+        }
+
+        render() {
+            return <RichTextEditor 
+                value={this.state.value}
+                onChange={this.onChange}
+                placeholder={this.props.label} />;
+        }
+    }
+);
\ No newline at end of file
index f81e9da9b832dff89cabb4b5f9fbae74ab776c77..d0154b663e0a9150419edbf437ac1b1eb729405d 100644 (file)
@@ -18,7 +18,7 @@ import { createServices } from "./services/services";
 import { MuiThemeProvider } from '@material-ui/core/styles';
 import { CustomTheme } from './common/custom-theme';
 import { fetchConfig } from './common/config';
-import { addMenuActionSet, ContextMenuKind } from "./views-components/context-menu/context-menu";
+import { addMenuActionSet, ContextMenuKind } from './views-components/context-menu/context-menu';
 import { rootProjectActionSet } from "./views-components/context-menu/action-sets/root-project-action-set";
 import { projectActionSet } from "./views-components/context-menu/action-sets/project-action-set";
 import { resourceActionSet } from './views-components/context-menu/action-sets/resource-action-set';
@@ -36,9 +36,10 @@ import { initWebSocket } from '~/websocket/websocket';
 import { Config } from '~/common/config';
 import { addRouteChangeHandlers } from './routes/route-change-handlers';
 import { setCurrentTokenDialogApiHost } from '~/store/current-token-dialog/current-token-dialog-actions';
-import { processResourceActionSet } from './views-components/context-menu/action-sets/process-resource-action-set';
+import { processResourceActionSet } from '~/views-components/context-menu/action-sets/process-resource-action-set';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { setUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions';
+import { trashedCollectionActionSet } from '~/views-components/context-menu/action-sets/trashed-collection-action-set';
 
 const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
 const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
@@ -56,6 +57,7 @@ addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
+addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
 addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
 addMenuActionSet(ContextMenuKind.PROCESS_RESOURCE, processResourceActionSet);
 addMenuActionSet(ContextMenuKind.TRASH, trashActionSet);
index 4ac07b3bd5bbb39643e87d20fbba068999f4f03f..a5ded34eaf25048a2df980ba56e6b41e2c533795 100644 (file)
@@ -40,11 +40,17 @@ export const setSidePanelBreadcrumbs = (uuid: string) =>
     };
 
 export const setSharedWithMeBreadcrumbs = (uuid: string) =>
+    setCategoryBreadcrumbs(uuid, SidePanelTreeCategory.SHARED_WITH_ME);
+
+export const setTrashBreadcrumbs = (uuid: string) =>
+    setCategoryBreadcrumbs(uuid, SidePanelTreeCategory.TRASH);
+
+export const setCategoryBreadcrumbs = (uuid: string, category: SidePanelTreeCategory) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const ancestors = await services.ancestorsService.ancestors(uuid, '');
         dispatch(updateResources(ancestors));
         const initialBreadcrumbs: ResourceBreadcrumb[] = [
-            { label: SidePanelTreeCategory.SHARED_WITH_ME, uuid: SidePanelTreeCategory.SHARED_WITH_ME }
+            { label: category, uuid: category }
         ];
         const breadrumbs = ancestors.reduce((breadcrumbs, ancestor) =>
             ancestor.kind === ResourceKind.GROUP
@@ -59,7 +65,7 @@ export const setProjectBreadcrumbs = (uuid: string) =>
     (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         const ancestors = getSidePanelTreeNodeAncestorsIds(uuid)(getState().treePicker);
         const rootUuid = services.authService.getUuid();
-        if (uuid === rootUuid ||ancestors.find(uuid => uuid === rootUuid)) {
+        if (uuid === rootUuid || ancestors.find(uuid => uuid === rootUuid)) {
             dispatch(setSidePanelBreadcrumbs(uuid));
         } else {
             dispatch(setSharedWithMeBreadcrumbs(uuid));
index d85059d6e1e25a82dfb20c051a55c1c63ffcab0d..3ae79db40515e3381a421930095783b70a925812 100644 (file)
@@ -31,13 +31,18 @@ export type ContextMenuResource = {
     menuKind: ContextMenuKind;
     isTrashed?: boolean;
 };
-
+export const isKeyboardClick = (event: React.MouseEvent<HTMLElement>) =>
+    event.nativeEvent.detail === 0;
 export const openContextMenu = (event: React.MouseEvent<HTMLElement>, resource: ContextMenuResource) =>
     (dispatch: Dispatch) => {
         event.preventDefault();
+        const { left, top } = event.currentTarget.getBoundingClientRect();
         dispatch(
             contextMenuActions.OPEN_CONTEXT_MENU({
-                position: { x: event.clientX, y: event.clientY },
+                position: {
+                    x: event.clientX || left,
+                    y: event.clientY || top,
+                },
                 resource
             })
         );
index d332e0fca600dc03c6c3f9c6ebc944ac0edb7cbf..c8a554c7651ea5d5f955ab11bb91051ee96626b2 100644 (file)
@@ -28,6 +28,8 @@ export const navigateTo = (uuid: string) =>
             dispatch(navigateToSharedWithMe);
         } else if (uuid === SidePanelTreeCategory.WORKFLOWS) {
             dispatch(navigateToWorkflows);
+        } else if (uuid === SidePanelTreeCategory.TRASH) {
+            dispatch(navigateToTrash);
         }
     };
 
index de55a2cb50be1796d444470654e76eaa03535059..6c765568aaf9ddd707ee283ffa4add5571199c24 100644 (file)
@@ -6,6 +6,7 @@ import { dialogActions } from '~/store/dialog/dialog-actions';
 import { RootState } from '../store';
 import { Dispatch } from 'redux';
 import { getProcess } from '~/store/processes/process';
+import { quote } from 'shell-quote';
 
 export const PROCESS_COMMAND_DIALOG_NAME = 'processCommandDialog';
 
@@ -19,7 +20,7 @@ export const openProcessCommandDialog = (processUuid: string) =>
         const process = getProcess(processUuid)(getState().resources);
         if (process) {
             const data: ProcessCommandDialogData = {
-                command: process.containerRequest.command.join(' '),
+                command: quote(process.containerRequest.command),
                 processName: process.containerRequest.name,
             };
             dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_COMMAND_DIALOG_NAME, data }));
index 89885afb526ee7b904855e2bfab15c2f8ea8b5fe..dbd1beb30dd546f48ca91856ac7c18c724ea1b6a 100644 (file)
@@ -9,21 +9,28 @@ export type ProgressIndicatorState = { id: string, working: boolean }[];
 const initialState: ProgressIndicatorState = [];
 
 export const progressIndicatorReducer = (state: ProgressIndicatorState = initialState, action: ProgressIndicatorAction) => {
-    const startWorking = (id: string) => state.find(p => p.id === id) ? state : state.concat({ id, working: true });
     const stopWorking = (id: string) => state.filter(p => p.id !== id);
 
     return progressIndicatorActions.match(action, {
-        START_WORKING: id => startWorking(id),
+        START_WORKING: id => startWorking(id, state),
         STOP_WORKING: id => stopWorking(id),
         PERSIST_STOP_WORKING: id => state.map(p => ({
             ...p,
             working: p.id === id ? false : p.working
         })),
-        TOGGLE_WORKING: ({ id, working }) => working ? startWorking(id) : stopWorking(id),
+        TOGGLE_WORKING: ({ id, working }) => working ? startWorking(id, state) : stopWorking(id),
         default: () => state,
     });
 };
 
+const startWorking = (id: string, state: ProgressIndicatorState) => {
+    return getProgressIndicator(id)(state)
+        ? state.map(indicator => indicator.id === id
+            ? { ...indicator, working: true }
+            : indicator)
+        : state.concat({ id, working: true });
+};
+
 export function isSystemWorking(state: ProgressIndicatorState): boolean {
     return state.length > 0 && state.reduce((working, p) => working ? true : p.working, false);
 }
index afa2e35e8d7c6555055ba053c0bfaeadb6145d84..34ea42f59bd93796bb355da70d3291cc91133906 100644 (file)
@@ -10,6 +10,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from "~/ser
 import { ServiceRepository } from "~/services/services";
 import { ProjectResource } from '~/models/project';
 import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
+import { getResource } from '~/store/resources/resources';
 
 export interface ProjectUpdateFormDialogData {
     uuid: string;
@@ -20,8 +21,9 @@ export interface ProjectUpdateFormDialogData {
 export const PROJECT_UPDATE_FORM_NAME = 'projectUpdateFormName';
 
 export const openProjectUpdateDialog = (resource: ContextMenuResource) =>
-    (dispatch: Dispatch) => {
-        dispatch(initialize(PROJECT_UPDATE_FORM_NAME, resource));
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const project = getResource(resource.uuid)(getState().resources);
+        dispatch(initialize(PROJECT_UPDATE_FORM_NAME, project));
         dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_UPDATE_FORM_NAME, data: {} }));
     };
 
diff --git a/src/store/rich-text-editor-dialog/rich-text-editor-dialog-actions.tsx b/src/store/rich-text-editor-dialog/rich-text-editor-dialog-actions.tsx
new file mode 100644 (file)
index 0000000..f2a1c4b
--- /dev/null
@@ -0,0 +1,10 @@
+// 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";
+
+export const RICH_TEXT_EDITOR_DIALOG_NAME = 'richTextEditorDialogName';
+export const openRichTextEditorDialog = (title: string, text: string) => 
+    dialogActions.OPEN_DIALOG({ id: RICH_TEXT_EDITOR_DIALOG_NAME, data: { title, text } });
\ No newline at end of file
index 073de22c4ea4b9fa30aae1b15fc2311dfc706fe0..22a83dda8c9f71b130e5b8251b3e8d8c321bb714 100644 (file)
@@ -13,6 +13,7 @@ import { getTreePicker, TreePicker } from '../tree-picker/tree-picker';
 import { TreeItemStatus } from "~/components/tree/tree";
 import { getNodeAncestors, getNodeValue, getNodeAncestorsIds, getNode } from '~/models/tree';
 import { ProjectResource } from '~/models/project';
+import { OrderBuilder } from '../../services/api/order-builder';
 
 export enum SidePanelTreeCategory {
     PROJECTS = 'Projects',
@@ -78,7 +79,10 @@ export const loadSidePanelTreeProjects = (projectUuid: string) =>
             const params = {
                 filters: new FilterBuilder()
                     .addEqual('ownerUuid', projectUuid)
-                    .getFilters()
+                    .getFilters(),
+                order: new OrderBuilder<ProjectResource>()
+                    .addAsc('name')
+                    .getOrder()
             };
             const { items } = await services.projectService.list(params);
             dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
index 5cf952eb1fa98a5a53857faf2f9da6224039fcfb..b59276c1f2bea84454a48fc11f28d247fa6b4913 100644 (file)
@@ -10,6 +10,8 @@ import { trashPanelActions } from "~/store/trash-panel/trash-panel-action";
 import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "~/store/side-panel-tree/side-panel-tree-actions";
 import { projectPanelActions } from "~/store/project-panel/project-panel-action";
 import { ResourceKind } from "~/models/resource";
+import { navigateToTrash } from '../navigation/navigation-action';
+import { matchTrashRoute, matchCollectionRoute } from '../../routes/routes';
 
 export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
@@ -46,8 +48,12 @@ export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
         try {
             if (isTrashed) {
+                const { location } = getState().router;
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." }));
                 await services.collectionService.untrash(uuid);
+                if (matchCollectionRoute(location ? location.pathname : '')) {
+                    dispatch(navigateToTrash);
+                }
                 dispatch(trashPanelActions.REQUEST_ITEMS());
                 dispatch(snackbarActions.OPEN_SNACKBAR({
                     message: "Restored from trash",
index 01b5b92c7b365515e70d276dddc1d307efebd25b..8f034ec0383b4f61cb4e8b5b98ebe688e9da0e4f 100644 (file)
@@ -2,20 +2,19 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Dispatch, AnyAction } from 'redux';
+import { Dispatch } from 'redux';
 import { RootState } from "../store";
 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
-import { loadCollectionPanel } from '~/store/collection-panel/collection-panel-action';
 import { snackbarActions } from '../snackbar/snackbar-actions';
 import { loadFavoritePanel } from '../favorite-panel/favorite-panel-action';
 import { openProjectPanel, projectPanelActions } from '~/store/project-panel/project-panel-action';
-import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects, getSidePanelTreeNodeAncestorsIds } from '../side-panel-tree/side-panel-tree-actions';
+import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects } from '../side-panel-tree/side-panel-tree-actions';
 import { loadResource, updateResources } from '../resources/resources-actions';
 import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-action';
 import { projectPanelColumns } from '~/views/project-panel/project-panel';
 import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel';
 import { matchRootRoute } from '~/routes/routes';
-import { setCollectionBreadcrumbs, setProjectBreadcrumbs, setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions';
+import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions';
 import { navigateToProject } from '../navigation/navigation-action';
 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
 import { ServiceRepository } from '~/services/services';
@@ -43,6 +42,10 @@ import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/
 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { getProgressIndicator } from '../progress-indicator/progress-indicator-reducer';
+import { ResourceKind, extractUuidKind } from '~/models/resource';
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { GroupContentsResource } from '~/services/groups-service/groups-service';
+import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -110,10 +113,33 @@ export const loadTrash = () =>
 export const loadProject = (uuid: string) =>
     handleFirstTimeLoad(
         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
-            dispatch(openProjectPanel(uuid));
-            await dispatch(activateSidePanelTreeItem(uuid));
-            dispatch(setProjectBreadcrumbs(uuid));
-            dispatch(loadDetailsPanel(uuid));
+            const userUuid = services.authService.getUuid();
+            if (userUuid) {
+                if (userUuid !== uuid) {
+                    const match = await loadGroupContentsResource({ uuid, userUuid, services });
+                    match({
+                        OWNED: async project => {
+                            await dispatch(activateSidePanelTreeItem(uuid));
+                            dispatch<any>(setSidePanelBreadcrumbs(uuid));
+                            dispatch(finishLoadingProject(project));
+                        },
+                        SHARED: project => {
+                            dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
+                            dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
+                            dispatch(finishLoadingProject(project));
+                        },
+                        TRASHED: project => {
+                            dispatch<any>(setTrashBreadcrumbs(uuid));
+                            dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
+                            dispatch(finishLoadingProject(project));
+                        }
+                    });
+                } else {
+                    await dispatch(activateSidePanelTreeItem(userUuid));
+                    dispatch<any>(setSidePanelBreadcrumbs(userUuid));
+                    dispatch(finishLoadingProject(userUuid));
+                }
+            }
         });
 
 export const createProject = (data: projectCreateActions.ProjectCreateFormDialogData) =>
@@ -148,7 +174,7 @@ export const moveProject = (data: MoveToFormDialogData) =>
     };
 
 export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+    async (dispatch: Dispatch) => {
         const updatedProject = await dispatch<any>(projectUpdateActions.updateProject(data));
         if (updatedProject) {
             dispatch(snackbarActions.OPEN_SNACKBAR({
@@ -162,11 +188,29 @@ export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialog
 
 export const loadCollection = (uuid: string) =>
     handleFirstTimeLoad(
-        async (dispatch: Dispatch) => {
-            const collection = await dispatch<any>(loadCollectionPanel(uuid));
-            await dispatch<any>(activateSidePanelTreeItem(collection.ownerUuid));
-            dispatch<any>(setCollectionBreadcrumbs(collection.uuid));
-            dispatch(loadDetailsPanel(uuid));
+        async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+            const userUuid = services.authService.getUuid();
+            if (userUuid) {
+                const match = await loadGroupContentsResource({ uuid, userUuid, services });
+                match({
+                    OWNED: async collection => {
+                        dispatch(updateResources([collection]));
+                        await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
+                        dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
+                    },
+                    SHARED: collection => {
+                        dispatch(updateResources([collection]));
+                        dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
+                        dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
+                    },
+                    TRASHED: collection => {
+                        dispatch(updateResources([collection]));
+                        dispatch(setTrashBreadcrumbs(''));
+                        dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
+                    },
+
+                });
+            }
         });
 
 export const createCollection = (data: collectionCreateActions.CollectionCreateFormDialogData) =>
@@ -311,3 +355,58 @@ export const loadWorkflow = handleFirstTimeLoad(async (dispatch: Dispatch<any>)
     await dispatch(loadWorkflowPanel());
     dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.WORKFLOWS));
 });
+const finishLoadingProject = (project: GroupContentsResource | string) =>
+    async (dispatch: Dispatch<any>) => {
+        const uuid = typeof project === 'string' ? project : project.uuid;
+        dispatch(openProjectPanel(uuid));
+        dispatch(loadDetailsPanel(uuid));
+        if (typeof project !== 'string') {
+            dispatch(updateResources([project]));
+        }
+    };
+
+const loadGroupContentsResource = async (params: {
+    uuid: string,
+    userUuid: string,
+    services: ServiceRepository
+}) => {
+    const filters = new FilterBuilder()
+        .addEqual('uuid', params.uuid)
+        .getFilters();
+    const { items } = await params.services.groupsService.contents(params.userUuid, {
+        filters,
+        recursive: true,
+        includeTrash: true,
+    });
+    const resource = items.shift();
+    let handler: GroupContentsHandler;
+    if (resource) {
+        handler = (resource.kind === ResourceKind.COLLECTION || resource.kind === ResourceKind.PROJECT) && resource.isTrashed
+            ? groupContentsHandlers.TRASHED(resource)
+            : groupContentsHandlers.OWNED(resource);
+    } else {
+        const kind = extractUuidKind(params.uuid);
+        let resource: GroupContentsResource;
+        if (kind === ResourceKind.COLLECTION) {
+            resource = await params.services.collectionService.get(params.uuid);
+        } else if (kind === ResourceKind.PROJECT) {
+            resource = await params.services.projectService.get(params.uuid);
+        } else {
+            resource = await params.services.containerRequestService.get(params.uuid);
+        }
+        handler = groupContentsHandlers.SHARED(resource);
+    }
+    return (cases: MatchCases<typeof groupContentsHandlersRecord, GroupContentsHandler, void>) =>
+        groupContentsHandlers.match(handler, cases);
+
+};
+
+const groupContentsHandlersRecord = {
+    TRASHED: ofType<GroupContentsResource>(),
+    SHARED: ofType<GroupContentsResource>(),
+    OWNED: ofType<GroupContentsResource>(),
+};
+
+const groupContentsHandlers = unionize(groupContentsHandlersRecord);
+
+type GroupContentsHandler = UnionOf<typeof groupContentsHandlers>;
index 755cd7f7b4c7be4b7a1650653c3b7783406c1179..edc472657eb3178036fb0d8b3917dd0600e39ce5 100644 (file)
@@ -9,7 +9,6 @@ export const TAG_KEY_VALIDATION = [require, maxLength(255)];
 export const TAG_VALUE_VALIDATION = [require, maxLength(255)];
 
 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)];
diff --git a/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts b/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts
new file mode 100644 (file)
index 0000000..c42da1e
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import { DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RestoreFromTrashIcon } from '~/components/icon/icon';
+import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+
+export const trashedCollectionActionSet: ContextMenuActionSet = [[
+    {
+        icon: DetailsIcon,
+        name: "View details",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: ProvenanceGraphIcon,
+        name: "Provenance graph",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: AdvancedIcon,
+        name: "Advanced",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: RestoreFromTrashIcon,
+        name: "Restore",
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, true));
+        }
+    },
+]];
index d5c82be2d7f0736243f5e97661e4f7c7ec51d7a4..ad6f7e306030b5eedea8309dd2d2b931fccc6bab 100644 (file)
@@ -64,6 +64,7 @@ export enum ContextMenuKind {
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
     COLLECTION = 'Collection',
     COLLECTION_RESOURCE = 'CollectionResource',
+    TRASHED_COLLECTION = 'TrashedCollection',
     PROCESS = "Process",
     PROCESS_RESOURCE = 'ProcessResource',
     PROCESS_LOGS = "ProcessLogs"
index 1e65ec834bf8e48f75230bea8505d843eda82a63..331952f259e7ff357cd48a2e088007064e5a2a8d 100644 (file)
@@ -10,6 +10,7 @@ import { ResourceKind } from '~/models/resource';
 import { resourceLabel } from '~/common/labels';
 import { DetailsData } from "./details-data";
 import { DetailsAttribute } from "~/components/details-attribute/details-attribute";
+import { RichTextEditorLink } from '~/components/rich-text-editor-link/rich-text-editor-link';
 
 export class ProjectDetails extends DetailsData<ProjectResource> {
 
@@ -27,7 +28,15 @@ export class ProjectDetails extends DetailsData<ProjectResource> {
             <DetailsAttribute label='Created at' value={formatDate(this.item.createdAt)} />
             {/* Missing attr */}
             <DetailsAttribute label='File size' value='1.4 GB' />
-            <DetailsAttribute label='Description' value={this.item.description} />
+            <DetailsAttribute label='Description'>
+                {this.item.description ? 
+                    <RichTextEditorLink
+                        title={`Description of ${this.item.name}`}
+                        content={this.item.description} 
+                        label='Show full description' />
+                    : '---'
+                }
+            </DetailsAttribute>
         </div>;
     }
 }
index 6446c763a81300850c026ed3889ed4d86872837a..8243cfe364d45cee3d05fde0b3637a7b13a3838f 100644 (file)
@@ -4,8 +4,8 @@
 
 import * as React from "react";
 import { Field } from "redux-form";
-import { TextField } from "~/components/text-field/text-field";
-import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from "~/validators/validators";
+import { TextField, RichEditorTextField } from "~/components/text-field/text-field";
+import { PROJECT_NAME_VALIDATION } from "~/validators/validators";
 
 export const ProjectNameField = () =>
     <Field
@@ -18,6 +18,5 @@ export const ProjectNameField = () =>
 export const ProjectDescriptionField = () =>
     <Field
         name='description'
-        component={TextField}
-        validate={PROJECT_DESCRIPTION_VALIDATION}
+        component={RichEditorTextField}
         label="Description - optional" />;
index 4bde68d8be42776c5a2ca891d73db6ce712c9458..81022ea56fe982297d44be5d92ab9f20fbaa47bd 100644 (file)
@@ -3,20 +3,25 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { Dialog, DialogTitle, DialogActions, Button, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import { Dialog, DialogTitle, DialogActions, Button, StyleRulesCallback, WithStyles, withStyles, Tooltip, IconButton, Grid, CardHeader } from '@material-ui/core';
 import { withDialog } from "~/store/dialog/with-dialog";
 import { PROCESS_COMMAND_DIALOG_NAME } from '~/store/processes/process-command-actions';
 import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { ProcessCommandDialogData } from '~/store/processes/process-command-actions';
 import { DefaultCodeSnippet } from "~/components/default-code-snippet/default-code-snippet";
 import { compose } from 'redux';
+import * as CopyToClipboard from "react-copy-to-clipboard";
+import { CopyIcon } from '~/components/icon/icon';
 
-type CssRules = 'codeSnippet';
+type CssRules = 'codeSnippet' | 'copyToClipboard';
 
 const styles: StyleRulesCallback<CssRules> = theme => ({
     codeSnippet: {
         marginLeft: theme.spacing.unit * 3,
         marginRight: theme.spacing.unit * 3,
+    },
+    copyToClipboard: {
+        marginRight: theme.spacing.unit,
     }
 });
 
@@ -30,7 +35,17 @@ export const ProcessCommandDialog = compose(
             maxWidth="md"
             onClose={props.closeDialog}
             style={{ alignSelf: 'stretch' }}>
-            <DialogTitle>{`Command - ${props.data.processName}`}</DialogTitle>
+            <CardHeader
+                title={`Command - ${props.data.processName}`}
+                action={
+                    <Tooltip title="Copy to clipboard">
+                        <CopyToClipboard text={props.data.command}>
+                            <IconButton className={props.classes.copyToClipboard}>
+                                <CopyIcon />
+                            </IconButton>
+                        </CopyToClipboard>
+                    </Tooltip>
+                } />
             <DefaultCodeSnippet
                 className={props.classes.codeSnippet}
                 lines={[props.data.command]} />
diff --git a/src/views-components/progress/content-progress.tsx b/src/views-components/progress/content-progress.tsx
deleted file mode 100644 (file)
index fa2cad5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// // Copyright (C) The Arvados Authors. All rights reserved.
-// //
-// // SPDX-License-Identifier: AGPL-3.0
-//
-// import * as React from 'react';
-// import { CircularProgress } from '@material-ui/core';
-// import { withProgress } from '~/store/progress-indicator/with-progress';
-// import { WithProgressStateProps } from '~/store/progress-indicator/with-progress';
-// import { ProgressIndicatorData } from '~/store/progress-indicator/progress-indicator-reducer';
-//
-// export const ContentProgress = withProgress(ProgressIndicatorData.CONTENT_PROGRESS)((props: WithProgressStateProps) =>
-//     props.started ? <CircularProgress /> : null
-// );
diff --git a/src/views-components/progress/side-panel-progress.tsx b/src/views-components/progress/side-panel-progress.tsx
deleted file mode 100644 (file)
index 2d832a5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// // Copyright (C) The Arvados Authors. All rights reserved.
-// //
-// // SPDX-License-Identifier: AGPL-3.0
-//
-// import * as React from 'react';
-// import { CircularProgress } from '@material-ui/core';
-// import { withProgress } from '~/store/progress-indicator/with-progress';
-// import { WithProgressStateProps } from '~/store/progress-indicator/with-progress';
-// import { ProgressIndicatorData } from '~/store/progress-indicator/progress-indicator-reducer';
-//
-// export const SidePanelProgress = withProgress(ProgressIndicatorData.SIDE_PANEL_PROGRESS)((props: WithProgressStateProps) =>
-//     props.started ? <span style={{ display: 'flex', justifyContent: 'center', marginTop: "40px" }}><CircularProgress /></span> : null
-// );
diff --git a/src/views-components/progress/workbench-progress.tsx b/src/views-components/progress/workbench-progress.tsx
deleted file mode 100644 (file)
index 1fdd57c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-// import * as React from 'react';
-// import { LinearProgress } from '@material-ui/core';
-// import { withProgress } from '~/store/progress-indicator/with-progress';
-// import { WithProgressStateProps } from '~/store/progress-indicator/with-progress';
-// import { ProgressIndicatorData } from '~/store/progress-indicator/progress-indicator-reducer';
-
-// export const WorkbenchProgress = withProgress(ProgressIndicatorData.WORKBENCH_PROGRESS)(
-//     (props: WithProgressStateProps) =>
-//         props.started ? <LinearProgress color="secondary" /> : null
-// );
diff --git a/src/views-components/rich-text-editor-dialog/rich-text-editor-dialog.tsx b/src/views-components/rich-text-editor-dialog/rich-text-editor-dialog.tsx
new file mode 100644 (file)
index 0000000..a997355
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Dialog, DialogTitle, DialogContent, DialogActions, Button, DialogContentText } from "@material-ui/core";
+import { WithDialogProps } from "../../store/dialog/with-dialog";
+import { withDialog } from '~/store/dialog/with-dialog';
+import { RICH_TEXT_EDITOR_DIALOG_NAME } from "~/store/rich-text-editor-dialog/rich-text-editor-dialog-actions";
+import RichTextEditor from 'react-rte';
+
+export interface RichTextEditorDialogDataProps {
+    title: string;
+    text: string;
+}
+
+export const RichTextEditorDialog = withDialog(RICH_TEXT_EDITOR_DIALOG_NAME)(
+    (props: WithDialogProps<RichTextEditorDialogDataProps>) =>
+        <Dialog open={props.open}
+            onClose={props.closeDialog}
+            fullWidth
+            maxWidth='sm'>
+            <DialogTitle>{props.data.title}</DialogTitle>
+            <DialogContent>
+                <RichTextEditor 
+                    value={RichTextEditor.createValueFromString(props.data.text, 'html')}
+                    readOnly={true} />
+            </DialogContent>
+            <DialogActions>
+                <Button
+                    variant='flat'
+                    color='primary'
+                    onClick={props.closeDialog}>
+                    Close
+                </Button>
+            </DialogActions>
+        </Dialog>
+);
\ No newline at end of file
index 7449e1e2f82027afeb870a834031dc584df6390d..03fe57e4782fb91062665e47079b0c618daa0a92 100644 (file)
@@ -5,7 +5,7 @@
 import * as React from "react";
 import { connect } from "react-redux";
 import { RootState } from "~/store/store";
-import MaterialSnackbar, { SnackbarProps } from "@material-ui/core/Snackbar";
+import MaterialSnackbar, { SnackbarOrigin } from "@material-ui/core/Snackbar";
 import { Dispatch } from "redux";
 import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
 import IconButton from '@material-ui/core/IconButton';
@@ -20,7 +20,20 @@ import { ArvadosTheme } from "~/common/custom-theme";
 import { amber, green } from "@material-ui/core/colors";
 import * as classNames from 'classnames';
 
-const mapStateToProps = (state: RootState): SnackbarProps & ArvadosSnackbarProps => {
+interface SnackbarDataProps {
+    anchorOrigin?: SnackbarOrigin;
+    autoHideDuration?: number;
+    open: boolean;
+    message?: React.ReactElement<any>;
+    kind: SnackbarKind;
+}
+
+interface SnackbarEventProps {
+    onClose?: (event: React.SyntheticEvent<any>, reason: string) => void;
+    onExited: () => void;
+}
+
+const mapStateToProps = (state: RootState): SnackbarDataProps => {
     const messages = state.snackbar.messages;
     return {
         anchorOrigin: { vertical: "bottom", horizontal: "right" },
@@ -31,7 +44,7 @@ const mapStateToProps = (state: RootState): SnackbarProps & ArvadosSnackbarProps
     };
 };
 
-const mapDispatchToProps = (dispatch: Dispatch) => ({
+const mapDispatchToProps = (dispatch: Dispatch): SnackbarEventProps => ({
     onClose: (event: any, reason: string) => {
         if (reason !== "clickaway") {
             dispatch(snackbarActions.CLOSE_SNACKBAR());
@@ -42,10 +55,6 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
     }
 });
 
-const ArvadosSnackbar = (props: any) => <MaterialSnackbar {...props}>
-    <ArvadosSnackbarContent {...props}/>
-</MaterialSnackbar>;
-
 type CssRules = "success" | "error" | "info" | "warning" | "icon" | "iconVariant" | "message";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
@@ -74,62 +83,47 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     },
 });
 
-interface ArvadosSnackbarProps {
-    kind: SnackbarKind;
-}
+export const Snackbar = withStyles(styles)(connect(mapStateToProps, mapDispatchToProps)(
+    (props: SnackbarDataProps & SnackbarEventProps & WithStyles<CssRules>) => {
+        const { classes } = props;
 
-const ArvadosSnackbarContent = (props: SnackbarProps & ArvadosSnackbarProps & WithStyles<CssRules>) => {
-    const { classes, className, message, onClose, kind } = props;
+        const variants = {
+            [SnackbarKind.INFO]: [InfoIcon, classes.info],
+            [SnackbarKind.WARNING]: [WarningIcon, classes.warning],
+            [SnackbarKind.SUCCESS]: [CheckCircleIcon, classes.success],
+            [SnackbarKind.ERROR]: [ErrorIcon, classes.error]
+        };
 
-    let Icon = InfoIcon;
-    let cssClass = classes.info;
+        const [Icon, cssClass] = variants[props.kind];
 
-    switch (kind) {
-        case SnackbarKind.INFO:
-            Icon = InfoIcon;
-            cssClass = classes.info;
-            break;
-        case SnackbarKind.WARNING:
-            Icon = WarningIcon;
-            cssClass = classes.warning;
-            break;
-        case SnackbarKind.SUCCESS:
-            Icon = CheckCircleIcon;
-            cssClass = classes.success;
-            break;
-        case SnackbarKind.ERROR:
-            Icon = ErrorIcon;
-            cssClass = classes.error;
-            break;
+        return (
+            <MaterialSnackbar
+                open={props.open}
+                message={props.message}
+                onClose={props.onClose}
+                onExited={props.onExited}
+                anchorOrigin={props.anchorOrigin}
+                autoHideDuration={props.autoHideDuration}>
+                <SnackbarContent
+                    className={classNames(cssClass)}
+                    aria-describedby="client-snackbar"
+                    message={
+                        <span id="client-snackbar" className={classes.message}>
+                            <Icon className={classNames(classes.icon, classes.iconVariant)}/>
+                            {props.message}
+                        </span>
+                    }
+                    action={
+                        <IconButton
+                            key="close"
+                            aria-label="Close"
+                            color="inherit"
+                            onClick={e => props.onClose && props.onClose(e, '')}>
+                            <CloseIcon className={classes.icon}/>
+                        </IconButton>
+                    }
+                />
+            </MaterialSnackbar>
+        );
     }
-
-    return (
-        <SnackbarContent
-            className={classNames(cssClass, className)}
-            aria-describedby="client-snackbar"
-            message={
-                <span id="client-snackbar" className={classes.message}>
-                    <Icon className={classNames(classes.icon, classes.iconVariant)}/>
-                    {message}
-                </span>
-            }
-            action={
-                <IconButton
-                    key="close"
-                    aria-label="Close"
-                    color="inherit"
-                    onClick={e => {
-                        if (onClose) {
-                            onClose(e, '');
-                        }
-                    }}>
-                    <CloseIcon className={classes.icon}/>
-                </IconButton>
-            }
-        />
-    );
-};
-
-export const Snackbar = connect(mapStateToProps, mapDispatchToProps)(
-    withStyles(styles)(ArvadosSnackbar)
-);
+));
index 0b264b6bab4593a454b5e9220c51274c9c44c392..07eb7d971a5cfe01f292c04e34f7a756b3e62ecd 100644 (file)
@@ -70,76 +70,80 @@ export const CollectionPanel = withStyles(styles)(
         class extends React.Component<CollectionPanelProps> {
             render() {
                 const { classes, item } = this.props;
-                return <div>
-                    <Card className={classes.card}>
-                        <CardHeader
-                            avatar={<CollectionIcon className={classes.iconHeader} />}
-                            action={
-                                <Tooltip title="More options">
-                                    <IconButton
-                                        aria-label="More options"
-                                        onClick={this.handleContextMenu}>
-                                        <MoreOptionsIcon />
-                                    </IconButton>
-                                </Tooltip>
-                            }
-                            title={item && item.name}
-                            subheader={item && item.description} />
-                        <CardContent>
-                            <Grid container direction="column">
-                                <Grid item xs={6}>
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Collection UUID'
-                                        value={item && item.uuid}>
-                                        <Tooltip title="Copy uuid">
-                                            <CopyToClipboard text={item && item.uuid} onCopy={() => this.onCopy()}>
-                                                <CopyIcon className={classes.copyIcon} />
-                                            </CopyToClipboard>
-                                        </Tooltip>
-                                    </DetailsAttribute>
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Number of files' value='14' />
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Content size' value='54 MB' />
-                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Owner' value={item && item.ownerUuid} />
+                return item
+                    ? <>
+                        <Card className={classes.card}>
+                            <CardHeader
+                                avatar={<CollectionIcon className={classes.iconHeader} />}
+                                action={
+                                    <Tooltip title="More options">
+                                        <IconButton
+                                            aria-label="More options"
+                                            onClick={this.handleContextMenu}>
+                                            <MoreOptionsIcon />
+                                        </IconButton>
+                                    </Tooltip>
+                                }
+                                title={item && item.name}
+                                subheader={item && item.description} />
+                            <CardContent>
+                                <Grid container direction="column">
+                                    <Grid item xs={6}>
+                                        <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                            label='Collection UUID'
+                                            value={item && item.uuid}>
+                                            <Tooltip title="Copy uuid">
+                                                <CopyToClipboard text={item && item.uuid} onCopy={() => this.onCopy()}>
+                                                    <CopyIcon className={classes.copyIcon} />
+                                                </CopyToClipboard>
+                                            </Tooltip>
+                                        </DetailsAttribute>
+                                        <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                            label='Number of files' value='14' />
+                                        <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                            label='Content size' value='54 MB' />
+                                        <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                            label='Owner' value={item && item.ownerUuid} />
+                                    </Grid>
                                 </Grid>
-                            </Grid>
-                        </CardContent>
-                    </Card>
+                            </CardContent>
+                        </Card>
 
-                    <Card className={classes.card}>
-                        <CardHeader title="Properties" />
-                        <CardContent>
-                            <Grid container direction="column">
-                                <Grid item xs={12}><CollectionTagForm /></Grid>
-                                <Grid item xs={12}>
-                                    {
-                                        Object.keys(item.properties).map( key => {
-                                            return <Chip key={key} className={classes.tag}
-                                                onDelete={this.handleDelete(key)}
-                                                label={`${key}: ${item.properties[key]}`} />;
-                                        })
-                                    }
+                        <Card className={classes.card}>
+                            <CardHeader title="Properties" />
+                            <CardContent>
+                                <Grid container direction="column">
+                                    <Grid item xs={12}><CollectionTagForm /></Grid>
+                                    <Grid item xs={12}>
+                                        {
+                                            Object.keys(item.properties).map(key => {
+                                                return <Chip key={key} className={classes.tag}
+                                                    onDelete={this.handleDelete(key)}
+                                                    label={`${key}: ${item.properties[key]}`} />;
+                                            })
+                                        }
+                                    </Grid>
                                 </Grid>
-                            </Grid>
-                        </CardContent>
-                    </Card>
-                    <div className={classes.card}>
-                        <CollectionPanelFiles />
-                    </div>
-                </div>;
+                            </CardContent>
+                        </Card>
+                        <div className={classes.card}>
+                            <CollectionPanelFiles />
+                        </div>
+                    </>
+                    : null;
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                const { uuid, ownerUuid, name, description, kind } = this.props.item;
+                const { uuid, ownerUuid, name, description, kind, isTrashed } = this.props.item;
                 const resource = {
                     uuid,
                     ownerUuid,
                     name,
                     description,
                     kind,
-                    menuKind: ContextMenuKind.COLLECTION
+                    menuKind: isTrashed
+                        ? ContextMenuKind.TRASHED_COLLECTION
+                        : ContextMenuKind.COLLECTION
                 };
                 this.props.dispatch<any>(openContextMenu(event, resource));
             }
index 692c40b819b8b68cea59fa8f59b9f34b9b5a30aa..776850ceb8950ffe89b2fa7f1e7fc58414dce685 100644 (file)
@@ -11,6 +11,7 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { ContextMenu } from "~/views-components/context-menu/context-menu";
 import { FavoritePanel } from "../favorite-panel/favorite-panel";
 import { CurrentTokenDialog } from '~/views-components/current-token-dialog/current-token-dialog';
+import { RichTextEditorDialog } from '~/views-components/rich-text-editor-dialog/rich-text-editor-dialog';
 import { Snackbar } from '~/views-components/snackbar/snackbar';
 import { CollectionPanel } from '../collection-panel/collection-panel';
 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
@@ -119,6 +120,7 @@ export const WorkbenchPanel =
             <PartialCopyCollectionDialog />
             <ProcessCommandDialog />
             <RenameFileDialog />
+            <RichTextEditorDialog />
             <Snackbar />
             <UpdateCollectionDialog />
             <UpdateProcessDialog />
index da8e4415d1f6c2d863eb47cb8586ab9214a5ba32..b9f1cc627770e4061f08cccbf10db29e40fefbac 100644 (file)
@@ -12,4 +12,5 @@ declare interface System {
 }
 declare var System: System;
 
-declare module 'react-splitter-layout';
\ No newline at end of file
+declare module 'react-splitter-layout';
+declare module 'react-rte';
\ No newline at end of file
index 30e94bdefb4c9be9d37fc394908c15653130d55f..211c82e9294b5996bfc8b06e9f29ae8d972bc9b0 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
     "@types/react" "*"
     redux "^3.6.0 || ^4.0.0"
 
+"@types/shell-quote@1.6.0":
+  version "1.6.0"
+  resolved "https://registry.yarnpkg.com/@types/shell-quote/-/shell-quote-1.6.0.tgz#537b2949a2ebdcb0d353e448fee45b081021963f"
+
 "@types/uuid@3.4.4":
   version "3.4.4"
   resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.4.tgz#7af69360fa65ef0decb41fd150bf4ca5c0cefdf5"
@@ -1119,7 +1123,7 @@ babel-register@^6.26.0:
     mkdirp "^0.5.1"
     source-map-support "^0.4.15"
 
-babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0, babel-runtime@^6.9.2:
+babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0, babel-runtime@^6.9.2:
   version "6.26.0"
   resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
   dependencies:
@@ -1608,6 +1612,10 @@ clap@^1.0.9:
   dependencies:
     chalk "^1.1.3"
 
+class-autobind@^0.1.4:
+  version "0.1.4"
+  resolved "https://registry.yarnpkg.com/class-autobind/-/class-autobind-0.1.4.tgz#34516c49167cf8d3f639ddc186bcfa2268afff34"
+
 class-utils@^0.3.5:
   version "0.3.6"
   resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"
@@ -2369,6 +2377,50 @@ dotenv@4.0.0:
   version "4.0.0"
   resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d"
 
+draft-js-export-html@>=0.6.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/draft-js-export-html/-/draft-js-export-html-1.2.0.tgz#1cbe2b78e1fed74fc29c7cdcbfd7540468eca209"
+  dependencies:
+    draft-js-utils "^1.2.0"
+
+draft-js-export-markdown@>=0.3.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/draft-js-export-markdown/-/draft-js-export-markdown-1.2.0.tgz#c423d67389e1c70ddd13e956afe82fd1b72feea5"
+  dependencies:
+    draft-js-utils "^1.2.0"
+
+draft-js-import-element@^1.2.1:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/draft-js-import-element/-/draft-js-import-element-1.2.1.tgz#9a6a56d74690d48d35d8d089564e6d710b4926eb"
+  dependencies:
+    draft-js-utils "^1.2.0"
+    synthetic-dom "^1.2.0"
+
+draft-js-import-html@>=0.4.0:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/draft-js-import-html/-/draft-js-import-html-1.2.1.tgz#88adb8ce5dbe1a5a777663b1893cee6a35239eaa"
+  dependencies:
+    draft-js-import-element "^1.2.1"
+
+draft-js-import-markdown@>=0.3.0:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/draft-js-import-markdown/-/draft-js-import-markdown-1.2.1.tgz#ec18eb15008bab13d9878d65db50e181dd64a5ce"
+  dependencies:
+    draft-js-import-element "^1.2.1"
+    synthetic-dom "^1.2.0"
+
+draft-js-utils@>=0.2.0, draft-js-utils@^1.2.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/draft-js-utils/-/draft-js-utils-1.2.0.tgz#f5cb23eb167325ffed3d79882fdc317721d2fd12"
+
+draft-js@>=0.10.0:
+  version "0.10.5"
+  resolved "https://registry.yarnpkg.com/draft-js/-/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742"
+  dependencies:
+    fbjs "^0.8.15"
+    immutable "~3.7.4"
+    object-assign "^4.1.0"
+
 duplexer3@^0.1.4:
   version "0.1.4"
   resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
@@ -2858,7 +2910,7 @@ fb-watchman@^2.0.0:
   dependencies:
     bser "^2.0.0"
 
-fbjs@^0.8.1, fbjs@^0.8.16:
+fbjs@^0.8.1, fbjs@^0.8.15, fbjs@^0.8.16:
   version "0.8.17"
   resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd"
   dependencies:
@@ -3545,6 +3597,14 @@ ignore-walk@^3.0.1:
   dependencies:
     minimatch "^3.0.4"
 
+immutable@^3.8.1:
+  version "3.8.2"
+  resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
+
+immutable@~3.7.4:
+  version "3.7.6"
+  resolved "http://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b"
+
 import-lazy@^2.1.0:
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
@@ -6119,14 +6179,14 @@ react-dev-utils@^5.0.1:
     strip-ansi "3.0.1"
     text-table "0.2.0"
 
-react-dom@16.4.2:
-  version "16.4.2"
-  resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.2.tgz#4afed569689f2c561d2b8da0b819669c38a0bda4"
+react-dom@16.5.2:
+  version "16.5.2"
+  resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.2.tgz#b69ee47aa20bab5327b2b9d7c1fe2a30f2cfa9d7"
   dependencies:
-    fbjs "^0.8.16"
     loose-envify "^1.1.0"
     object-assign "^4.1.1"
-    prop-types "^15.6.0"
+    prop-types "^15.6.2"
+    schedule "^0.5.0"
 
 react-dropzone@5.0.1:
   version "5.0.1"
@@ -6216,6 +6276,21 @@ react-router@4.3.1, react-router@^4.2.0, react-router@^4.3.1:
     prop-types "^15.6.1"
     warning "^4.0.1"
 
+react-rte@0.16.1:
+  version "0.16.1"
+  resolved "https://registry.yarnpkg.com/react-rte/-/react-rte-0.16.1.tgz#e345664c87e992d15ec053b406f51ffac6e86622"
+  dependencies:
+    babel-runtime "^6.23.0"
+    class-autobind "^0.1.4"
+    classnames "^2.2.5"
+    draft-js ">=0.10.0"
+    draft-js-export-html ">=0.6.0"
+    draft-js-export-markdown ">=0.3.0"
+    draft-js-import-html ">=0.4.0"
+    draft-js-import-markdown ">=0.3.0"
+    draft-js-utils ">=0.2.0"
+    immutable "^3.8.1"
+
 react-scripts-ts@2.17.0:
   version "2.17.0"
   resolved "https://registry.yarnpkg.com/react-scripts-ts/-/react-scripts-ts-2.17.0.tgz#398bae19a30c9b39b3dfe0720ebb40c60c2f6574"
@@ -6282,14 +6357,14 @@ react-transition-group@2.4.0, react-transition-group@^2.2.1:
     prop-types "^15.6.2"
     react-lifecycles-compat "^3.0.4"
 
-react@16.4.2:
-  version "16.4.2"
-  resolved "https://registry.yarnpkg.com/react/-/react-16.4.2.tgz#2cd90154e3a9d9dd8da2991149fdca3c260e129f"
+react@16.5.2:
+  version "16.5.2"
+  resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42"
   dependencies:
-    fbjs "^0.8.16"
     loose-envify "^1.1.0"
     object-assign "^4.1.1"
-    prop-types "^15.6.0"
+    prop-types "^15.6.2"
+    schedule "^0.5.0"
 
 read-pkg-up@^1.0.1:
   version "1.0.1"
@@ -6737,6 +6812,12 @@ sax@^1.2.4, sax@~1.2.1:
   version "1.2.4"
   resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
 
+schedule@^0.5.0:
+  version "0.5.0"
+  resolved "https://registry.yarnpkg.com/schedule/-/schedule-0.5.0.tgz#c128fffa0b402488b08b55ae74bb9df55cc29cc8"
+  dependencies:
+    object-assign "^4.1.1"
+
 schema-utils@^0.3.0:
   version "0.3.0"
   resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf"
@@ -7281,6 +7362,10 @@ symbol-tree@^3.2.2:
   version "3.2.2"
   resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"
 
+synthetic-dom@^1.2.0:
+  version "1.2.0"
+  resolved "https://registry.yarnpkg.com/synthetic-dom/-/synthetic-dom-1.2.0.tgz#f3589aafe2b5e299f337bb32973a9be42dd5625e"
+
 tapable@^0.2.7:
   version "0.2.8"
   resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22"