(props.uuid)(state.resources);
+ return resource || { name: '', uuid: '', kind: '', ownerUuid: '' };
+ })(renderWorkflowName);
+
+const getPublicUuid = (uuidPrefix: string) => {
+ return `${uuidPrefix}-tpzed-anonymouspublic`;
+};
+
+// ToDo: share onClick
+export const resourceShare = (uuidPrefix: string, ownerUuid?: string) => {
+ const isPublic = ownerUuid === getPublicUuid(uuidPrefix);
+ return (
+
+ { isPublic &&
+
+ undefined}>
+
+
+
+ }
+
+ );
};
+export const ResourceShare = 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 }) => resourceShare(props.uuidPrefix, props.ownerUuid));
+
+export 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) as GroupContentsResource | undefined;
+ 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 = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
- return {};
+ const resource = getResourceData(props.uuid)(state.resourcesData);
+ return { fileSize: resource ? resource.fileSize : 0 };
})((props: { fileSize?: number }) => renderFileSize(props.fileSize));
export const renderOwner = (owner: string) =>
@@ -80,7 +169,7 @@ export const renderOwner = (owner: string) =>
export const ResourceOwner = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return { owner: resource ? resource.ownerUuid : '' };
})((props: { owner: string }) => renderOwner(props.owner));
@@ -91,17 +180,21 @@ export const renderType = (type: string) =>
export const ResourceType = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return { type: resource ? resource.kind : '' };
})((props: { type: string }) => renderType(props.type));
-export const renderStatus = (item: { status?: string }) =>
-
- {item.status || "-"}
- ;
-
-export const ProcessStatus = connect(
- (state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as ProcessResource | undefined;
- return { status: resource ? resource.state : '-' };
- })((props: { status: string }) => renderType(props.status));
+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}
+ ;
+ });