+export const ResponsiblePerson =
+ compose(
+ connect(
+ (state: RootState, props: { uuid: string }) => {
+ let responsiblePersonName = '';
+ 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);
+ }
+
+ if (resource && resource.kind === ResourceKind.USER) {
+ responsiblePersonName = getUserFullname(resource as UserResource) || (resource as GroupContentsResource).name;
+ }
+
+ return { uuid: props.uuid, responsiblePersonName };
+ }),
+ withStyles({}, { withTheme: true }))
+ ((props: { uuid: string, responsiblePersonName: string, theme: ArvadosTheme }) => {
+ const { uuid, responsiblePersonName, theme } = props;
+
+ 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>;
+ });
+