[ARVADOS-WORKBENCH2] updated: 2.1.0-369-g25dc48d4

Git user git at public.arvados.org
Thu May 20 23:40:48 UTC 2021


Summary of changes:
 cypress/integration/collection.spec.js           | 34 ++++++++++++++++++++++--
 src/common/config.ts                             |  4 ++-
 src/views-components/data-explorer/renderers.tsx | 15 ++++++++---
 src/views/collection-panel/collection-panel.tsx  |  2 +-
 4 files changed, 47 insertions(+), 8 deletions(-)

       via  25dc48d4655faf7a6eebdb717e225b77d8ff5c3f (commit)
      from  72470537b4b0a8470b6f5360817cc4039d74978c (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 25dc48d4655faf7a6eebdb717e225b77d8ff5c3f
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Fri May 21 01:39:37 2021 +0200

    16647: Added key search from config and tests
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js
index 15170076..75be94f9 100644
--- a/cypress/integration/collection.spec.js
+++ b/cypress/integration/collection.spec.js
@@ -103,8 +103,7 @@ describe('Collection panel tests', function () {
                 cy.doRequest('GET', `/arvados/v1/collections/${this.testCollection.uuid}`)
                     .its('body').as('collection')
                     .then(function () {
-                        expect(this.collection.properties).to.deep.equal(
-                            { IDTAGCOLORS: 'IDVALCOLORS3' });
+                        expect(this.collection.properties.IDTAGCOLORS).to.equal('IDVALCOLORS3');
                     });
             });
     });
@@ -583,4 +582,35 @@ describe('Collection panel tests', function () {
         cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
         cy.get('[data-cy=breadcrumb-last]').should('contain', collName);
     });
+
+    it.only('shows responsible person for collection if available', () => {
+        cy.createCollection(adminUser.token, {
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+            owner_uuid: activeUser.user.uuid,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        })
+            .as('testCollection1');
+
+        cy.createCollection(adminUser.token, {
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+            owner_uuid: adminUser.user.uuid,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+        })
+            .as('testCollection2').then(function (testCollection2) {
+                cy.shareWith(adminUser.token, activeUser.user.uuid, testCollection2.uuid, 'can_write');
+            });
+
+        cy.getAll('@testCollection1', '@testCollection2')
+            .then(function ([testCollection1, testCollection2]) {
+                cy.loginAs(activeUser);
+
+                cy.goToPath(`/collections/${testCollection1.uuid}`);
+                cy.get('[data-cy=responsible-person-wrapper]')
+                    .contains(activeUser.user.uuid);
+
+                cy.goToPath(`/collections/${testCollection2.uuid}`);
+                cy.get('[data-cy=responsible-person-wrapper]')
+                    .contains(adminUser.user.uuid);
+            });
+    });
 })
diff --git a/src/common/config.ts b/src/common/config.ts
index 2a02f8c2..5d943595 100644
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@ -84,8 +84,10 @@ export interface ClusterConfigJSON {
     Collections: {
         ForwardSlashNameSubstitution: string;
         ManagedProperties?: {
-            responsible_person_uuid?: {
+            [key: string]: {
                 Function: string,
+                Value: string,
+                Protected?: boolean,
             }
         }
     };
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index ed8e393f..ee40dd39 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -477,14 +477,21 @@ export const ResponsiblePerson =
                 let responsiblePersonProperty = null;
 
                 if (state.auth.config.clusterConfig.Collections.ManagedProperties) {
-                    if (state.auth.config.clusterConfig.Collections.ManagedProperties.responsible_person_uuid) {
-                        responsiblePersonProperty = state.auth.config.clusterConfig.Collections.ManagedProperties.responsible_person_uuid.Function;
+                    let index = 0;
+                    const keys = Object.keys(state.auth.config.clusterConfig.Collections.ManagedProperties);
+
+                    while (!responsiblePersonProperty && keys[index]) {
+                        const key = keys[index];
+                        if (state.auth.config.clusterConfig.Collections.ManagedProperties[key].Function === 'original_owner') {
+                            responsiblePersonProperty = key;
+                        }
+                        index++;
                     }
                 }
 
                 let resource: Resource | undefined = getResource<GroupContentsResource & UserResource>(props.uuid)(state.resources);
 
-                while (resource && resource.kind !== ResourceKind.USER && resource.kind === ResourceKind.COLLECTION && responsiblePersonProperty) {
+                while (resource && resource.kind !== ResourceKind.USER && responsiblePersonProperty) {
                     responsiblePersonUUID = (resource as CollectionResource).properties[responsiblePersonProperty];
                     resource = getResource<GroupContentsResource & UserResource>(responsiblePersonUUID)(state.resources);
                 }
@@ -506,7 +513,7 @@ export const ResponsiblePerson =
                 parentRef.style.display = 'block';
             }
 
-            if (responsiblePersonName === '') {
+            if (!responsiblePersonName) {
                 return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
                     {uuid}
                 </Typography>;
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index d57afd47..81bd1ebc 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -302,7 +302,7 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
                 label='Owner' linkToUuid={item.ownerUuid}
                 uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
         </Grid>
-        <div ref={responsiblePersonRef}>
+        <div data-cy="responsible-person-wrapper" ref={responsiblePersonRef}>
             <Grid item xs={12} md={mdSize}>
                 <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                     label='Responsible person' linkToUuid={item.ownerUuid}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list