X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1bbdd9c70d0099e0bf46b3c1ac55e423e3406314..38d27e9783f7f760cee84cc225e86144069848c4:/src/components/data-explorer/data-explorer.tsx diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index cb979c7bd2..a38d0ed65a 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -2,18 +2,19 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; -import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip } from '@material-ui/core'; -import { ColumnSelector } from "../column-selector/column-selector"; -import { DataTable, DataColumns } from "../data-table/data-table"; -import { DataColumn, SortDirection } from "../data-table/data-column"; -import { SearchInput } from '../search-input/search-input'; -import { ArvadosTheme } from "~/common/custom-theme"; -import { createTree } from '~/models/tree'; -import { DataTableFilters } from '../data-table-filters/data-table-filters-tree'; -import { MoreOptionsIcon } from '~/components/icon/icon'; +import React from 'react'; +import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip, Button } from '@material-ui/core'; +import { ColumnSelector } from "components/column-selector/column-selector"; +import { DataTable, DataColumns, DataTableFetchMode } from "components/data-table/data-table"; +import { DataColumn } from "components/data-table/data-column"; +import { SearchInput } from 'components/search-input/search-input'; +import { ArvadosTheme } from "common/custom-theme"; +import { createTree } from 'models/tree'; +import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree'; +import { MoreOptionsIcon } from 'components/icon/icon'; +import { PaperProps } from '@material-ui/core/Paper'; -type CssRules = 'searchBox' | "toolbar" | "footer" | "root" | 'moreOptionsButton'; +type CssRules = 'searchBox' | "toolbar" | "toolbarUnderTitle" | "footer" | "root" | 'moreOptionsButton' | 'title'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ searchBox: { @@ -22,6 +23,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { paddingTop: theme.spacing.unit * 2 }, + toolbarUnderTitle: { + paddingTop: 0 + }, footer: { overflow: 'auto' }, @@ -30,13 +34,20 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, moreOptionsButton: { padding: 0 + }, + title: { + paddingLeft: theme.spacing.unit * 3, + paddingTop: theme.spacing.unit * 3, + fontSize: '18px' } }); interface DataExplorerDataProps { + fetchMode: DataTableFetchMode; items: T[]; itemsAvailable: number; columns: DataColumns; + searchLabel?: string; searchValue: string; rowsPerPage: number; rowsPerPageOptions: number[]; @@ -44,6 +55,13 @@ interface DataExplorerDataProps { contextMenuColumn: boolean; dataTableDefaultView?: React.ReactNode; working?: boolean; + hideColumnSelector?: boolean; + paperProps?: PaperProps; + actions?: React.ReactNode; + hideSearchInput?: boolean; + title?: React.ReactNode; + paperKey?: string; + currentItemUuid: string; } interface DataExplorerActionProps { @@ -57,6 +75,7 @@ interface DataExplorerActionProps { onFiltersChange: (filters: DataTableFilters, column: DataColumn) => void; onChangePage: (page: number) => void; onChangeRowsPerPage: (rowsPerPage: number) => void; + onLoadMore: (page: number) => void; extractKey?: (item: T) => React.Key; } @@ -72,23 +91,27 @@ export const DataExplorer = withStyles(styles)( render() { const { columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey, - rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch, + rowsPerPage, rowsPerPageOptions, onColumnToggle, searchLabel, searchValue, onSearch, items, itemsAvailable, onRowClick, onRowDoubleClick, classes, - dataTableDefaultView + dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput, + paperKey, fetchMode, currentItemUuid, title } = this.props; - return - + return + {title &&
{title}
} + {(!hideColumnSelector || !hideSearchInput) &&
- + onSearch={onSearch} />}
- + onColumnToggle={onColumnToggle} />}
-
+
} + currentItemUuid={currentItemUuid} + currentRoute={paperKey} /> - + component="div" /> : }
; @@ -124,6 +152,10 @@ export const DataExplorer = withStyles(styles)( this.props.onChangeRowsPerPage(parseInt(event.target.value, 10)); } + loadMore = () => { + this.props.onLoadMore(this.props.page + 1); + } + renderContextMenuTrigger = (item: T) => @@ -137,7 +169,6 @@ export const DataExplorer = withStyles(styles)( name: "Actions", selected: true, configurable: false, - sortDirection: SortDirection.NONE, filters: createTree(), key: "context-actions", render: this.renderContextMenuTrigger