X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ad5208965b91e020b431cd9d2c1d15ff4b856450..59000cfd2934a50da18b5e70fd14f12abd020eb7:/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 d906a32cbf..9f727049b1 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -3,17 +3,18 @@ // 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 { 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 } from "~/components/data-table/data-table"; -import { DataColumn, SortDirection } from "~/components/data-table/data-column"; +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' | 'rootUserPanel'; +type CssRules = 'searchBox' | "toolbar" | "footer" | "root" | 'moreOptionsButton'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ searchBox: { @@ -28,16 +29,13 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { height: '100%' }, - rootUserPanel: { - height: '100%', - boxShadow: 'none' - }, moreOptionsButton: { padding: 0 } }); interface DataExplorerDataProps { + fetchMode: DataTableFetchMode; items: T[]; itemsAvailable: number; columns: DataColumns; @@ -48,7 +46,13 @@ interface DataExplorerDataProps { contextMenuColumn: boolean; dataTableDefaultView?: React.ReactNode; working?: boolean; - isUserPanel?: boolean; + hideColumnSelector?: boolean; + paperProps?: PaperProps; + actions?: React.ReactNode; + hideSearchInput?: boolean; + header?: React.ReactNode; + paperKey?: string; + currentItemUuid: string; } interface DataExplorerActionProps { @@ -62,6 +66,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; } @@ -79,21 +84,24 @@ export const DataExplorer = withStyles(styles)( columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey, rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch, items, itemsAvailable, onRowClick, onRowDoubleClick, classes, - dataTableDefaultView, isUserPanel + dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput, + paperKey, fetchMode, currentItemUuid, header } = this.props; - return - + return + {(!hideColumnSelector || !hideSearchInput) && + {header &&
{header}
}
- + onSearch={onSearch} />}
- {!isUserPanel && }
-
+
} + currentItemUuid={currentItemUuid} + currentRoute={paperKey} /> - + component="div" /> : }
; @@ -129,6 +142,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) => @@ -142,7 +159,6 @@ export const DataExplorer = withStyles(styles)( name: "Actions", selected: true, configurable: false, - sortDirection: SortDirection.NONE, filters: createTree(), key: "context-actions", render: this.renderContextMenuTrigger