18594: Code and test cleanup
authorDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Mon, 14 Feb 2022 19:32:04 +0000 (20:32 +0100)
committerDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Mon, 14 Feb 2022 19:32:04 +0000 (20:32 +0100)
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>

cypress/integration/project.spec.js
src/store/advanced-tab/advanced-tab.tsx
src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
src/views-components/advanced-tab-dialog/metadataTab.tsx

index 96e73bc127d197e81aab1d496ae342a59fe30647..ecac38614a1ca015ddf23a0e3b7fd0868d39dd2d 100644 (file)
@@ -257,7 +257,7 @@ describe('Project tests', function() {
 
                     cy.get('td').contains(uuid).should('exist');
 
-                    cy.get('td').contains('Active User').should('exist');
+                    cy.get('td').contains(activeUser.user.uuid).should('exist');
                 });
         });
     });
index 33faebbed67a7dd7c0da27bbecfcc35dcf820964..61fd705ac3778d335fcfeb8db9b9f0221f295d87 100644 (file)
@@ -18,7 +18,7 @@ import { ListResults } from 'services/common-service/common-service';
 import { RepositoryResource } from 'models/repositories';
 import { SshKeyResource } from 'models/ssh-key';
 import { VirtualMachinesResource } from 'models/virtual-machines';
-import { UserResource, getUserDisplayName } from 'models/user';
+import { UserResource } from 'models/user';
 import { LinkResource } from 'models/link';
 import { KeepServiceResource } from 'models/keep-services';
 import { ApiClientAuthorization } from 'models/api-client-authorization';
@@ -280,22 +280,8 @@ const getDataForAdvancedTab = (uuid: string) =>
                 .addEqual('head_uuid', uuid)
                 .getFilters()
         });
-        let user;
-
-        if (metadata.itemsAvailable) {
-            metadata.items.forEach(async (item) => {
-                const {tailKind, tailUuid, properties} = item;
-                properties['tail'] = tailUuid;
-                try {
-                    if (tailKind === ResourceKind.USER && tailUuid) {
-                        user = await services.userService.get(tailUuid);
-                        properties['tail'] = getUserDisplayName(user);
-                    }
-                } catch {};
-            });
-        }
 
-        return { data, metadata, user };
+        return { data, metadata };
     };
 
 const initAdvancedTabDialog = (data: AdvancedTabDialogData) => dialogActions.OPEN_DIALOG({ id: ADVANCED_TAB_DIALOG, data });
index e8d4aaefd3773b6f13f1cba008951c740ecab6fc..f493df33ad2533cbf7fcba1a3c16993f2425deb1 100644 (file)
@@ -61,7 +61,6 @@ export const AdvancedTabDialog = compose(
                 curlHeader,
                 curlExample,
                 uuid,
-                user
             } = this.props.data;
             return <Dialog
                 open={open}
@@ -80,7 +79,7 @@ export const AdvancedTabDialog = compose(
                     {value === 0 && <div>{dialogContentExample(apiResponse, classes)}</div>}
                     {value === 1 && <div>
                         {metadata !== '' && metadata.items.length > 0 ?
-                            <MetadataTab items={metadata.items} uuid={uuid} user={user} />
+                            <MetadataTab items={metadata.items} uuid={uuid} />
                             : dialogContentHeader('(No metadata links found)')}
                     </div>}
                     {value === 2 && dialogContent(pythonHeader, pythonExample, classes)}
index 88d0137f8a7ede6a1df055a3250a8a10325e67e8..1b950d242f1f5989401df72bf180101ff920aba2 100644 (file)
@@ -4,7 +4,6 @@
 
 import React from "react";
 import { Table, TableHead, TableCell, TableRow, TableBody, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
-import { UserResource } from "models/user";
 
 type CssRules = 'cell';
 
@@ -25,7 +24,6 @@ interface MetadataTable {
 
 interface MetadataProps {
     items: MetadataTable[];
-    user: UserResource;
     uuid: string;
 }
 
@@ -47,9 +45,9 @@ 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.properties.tail}</TableCell>
+                    <TableCell className={props.classes.cell}>{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, (key, value) => { return key === 'tail' ? undefined : value; })}</TableCell>
+                    <TableCell className={props.classes.cell}>{JSON.stringify(it.properties)}</TableCell>
                 </TableRow>
             )}
         </TableBody>