1+ /*
2+ -*- coding: utf-8 -*-
3+
4+ This file is part of REANA.
5+ Copyright (C) 2023, 2024 CERN.
6+
7+ REANA is free software; you can redistribute it and/or modify it
8+ under the terms of the MIT License; see LICENSE file for more details.
9+ */
10+
111import styles from "./WorkflowBadges.module.scss" ;
212import { Label } from "semantic-ui-react" ;
313import { JupyterNotebookIcon } from "~/components" ;
414import { INTERACTIVE_SESSION_URL } from "~/client" ;
515import { LauncherLabel } from "~/components" ;
616import { getReanaToken } from "~/selectors" ;
717import { useSelector } from "react-redux" ;
8- import { statusMapping } from "~/util" ;
918
1019export default function WorkflowBadges ( { workflow } ) {
1120 const reanaToken = useSelector ( getReanaToken ) ;
1221 const {
13- id,
1422 size,
1523 launcherURL,
1624 session_uri : sessionUri ,
@@ -20,44 +28,39 @@ export default function WorkflowBadges({ workflow }) {
2028 const isSessionOpen = sessionStatus === "created" ;
2129
2230 return (
23- < >
24- < div className = { styles . badgesContainer } >
25- { workflow . duration && (
26- < Label
27- size = "tiny"
28- content = { workflow . duration }
29- icon = "clock"
30- rel = "noopener noreferrer"
31- color = { statusMapping [ workflow . status ] . color }
32- onClick = { ( e ) => e . stopPropagation ( ) }
33- />
34- ) }
35- { hasDiskUsage && (
36- < Label
37- size = "tiny"
38- content = { size . human_readable }
39- icon = "hdd"
40- as = "a"
41- href = { "/details/" + id }
42- target = "_blank"
43- rel = "noopener noreferrer"
44- onClick = { ( e ) => e . stopPropagation ( ) }
45- />
46- ) }
47- { isSessionOpen && (
48- < Label
49- size = "tiny"
50- content = { "Notebook" }
51- icon = { < JupyterNotebookIcon size = { 12 } /> }
52- as = "a"
53- href = { INTERACTIVE_SESSION_URL ( sessionUri , reanaToken ) }
54- target = "_blank"
55- rel = "noopener noreferrer"
56- onClick = { ( e ) => e . stopPropagation ( ) }
57- />
58- ) }
59- < LauncherLabel url = { launcherURL } />
60- </ div >
61- </ >
31+ < div className = { styles . badgesContainer } >
32+ { workflow . duration && (
33+ < Label
34+ basic
35+ size = "tiny"
36+ content = { `CPU ${ workflow . duration } ` }
37+ icon = "clock"
38+ />
39+ ) }
40+ { hasDiskUsage && (
41+ < Label
42+ basic
43+ size = "tiny"
44+ content = { `Disk ${ size . human_readable } ` }
45+ icon = "hdd"
46+ />
47+ ) }
48+ < LauncherLabel url = { launcherURL } />
49+ { isSessionOpen && (
50+ < Label
51+ size = "tiny"
52+ content = { "Notebook" }
53+ icon = {
54+ < i className = "icon" >
55+ < JupyterNotebookIcon size = { 12 } />
56+ </ i >
57+ }
58+ as = "a"
59+ href = { INTERACTIVE_SESSION_URL ( sessionUri , reanaToken ) }
60+ target = "_blank"
61+ rel = "noopener noreferrer"
62+ />
63+ ) }
64+ </ div >
6265 ) ;
6366}
0 commit comments