21461: Fixes log line-breaking behavior for really long strings.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 16 Feb 2024 22:50:27 +0000 (19:50 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 20 Feb 2024 19:21:35 +0000 (16:21 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

services/workbench2/src/views/process-panel/process-log-code-snippet.tsx

index 50d343d6223c31f0c4a5998298d415ccaaa688bd..091078c4521c0615071ebf217c7baa629975aa49 100644 (file)
@@ -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<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -35,8 +35,11 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     logText: {
         padding: `0 ${theme.spacing.unit*0.5}px`,
     },
-    wordWrap: {
-        whiteSpace: 'pre-wrap',
+    wordWrapOn: {
+        overflowWrap: 'anywhere',
+    },
+    wordWrapOff: {
+        whiteSpace: 'nowrap',
     },
 });
 
@@ -119,8 +122,8 @@ export const ProcessLogCodeSnippet = withStyles(styles)(connect(mapStateToProps)
                     }
                 }}>
                 { lines.map((line: string, index: number) =>
-                <Typography key={index} component="pre"
-                    className={classNames(classes.logText, wordWrap ? classes.wordWrap : undefined)}>
+                <Typography key={index} component="span"
+                    className={classNames(classes.logText, wordWrap ? classes.wordWrapOn : classes.wordWrapOff)}>
                     {renderLinks(fontSize, auth, dispatch)(line)}
                 </Typography>
                 ) }