1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { ShareMeIcon } from '~/components/icon/icon';
7 import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
8 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
9 import { COMPUTE_NODE_PANEL_ID } from '~/store/compute-nodes/compute-nodes-actions';
10 import { DataColumns } from '~/components/data-table/data-table';
11 import { SortDirection } from '~/components/data-table/data-column';
12 import { createTree } from '~/models/tree';
14 ComputeNodeInfo, ComputeNodeDomain, ComputeNodeHostname, ComputeNodeJobUuid,
15 ComputeNodeFirstPingAt, ComputeNodeLastPingAt, ComputeNodeIpAddress, CommonUuid
16 } from '~/views-components/data-explorer/renderers';
17 import { ResourcesState } from '~/store/resources/resources';
19 export enum ComputeNodePanelColumnNames {
23 FIRST_PING_AT = 'First ping at',
24 HOSTNAME = 'Hostname',
25 IP_ADDRESS = 'IP Address',
27 LAST_PING_AT = 'Last ping at'
30 export const computeNodePanelColumns: DataColumns<string> = [
32 name: ComputeNodePanelColumnNames.INFO,
35 filters: createTree(),
36 render: uuid => <ComputeNodeInfo uuid={uuid} />
39 name: ComputeNodePanelColumnNames.UUID,
42 sortDirection: SortDirection.NONE,
43 filters: createTree(),
44 render: uuid => <CommonUuid uuid={uuid} />
47 name: ComputeNodePanelColumnNames.DOMAIN,
50 filters: createTree(),
51 render: uuid => <ComputeNodeDomain uuid={uuid} />
54 name: ComputeNodePanelColumnNames.FIRST_PING_AT,
57 filters: createTree(),
58 render: uuid => <ComputeNodeFirstPingAt uuid={uuid} />
61 name: ComputeNodePanelColumnNames.HOSTNAME,
64 filters: createTree(),
65 render: uuid => <ComputeNodeHostname uuid={uuid} />
68 name: ComputeNodePanelColumnNames.IP_ADDRESS,
71 filters: createTree(),
72 render: uuid => <ComputeNodeIpAddress uuid={uuid} />
75 name: ComputeNodePanelColumnNames.JOB,
78 filters: createTree(),
79 render: uuid => <ComputeNodeJobUuid uuid={uuid} />
82 name: ComputeNodePanelColumnNames.LAST_PING_AT,
85 filters: createTree(),
86 render: uuid => <ComputeNodeLastPingAt uuid={uuid} />
90 const DEFAULT_MESSAGE = 'Your compute node list is empty.';
92 export interface ComputeNodePanelRootActionProps {
93 onItemClick: (item: string) => void;
94 onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
95 onItemDoubleClick: (item: string) => void;
98 export interface ComputeNodePanelRootDataProps {
99 resources: ResourcesState;
102 type ComputeNodePanelRootProps = ComputeNodePanelRootActionProps & ComputeNodePanelRootDataProps;
104 export const ComputeNodePanelRoot = (props: ComputeNodePanelRootProps) => {
106 id={COMPUTE_NODE_PANEL_ID}
107 onRowClick={props.onItemClick}
108 onRowDoubleClick={props.onItemDoubleClick}
109 onContextMenu={props.onContextMenu}
110 contextMenuColumn={true}
113 dataTableDefaultView={
114 <DataTableDefaultView
116 messages={[DEFAULT_MESSAGE]} />