Skip to content

Commit 59e24eb

Browse files
refactor: centralize workflow info/badges in list, details pages (reanahub#394)
Closes reanahub#151 Closes reanahub#395
1 parent f99ae86 commit 59e24eb

17 files changed

+150
-309
lines changed

reana-ui/src/pages/workflowDetails/components/LauncherLabel.js renamed to reana-ui/src/components/LauncherLabel.js

File renamed without changes.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import styles from "./WorkflowBadges.module.scss";
2+
import { Label } from "semantic-ui-react";
3+
import { JupyterNotebookIcon } from "~/components";
4+
import { INTERACTIVE_SESSION_URL } from "~/client";
5+
import { LauncherLabel } from "~/components";
6+
import { getReanaToken } from "~/selectors";
7+
import { useSelector } from "react-redux";
8+
import { statusMapping } from "~/util";
9+
10+
export default function WorkflowBadges({ workflow }) {
11+
const reanaToken = useSelector(getReanaToken);
12+
const {
13+
id,
14+
size,
15+
launcherURL,
16+
session_uri: sessionUri,
17+
session_status: sessionStatus,
18+
} = workflow;
19+
const hasDiskUsage = size.raw > 0;
20+
const isSessionOpen = sessionStatus === "created";
21+
22+
return (
23+
<>
24+
<div className={styles.badgesContainer}>
25+
{workflow.duration && (
26+
<Label
27+
size="tiny"
28+
content={workflow.duration}
29+
icon="clock"
30+
as="a"
31+
href={"/details/" + id}
32+
target="_blank"
33+
rel="noopener noreferrer"
34+
color={statusMapping[workflow.status].color}
35+
onClick={(e) => e.stopPropagation()}
36+
/>
37+
)}
38+
{hasDiskUsage && (
39+
<Label
40+
size="tiny"
41+
content={size.human_readable}
42+
icon="hdd"
43+
as="a"
44+
href={"/details/" + id}
45+
target="_blank"
46+
rel="noopener noreferrer"
47+
onClick={(e) => e.stopPropagation()}
48+
/>
49+
)}
50+
{isSessionOpen && (
51+
<Label
52+
size="tiny"
53+
content={" Notebook"}
54+
icon={<JupyterNotebookIcon size={12} />}
55+
as="a"
56+
href={INTERACTIVE_SESSION_URL(sessionUri, reanaToken)}
57+
target="_blank"
58+
rel="noopener noreferrer"
59+
onClick={(e) => e.stopPropagation()}
60+
/>
61+
)}
62+
<LauncherLabel url={launcherURL} />
63+
</div>
64+
</>
65+
);
66+
}

reana-ui/src/pages/workflowList/components/WorkflowBadges.module.scss renamed to reana-ui/src/components/WorkflowBadges.module.scss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,6 @@
88
under the terms of the MIT License; see LICENSE file for more details.
99
*/
1010

11-
.divider {
12-
margin: 0 !important;
13-
border-color: #f8f8f8 !important;
14-
}
15-
16-
.badges-and-actions {
17-
display: flex;
18-
justify-content: space-between;
19-
width: 100%;
20-
padding: 0.75em 1em;
21-
22-
.actions {
23-
min-width: 22px;
24-
25-
&:hover {
26-
color: #d1d1d1;
27-
}
28-
29-
&.always-visible {
30-
visibility: visible;
31-
}
32-
}
33-
}
34-
3511
.badgesContainer {
3612
display: flex;
3713

reana-ui/src/pages/workflowList/components/WorkflowDetails.js renamed to reana-ui/src/components/WorkflowInfo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-*- coding: utf-8 -*-
33
44
This file is part of REANA.
5-
Copyright (C) 2023 CERN.
5+
Copyright (C) 2023, 2024 CERN.
66
77
REANA is free software; you can redistribute it and/or modify it
88
under the terms of the MIT License; see LICENSE file for more details.
@@ -13,10 +13,10 @@ import PropTypes from "prop-types";
1313

1414
import { statusMapping } from "~/util";
1515

16-
import styles from "./WorkflowDetails.module.scss";
17-
import WorkflowProgressCircleBar from "~/pages/workflowList/components/WorkflowProgressCircleBar";
16+
import styles from "./WorkflowInfo.module.scss";
17+
import { WorkflowProgressCircleBar } from "~/components";
1818

19-
export default function WorkflowDetails({ workflow }) {
19+
export default function WorkflowInfo({ workflow }) {
2020
const {
2121
name,
2222
run,
@@ -87,6 +87,6 @@ export default function WorkflowDetails({ workflow }) {
8787
);
8888
}
8989

90-
WorkflowDetails.propTypes = {
90+
WorkflowInfo.propTypes = {
9191
workflow: PropTypes.object.isRequired,
9292
};

reana-ui/src/pages/workflowList/components/WorkflowDetails.module.scss renamed to reana-ui/src/components/WorkflowInfo.module.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
.workflow {
1919
color: $raven;
20+
font-size: 1.15rem;
2021

2122
/**FIXME visibility on hover is missing!*/
2223
&.hover {
@@ -73,7 +74,7 @@
7374
width: 210px;
7475
flex-shrink: 0;
7576
display: flex;
76-
justify-content: end;
77+
justify-content: flex-end;
7778
text-align: right;
7879
}
7980

reana-ui/src/pages/workflowList/components/WorkflowProgressCircleBar.js renamed to reana-ui/src/components/WorkflowProgressCircleBar.js

File renamed without changes.

reana-ui/src/pages/workflowList/components/WorkflowProgressCircleBar.module.scss renamed to reana-ui/src/components/WorkflowProgressCircleBar.module.scss

File renamed without changes.

reana-ui/src/pages/workflowDetails/components/__tests__/LauncherLabel.test.js renamed to reana-ui/src/components/__tests__/LauncherLabel.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of REANA.
3-
Copyright (C) 2022 CERN.
3+
Copyright (C) 2022, 2023, 2024 CERN.
44
55
REANA is free software; you can redistribute it and/or modify it
66
under the terms of the MIT License; see LICENSE file for more details.

reana-ui/src/components/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-*- coding: utf-8 -*-
33
44
This file is part of REANA.
5-
Copyright (C) 2020, 2021, 2022, 2023 CERN.
5+
Copyright (C) 2020, 2021, 2022, 2023, 2024 CERN.
66
77
REANA is free software; you can redistribute it and/or modify it
88
under the terms of the MIT License; see LICENSE file for more details.
@@ -16,10 +16,14 @@ export { default as Pagination } from "./Pagination";
1616
export { default as Title } from "./Title";
1717
export { default as TopHeader } from "./TopHeader";
1818
export { default as TooltipIfTruncated } from "./TooltipIfTruncated";
19+
export { default as LauncherLabel } from "./LauncherLabel";
1920
export { default as JupyterNotebookIcon } from "./JupyterNotebookIcon";
2021
export { default as WorkflowDeleteModal } from "./WorkflowDeleteModal";
22+
export { default as WorkflowInfo } from "./WorkflowInfo";
23+
export { default as WorkflowBadges } from "./WorkflowBadges";
2124
export { default as WorkflowStopModal } from "./WorkflowStopModal";
2225
export { default as WorkflowActionsPopup } from "./WorkflowActionsPopup";
26+
export { default as WorkflowProgressCircleBar } from "./WorkflowProgressCircleBar";
2327
export { default as PieChart } from "./PieChart";
2428
export { default as Search } from "./Search";
2529
export { default as Box } from "./Box";

reana-ui/src/pages/workflowDetails/WorkflowDetails.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-*- coding: utf-8 -*-
33
44
This file is part of REANA.
5-
Copyright (C) 2020, 2022, 2023 CERN.
5+
Copyright (C) 2020, 2022, 2023, 2024 CERN.
66
77
REANA is free software; you can redistribute it and/or modify it
88
under the terms of the MIT License; see LICENSE file for more details.
@@ -24,15 +24,18 @@ import {
2424
import BasePage from "../BasePage";
2525
import {
2626
Notification,
27+
WorkflowInfo,
28+
WorkflowActionsPopup,
29+
WorkflowBadges,
2730
WorkflowDeleteModal,
2831
WorkflowStopModal,
2932
} from "~/components";
3033
import {
31-
WorkflowInfo,
3234
WorkflowLogs,
3335
WorkflowFiles,
3436
WorkflowSpecification,
3537
} from "./components";
38+
import styles from "./WorkflowDetails.module.scss";
3639

3740
const FINISHED_STATUSES = ["finished", "failed", "stopped", "deleted"];
3841

@@ -139,8 +142,14 @@ export default function WorkflowDetails() {
139142

140143
return (
141144
<BasePage title={pageTitle}>
142-
<Container>
145+
<Container className={styles["workflow-details-container"]}>
143146
<WorkflowInfo workflow={workflow} />
147+
<div className={styles["badges-and-actions"]}>
148+
<WorkflowBadges workflow={workflow} withDivider={false} />
149+
<div className={styles.actionsContainer}>
150+
<WorkflowActionsPopup workflow={workflow} />
151+
</div>
152+
</div>
144153
<Tab
145154
menu={{ secondary: true, pointing: true }}
146155
panes={panes}

0 commit comments

Comments
 (0)