File tree Expand file tree Collapse file tree 3 files changed +97
-0
lines changed
webview-ui/src/Layout/SeqeraCloud/Workspace/RunHistory Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ import { useState } from "react" ;
2+ import clsx from "clsx" ;
3+
4+ import styles from "./styles.module.css" ;
5+
6+ const ErrorReport = ( { errorReport } : { errorReport : string } ) => {
7+ const [ isExpanded , setIsExpanded ] = useState ( false ) ;
8+ const [ copied , setCopied ] = useState ( false ) ;
9+
10+ if ( ! errorReport ) return null ;
11+
12+ const firstLine = errorReport . split ( "\n" ) [ 0 ] ;
13+
14+ const handleCopy = ( e : React . MouseEvent ) => {
15+ e . preventDefault ( ) ;
16+ e . stopPropagation ( ) ;
17+ navigator . clipboard . writeText ( errorReport ) ;
18+ setCopied ( true ) ;
19+ setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
20+ } ;
21+
22+ return (
23+ < div className = { styles . errorReport } >
24+ < div
25+ className = { styles . errorPreview }
26+ onClick = { ( e ) => {
27+ e . preventDefault ( ) ;
28+ e . stopPropagation ( ) ;
29+ setIsExpanded ( ! isExpanded ) ;
30+ } }
31+ >
32+ < div className = { styles . errorContent } >
33+ { isExpanded ? errorReport : `${ firstLine } ...` }
34+ </ div >
35+ < button
36+ className = { clsx (
37+ copied ? "codicon codicon-check" : "codicon codicon-copy" ,
38+ styles . copyButton
39+ ) }
40+ onClick = { handleCopy }
41+ title = { copied ? "Copied!" : "Copy error report" }
42+ > </ button >
43+ </ div >
44+ </ div >
45+ ) ;
46+ } ;
47+
48+ export default ErrorReport ;
Original file line number Diff line number Diff line change 99 getStatusIcon
1010} from "./utils" ;
1111import Button from "../../../../components/Button" ;
12+ import ErrorReport from "./ErrorReport" ;
1213import FilterForProject from "../FilterForProject" ;
1314
1415import styles from "./styles.module.css" ;
@@ -60,6 +61,9 @@ const RunHistory = () => {
6061 { relativeTime ( workflow . dateCreated ) }
6162 </ div >
6263 </ div >
64+ { workflow . status === "FAILED" && (
65+ < ErrorReport errorReport = { workflow . errorReport } />
66+ ) }
6367 </ a >
6468 ) ) }
6569 { hasMore && (
Original file line number Diff line number Diff line change 88 cursor : pointer;
99 transition : all 0.2s ;
1010 min-width : 260px ;
11+ outline : none !important ;
1112 & : hover {
1213 border-color : var (--vscode-button-background );
1314 color : var (--vscode-button-foreground );
6465 text-overflow : ellipsis;
6566 }
6667}
68+
69+ .errorReport {
70+ margin-top : 6px ;
71+ font-size : 11px ;
72+ }
73+
74+ .errorPreview {
75+ background : var (--vscode-editor-background );
76+ border : 1px solid var (--vscode-panel-border );
77+ border-radius : 4px ;
78+ padding : 6px ;
79+ cursor : pointer;
80+ white-space : pre-wrap;
81+ word-break : break-word;
82+ color : var (--vscode-errorForeground );
83+ position : relative;
84+ & : hover {
85+ & .copyButton {
86+ opacity : 0.5 ;
87+ }
88+ }
89+ }
90+
91+ .errorContent {
92+ padding-right : 24px ;
93+ }
94+
95+ .copyButton {
96+ position : absolute;
97+ top : 4px ;
98+ right : 4px ;
99+ background : none;
100+ border : none;
101+ padding : 4px ;
102+ cursor : pointer;
103+ color : var (--vscode-button-foreground );
104+ opacity : 0 ;
105+ transition : opacity 0.2s ;
106+ font-size : 12px ;
107+ outline : none !important ;
108+ & : hover {
109+ opacity : 1 ;
110+ }
111+ }
You can’t perform that action at this time.
0 commit comments