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');
});
});
});
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);
+ });
+ });
})
};
Collections: {
ForwardSlashNameSubstitution: string;
+ ManagedProperties?: {
+ [key: string]: {
+ Function: string,
+ Value: string,
+ Protected?: boolean,
+ }
+ }
};
}
import * as React from 'react';
import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox } from '@material-ui/core';
import { FavoriteStar, PublicFavoriteStar } from '../favorite-star/favorite-star';
-import { ResourceKind, TrashableResource } from '~/models/resource';
+import { Resource, ResourceKind, TrashableResource } from '~/models/resource';
import { ProjectIcon, FilterGroupIcon, CollectionIcon, ProcessIcon, DefaultIcon, ShareIcon, CollectionOldVersionIcon, WorkflowIcon } from '~/components/icon/icon';
import { formatDate, formatFileSize, formatTime } from '~/common/formatters';
import { resourceLabel } from '~/common/labels';
</Typography>;
});
+export const ResponsiblePerson =
+ compose(
+ connect(
+ (state: RootState, props: { uuid: string, parentRef: HTMLElement | null }) => {
+ let responsiblePersonName = null;
+ let responsiblePersonUUID = null;
+ let responsiblePersonProperty = null;
+
+ if (state.auth.config.clusterConfig.Collections.ManagedProperties) {
+ 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 && 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: responsiblePersonUUID, responsiblePersonName, parentRef: props.parentRef };
+ }),
+ withStyles({}, { withTheme: true }))
+ ((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>
+ {uuid}
+ </Typography>;
+ }
+
+ return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
+ {responsiblePersonName} ({uuid})
+ </Typography>;
+ });
+
const renderType = (type: string, subtype: string) =>
<Typography noWrap>
{resourceLabel(type, subtype)}
import { COLLECTION_PANEL_LOAD_FILES, loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
import { Link } from 'react-router-dom';
import { Link as ButtonLink } from '@material-ui/core';
-import { ResourceOwnerWithName } from '~/views-components/data-explorer/renderers';
+import { ResourceOwnerWithName, ResponsiblePerson } from '~/views-components/data-explorer/renderers';
type CssRules = 'root'
| 'button'
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}
label='Owner' linkToUuid={item.ownerUuid}
uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
</Grid>
+ <div data-cy="responsible-person-wrapper" ref={responsiblePersonRef}>
+ <Grid item xs={12} md={12}>
+ <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'
BlobSigningKey: zfhgfenhffzltr9dixws36j1yhksjoll2grmku38mi7yxd66h5j4q9w4jzanezacp8s6q0ro3hxakfye02152hncy6zml2ed0uc
TrustAllContent: true
ForwardSlashNameSubstitution: /
+ ManagedProperties:
+ original_owner_uuid: {Function: original_owner, Protected: true}
Login:
PAM:
Enable: true