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
+
1
11
import styles from "./WorkflowBadges.module.scss" ;
2
12
import { Label } from "semantic-ui-react" ;
3
13
import { JupyterNotebookIcon } from "~/components" ;
4
14
import { INTERACTIVE_SESSION_URL } from "~/client" ;
5
15
import { LauncherLabel } from "~/components" ;
6
16
import { getReanaToken } from "~/selectors" ;
7
17
import { useSelector } from "react-redux" ;
8
- import { statusMapping } from "~/util" ;
9
18
10
19
export default function WorkflowBadges ( { workflow } ) {
11
20
const reanaToken = useSelector ( getReanaToken ) ;
12
21
const {
13
- id,
14
22
size,
15
23
launcherURL,
16
24
session_uri : sessionUri ,
@@ -20,44 +28,39 @@ export default function WorkflowBadges({ workflow }) {
20
28
const isSessionOpen = sessionStatus === "created" ;
21
29
22
30
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 >
62
65
) ;
63
66
}
0 commit comments