info-card-view
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 28 Aug 2018 10:19:01 +0000 (12:19 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 28 Aug 2018 10:19:01 +0000 (12:19 +0200)
Feature #13858

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

src/components/details-attribute/details-attribute.tsx
src/index.tsx
src/views-components/context-menu/action-sets/process-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/context-menu.tsx
src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx [deleted file]
src/views-components/dialog-create/dialog-collection-create-selected.tsx [deleted file]
src/views-components/rename-file-dialog/rename-file-dialog.tsx
src/views/process-panel/process-panel.tsx
src/views/workbench/workbench.tsx

index 32ab167182c28170660a42e1f0507c40f35256ce..8794b1585bf595a159d0034ba39a08a518bd694e 100644 (file)
@@ -40,7 +40,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 interface DetailsAttributeDataProps {
     label: string;
     classLabel?: string;
-    value?: string | number;
+    value?: any;
     classValue?: string;
     lowercaseValue?: boolean;
     link?: string;
index bee08c80a7fa598d7ffd42ad87abd14335f872ef..c6a5da24a372f2f3adbb822435e69008de18a3bc 100644 (file)
@@ -27,6 +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 { processActionSet } from './views-components/context-menu/action-sets/process-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);
@@ -44,6 +45,7 @@ addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
+addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
 
 fetchConfig()
     .then(config => {
diff --git a/src/views-components/context-menu/action-sets/process-action-set.ts b/src/views-components/context-menu/action-sets/process-action-set.ts
new file mode 100644 (file)
index 0000000..1d94170
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import { ToggleFavoriteAction } from "../actions/favorite-action";
+import { toggleFavorite } from "~/store/favorites/favorites-actions";
+import {
+    RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon,
+    AdvancedIcon, RemoveIcon, ReRunProcessIcon, LogIcon
+} from "~/components/icon/icon";
+import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
+
+export const processActionSet: ContextMenuActionSet = [[
+    {
+        icon: RenameIcon,
+        name: "Edit process",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: ShareIcon,
+        name: "Share",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: MoveToIcon,
+        name: "Move to",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        component: ToggleFavoriteAction,
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleFavorite(resource)).then(() => {
+                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+            });
+        }
+    },
+    {
+        icon: CopyIcon,
+        name: "Copy to project",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: ReRunProcessIcon,
+        name: "Re-run process",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: DetailsIcon,
+        name: "View details",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    },
+    {
+        icon: LogIcon,
+        name: "Log",
+        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: RemoveIcon,
+        name: "Remove",
+        execute: (dispatch, resource) => {
+            // add code
+        }
+    }
+]];
index 8036bb572859ee90a11fa94474a328ec69aca07f..5d94766c447674170560e45b5392993ef505a977 100644 (file)
@@ -63,5 +63,6 @@ export enum ContextMenuKind {
     COLLECTION_FILES = "CollectionFiles",
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
     COLLECTION = 'Collection',
-    COLLECTION_RESOURCE = 'CollectionResource'
+    COLLECTION_RESOURCE = 'CollectionResource',
+    PROCESS = "Process"
 }
diff --git a/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx b/src/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected.tsx
deleted file mode 100644 (file)
index fb5f094..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { Dispatch } from "redux";
-import { reduxForm, reset, startSubmit, stopSubmit } from "redux-form";
-import { withDialog } from "~/store/dialog/with-dialog";
-import { dialogActions } from "~/store/dialog/dialog-actions";
-import { DialogCollectionCreateWithSelected } from "../dialog-create/dialog-collection-create-selected";
-import { resetPickerProjectTree } from "~/store/project-tree-picker/project-tree-picker-actions";
-
-export const DIALOG_COLLECTION_CREATE_WITH_SELECTED = 'dialogCollectionCreateWithSelected';
-
-export const createCollectionWithSelected = () =>
-    (dispatch: Dispatch) => {
-        dispatch(reset(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
-        dispatch<any>(resetPickerProjectTree());
-        dispatch(dialogActions.OPEN_DIALOG({ id: DIALOG_COLLECTION_CREATE_WITH_SELECTED, data: {} }));
-    };
-
-export const [DialogCollectionCreateWithSelectedFile] = [DialogCollectionCreateWithSelected]
-    .map(withDialog(DIALOG_COLLECTION_CREATE_WITH_SELECTED))
-    .map(reduxForm({
-        form: DIALOG_COLLECTION_CREATE_WITH_SELECTED,
-        onSubmit: (data, dispatch) => {
-            dispatch(startSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED));
-            setTimeout(() => dispatch(stopSubmit(DIALOG_COLLECTION_CREATE_WITH_SELECTED, { name: 'Invalid name' })), 2000);
-        }
-    }));
diff --git a/src/views-components/dialog-create/dialog-collection-create-selected.tsx b/src/views-components/dialog-create/dialog-collection-create-selected.tsx
deleted file mode 100644 (file)
index ad684d7..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import * as React from "react";
-import { InjectedFormProps, Field, WrappedFieldProps } from "redux-form";
-import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress } from "@material-ui/core";
-import { WithDialogProps } from "~/store/dialog/with-dialog";
-import { TextField } from "~/components/text-field/text-field";
-import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
-import { ProjectTreePicker } from "../project-tree-picker/project-tree-picker";
-
-export const DialogCollectionCreateWithSelected = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
-    <form>
-        <Dialog open={props.open}
-            disableBackdropClick={true}
-            disableEscapeKeyDown={true}>
-            <DialogTitle>Create a collection</DialogTitle>
-            <DialogContent style={{ display: 'flex' }}>
-                <div>
-                    <Field
-                        name='name'
-                        component={TextField}
-                        validate={COLLECTION_NAME_VALIDATION}
-                        label="Collection Name" />
-                    <Field
-                        name='description'
-                        component={TextField}
-                        validate={COLLECTION_DESCRIPTION_VALIDATION}
-                        label="Description - optional" />
-                </div>
-                <Field
-                    name="projectUuid"
-                    component={Picker}
-                    validate={COLLECTION_PROJECT_VALIDATION} />
-            </DialogContent>
-            <DialogActions>
-                <Button
-                    variant='flat'
-                    color='primary'
-                    disabled={props.submitting}
-                    onClick={props.closeDialog}>
-                    Cancel
-                    </Button>
-                <Button
-                    variant='contained'
-                    color='primary'
-                    type='submit'
-                    onClick={props.handleSubmit}
-                    disabled={props.pristine || props.invalid || props.submitting}>
-                    {props.submitting ? <CircularProgress size={20} /> : 'Create a collection'}
-                </Button>
-            </DialogActions>
-        </Dialog>
-    </form>;
-
-const Picker = (props: WrappedFieldProps) =>
-    <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
-        <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
-    </div>;
index 20116fcda747c0f322223b48fc6d83b67a024762..862227bd888c27c277e4b4d9e28d66a0e36b76f3 100644 (file)
@@ -4,7 +4,7 @@
 
 import * as React from 'react';
 import { compose } from 'redux';
-import { reduxForm, reset, startSubmit, stopSubmit, InjectedFormProps, Field } from 'redux-form';
+import { reduxForm, InjectedFormProps, Field } from 'redux-form';
 import { withDialog, WithDialogProps } from '~/store/dialog/with-dialog';
 import { FormDialog } from '~/components/form-dialog/form-dialog';
 import { DialogContentText } from '@material-ui/core';
index dff1437bd0ff5eec19e338878174c59540ad8fae..1ae87470694ea8e07ace381917abe5848ed578cb 100644 (file)
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import {
     StyleRulesCallback, WithStyles, withStyles, Card,
-    CardHeader, IconButton, CardContent, Grid
+    CardHeader, IconButton, CardContent, Grid, Chip
 } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { ProcessResource } from '~/models/process';
@@ -15,11 +15,12 @@ import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
 import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
 import { RootState } from '~/store/store';
 
-type CssRules = 'card' | 'iconHeader' | 'label' | 'value';
+type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'content' | 'chip' | 'headerText';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     card: {
-        marginBottom: theme.spacing.unit * 2
+        marginBottom: theme.spacing.unit * 2,
+        width: '60%'
     },
     iconHeader: {
         fontSize: '1.875rem',
@@ -31,6 +32,30 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     value: {
         textTransform: 'none',
         fontSize: '0.875rem'
+    },
+    content: {
+        display: 'flex',
+        paddingBottom: '0px ',
+        paddingTop: '0px',
+        '&:last-child': {
+            paddingBottom: '0px ',
+        }
+    },
+    chip: {
+        height: theme.spacing.unit * 2.5,
+        width: theme.spacing.unit * 12,
+        backgroundColor: theme.customs.colors.green700,
+        color: theme.palette.common.white,
+        fontSize: '0.875rem',
+        borderRadius: theme.spacing.unit * 0.625
+    },
+    headerText: {
+        fontSize: '0.875rem',
+        display: 'flex',
+        position: 'relative',
+        justifyContent: 'flex-end',
+        top: -theme.spacing.unit * 4.5,
+        right: theme.spacing.unit * 2,
     }
 });
 
@@ -66,22 +91,30 @@ export const ProcessPanel = withStyles(styles)(
                                 </IconButton>
                             }
                             title="Pipeline template that generates a config file from a template"
-                            subheader="(no description)"
-                        />
-                        <CardContent>
+                             />
+                        <CardContent className={classes.content}>
                             <Grid container direction="column">
-                                <Grid item xs={6}>
+                                <Grid item xs={8}>
+                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                        label='Status' value={<Chip label="Complete" className={classes.chip} />} />
                                     <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Collection UUID' value="uuid" />
+                                        label='Started at' value="1:25 PM 3/23/2018" />
+                                    <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                                        label='Finished at' value='1:25 PM 3/23/2018' />
+                                </Grid>
+                            </Grid>
+                            <Grid container direction="column">
+                                <Grid item xs={8}>
                                     <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Number of files' value='14' />
+                                        label='Container output' />
                                     <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Content size' value='54 MB' />
+                                        label='Show inputs' />
                                     <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                                        label='Owner' value="ownerUuid" />
+                                        label='Show command' />
                                 </Grid>
                             </Grid>
                         </CardContent>
+                        <span className={classes.headerText}>This container request was created from the workflow FastQC MultiQC</span>
                     </Card>
                 </div>;
             }
