1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import 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';
18 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
19 import { ArvadosTheme } from 'common/custom-theme';
21 type CssRules = "root";
23 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
29 export enum LinkPanelColumnNames {
31 LINK_CLASS = "Link Class",
37 export const linkPanelColumns: DataColumns<string> = [
39 name: LinkPanelColumnNames.NAME,
42 sortDirection: SortDirection.NONE,
43 filters: createTree(),
44 render: uuid => <ResourceLinkName uuid={uuid} />
47 name: LinkPanelColumnNames.LINK_CLASS,
50 filters: createTree(),
51 render: uuid => <ResourceLinkClass uuid={uuid} />
54 name: LinkPanelColumnNames.TAIL,
57 filters: createTree(),
58 render: uuid => <ResourceLinkTail uuid={uuid} />
61 name: LinkPanelColumnNames.HEAD,
64 filters: createTree(),
65 render: uuid => <ResourceLinkHead uuid={uuid} />
68 name: LinkPanelColumnNames.UUID,
71 filters: createTree(),
72 render: uuid => <ResourceLinkUuid uuid={uuid} />
76 export interface LinkPanelRootDataProps {
77 resources: ResourcesState;
80 export interface LinkPanelRootActionProps {
81 onItemClick: (item: string) => void;
82 onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
83 onItemDoubleClick: (item: string) => void;
86 export type LinkPanelRootProps = LinkPanelRootDataProps & LinkPanelRootActionProps & WithStyles<CssRules>;
88 export const LinkPanelRoot = withStyles(styles)((props: LinkPanelRootProps) => {
89 return <div className={props.classes.root}><DataExplorer
91 onRowClick={props.onItemClick}
92 onRowDoubleClick={props.onItemDoubleClick}
93 onContextMenu={props.onContextMenu}
94 contextMenuColumn={true}
97 dataTableDefaultView={
100 messages={['Your link list is empty.']} />