(props.uuid)(state.resources);
return resource || { linkClass: '' };
})(renderLinkClass);
const renderLinkTail = (dispatch: Dispatch, item: { uuid: string, tailUuid: string, tailKind: string }) => {
const currentLabel = resourceLabel(item.tailKind);
const isUnknow = currentLabel === "Unknown";
return (
{ !isUnknow ? (
renderLink(dispatch, item.tailUuid, currentLabel)
) : (
{item.tailUuid}
)}
);
};
const renderLink = (dispatch: Dispatch, uuid: string, label: string) =>
dispatch(navigateTo(uuid))}>
{label}: {uuid}
;
export const ResourceLinkTail = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return {
item: resource || { uuid: '', tailUuid: '', tailKind: ResourceKind.NONE }
};
})((props: { item: any } & DispatchProp) =>
renderLinkTail(props.dispatch, props.item));
const renderLinkHead = (dispatch: Dispatch, item: { uuid: string, headUuid: string, headKind: ResourceKind }) =>
renderLink(dispatch, item.headUuid, resourceLabel(item.headKind));
export const ResourceLinkHead = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return {
item: resource || { uuid: '', headUuid: '', headKind: ResourceKind.NONE }
};
})((props: { item: any } & DispatchProp) =>
renderLinkHead(props.dispatch, props.item));
export const ResourceLinkUuid = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return resource || { uuid: '' };
})(renderUuid);
// Process Resources
const resourceRunProcess = (dispatch: Dispatch, uuid: string) => {
return (
{uuid &&
dispatch(openRunProcess(uuid))}>
}
);
};
export const ResourceRunProcess = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return {
uuid: resource ? resource.uuid : ''
};
})((props: { uuid: string } & DispatchProp) =>
resourceRunProcess(props.dispatch, props.uuid));
const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => {
if (ownerUuid === getPublicUuid(uuidPrefix)) {
return renderStatus(ResourceStatus.PUBLIC);
} else {
return renderStatus(ResourceStatus.PRIVATE);
}
};
const renderStatus = (status: string) =>
{status};
export const ResourceWorkflowStatus = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
const uuidPrefix = getUuidPrefix(state);
return {
ownerUuid: resource ? resource.ownerUuid : '',
uuidPrefix
};
})((props: { ownerUuid?: string, uuidPrefix: string }) => renderWorkflowStatus(props.uuidPrefix, props.ownerUuid));
export const ResourceLastModifiedDate = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return { date: resource ? resource.modifiedAt : '' };
})((props: { date: string }) => renderDate(props.date));
export const ResourceTrashDate = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return { date: resource ? resource.trashAt : '' };
})((props: { date: string }) => renderDate(props.date));
export const ResourceDeleteDate = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return { date: resource ? resource.deleteAt : '' };
})((props: { date: string }) => renderDate(props.date));
export const renderFileSize = (fileSize?: number) =>
{formatFileSize(fileSize)}
;
export const ResourceFileSize = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResourceData(props.uuid)(state.resourcesData);
return { fileSize: resource ? resource.fileSize : 0 };
})((props: { fileSize?: number }) => renderFileSize(props.fileSize));
const renderOwner = (owner: string) =>
{owner}
;
export const ResourceOwner = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return { owner: resource ? resource.ownerUuid : '' };
})((props: { owner: string }) => renderOwner(props.owner));
const renderType = (type: string) =>
{resourceLabel(type)}
;
export const ResourceType = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
return { type: resource ? resource.kind : '' };
})((props: { type: string }) => renderType(props.type));
export const ProcessStatus = compose(
connect((state: RootState, props: { uuid: string }) => {
return { process: getProcess(props.uuid)(state.resources) };
}),
withStyles({}, { withTheme: true }))
((props: { process?: Process, theme: ArvadosTheme }) => {
const status = props.process ? getProcessStatus(props.process) : "-";
return
{status}
;
});