index 4640323f0923b863fd3f5e24a3754a4b9d522982..856a626c088f0dbf027fb6f1417843ef9fead85e 100644 (file)
@@ -50,7 +50,6 @@ import { AuthService } from "~/services/auth-service/auth-service";
 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
-import { DialogCollectionCreateWithSelectedFile } from '~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected';
 import { UploadCollectionFilesDialog } from '~/views-components/upload-collection-files-dialog/upload-collection-files-dialog';
 import { CollectionPartialCopyDialog } from '~/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog';
 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
@@ -251,7 +250,6 @@ export const Workbench = withStyles(styles)(
                         <CreateCollectionDialog />
                         <RenameFileDialog />
                         <CollectionPartialCopyDialog />
-                        <DialogCollectionCreateWithSelectedFile />
                         <FileRemoveDialog />
                         <CopyCollectionDialog />
                         <MultipleFilesRemoveDialog />
@@ -274,10 +272,10 @@ export const Workbench = withStyles(styles)(
                 }}
                 onContextMenu={(event, item) => {
                     this.openContextMenu(event, {
-                        uuid: item.uuid,
-                        name: item.name,
-                        description: item.description,
-                        kind: ContextMenuKind.COLLECTION
+                        uuid: 'item.uuid',
+                        name: 'item.name',
+                        description: 'item.description',
+                        kind: ContextMenuKind.PROCESS
                     });
                 }}
                 {...props} />