[ARVADOS-WORKBENCH2] updated: 2.3.0-153-g26120161

Git user git at public.arvados.org
Thu Feb 10 21:55:07 UTC 2022


Summary of changes:
 cypress/integration/project.spec.js                | 58 +++++++++++++++-------
 src/store/advanced-tab/advanced-tab.tsx            | 19 ++++---
 .../advanced-tab-dialog/advanced-tab-dialog.tsx    |  6 ++-
 .../advanced-tab-dialog/metadataTab.tsx            |  6 +--
 4 files changed, 60 insertions(+), 29 deletions(-)

       via  261201611113224f4a61b3979f6cd9992c4aa6c6 (commit)
      from  c797ff39572137b5552f76f29d39b94c7554b1a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 261201611113224f4a61b3979f6cd9992c4aa6c6
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Thu Feb 10 22:54:13 2022 +0100

    18594: Added multiple tails display, added tests
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js
index f369330e..96e73bc1 100644
--- a/cypress/integration/project.spec.js
+++ b/cypress/integration/project.spec.js
@@ -200,7 +200,10 @@ describe('Project tests', function() {
         cy.createGroup(activeUser.token, {
             name: `Test root project ${Math.floor(Math.random() * 999999)}`,
             group_class: 'project',
-        }).as('testProject1');
+        }).as('testProject1').then((testProject1) => {
+      
+            cy.shareWith(adminUser.token, activeUser.user.uuid, testCollection2.uuid, 'can_write');
+        });
 
         cy.getAll('@testProject1').then(function([testProject1]) {
             cy.loginAs(activeUser);
@@ -216,29 +219,46 @@ describe('Project tests', function() {
     });
 
     it('opens advanced popup for project with username', () => {
-        const projectName = `Test root project ${Math.floor(Math.random() * 999999)}`;
-
-        cy.createProject({
-            owningUser: adminUser,
-            targetUser: activeUser,
-            projectName,
-            canWrite: true,
-            addToFavorites: true
-        }).as('mySharedProject');
-
-        cy.getAll('@mySharedProject')
-            .then(function ([mySharedProject]) {
-                cy.loginAs(activeUser);
+        const projectName = `Test project ${Math.floor(Math.random() * 999999)}`;
+
+        cy.createGroup(adminUser.token, {
+            name: projectName,
+            group_class: 'project',
+        }).as('mainProject')
+
+        cy.getAll('@mainProject')
+            .then(function ([mainProject]) {
+                cy.loginAs(adminUser);
                 
-                cy.get('[data-cy=side-panel-tree]').contains('Shared with me').click();
+                cy.get('[data-cy=side-panel-tree]').contains('Groups').click();
+
+                cy.get('[data-cy=uuid]').eq(0).invoke('text').then(uuid => {
+                    cy.createLink(adminUser.token, {
+                        name: 'can_write',
+                        link_class: 'permission',
+                        head_uuid: mainProject.uuid,
+                        tail_uuid: uuid
+                    });
 
-                cy.get('main').contains(projectName).rightclick();
+                    cy.createLink(adminUser.token, {
+                        name: 'can_write',
+                        link_class: 'permission',
+                        head_uuid: mainProject.uuid,
+                        tail_uuid: activeUser.user.uuid
+                    });
+
+                    cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
+
+                    cy.get('main').contains(projectName).rightclick();
 
-                cy.get('[data-cy=context-menu]').contains('Advanced').click();
+                    cy.get('[data-cy=context-menu]').contains('Advanced').click();
 
-                cy.get('[role=tablist]').contains('METADATA').click();
+                    cy.get('[role=tablist]').contains('METADATA').click();
 
-                cy.get('td').contains('User: Active User').should('exist');
+                    cy.get('td').contains(uuid).should('exist');
+
+                    cy.get('td').contains('Active User').should('exist');
+                });
         });
     });
 });
\ No newline at end of file
diff --git a/src/store/advanced-tab/advanced-tab.tsx b/src/store/advanced-tab/advanced-tab.tsx
index 052df3a2..33faebbe 100644
--- a/src/store/advanced-tab/advanced-tab.tsx
+++ b/src/store/advanced-tab/advanced-tab.tsx
@@ -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 } from 'models/user';
+import { UserResource, getUserDisplayName } from 'models/user';
 import { LinkResource } from 'models/link';
 import { KeepServiceResource } from 'models/keep-services';
 import { ApiClientAuthorization } from 'models/api-client-authorization';
@@ -282,11 +282,18 @@ const getDataForAdvancedTab = (uuid: string) =>
         });
         let user;
 
-        try {
-            if (metadata.itemsAvailable && metadata.items[0].tailKind === ResourceKind.USER) {
-                user = await services.userService.get(metadata.items[0].tailUuid || '');
-            }
-        } catch {};
+        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 };
     };
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 b631a74c..e8d4aaef 100644
--- a/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
+++ b/src/views-components/advanced-tab-dialog/advanced-tab-dialog.tsx
@@ -78,7 +78,11 @@ export const AdvancedTabDialog = compose(
                 </Tabs>
                 <DialogContent className={classes.content}>
                     {value === 0 && <div>{dialogContentExample(apiResponse, classes)}</div>}
-                    {value === 1 && <div>{metadata !== '' && metadata.items.length > 0 ? <MetadataTab items={metadata.items} uuid={uuid} user={user} /> : dialogContentHeader('(No metadata links found)')}</div>}
+                    {value === 1 && <div>
+                        {metadata !== '' && metadata.items.length > 0 ?
+                            <MetadataTab items={metadata.items} uuid={uuid} user={user} />
+                            : 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 9f08d1e3..88d0137f 100644
--- a/src/views-components/advanced-tab-dialog/metadataTab.tsx
+++ b/src/views-components/advanced-tab-dialog/metadataTab.tsx
@@ -4,7 +4,7 @@
 
 import React from "react";
 import { Table, TableHead, TableCell, TableRow, TableBody, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
-import { UserResource, getUserDisplayName } from "models/user";
+import { UserResource } from "models/user";
 
 type CssRules = 'cell';
 
@@ -47,9 +47,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}>{props.user && `User: ${getUserDisplayName(props.user)}`}</TableCell>
+                    <TableCell className={props.classes.cell}>{it.properties.tail}</TableCell>
                     <TableCell className={props.classes.cell}>{it.headUuid === props.uuid ? 'this' : it.headUuid}</TableCell>
-                    <TableCell className={props.classes.cell}>{JSON.stringify(it.properties)}</TableCell>
+                    <TableCell className={props.classes.cell}>{JSON.stringify(it.properties, (key, value) => { return key === 'tail' ? undefined : value; })}</TableCell>
                 </TableRow>
             )}
         </TableBody>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list