[ARVADOS-WORKBENCH2] created: 1.2.0-800-gb9cd512

Git user git at public.curoverse.com
Mon Nov 5 05:56:19 EST 2018


        at  b9cd512debf45e62d9b81a12b4ac64fde998c356 (commit)


commit b9cd512debf45e62d9b81a12b4ac64fde998c356
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Nov 5 11:56:01 2018 +0100

    metadata-tail-and-head-proper-rendering
    
    Feature #14431
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/advanced-tab/advanced-tab.ts b/src/store/advanced-tab/advanced-tab.ts
index 1fa86c8..c986a24 100644
--- a/src/store/advanced-tab/advanced-tab.ts
+++ b/src/store/advanced-tab/advanced-tab.ts
@@ -20,6 +20,7 @@ export const ADVANCED_TAB_DIALOG = 'advancedTabDialog';
 export interface AdvancedTabDialogData {
     apiResponse: any;
     metadata: any;
+    uuid: string;
     pythonHeader: string;
     pythonExample: string;
     cliGetHeader: string;
@@ -50,6 +51,11 @@ export const openAdvancedTabDialog = (uuid: string) =>
         const { resources } = getState();
         const kind = extractUuidKind(uuid);
         const data = getResource<any>(uuid)(resources);
+        const user = await services.userService.list({
+            filters: new FilterBuilder()
+                .addEqual('uuid', data.ownerUuid)
+                .getFilters()
+        });
         const metadata = await services.linkService.list({
             filters: new FilterBuilder()
                 .addEqual('headUuid', uuid)
@@ -57,46 +63,13 @@ export const openAdvancedTabDialog = (uuid: string) =>
         });
         if (data) {
             if (kind === ResourceKind.COLLECTION) {
-                const dataCollection: AdvancedTabDialogData = {
-                    apiResponse: collectionApiResponse(data),
-                    metadata,
-                    pythonHeader: pythonHeader(CollectionData.COLLECTION),
-                    pythonExample: pythonExample(data.uuid, GroupContentsResourcePrefix.COLLECTION),
-                    cliGetHeader: cliGetHeader(CollectionData.COLLECTION),
-                    cliGetExample: cliGetExample(data.uuid, GroupContentsResourcePrefix.COLLECTION),
-                    cliUpdateHeader: cliUpdateHeader(CollectionData.COLLECTION, CollectionData.STORAGE_CLASSES_CONFIRMED),
-                    cliUpdateExample: cliUpdateExample(data.uuid, CollectionData.COLLECTION, data.storageClassesConfirmed, CollectionData.STORAGE_CLASSES_CONFIRMED),
-                    curlHeader: curlHeader(CollectionData.COLLECTION, CollectionData.STORAGE_CLASSES_CONFIRMED),
-                    curlExample: curlExample(data.uuid, GroupContentsResourcePrefix.COLLECTION, data.storageClassesConfirmed, CollectionData.COLLECTION, CollectionData.STORAGE_CLASSES_CONFIRMED)
-                };
+                const dataCollection: AdvancedTabDialogData = advancedTabData(uuid, metadata, user, collectionApiResponse, data, CollectionData.COLLECTION, GroupContentsResourcePrefix.COLLECTION, CollectionData.STORAGE_CLASSES_CONFIRMED, data.storageClassesConfirmed);
                 dispatch(dialogActions.OPEN_DIALOG({ id: ADVANCED_TAB_DIALOG, data: dataCollection }));
             } else if (kind === ResourceKind.PROCESS) {
-                const dataProcess: AdvancedTabDialogData = {
-                    apiResponse: containerRequestApiResponse(data),
-                    metadata,
-                    pythonHeader: pythonHeader(ProcessData.CONTAINER_REQUEST),
-                    pythonExample: pythonExample(data.uuid, GroupContentsResourcePrefix.PROCESS),
-                    cliGetHeader: cliGetHeader(ProcessData.CONTAINER_REQUEST),
-                    cliGetExample: cliGetExample(data.uuid, GroupContentsResourcePrefix.PROCESS),
-                    cliUpdateHeader: cliUpdateHeader(ProcessData.CONTAINER_REQUEST, ProcessData.OUTPUT_NAME),
-                    cliUpdateExample: cliUpdateExample(data.uuid, ProcessData.CONTAINER_REQUEST, data.outputName, ProcessData.OUTPUT_NAME),
-                    curlHeader: curlHeader(ProcessData.CONTAINER_REQUEST, ProcessData.OUTPUT_NAME),
-                    curlExample: curlExample(data.uuid, GroupContentsResourcePrefix.PROCESS, data.outputName, ProcessData.CONTAINER_REQUEST, ProcessData.OUTPUT_NAME)
-                };
+                const dataProcess: AdvancedTabDialogData = advancedTabData(uuid, metadata, user, containerRequestApiResponse, data, ProcessData.CONTAINER_REQUEST, GroupContentsResourcePrefix.PROCESS, ProcessData.OUTPUT_NAME, data.outputName);
                 dispatch(dialogActions.OPEN_DIALOG({ id: ADVANCED_TAB_DIALOG, data: dataProcess }));
             } else if (kind === ResourceKind.PROJECT) {
-                const dataProject: AdvancedTabDialogData = {
-                    apiResponse: groupRequestApiResponse(data),
-                    metadata,
-                    pythonHeader: pythonHeader(ProjectData.GROUP),
-                    pythonExample: pythonExample(data.uuid, GroupContentsResourcePrefix.PROJECT),
-                    cliGetHeader: cliGetHeader(ProjectData.GROUP),
-                    cliGetExample: cliGetExample(data.uuid, GroupContentsResourcePrefix.PROJECT),
-                    cliUpdateHeader: cliUpdateHeader(ProjectData.GROUP, ProjectData.DELETE_AT),
-                    cliUpdateExample: cliUpdateExample(data.uuid, ProjectData.GROUP, data.deleteAt, ProjectData.DELETE_AT),
-                    curlHeader: curlHeader(ProjectData.GROUP, ProjectData.DELETE_AT),
-                    curlExample: curlExample(data.uuid, GroupContentsResourcePrefix.PROJECT, data.deleteAt, ProjectData.GROUP, ProjectData.DELETE_AT)
-                };
+                const dataProject: AdvancedTabDialogData = advancedTabData(uuid, metadata, user, groupRequestApiResponse, data, ProjectData.GROUP, GroupContentsResourcePrefix.PROJECT, ProjectData.DELETE_AT, data.deleteAt);
                 dispatch(dialogActions.OPEN_DIALOG({ id: ADVANCED_TAB_DIALOG, data: dataProject }));
             }
         } else {
@@ -104,6 +77,22 @@ export const openAdvancedTabDialog = (uuid: string) =>
         }
     };
 
