X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/a0a42fd73533f2f17844cd9343519c34043fda71..2563eaaa00e5ffb77981fbb8cc1bdd37fb2a3ca6:/src/components/data-explorer/data-explorer.tsx?ds=inline

diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 5faaabcb..e808351b 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton } from '@material-ui/core';
+import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip } from '@material-ui/core';
 import MoreVertIcon from "@material-ui/icons/MoreVert";
 import { ColumnSelector } from "../column-selector/column-selector";
 import { DataTable, DataColumns } from "../data-table/data-table";
@@ -11,10 +11,8 @@ import { DataColumn, SortDirection } from "../data-table/data-column";
 import { DataTableFilterItem } from '../data-table-filters/data-table-filters';
 import { SearchInput } from '../search-input/search-input';
 import { ArvadosTheme } from "~/common/custom-theme";
-import { DefaultView } from '../default-view/default-view';
-import { IconType } from '../icon/icon';
 
-type CssRules = 'searchBox' | "toolbar" | 'defaultRoot' | 'defaultMessage' | 'defaultIcon';
+type CssRules = 'searchBox' | "toolbar" | "footer" | "root";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     searchBox: {
@@ -23,18 +21,11 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     toolbar: {
         paddingTop: theme.spacing.unit * 2
     },
-    defaultRoot: {
-        position: 'absolute',
-        width: '80%',
-        left: '50%',
-        top: '50%',
-        transform: 'translate(-50%, -50%)'
+    footer: {
+        overflow: 'auto'
     },
-    defaultMessage: {
-        fontSize: '1.75rem',
-    },
-    defaultIcon: {
-        fontSize: '6rem'
+    root: {
+        height: '100%'
     }
 });
 
@@ -46,9 +37,9 @@ interface DataExplorerDataProps<T> {
     rowsPerPage: number;
     rowsPerPageOptions: number[];
     page: number;
-    defaultIcon: IconType;
-    defaultMessages: string[];
     contextMenuColumn: boolean;
+    dataTableDefaultView?: React.ReactNode;
+    working?: boolean;
 }
 
 interface DataExplorerActionProps<T> {
@@ -76,56 +67,49 @@ export const DataExplorer = withStyles(styles)(
         }
         render() {
             const {
-                columns, onContextMenu, onFiltersChange, onSortToggle, extractKey,
+                columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey,
                 rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch,
-                items, itemsAvailable, onRowClick, onRowDoubleClick, defaultIcon, defaultMessages, classes
+                items, itemsAvailable, onRowClick, onRowDoubleClick, classes,
+                dataTableDefaultView
             } = this.props;
-            return <div>
-                { items.length > 0 ? (
-                    <Paper>
-                        <Toolbar className={classes.toolbar}>
-                            <Grid container justify="space-between" wrap="nowrap" alignItems="center">
-                                <div className={classes.searchBox}>
-                                    <SearchInput
-                                        value={searchValue}
-                                        onSearch={onSearch}/>
-                                </div>
-                                <ColumnSelector
-                                    columns={columns}
-                                    onColumnToggle={onColumnToggle}/>
-                            </Grid>
-                        </Toolbar>
-                        <DataTable
-                            columns={this.props.contextMenuColumn ? [...columns, this.contextMenuColumn] : columns}
-                            items={items}
-                            onRowClick={(_, item: T) => onRowClick(item)}
-                            onContextMenu={onContextMenu}
-                            onRowDoubleClick={(_, item: T) => onRowDoubleClick(item)}
-                            onFiltersChange={onFiltersChange}
-                            onSortToggle={onSortToggle}
-                            extractKey={extractKey}/>
-                        <Toolbar>
-                            <Grid container justify="flex-end">
-                                <TablePagination
-                                    count={itemsAvailable}
-                                    rowsPerPage={rowsPerPage}
-                                    rowsPerPageOptions={rowsPerPageOptions}
-                                    page={this.props.page}
-                                    onChangePage={this.changePage}
-                                    onChangeRowsPerPage={this.changeRowsPerPage}
-                                    component="div" />
-                            </Grid>
-                        </Toolbar>
-                    </Paper>
-                ) : (
-                    <DefaultView
-                        classRoot={classes.defaultRoot}
-                        icon={defaultIcon}
-                        classIcon={classes.defaultIcon}
-                        messages={defaultMessages}
-                        classMessage={classes.defaultMessage} />
-                )}
-            </div>;
+            return <Paper className={classes.root}>
+                <Toolbar className={classes.toolbar}>
+                    <Grid container justify="space-between" wrap="nowrap" alignItems="center">
+                        <div className={classes.searchBox}>
+                            <SearchInput
+                                value={searchValue}
+                                onSearch={onSearch} />
+                        </div>
+                        <ColumnSelector
+                            columns={columns}
+                            onColumnToggle={onColumnToggle} />
+                    </Grid>
+                </Toolbar>
+                <DataTable
+                    columns={this.props.contextMenuColumn ? [...columns, this.contextMenuColumn] : columns}
+                    items={items}
+                    onRowClick={(_, item: T) => onRowClick(item)}
+                    onContextMenu={onContextMenu}
+                    onRowDoubleClick={(_, item: T) => onRowDoubleClick(item)}
+                    onFiltersChange={onFiltersChange}
+                    onSortToggle={onSortToggle}
+                    extractKey={extractKey}
+                    working={working}
+                    defaultView={dataTableDefaultView}
+                />
+                <Toolbar className={classes.footer}>
+                    <Grid container justify="flex-end">
+                        <TablePagination
+                            count={itemsAvailable}
+                            rowsPerPage={rowsPerPage}
+                            rowsPerPageOptions={rowsPerPageOptions}
+                            page={this.props.page}
+                            onChangePage={this.changePage}
+                            onChangeRowsPerPage={this.changeRowsPerPage}
+                            component="div" />
+                    </Grid>
+                </Toolbar>
+            </Paper>;
         }
 
         changePage = (event: React.MouseEvent<HTMLButtonElement>, page: number) => {
@@ -138,9 +122,11 @@ export const DataExplorer = withStyles(styles)(
 
         renderContextMenuTrigger = (item: T) =>
             <Grid container justify="flex-end">
-                <IconButton onClick={event => this.props.onContextMenu(event, item)}>
-                    <MoreVertIcon/>
-                </IconButton>
+                <Tooltip title="More options">
+                    <IconButton onClick={event => this.props.onContextMenu(event, item)}>
+                        <MoreVertIcon />
+                    </IconButton>
+                </Tooltip>
             </Grid>
 
         contextMenuColumn: DataColumn<any> = {
