From cfe5ff035578ede95613b0c545708466da78cbea Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 18 Mar 2022 18:31:42 -0300 Subject: [PATCH] 16672: Adds font size control to the log viewer. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/components/code-snippet/code-snippet.tsx | 5 +++-- src/components/icon/icon.tsx | 4 ++++ src/views/process-panel/process-log-card.tsx | 22 ++++++++++++++++++- .../process-log-code-snippet.tsx | 3 ++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx index d0cf6ab3..6dc12401 100644 --- a/src/components/code-snippet/code-snippet.tsx +++ b/src/components/code-snippet/code-snippet.tsx @@ -25,17 +25,18 @@ export interface CodeSnippetDataProps { className?: string; apiResponse?: boolean; containerClassName?: string; + fontSize?: number; } type CodeSnippetProps = CodeSnippetDataProps & WithStyles; export const CodeSnippet = withStyles(styles)( - ({ classes, lines, className, containerClassName, apiResponse }: CodeSnippetProps) => + ({ classes, lines, className, containerClassName, apiResponse, fontSize }: CodeSnippetProps) => { lines.map((line: string, index: number) => { - return {line}; + return {line}; }) } ); \ No newline at end of file diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index 7fb74e81..557e22e7 100644 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -66,6 +66,8 @@ import LinkOutlined from '@material-ui/icons/LinkOutlined'; import RemoveRedEye from '@material-ui/icons/RemoveRedEye'; import Computer from '@material-ui/icons/Computer'; import WrapText from '@material-ui/icons/WrapText'; +import TextIncrease from '@material-ui/icons/ZoomIn'; +import TextDecrease from '@material-ui/icons/ZoomOut'; // Import FontAwesome icons import { library } from '@fortawesome/fontawesome-svg-core'; @@ -175,3 +177,5 @@ export const CanWriteIcon: IconType = (props) => ; export const CanManageIcon: IconType = (props) => ; export const AddUserIcon: IconType = (props) => ; export const WordWrapIcon: IconType = (props) => ; +export const TextIncreaseIcon: IconType = (props) => ; +export const TextDecreaseIcon: IconType = (props) => ; diff --git a/src/views/process-panel/process-log-card.tsx b/src/views/process-panel/process-log-card.tsx index bbb4ff9d..56ac4d92 100644 --- a/src/views/process-panel/process-log-card.tsx +++ b/src/views/process-panel/process-log-card.tsx @@ -21,6 +21,8 @@ import { CollectionIcon, LogIcon, MaximizeIcon, + TextDecreaseIcon, + TextIncreaseIcon, WordWrapIcon } from 'components/icon/icon'; import { Process } from 'store/processes/process'; @@ -87,6 +89,10 @@ export const ProcessLogsCard = withStyles(styles)( ({ classes, process, filters, selectedFilter, lines, onLogFilterChange, navigateToLog, doHidePanel, doMaximizePanel, panelMaximized, panelName }: ProcessLogsCardProps) => { const [wordWrapToggle, setWordWrapToggle] = useState(true); + const [fontSize, setFontSize] = useState(3); + const fontBaseSize = 10; + const fontStepSize = 1; + return + + + fontSize > 1 && setFontSize(fontSize-1)}> + + + + + + + fontSize < 5 && setFontSize(fontSize+1)}> + + + + setWordWrapToggle(!wordWrapToggle)}> @@ -133,7 +153,7 @@ export const ProcessLogsCard = withStyles(styles)( spacing={24} direction='column'> - + : ) => - ); \ No newline at end of file -- 2.30.2