From: Lucas Di Pentima Date: Tue, 19 Oct 2021 14:56:07 +0000 (-0300) Subject: 18128: Fixes app's main content layouts. X-Git-Tag: 2.4.0~25^2~12 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/770ffecbecc120d200bebaaf4606dfc055c64008 18128: Fixes app's main content layouts. Moves the height calculation from the DataExplorer/DataTable component combo to the outer layers so that DataExplorer can be used as one of many data panels inside a view. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index 7fce77de..cf14303d 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -15,7 +15,7 @@ import { CloseIcon, MaximizeIcon, MoreOptionsIcon } from 'components/icon/icon'; import { PaperProps } from '@material-ui/core/Paper'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; -type CssRules = 'searchBox' | "toolbar" | "toolbarUnderTitle" | "footer" | "root" | 'moreOptionsButton' | 'title'; +type CssRules = 'searchBox' | "toolbar" | "toolbarUnderTitle" | "footer" | "root" | 'moreOptionsButton' | 'title' | 'dataTable' | 'container'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ searchBox: { @@ -32,7 +32,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ overflow: 'auto' }, root: { - height: '100%' + height: '100%', }, moreOptionsButton: { padding: 0 @@ -41,7 +41,14 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingLeft: theme.spacing.unit * 3, paddingTop: theme.spacing.unit * 3, fontSize: '18px' - } + }, + dataTable: { + height: '100%', + overflow: 'auto', + }, + container: { + height: '100%', + }, }); interface DataExplorerDataProps { @@ -101,8 +108,9 @@ export const DataExplorer = withStyles(styles)( doHidePanel, doMaximizePanel, panelName, panelMaximized } = this.props; return - {title &&
{title}
} - {(!hideColumnSelector || !hideSearchInput) && + + {title && {title}} + {(!hideColumnSelector || !hideSearchInput) &&
{!hideSearchInput && } - } - } + onRowClick(item)} @@ -136,8 +144,8 @@ export const DataExplorer = withStyles(styles)( working={working} defaultView={dataTableDefaultView} currentItemUuid={currentItemUuid} - currentRoute={paperKey} /> - + currentRoute={paperKey} /> + {fetchMode === DataTableFetchMode.PAGINATED ? Load more} - + + ; } diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx index 0c84f642..de52d365 100644 --- a/src/components/data-table/data-table.tsx +++ b/src/components/data-table/data-table.tsx @@ -39,13 +39,11 @@ type CssRules = "tableBody" | "root" | "content" | "noItemsInfo" | 'tableCell' | const styles: StyleRulesCallback = (theme: Theme) => ({ root: { - overflowX: 'auto', - overflowY: 'auto', - height: 'calc(100vh - 280px)', + width: '100%', }, content: { display: 'inline-block', - width: '100%' + width: '100%', }, tableBody: { background: theme.palette.background.paper diff --git a/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx b/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx index 703bbec5..8f87cb26 100644 --- a/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx +++ b/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx @@ -4,10 +4,10 @@ import React from 'react'; import { - StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Grid, Tooltip, IconButton + StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { HelpIcon, ShareMeIcon } from 'components/icon/icon'; +import { ShareMeIcon } from 'components/icon/icon'; import { createTree } from 'models/tree'; import { DataColumns } from 'components/data-table/data-table'; import { SortDirection } from 'components/data-table/data-column'; @@ -20,21 +20,11 @@ import { TokenLastUsedAt, TokenLastUsedByIpAddress, TokenScopes, TokenUserId } from 'views-components/data-explorer/renderers'; -type CssRules = 'card' | 'cardContent' | 'helpIconGrid'; +type CssRules = 'root'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ - card: { + root: { width: '100%', - overflow: 'auto' - }, - cardContent: { - padding: 0, - '&:last-child': { - paddingBottom: 0 - } - }, - helpIconGrid: { - textAlign: 'right' } }); @@ -132,7 +122,6 @@ export interface ApiClientAuthorizationPanelRootActionProps { onItemClick: (item: string) => void; onContextMenu: (event: React.MouseEvent, item: string) => void; onItemDoubleClick: (item: string) => void; - openHelpDialog: () => void; } export interface ApiClientAuthorizationPanelRootDataProps { @@ -143,33 +132,18 @@ type ApiClientAuthorizationPanelRootProps = ApiClientAuthorizationPanelRootActio & ApiClientAuthorizationPanelRootDataProps & WithStyles; export const ApiClientAuthorizationPanelRoot = withStyles(styles)( - ({ classes, onItemDoubleClick, onItemClick, onContextMenu, openHelpDialog }: ApiClientAuthorizationPanelRootProps) => - - - - - - - - - - - - - } /> - - - - + ({ classes, onItemDoubleClick, onItemClick, onContextMenu }: ApiClientAuthorizationPanelRootProps) => +
+ } />
); \ No newline at end of file diff --git a/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx b/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx index 89254dcc..9604bf50 100644 --- a/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx +++ b/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx @@ -11,7 +11,6 @@ import { ApiClientAuthorizationPanelRootActionProps } from 'views/api-client-authorization-panel/api-client-authorization-panel-root'; import { openApiClientAuthorizationContextMenu } from 'store/context-menu/context-menu-actions'; -import { openApiClientAuthorizationsHelpDialog } from 'store/api-client-authorizations/api-client-authorizations-actions'; const mapStateToProps = (state: RootState): ApiClientAuthorizationPanelRootDataProps => { return { @@ -25,9 +24,6 @@ const mapDispatchToProps = (dispatch: Dispatch): ApiClientAuthorizationPanelRoot }, onItemClick: (resourceUuid: string) => { return; }, onItemDoubleClick: uuid => { return; }, - openHelpDialog: () => { - dispatch(openApiClientAuthorizationsHelpDialog()); - } }); export const ApiClientAuthorizationPanel = connect(mapStateToProps, mapDispatchToProps)(ApiClientAuthorizationPanelRoot); \ No newline at end of file diff --git a/src/views/collection-content-address-panel/collection-content-address-panel.tsx b/src/views/collection-content-address-panel/collection-content-address-panel.tsx index 88638085..f1278049 100644 --- a/src/views/collection-content-address-panel/collection-content-address-panel.tsx +++ b/src/views/collection-content-address-panel/collection-content-address-panel.tsx @@ -7,7 +7,6 @@ import { StyleRulesCallback, WithStyles, withStyles, - Grid, Button } from '@material-ui/core'; import { CollectionIcon } from 'components/icon/icon'; @@ -38,7 +37,7 @@ import { getResource, ResourcesState } from 'store/resources/resources'; import { RootState } from 'store/store'; import { CollectionResource } from 'models/collection'; -type CssRules = 'backLink' | 'backIcon' | 'card' | 'title' | 'iconHeader' | 'link'; +type CssRules = 'backLink' | 'backIcon' | 'root' | 'content'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ backLink: { @@ -53,24 +52,13 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ backIcon: { marginRight: theme.spacing.unit }, - card: { - width: '100%' + root: { + width: '100%', }, - title: { - color: theme.palette.grey["700"] + content: { + // reserve space for the content address bar + height: `calc(100% - ${theme.spacing.unit * 7}px)`, }, - iconHeader: { - fontSize: '1.875rem', - color: theme.customs.colors.green700 - }, - link: { - fontSize: '0.875rem', - color: theme.palette.primary.main, - textAlign: 'right', - '&:hover': { - cursor: 'pointer' - } - } }); enum CollectionContentAddressPanelColumnNames { @@ -162,14 +150,14 @@ export const CollectionsContentAddressPanel = withStyles(styles)( connect(mapStateToProps, mapDispatchToProps)( class extends React.Component> { render() { - return + return
- - } />; - ; + } />
+
; } } ) diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx index 404baeb9..0b6532c1 100644 --- a/src/views/favorite-panel/favorite-panel.tsx +++ b/src/views/favorite-panel/favorite-panel.tsx @@ -41,7 +41,7 @@ import { getProperty } from 'store/properties/properties'; import { PROJECT_PANEL_CURRENT_UUID } from 'store/project-panel/project-panel-action'; import { CollectionResource } from 'models/collection'; -type CssRules = "toolbar" | "button"; +type CssRules = "toolbar" | "button" | "root"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { @@ -51,6 +51,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ button: { marginLeft: theme.spacing.unit }, + root: { + width: '100%', + }, }); export enum FavoritePanelColumnNames { @@ -176,7 +179,7 @@ export const FavoritePanel = withStyles(styles)( } render() { - return - } />; + } />; } } ) diff --git a/src/views/groups-panel/groups-panel.tsx b/src/views/groups-panel/groups-panel.tsx index 4d15118c..faefab10 100644 --- a/src/views/groups-panel/groups-panel.tsx +++ b/src/views/groups-panel/groups-panel.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { connect } from 'react-redux'; -import { Grid, Button, Typography } from "@material-ui/core"; +import { Grid, Button, Typography, StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core"; import { DataExplorer } from "views-components/data-explorer/data-explorer"; import { DataColumns } from 'components/data-table/data-table'; import { SortDirection } from 'components/data-table/data-column'; @@ -22,6 +22,15 @@ import { openContextMenu } from 'store/context-menu/context-menu-actions'; import { ResourceKind } from 'models/resource'; import { LinkClass, LinkResource } from 'models/link'; import { navigateToGroupDetails } from 'store/navigation/navigation-action'; +import { ArvadosTheme } from 'common/custom-theme'; + +type CssRules = "root"; + +const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ + root: { + width: '100%', + } +}); export enum GroupsPanelColumnNames { GROUP = "Name", @@ -74,14 +83,14 @@ export interface GroupsPanelProps { resources: ResourcesState; } -export const GroupsPanel = connect( +export const GroupsPanel = withStyles(styles)(connect( mapStateToProps, mapDispatchToProps )( - class GroupsPanel extends React.Component { + class GroupsPanel extends React.Component> { render() { return ( - New group
- } /> + } /> ); } @@ -113,7 +122,7 @@ export const GroupsPanel = connect( }); } } - }); + })); const GroupMembersCount = connect( diff --git a/src/views/link-panel/link-panel-root.tsx b/src/views/link-panel/link-panel-root.tsx index 7a5f0503..b32208cd 100644 --- a/src/views/link-panel/link-panel-root.tsx +++ b/src/views/link-panel/link-panel-root.tsx @@ -11,10 +11,20 @@ import { DataTableDefaultView } from 'components/data-table-default-view/data-ta import { ResourcesState } from 'store/resources/resources'; import { ShareMeIcon } from 'components/icon/icon'; import { createTree } from 'models/tree'; -import { - ResourceLinkUuid, ResourceLinkHead, ResourceLinkTail, - ResourceLinkClass, ResourceLinkName } +import { + ResourceLinkUuid, ResourceLinkHead, ResourceLinkTail, + ResourceLinkClass, ResourceLinkName } from 'views-components/data-explorer/renderers'; +import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core'; +import { ArvadosTheme } from 'common/custom-theme'; + +type CssRules = "root"; + +const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ + root: { + width: '100%', + } +}); export enum LinkPanelColumnNames { NAME = "Name", @@ -73,20 +83,20 @@ export interface LinkPanelRootActionProps { onItemDoubleClick: (item: string) => void; } -export type LinkPanelRootProps = LinkPanelRootDataProps & LinkPanelRootActionProps; +export type LinkPanelRootProps = LinkPanelRootDataProps & LinkPanelRootActionProps & WithStyles; -export const LinkPanelRoot = (props: LinkPanelRootProps) => { - return { + return
- }/>; -}; \ No newline at end of file + }/>
; +}); \ No newline at end of file diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx index 67264511..97f79517 100644 --- a/src/views/project-panel/project-panel.tsx +++ b/src/views/project-panel/project-panel.tsx @@ -51,9 +51,7 @@ type CssRules = 'root' | "button"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { - position: 'relative', width: '100%', - height: '100%' }, button: { marginLeft: theme.spacing.unit diff --git a/src/views/public-favorites-panel/public-favorites-panel.tsx b/src/views/public-favorites-panel/public-favorites-panel.tsx index ee09654a..b58aa2f0 100644 --- a/src/views/public-favorites-panel/public-favorites-panel.tsx +++ b/src/views/public-favorites-panel/public-favorites-panel.tsx @@ -39,7 +39,7 @@ import { getResource, ResourcesState } from 'store/resources/resources'; import { GroupContentsResource } from 'services/groups-service/groups-service'; import { CollectionResource } from 'models/collection'; -type CssRules = "toolbar" | "button"; +type CssRules = "toolbar" | "button" | "root"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { @@ -49,6 +49,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ button: { marginLeft: theme.spacing.unit }, + root: { + width: '100%', + }, }); export enum PublicFavoritePanelColumnNames { @@ -160,7 +163,7 @@ export const PublicFavoritePanel = withStyles(styles)( connect(mapStateToProps, mapDispatchToProps)( class extends React.Component { render() { - return - } />; + } />; } } ) diff --git a/src/views/shared-with-me-panel/shared-with-me-panel.tsx b/src/views/shared-with-me-panel/shared-with-me-panel.tsx index eb3127a7..219410c5 100644 --- a/src/views/shared-with-me-panel/shared-with-me-panel.tsx +++ b/src/views/shared-with-me-panel/shared-with-me-panel.tsx @@ -20,7 +20,7 @@ import { } from 'store/context-menu/context-menu-actions'; import { GroupContentsResource } from 'services/groups-service/groups-service'; -type CssRules = "toolbar" | "button"; +type CssRules = "toolbar" | "button" | "root"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { @@ -30,6 +30,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ button: { marginLeft: theme.spacing.unit }, + root: { + width: '100%', + }, }); interface SharedWithMePanelDataProps { @@ -46,13 +49,13 @@ export const SharedWithMePanel = withStyles(styles)( }))( class extends React.Component { render() { - return } />; + dataTableDefaultView={} />; } handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { diff --git a/src/views/trash-panel/trash-panel.tsx b/src/views/trash-panel/trash-panel.tsx index b67b666c..d303c2f7 100644 --- a/src/views/trash-panel/trash-panel.tsx +++ b/src/views/trash-panel/trash-panel.tsx @@ -36,7 +36,7 @@ import { getTrashPanelTypeFilters } from 'store/resource-type-filters/resource-type-filters'; -type CssRules = "toolbar" | "button"; +type CssRules = "toolbar" | "button" | "root"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { @@ -46,6 +46,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ button: { marginLeft: theme.spacing.unit }, + root: { + width: '100%', + }, }); export enum TrashPanelColumnNames { @@ -146,7 +149,7 @@ export const TrashPanel = withStyles(styles)( }))( class extends React.Component { render() { - return - } />; + } />; } handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { diff --git a/src/views/user-panel/user-panel.tsx b/src/views/user-panel/user-panel.tsx index c86ca519..5fb979a2 100644 --- a/src/views/user-panel/user-panel.tsx +++ b/src/views/user-panel/user-panel.tsx @@ -30,7 +30,7 @@ import { ShareMeIcon, AddIcon } from 'components/icon/icon'; import { USERS_PANEL_ID, openUserCreateDialog } from 'store/users/users-actions'; import { noop } from 'lodash'; -type UserPanelRules = "button"; +type UserPanelRules = "button" | 'root' | 'content'; const styles = withStyles(theme => ({ button: { @@ -39,6 +39,13 @@ const styles = withStyles(theme => ({ textAlign: 'right', alignSelf: 'center' }, + root: { + width: '100%', + }, + content: { + // reserve space for the tab bar + height: `calc(100% - ${theme.spacing.unit * 7}px)`, + } })); export enum UserPanelColumnNames { @@ -149,13 +156,13 @@ export const UserPanel = compose( render() { const { value } = this.state; - return + return {value === 0 && - +
} /> - } +
}
; } diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 9ce93bf2..1c6bf03f 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -129,6 +129,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ minWidth: 0, paddingLeft: theme.spacing.unit * 3, paddingRight: theme.spacing.unit * 3, + // Reserve vertical space for app bar + MainContentBar + minHeight: `calc(100vh - ${theme.spacing.unit * 16}px)`, + display: 'flex', } });