-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: centralize workflow info/badges in list, details pages (#394)
- Loading branch information
1 parent
c6921a5
commit 64650e2
Showing
19 changed files
with
172 additions
and
360 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import styles from "./WorkflowBadges.module.scss"; | ||
import { Label } from "semantic-ui-react"; | ||
import { JupyterNotebookIcon } from "~/components"; | ||
import { INTERACTIVE_SESSION_URL } from "~/client"; | ||
import { LauncherLabel } from "~/components"; | ||
import { getReanaToken } from "~/selectors"; | ||
import { useSelector } from "react-redux"; | ||
import { statusMapping } from "~/util"; | ||
|
||
export default function WorkflowBadges({ workflow }) { | ||
const reanaToken = useSelector(getReanaToken); | ||
const { | ||
id, | ||
size, | ||
launcherURL, | ||
session_uri: sessionUri, | ||
session_status: sessionStatus, | ||
} = workflow; | ||
const hasDiskUsage = size.raw > 0; | ||
const isSessionOpen = sessionStatus === "created"; | ||
|
||
return ( | ||
<> | ||
<div className={styles.badgesContainer}> | ||
{workflow.duration && ( | ||
<Label | ||
size="tiny" | ||
content={workflow.duration} | ||
icon="clock" | ||
rel="noopener noreferrer" | ||
color={statusMapping[workflow.status].color} | ||
onClick={(e) => e.stopPropagation()} | ||
/> | ||
)} | ||
{hasDiskUsage && ( | ||
<Label | ||
size="tiny" | ||
content={size.human_readable} | ||
icon="hdd" | ||
as="a" | ||
href={"/details/" + id} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
onClick={(e) => e.stopPropagation()} | ||
/> | ||
)} | ||
{isSessionOpen && ( | ||
<Label | ||
size="tiny" | ||
content={"Notebook"} | ||
icon={<JupyterNotebookIcon size={12} />} | ||
as="a" | ||
href={INTERACTIVE_SESSION_URL(sessionUri, reanaToken)} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
onClick={(e) => e.stopPropagation()} | ||
/> | ||
)} | ||
<LauncherLabel url={launcherURL} /> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
-*- coding: utf-8 -*- | ||
This file is part of REANA. | ||
Copyright (C) 2023 CERN. | ||
REANA is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
.badgesContainer { | ||
display: flex; | ||
|
||
a:global(.label) { | ||
margin-left: 15px; | ||
gap: 10px; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
filter: opacity(0.8); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...omponents/__tests__/LauncherLabel.test.js → ...omponents/__tests__/LauncherLabel.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
reana-ui/src/pages/workflowDetails/WorkflowDetails.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.workflow-details-container { | ||
padding-top: 2rem; | ||
} | ||
|
||
.badges-and-actions { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
padding: 0 0.75rem 1rem 1rem; | ||
} |
119 changes: 0 additions & 119 deletions
119
reana-ui/src/pages/workflowDetails/components/WorkflowInfo.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.