Skip to content

Commit e4c024b

Browse files
committed
feat(workflow-badges): add Dask dashboard icon (#417)
Closes #415
1 parent 35c98b5 commit e4c024b

File tree

5 files changed

+100
-2
lines changed

5 files changed

+100
-2
lines changed

reana-ui/src/client.js

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export const INTERACTIVE_SESSIONS_CLOSE_URL = (id) =>
5656
`${api}/api/workflows/${id}/close/`;
5757
export const INTERACTIVE_SESSION_URL = (sessionUri, reanaToken) =>
5858
`${api}${sessionUri}?token=${reanaToken}`;
59+
export const DASK_DASHBOARD_URL = (workflow_id) =>
60+
`${api}/${workflow_id}/dashboard/status`;
5961
export const LAUNCH_ON_REANA_URL = `${api}/api/launch`;
6062

6163
class Client {

reana-ui/src/components/DaskIcon.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
-*- coding: utf-8 -*-
3+
4+
This file is part of REANA.
5+
Copyright (C) 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+
import PropTypes from "prop-types";
11+
12+
import styles from "./DaskIcon.module.scss";
13+
14+
const DaskIcon = ({ size, className }) => {
15+
// Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0)
16+
return (
17+
<svg
18+
className={className || styles.icon}
19+
viewBox="0 0 512 512"
20+
width={`${size}px`}
21+
height={`${size}px`}
22+
xmlns="http://www.w3.org/2000/svg"
23+
xmlnsXlink="http://www.w3.org/1999/xlink"
24+
>
25+
<g>
26+
<path
27+
fill="#FFC11E"
28+
d="M143.71,157.61l126.5-72.99c1.25-0.72,2.02-2.05,2.02-3.5l0.01-43.77c0-6.48-2.66-12.9-7.83-16.81
29+
c-6.69-5.06-15.28-5.56-22.33-1.48L65.13,121.17c-6.22,3.59-10.06,10.23-10.06,17.41L55,369.18c0,6.47,2.65,12.89,7.81,16.81
30+
c6.68,5.07,15.29,5.57,22.35,1.49l37.48-21.62c1.25-0.72,2.02-2.05,2.02-3.5l0.05-171.85C124.71,176.93,131.95,164.4,143.71,157.61
31+
z"
32+
/>
33+
<path
34+
fill="#EF1161"
35+
d="M446.95,124.53c-3.15-1.82-6.61-2.73-10.06-2.73c-3.45,0-6.9,0.91-10.05,2.73l-176.96,102.1
36+
c-6.2,3.58-10.06,10.25-10.06,17.41l-0.07,231.47c0,7.27,3.76,13.78,10.05,17.42c6.3,3.64,13.81,3.64,20.11,0l176.95-102.11
37+
c6.2-3.58,10.06-10.25,10.06-17.41L457,141.95C457,134.68,453.24,128.16,446.95,124.53z"
38+
/>
39+
<path
40+
fill="#FC6E6B"
41+
d="M240.95,211.14l116.78-67.38c1.25-0.72,2.02-2.05,2.02-3.5l0.02-50.98c0-6.48-2.66-12.9-7.83-16.81
42+
c-6.69-5.06-15.27-5.55-22.33-1.48l-48.43,27.95L152.64,173.1c-6.22,3.59-10.06,10.23-10.06,17.41l-0.05,174.18l-0.02,56.41
43+
c0,6.48,2.65,12.89,7.81,16.81c6.69,5.07,15.29,5.57,22.35,1.49l47.2-27.24c1.25-0.72,2.02-2.05,2.02-3.5l0.05-164.64
44+
C221.95,230.46,229.19,217.92,240.95,211.14z"
45+
/>
46+
</g>
47+
</svg>
48+
);
49+
};
50+
51+
DaskIcon.defaultProps = {
52+
size: 22,
53+
className: "",
54+
};
55+
56+
DaskIcon.propTypes = {
57+
size: PropTypes.number,
58+
className: PropTypes.string,
59+
};
60+
61+
export default DaskIcon;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
-*- coding: utf-8 -*-
3+
4+
This file is part of REANA.
5+
Copyright (C) 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+
11+
@import "@palette";
12+
13+
.icon {
14+
display: inline-block;
15+
vertical-align: middle;
16+
}

reana-ui/src/components/WorkflowBadges.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
import styles from "./WorkflowBadges.module.scss";
1212
import { Label, Popup } from "semantic-ui-react";
13-
import { JupyterNotebookIcon } from "~/components";
14-
import { INTERACTIVE_SESSION_URL } from "~/client";
13+
import { JupyterNotebookIcon, DaskIcon } from "~/components";
14+
import { INTERACTIVE_SESSION_URL, DASK_DASHBOARD_URL } from "~/client";
1515
import { LauncherLabel } from "~/components";
1616
import { getReanaToken, getUserEmail } from "~/selectors";
1717
import { useSelector } from "react-redux";
@@ -22,11 +22,14 @@ export default function WorkflowBadges({ workflow }) {
2222
const {
2323
size,
2424
launcherURL,
25+
services,
2526
session_uri: sessionUri,
2627
session_status: sessionStatus,
2728
} = workflow;
2829
const hasDiskUsage = size.raw > 0;
2930
const isSessionOpen = sessionStatus === "running";
31+
const isDaskClusterUp =
32+
services.length > 0 && services[0].status === "running";
3033

3134
return (
3235
<div className={styles.badgesContainer}>
@@ -64,6 +67,21 @@ export default function WorkflowBadges({ workflow }) {
6467
rel="noopener noreferrer"
6568
/>
6669
)}
70+
{isDaskClusterUp && (
71+
<Label
72+
size="tiny"
73+
content={"Dashboard"}
74+
icon={
75+
<i className="icon">
76+
<DaskIcon size={12} />
77+
</i>
78+
}
79+
as="a"
80+
href={DASK_DASHBOARD_URL(workflow.id)}
81+
target="_blank"
82+
rel="noopener noreferrer"
83+
/>
84+
)}
6785
</>
6886
)}
6987
{workflow.ownerEmail !== userEmail && (

reana-ui/src/components/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export { default as Title } from "./Title";
1717
export { default as TopHeader } from "./TopHeader";
1818
export { default as TooltipIfTruncated } from "./TooltipIfTruncated";
1919
export { default as LauncherLabel } from "./LauncherLabel";
20+
export { default as DaskIcon } from "./DaskIcon";
2021
export { default as JupyterNotebookIcon } from "./JupyterNotebookIcon";
2122
export { default as WorkflowDeleteModal } from "./WorkflowDeleteModal";
2223
export { default as WorkflowInfo } from "./WorkflowInfo";

0 commit comments

Comments
 (0)