1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { LINK_PANEL_ID } from '~/store/link-panel/link-panel-actions';
7 import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
8 import { SortDirection } from '~/components/data-table/data-column';
9 import { DataColumns } from '~/components/data-table/data-table';
10 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
11 import { ResourcesState } from '~/store/resources/resources';
12 import { ShareMeIcon } from '~/components/icon/icon';
13 import { createTree } from '~/models/tree';
15 ResourceLinkUuid, ResourceLinkHead, ResourceLinkTail,
16 ResourceLinkClass, ResourceLinkName }
17 from '~/views-components/data-explorer/renderers';
19 export enum LinkPanelColumnNames {
21 LINK_CLASS = "Link Class",
27 export const linkPanelColumns: DataColumns<string> = [
29 name: LinkPanelColumnNames.NAME,
32 sortDirection: SortDirection.NONE,
33 filters: createTree(),
34 render: uuid => <ResourceLinkName uuid={uuid} />
37 name: LinkPanelColumnNames.LINK_CLASS,
40 filters: createTree(),
41 render: uuid => <ResourceLinkClass uuid={uuid} />
44 name: LinkPanelColumnNames.TAIL,
47 filters: createTree(),
48 render: uuid => <ResourceLinkTail uuid={uuid} />
51 name: LinkPanelColumnNames.HEAD,
54 filters: createTree(),
55 render: uuid => <ResourceLinkHead uuid={uuid} />
58 name: LinkPanelColumnNames.UUID,
61 filters: createTree(),
62 render: uuid => <ResourceLinkUuid uuid={uuid} />
66 export interface LinkPanelRootDataProps {
67 resources: ResourcesState;
70 export interface LinkPanelRootActionProps {
71 onItemClick: (item: string) => void;
72 onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
73 onItemDoubleClick: (item: string) => void;
76 export type LinkPanelRootProps = LinkPanelRootDataProps & LinkPanelRootActionProps;
78 export const LinkPanelRoot = (props: LinkPanelRootProps) => {
81 onRowClick={props.onItemClick}
82 onRowDoubleClick={props.onItemDoubleClick}
83 onContextMenu={props.onContextMenu}
84 contextMenuColumn={true}
87 dataTableDefaultView={
90 messages={['Your link list is empty.']} />