import { WorkflowResource } from '~/models/workflow';
import { ResourceStatus } from '~/views/workflow-panel/workflow-panel-view';
import { getUuidPrefix, openRunProcess } from '~/store/workflow-panel/workflow-panel-actions';
-import { getResourceData } from "~/store/resources-data/resources-data";
import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
import { UserResource } from '~/models/user';
import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
import { LinkResource } from '~/models/link';
import { navigateTo } from '~/store/navigation/navigation-action';
import { withResourceData } from '~/views-components/data-explorer/with-resources';
+import { CollectionResource } from '~/models/collection';
+import { IllegalNamingWarning } from '~/components/warning/warning';
const renderName = (dispatch: Dispatch, item: { name: string; uuid: string, kind: string }) =>
<Grid container alignItems="center" wrap="nowrap" spacing={16}>
</Grid>
<Grid item>
<Typography color="primary" style={{ width: 'auto', cursor: 'pointer' }} onClick={() => dispatch<any>(navigateTo(item.uuid))}>
+ { item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
+ ? <IllegalNamingWarning name={item.name} />
+ : null }
{item.name}
</Typography>
</Grid>
export const ResourceCluster = (props: { uuid: string }) => {
const CLUSTER_ID_LENGTH = 5;
- const pos = props.uuid.indexOf('-');
+ const pos = props.uuid.length > CLUSTER_ID_LENGTH ? props.uuid.indexOf('-') : 5;
const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substr(0, pos) : '';
- const ci = pos >= CLUSTER_ID_LENGTH ? (props.uuid.charCodeAt(0) + props.uuid.charCodeAt(1)) % clusterColors.length : 0;
- return <Typography>
- <div style={{
- backgroundColor: clusterColors[ci][0],
- color: clusterColors[ci][1],
- padding: "2px 7px",
- borderRadius: 3
- }}>{clusterId}</div>
- </Typography>;
+ const ci = pos >= CLUSTER_ID_LENGTH ? (((((
+ (props.uuid.charCodeAt(0) * props.uuid.charCodeAt(1))
+ + props.uuid.charCodeAt(2))
+ * props.uuid.charCodeAt(3))
+ + props.uuid.charCodeAt(4))) % clusterColors.length) : 0;
+ return <span style={{
+ backgroundColor: clusterColors[ci][0],
+ color: clusterColors[ci][1],
+ padding: "2px 7px",
+ borderRadius: 3
+ }}>{clusterId}</span>;
};
export const ComputeNodeInfo = withResourceData('info', renderNodeInfo);
export const ResourceFileSize = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResourceData(props.uuid)(state.resourcesData);
- return { fileSize: resource ? resource.fileSize : 0 };
+ const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+ return { fileSize: resource ? resource.fileSizeTotal : 0 };
})((props: { fileSize?: number }) => renderFileSize(props.fileSize));
const renderOwner = (owner: string) =>