From 4bc7ca180691fc56bee6f4e69288945313ab40d1 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 17 Mar 2022 18:19:01 -0300 Subject: [PATCH] 16672: Fixes panels' vertical space layout issues. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/components/code-snippet/code-snippet.tsx | 13 +++++---- .../multi-panel-view/multi-panel-view.tsx | 3 ++- .../process-panel/process-details-card.tsx | 7 ++++- .../process-information-card.tsx | 7 ++++- src/views/process-panel/process-log-card.tsx | 27 ++++++++++++++----- .../process-log-code-snippet.tsx | 14 ++++++---- .../process-panel/process-panel-root.tsx | 1 + 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx index f0a2b213..d0cf6ab3 100644 --- a/src/components/code-snippet/code-snippet.tsx +++ b/src/components/code-snippet/code-snippet.tsx @@ -24,19 +24,18 @@ export interface CodeSnippetDataProps { lines: string[]; className?: string; apiResponse?: boolean; + containerClassName?: string; } type CodeSnippetProps = CodeSnippetDataProps & WithStyles; export const CodeSnippet = withStyles(styles)( - ({ classes, lines, className, apiResponse }: CodeSnippetProps) => + ({ classes, lines, className, containerClassName, apiResponse }: CodeSnippetProps) => - { - lines.map((line: string, index: number) => { + component="div" + className={classNames(classes.root, containerClassName, className)}> + { lines.map((line: string, index: number) => { return {line}; - }) - } + }) } ); \ No newline at end of file diff --git a/src/components/multi-panel-view/multi-panel-view.tsx b/src/components/multi-panel-view/multi-panel-view.tsx index 6fb3cc49..b242f805 100644 --- a/src/components/multi-panel-view/multi-panel-view.tsx +++ b/src/components/multi-panel-view/multi-panel-view.tsx @@ -33,6 +33,7 @@ const styles: StyleRulesCallback = theme => ({ }, content: { overflow: 'auto', + height: '100%', }, }); @@ -85,7 +86,7 @@ export const MPVPanelContent = ({doHidePanel, doMaximizePanel, panelName, panelM } }, [panelRef]); - return + return {/* Element to scroll to when the panel is selected */} { forwardProps diff --git a/src/views/process-panel/process-details-card.tsx b/src/views/process-panel/process-details-card.tsx index 18610781..d3349c3a 100644 --- a/src/views/process-panel/process-details-card.tsx +++ b/src/views/process-panel/process-details-card.tsx @@ -19,12 +19,16 @@ import { Process } from 'store/processes/process'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; import { ProcessDetailsAttributes } from './process-details-attributes'; -type CssRules = 'card' | 'content' | 'title'; +type CssRules = 'card' | 'content' | 'title' | 'header'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { height: '100%' }, + header: { + paddingTop: theme.spacing.unit, + paddingBottom: theme.spacing.unit, + }, content: { '&:last-child': { paddingBottom: theme.spacing.unit * 2, @@ -46,6 +50,7 @@ export const ProcessDetailsCard = withStyles(styles)( ({ classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => { return = (theme: ArvadosTheme) => ({ card: { height: '100%' }, + header: { + paddingTop: theme.spacing.unit, + paddingBottom: theme.spacing.unit, + }, iconHeader: { fontSize: '1.875rem', color: theme.customs.colors.green700, @@ -93,6 +97,7 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })( const finishedAt = container ? formatDate(container.finishedAt) : 'N/A'; return = (theme: ArvadosTheme) => ({ card: { height: '100%' }, + header: { + paddingTop: theme.spacing.unit, + paddingBottom: theme.spacing.unit, + }, content: { - '&:last-child': { - paddingBottom: theme.spacing.unit * 2, - } + padding: theme.spacing.unit * 0, + height: '100%', + }, + logViewer: { + height: '100%', + }, + logViewerContainer: { + height: '100%', }, title: { overflow: 'hidden', @@ -51,6 +60,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ fontSize: '1.875rem', color: theme.customs.colors.green700 }, + root: { + height: '100%', + }, }); export interface ProcessLogsCardDataProps { @@ -73,9 +85,9 @@ type ProcessLogsCardProps = ProcessLogsCardDataProps export const ProcessLogsCard = withStyles(styles)( ({ classes, process, filters, selectedFilter, lines, onLogFilterChange, navigateToLog, doHidePanel, doMaximizePanel, panelMaximized, panelName }: ProcessLogsCardProps) => - + - } action={ @@ -107,10 +119,11 @@ export const ProcessLogsCard = withStyles(styles)( {lines.length > 0 ? < Grid + className={classes.logViewerContainer} container spacing={24} direction='column'> - + diff --git a/src/views/process-panel/process-log-code-snippet.tsx b/src/views/process-panel/process-log-code-snippet.tsx index d1756c77..01f5ca1c 100644 --- a/src/views/process-panel/process-log-code-snippet.tsx +++ b/src/views/process-panel/process-log-code-snippet.tsx @@ -6,13 +6,16 @@ import React from 'react'; import { MuiThemeProvider, createMuiTheme, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core/styles'; import { CodeSnippet } from 'components/code-snippet/code-snippet'; import grey from '@material-ui/core/colors/grey'; +import { ArvadosTheme } from 'common/custom-theme'; -type CssRules = 'codeSnippet'; +type CssRules = 'codeSnippet' | 'codeSnippetContainer'; -const styles: StyleRulesCallback = () => ({ +const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ codeSnippet: { - maxHeight: '550px', - } + }, + codeSnippetContainer: { + height: `calc(100% - ${theme.spacing.unit * 4}px)`, // so that horizontal scollbar is visible + }, }); const theme = createMuiTheme({ @@ -39,5 +42,6 @@ interface ProcessLogCodeSnippetProps { export const ProcessLogCodeSnippet = withStyles(styles)( (props: ProcessLogCodeSnippetProps & WithStyles) => - + ); \ No newline at end of file diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index c3980648..cf32b50f 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -22,6 +22,7 @@ type CssRules = 'root'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { width: '100%', + height: '100%', }, }); -- 2.30.2