+const advancedTabData = (uuid: string, metadata: any, user: any, apiResponseKind: any, data: any, resourceKind: CollectionData | ProcessData | ProjectData, resourcePrefix: GroupContentsResourcePrefix, resourceKindProperty: CollectionData | ProcessData | ProjectData, property: any) => {
+    return {
+        uuid,
+        metadata: { ...metadata, user },
+        apiResponse: apiResponseKind(data),
+        pythonHeader: pythonHeader(resourceKind),
+        pythonExample: pythonExample(uuid, resourcePrefix),
+        cliGetHeader: cliGetHeader(resourceKind),
+        cliGetExample: cliGetExample(uuid, resourcePrefix),
+        cliUpdateHeader: cliUpdateHeader(resourceKind, resourceKindProperty),
+        cliUpdateExample: cliUpdateExample(uuid, resourceKind, property, resourceKind),
+        curlHeader: curlHeader(resourceKind, resourceKindProperty),
+        curlExample: curlExample(uuid, resourcePrefix, property, resourceKind, resourceKindProperty),
+    };
+};
+
 const pythonHeader = (resourceKind: string) =>
     `An example python command to get a ${resourceKind} using its uuid:`;
 
diff --git a/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx b/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
index 3b3ca6d..f715899 100644
--- a/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
+++ b/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
@@ -59,7 +59,8 @@ export const AdvancedTabDialog = compose(
                 cliUpdateHeader,
                 cliUpdateExample,
                 curlHeader,
-                curlExample
+                curlExample,
+                uuid
             } = this.props.data;
             return <Dialog
                 open={open}
