Feature #14602_admin_compute_node_paginations
Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>
import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
import { LinkResource } from '~/models/link';
import { navigateTo } from '~/store/navigation/navigation-action';
import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
import { LinkResource } from '~/models/link';
import { navigateTo } from '~/store/navigation/navigation-action';
-import { withResource, getDataFromResource } from './with-resources';
+import { withResource, getDataFromResource, withResourceData } from '~/views-components/data-explorer/with-resources';
const renderName = (item: { name: string; uuid: string, kind: string }) =>
<Grid container alignItems="center" wrap="nowrap" spacing={16}>
const renderName = (item: { name: string; uuid: string, kind: string }) =>
<Grid container alignItems="center" wrap="nowrap" spacing={16}>
return <Typography>{JSON.stringify(data, null, 4)}</Typography>;
};
return <Typography>{JSON.stringify(data, null, 4)}</Typography>;
};
-export const ComputeNodeInfo = withResource(({ resource }) => renderNodeInfo(getDataFromResource('info', resource)));
+export const ComputeNodeInfo = withResourceData('info', renderNodeInfo);
-export const ComputeNodeUuid = withResource(({ resource }) => renderNodeData(getDataFromResource('uuid', resource)));
+export const ComputeNodeUuid = withResourceData('uuid', renderNodeData);
-export const ComputeNodeDomain = withResource(({ resource }) => renderNodeData(getDataFromResource('domain', resource)));
+export const ComputeNodeDomain = withResourceData('domain', renderNodeData);
-export const ComputeNodeFirstPingAt = withResource(({ resource }) => renderNodeDate(getDataFromResource('firstPingAt', resource)));
+export const ComputeNodeFirstPingAt = withResourceData('firstPingAt', renderNodeDate);
-export const ComputeNodeHostname = withResource(({ resource }) => renderNodeData(getDataFromResource('hostname', resource)));
+export const ComputeNodeHostname = withResourceData('hostname', renderNodeData);
-export const ComputeNodeIpAddress = withResource(({ resource }) => renderNodeData(getDataFromResource('ipAddress', resource)));
+export const ComputeNodeIpAddress = withResourceData('ipAddress', renderNodeData);
-export const ComputeNodeJobUuid = withResource(({ resource }) => renderNodeData(getDataFromResource('jobUuid', resource)));
+export const ComputeNodeJobUuid = withResourceData('jobUuid', renderNodeData);
-export const ComputeNodeLastPingAt = withResource(({ resource }) => renderNodeDate(getDataFromResource('lastPingAt', resource)));
+export const ComputeNodeLastPingAt = withResourceData('lastPingAt', renderNodeDate);
// Links Resources
const renderLinkName = (item: { name: string }) =>
// Links Resources
const renderLinkName = (item: { name: string }) =>
export const getDataFromResource = (property: string, resource?: Resource) => {
return resource && resource[property] ? resource[property] : '(none)';
};
export const getDataFromResource = (property: string, resource?: Resource) => {
return resource && resource[property] ? resource[property] : '(none)';
};
+
+export const withResourceData = (property: string, render: (data: any) => React.ReactElement<any>) =>
+ withResource(({ resource }) => render(getDataFromResource(property, resource)));