diff --git a/reana-ui/src/actions.js b/reana-ui/src/actions.js index b0e69ac2..363a7571 100644 --- a/reana-ui/src/actions.js +++ b/reana-ui/src/actions.js @@ -290,11 +290,13 @@ export function fetchWorkflows({ sort, showLoader = true, workflowIdOrName, + includeShared = false, }) { return async (dispatch) => { if (showLoader) { dispatch({ type: WORKFLOWS_FETCH }); } + return await client .getWorkflows({ pagination, @@ -304,15 +306,16 @@ export function fetchWorkflows({ sharedWith, sort, workflowIdOrName, + includeShared, }) - .then((resp) => + .then((resp) => { dispatch({ type: WORKFLOWS_RECEIVED, workflows: parseWorkflows(resp.data.items), total: resp.data.total, userHasWorkflows: resp.data.user_has_workflows, - }), - ) + }); + }) .catch((err) => { dispatch(errorActionCreator(err, USER_INFO_URL)); dispatch({ type: WORKFLOWS_FETCH_ERROR }); @@ -332,6 +335,7 @@ export function fetchWorkflow(id, { refetch = false, showLoader = true } = {}) { fetchWorkflows({ workflowIdOrName: id, showLoader, + includeShared: true, }), ); } diff --git a/reana-ui/src/client.js b/reana-ui/src/client.js index df83e314..005518b8 100644 --- a/reana-ui/src/client.js +++ b/reana-ui/src/client.js @@ -130,14 +130,16 @@ class Client { sharedWith, sort, workflowIdOrName, + includeShared = false, } = {}) { let shared = false; - if (ownedBy === "anybody") { + if (ownedBy === "anybody" || includeShared) { ownedBy = undefined; shared = true; } else if (ownedBy === "you") { ownedBy = undefined; } + return this._request( WORKFLOWS_URL({ ...(pagination ?? {}), diff --git a/reana-ui/src/components/WorkflowActionsPopup.js b/reana-ui/src/components/WorkflowActionsPopup.js index 18ad785c..f05007a2 100644 --- a/reana-ui/src/components/WorkflowActionsPopup.js +++ b/reana-ui/src/components/WorkflowActionsPopup.js @@ -31,7 +31,11 @@ import styles from "./WorkflowActionsPopup.module.scss"; const JupyterIcon = ; -export default function WorkflowActionsPopup({ workflow, className }) { +export default function WorkflowActionsPopup({ + workflow, + className, + insideClickableElement, +}) { const dispatch = useDispatch(); const config = useSelector(getConfig); const [open, setOpen] = useState(false); @@ -133,6 +137,17 @@ export default function WorkflowActionsPopup({ workflow, className }) { }); } + if (workflow.owner_email !== "-") { + return ( +
+ ); + } + return (
{menuItems.length > 0 && ( @@ -167,4 +182,5 @@ WorkflowActionsPopup.defaultProps = { WorkflowActionsPopup.propTypes = { workflow: workflowShape.isRequired, className: PropTypes.string, + insideClickableElement: PropTypes.bool, }; diff --git a/reana-ui/src/pages/workflowDetails/components/WorkflowInfo.js b/reana-ui/src/pages/workflowDetails/components/WorkflowInfo.js index ec50a517..1cfb2626 100644 --- a/reana-ui/src/pages/workflowDetails/components/WorkflowInfo.js +++ b/reana-ui/src/pages/workflowDetails/components/WorkflowInfo.js @@ -51,20 +51,43 @@ export default function WorkflowInfo({ workflow }) {
{name} #{run} - {isSessionOpen && ( - e.stopPropagation()} - className={styles.notebook} - > - - - )} + + + {workflow.owner_email === "-" ? ( + <> + {isSessionOpen && ( + e.stopPropagation()} + className={styles.notebook} + > + + + )} + + ) : ( + + + + } + position="top center" + content={ + "This workflow is read-only shared with you by " + + workflow.owner_email + } + /> + )} @@ -106,7 +129,10 @@ export default function WorkflowInfo({ workflow }) { step {completed}/{total}
- +
diff --git a/reana-ui/src/pages/workflowList/components/WorkflowList.js b/reana-ui/src/pages/workflowList/components/WorkflowList.js index 920e2a48..024389ea 100644 --- a/reana-ui/src/pages/workflowList/components/WorkflowList.js +++ b/reana-ui/src/pages/workflowList/components/WorkflowList.js @@ -76,25 +76,46 @@ export default function WorkflowList({ workflows, loading }) { {name} #{run}
- {hasDiskUsage && ( - - {size.human_readable} - - )} - {isSessionOpen && ( - e.stopPropagation()} - className={styles.notebook} - > - - + {workflow.owner_email === "-" ? ( + <> + {hasDiskUsage && ( + + {size.human_readable} + + )} + {isSessionOpen && ( + e.stopPropagation()} + className={styles.notebook} + > + + + )} + + ) : ( + + + {workflow.owner_email} + + } + position="top center" + content={ + "This workflow is read-only shared with you by " + + workflow.owner_email + } + /> )}