X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4bc7ca180691fc56bee6f4e69288945313ab40d1..c3bc34209f7dbbc80c62d8896af043c88cb6b9cf:/src/views/process-panel/process-log-card.tsx diff --git a/src/views/process-panel/process-log-card.tsx b/src/views/process-panel/process-log-card.tsx index bd700bcd43..e14f98f9b2 100644 --- a/src/views/process-panel/process-log-card.tsx +++ b/src/views/process-panel/process-log-card.tsx @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import React from 'react'; +import React, { useState } from 'react'; import { StyleRulesCallback, WithStyles, @@ -19,8 +19,14 @@ import { ArvadosTheme } from 'common/custom-theme'; import { CloseIcon, CollectionIcon, + CopyIcon, LogIcon, - MaximizeIcon + MaximizeIcon, + UnMaximizeIcon, + TextDecreaseIcon, + TextIncreaseIcon, + WordWrapOffIcon, + WordWrapOnIcon, } from 'components/icon/icon'; import { Process } from 'store/processes/process'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; @@ -31,6 +37,7 @@ import { import { ProcessLogCodeSnippet } from 'views/process-panel/process-log-code-snippet'; import { DefaultView } from 'components/default-view/default-view'; import { CodeSnippetDataProps } from 'components/code-snippet/code-snippet'; +import CopyToClipboard from 'react-copy-to-clipboard'; type CssRules = 'card' | 'content' | 'title' | 'iconHeader' | 'header' | 'root' | 'logViewer' | 'logViewerContainer'; @@ -48,17 +55,19 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, logViewer: { height: '100%', + overflowY: 'scroll', // Required for MacOS's Safari -- See #19687 }, logViewerContainer: { height: '100%', }, title: { overflow: 'hidden', - paddingTop: theme.spacing.unit * 0.5 + paddingTop: theme.spacing.unit * 0.5, + color: theme.customs.colors.greyD }, iconHeader: { fontSize: '1.875rem', - color: theme.customs.colors.green700 + color: theme.customs.colors.greyL }, root: { height: '100%', @@ -74,6 +83,7 @@ export interface ProcessLogsCardDataProps { export interface ProcessLogsCardActionProps { onLogFilterChange: (filter: FilterOption) => void; navigateToLog: (uuid: string) => void; + onCopy: (text: string) => void; } type ProcessLogsCardProps = ProcessLogsCardDataProps @@ -83,9 +93,15 @@ type ProcessLogsCardProps = ProcessLogsCardDataProps & MPVPanelProps; export const ProcessLogsCard = withStyles(styles)( - ({ classes, process, filters, selectedFilter, lines, onLogFilterChange, navigateToLog, - doHidePanel, doMaximizePanel, panelMaximized, panelName }: ProcessLogsCardProps) => - + ({ classes, process, filters, selectedFilter, lines, + onLogFilterChange, navigateToLog, onCopy, + doHidePanel, doMaximizePanel, doUnMaximizePanel, panelMaximized, panelName }: ProcessLogsCardProps) => { + const [wordWrap, setWordWrap] = useState(true); + const [fontSize, setFontSize] = useState(3); + const fontBaseSize = 10; + const fontStepSize = 1; + + return } @@ -94,6 +110,36 @@ export const ProcessLogsCard = withStyles(styles)( + + + fontSize > 1 && setFontSize(fontSize-1)}> + + + + + + + fontSize < 5 && setFontSize(fontSize+1)}> + + + + + + + + onCopy("Log copied to clipboard")}> + + + + + + + + setWordWrap(!wordWrap)}> + {wordWrap ? : } + + + navigateToLog(process.containerRequest.logUuid!)}> @@ -101,15 +147,18 @@ export const ProcessLogsCard = withStyles(styles)( + { doUnMaximizePanel && panelMaximized && + + + } { doMaximizePanel && !panelMaximized && } - { doHidePanel && - - - - } + { doHidePanel && + + + } } title={ @@ -124,7 +173,7 @@ export const ProcessLogsCard = withStyles(styles)( spacing={24} direction='column'> - + : -); +});