X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bfaee40696c3c15556ef089e69da47bb832b08db..04704ea80b294655fe14d0c8cddf4ec1a6b21b4d:/services/workbench2/src/views/process-panel/process-log-code-snippet.tsx diff --git a/services/workbench2/src/views/process-panel/process-log-code-snippet.tsx b/services/workbench2/src/views/process-panel/process-log-code-snippet.tsx index 50d343d622..f42dcaf542 100644 --- a/services/workbench2/src/views/process-panel/process-log-code-snippet.tsx +++ b/services/workbench2/src/views/process-panel/process-log-code-snippet.tsx @@ -20,7 +20,7 @@ import classNames from 'classnames'; import { FederationConfig, getNavUrl } from 'routes/routes'; import { RootState } from 'store/store'; -type CssRules = 'root' | 'wordWrap' | 'logText'; +type CssRules = 'root' | 'wordWrapOn' | 'wordWrapOff' | 'logText'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { @@ -33,10 +33,13 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, }, logText: { - padding: `0 ${theme.spacing.unit*0.5}px`, + padding: `0 ${theme.spacing.unit * 0.5}px`, }, - wordWrap: { - whiteSpace: 'pre-wrap', + wordWrapOn: { + overflowWrap: 'anywhere', + }, + wordWrapOff: { + whiteSpace: 'nowrap', }, }); @@ -73,21 +76,21 @@ const renderLinks = (fontSize: number, auth: FederationConfig, dispatch: Dispatc } return {text.split(REGEX).map((part, index) => - - {part} - {links[index] && - { - const url = getNavUrl(links[index], auth) - if (url) { - window.open(`${window.location.origin}${url}`, '_blank'); - } else { - dispatch(navigationNotAvailable(links[index])); - } - }} - style={ {cursor: 'pointer'} }> - {links[index]} - } - + + {part} + {links[index] && + { + const url = getNavUrl(links[index], auth) + if (url) { + window.open(`${window.location.origin}${url}`, '_blank', "noopener"); + } else { + dispatch(navigationNotAvailable(links[index])); + } + }} + style={{ cursor: 'pointer' }}> + {links[index]} + } + )} ; }; @@ -97,7 +100,7 @@ const mapStateToProps = (state: RootState): ProcessLogCodeSnippetAuthProps => ({ }); export const ProcessLogCodeSnippet = withStyles(styles)(connect(mapStateToProps)( - ({classes, lines, fontSize, auth, dispatch, wordWrap}: ProcessLogCodeSnippetProps & WithStyles & ProcessLogCodeSnippetAuthProps & DispatchProp) => { + ({ classes, lines, fontSize, auth, dispatch, wordWrap }: ProcessLogCodeSnippetProps & WithStyles & ProcessLogCodeSnippetAuthProps & DispatchProp) => { const [followMode, setFollowMode] = useState(true); const scrollRef = useRef(null); @@ -112,18 +115,18 @@ export const ProcessLogCodeSnippet = withStyles(styles)(connect(mapStateToProps)
{ const elem = e.target as HTMLDivElement; - if (elem.scrollTop + (elem.clientHeight*1.1) >= elem.scrollHeight) { + if (elem.scrollTop + (elem.clientHeight * 1.1) >= elem.scrollHeight) { setFollowMode(true); } else { setFollowMode(false); } }}> - { lines.map((line: string, index: number) => - - {renderLinks(fontSize, auth, dispatch)(line)} - - ) } + {lines.map((line: string, index: number) => + + {renderLinks(fontSize, auth, dispatch)(line)} + + )}
}));