[ARVADOS-WORKBENCH2] updated: 2.1.0-368-g72470537

Git user git at public.arvados.org
Wed May 19 19:06:44 UTC 2021


Summary of changes:
 src/common/config.ts                             |  5 ++++
 src/views-components/data-explorer/renderers.tsx | 31 ++++++++++++++++++------
 src/views/collection-panel/collection-panel.tsx  | 13 ++++++----
 3 files changed, 37 insertions(+), 12 deletions(-)

       via  72470537b4b0a8470b6f5360817cc4039d74978c (commit)
      from  c54ac3ea19122f4ff4172f08f40be56f1482a52e (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 72470537b4b0a8470b6f5360817cc4039d74978c
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Wed May 19 21:06:03 2021 +0200

    16647: Added responsible person property check
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/src/common/config.ts b/src/common/config.ts
index 146ca90a..2a02f8c2 100644
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@ -83,6 +83,11 @@ export interface ClusterConfigJSON {
     };
     Collections: {
         ForwardSlashNameSubstitution: string;
+        ManagedProperties?: {
+            responsible_person_uuid?: {
+                Function: string,
+            }
+        }
     };
 }
 
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 71d6f824..ed8e393f 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -471,23 +471,40 @@ export const ResourceOwnerWithName =
 export const ResponsiblePerson =
     compose(
         connect(
-            (state: RootState, props: { uuid: string }) => {
-                let responsiblePersonName = '';
+            (state: RootState, props: { uuid: string, parentRef: HTMLElement | null }) => {
+                let responsiblePersonName = null;
+                let responsiblePersonUUID = null;
+                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 resource: Resource | undefined = getResource<GroupContentsResource & UserResource>(props.uuid)(state.resources);
 
-                while (resource && resource.kind !== ResourceKind.USER) {
-                    resource = getResource<GroupContentsResource & UserResource>(resource.ownerUuid)(state.resources);
+                while (resource && resource.kind !== ResourceKind.USER && resource.kind === ResourceKind.COLLECTION && responsiblePersonProperty) {
+                    responsiblePersonUUID = (resource as CollectionResource).properties[responsiblePersonProperty];
+                    resource = getResource<GroupContentsResource & UserResource>(responsiblePersonUUID)(state.resources);
                 }
 
                 if (resource && resource.kind === ResourceKind.USER) {
                     responsiblePersonName = getUserFullname(resource as UserResource) || (resource as GroupContentsResource).name;
                 }
 
-                return { uuid: props.uuid, responsiblePersonName };
+                return { uuid: responsiblePersonUUID, responsiblePersonName, parentRef: props.parentRef };
             }),
         withStyles({}, { withTheme: true }))
-        ((props: { uuid: string, responsiblePersonName: string, theme: ArvadosTheme }) => {
-            const { uuid, responsiblePersonName, theme } = props;
+        ((props: { uuid: string | null, responsiblePersonName: string, parentRef: HTMLElement | null, theme: ArvadosTheme }) => {
+            const { uuid, responsiblePersonName, parentRef, theme } = props;
+
+            if (!uuid && parentRef) {
+                parentRef.style.display = 'none';
+                return null;
+            } else if (parentRef) {
+                parentRef.style.display = 'block';
+            }
 
             if (responsiblePersonName === '') {
                 return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 45053932..d57afd47 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -285,6 +285,7 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
     const isOldVersion = item && item.currentVersionUuid !== item.uuid;
     const mdSize = props.twoCol ? 6 : 12;
     const showVersionBrowser = props.showVersionBrowser;
+    const responsiblePersonRef = React.useRef(null);
     return <Grid container>
         <Grid item xs={12} md={mdSize}>
             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
@@ -301,11 +302,13 @@ export const CollectionDetailsAttributes = (props: { item: CollectionResource, t
                 label='Owner' linkToUuid={item.ownerUuid}
                 uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
         </Grid>
-        <Grid item xs={12} md={mdSize}>
-            <DetailsAttribute classLabel={classes.label} classValue={classes.value}
-                label='Responsible person' linkToUuid={item.ownerUuid}
-                uuidEnhancer={(uuid: string) => <ResponsiblePerson uuid={item.ownerUuid} />} />
-        </Grid>
+        <div ref={responsiblePersonRef}>
+            <Grid item xs={12} md={mdSize}>
+                <DetailsAttribute classLabel={classes.label} classValue={classes.value}
+                    label='Responsible person' linkToUuid={item.ownerUuid}
+                    uuidEnhancer={(uuid: string) => <ResponsiblePerson uuid={item.uuid} parentRef={responsiblePersonRef.current} />} />
+            </Grid>
+        </div>
         <Grid item xs={12} md={mdSize}>
             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                 label='Head version'

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list