@@ -76,7 +77,7 @@ export const AdvancedTabDialog = compose(
                 </Tabs>
                 <DialogContent className={classes.content}>
                     {value === 0 && <div>{dialogContentExample(apiResponse, classes)}</div>}
-                    {value === 1 && <div>{metadata.items.length > 0 ? <MetadataTab items={metadata.items}/>: dialogContentHeader('(No metadata links found)')}</div>}
+                    {value === 1 && <div>{metadata.items.length > 0 ? <MetadataTab items={metadata.items} uuid={uuid} user={metadata.user.items}/>: dialogContentHeader('(No metadata links found)')}</div>}
                     {value === 2 && dialogContent(pythonHeader, pythonExample, classes)}
                     {value === 3 && <div>
                         {dialogContent(cliGetHeader, cliGetExample, classes)}
diff --git a/src/views-components/advanced-tab-dialog/metadataTab.tsx b/src/views-components/advanced-tab-dialog/metadataTab.tsx
index 788b10d..6a2136a 100644
--- a/src/views-components/advanced-tab-dialog/metadataTab.tsx
+++ b/src/views-components/advanced-tab-dialog/metadataTab.tsx
@@ -4,6 +4,7 @@
 
 import * as React from "react";
 import { Table, TableHead, TableCell, TableRow, TableBody, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import { UserResource } from "~/models/user";
 
 type CssRules = 'cell';
 
@@ -24,6 +25,8 @@ interface MetadataTable {
 
 interface MetadataProps {
     items: MetadataTable[];
+    user: UserResource[];
+    uuid: string;
 }
 
 export const MetadataTab = withStyles(styles)((props: MetadataProps & WithStyles<CssRules>) =>
@@ -44,8 +47,8 @@ export const MetadataTab = withStyles(styles)((props: MetadataProps & WithStyles
                     <TableCell className={props.classes.cell}>{it.uuid}</TableCell>
                     <TableCell className={props.classes.cell}>{it.linkClass}</TableCell>
                     <TableCell className={props.classes.cell}>{it.name}</TableCell>
-                    <TableCell className={props.classes.cell}>{it.tailUuid}</TableCell>
-                    <TableCell className={props.classes.cell}>{it.headUuid}</TableCell>
+                    <TableCell className={props.classes.cell}>{props.user.length > 0 ? `User: ${props.user[0].firstName} ${props.user[0].lastName}` : it.tailUuid}</TableCell>
+                    <TableCell className={props.classes.cell}>{it.headUuid === props.uuid ? 'this' : it.headUuid}</TableCell>
                     <TableCell className={props.classes.cell}>{JSON.stringify(it.properties, null, 2)}</TableCell>
                 </TableRow>
             )}
diff --git a/src/views/process-panel/process-information-card.tsx b/src/views/process-panel/process-information-card.tsx
index 9b21ce5..0813126 100644
--- a/src/views/process-panel/process-information-card.tsx
+++ b/src/views/process-panel/process-information-card.tsx
@@ -75,7 +75,6 @@ type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles<
 export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
     ({ classes, process, onContextMenu, theme }: ProcessInformationCardProps) =>
         <Card className={classes.card}>
-        {console.log(process)}
             <CardHeader
                 classes={{
                     content: classes.title,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list