From fcafc620ae9482450ce597e5f48384323aaf905c Mon Sep 17 00:00:00 2001 From: monilprajapati Date: Mon, 24 Jun 2024 14:23:44 +0530 Subject: [PATCH] Changed the UI for the Workflow revisions --- frontend/src/views/AngularWorkflow.jsx | 106 ++++++++++++++++--------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 81a76c41..2517c26c 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -2094,12 +2094,14 @@ const releaseToConnectLabel = "Release to Connect" } setWorkflow(workflow); + setSelectedRevision(workflow); } setSavingState(1); setTimeout(() => { setSavingState(0); }, 1500); + getRevisionHistory(useworkflow.id) } }) .catch((error) => { @@ -17027,6 +17029,10 @@ const releaseToConnectLabel = "Release to Connect" style={{ height: 50, marginLeft: 10 }} variant={"outlined"} onClick={() => { + if(!lastSaved){ + toast("Save the workflow first") + return + } setShowWorkflowRevisions(true) setSelectedRevision(workflow) //setOriginalWorkflow(workflow) @@ -21335,14 +21341,12 @@ const releaseToConnectLabel = "Release to Connect" }*/ const RevisionBox = (props) => { - const { revision, } = props - - if (revision === undefined || revision === null || revision === {}) { + const { revision, } = props + if (revision === undefined || revision === null) { return null } var newrevision = JSON.parse(JSON.stringify(revision)) - // Make unix timestamp into ISO timestamp in the format July 27th, 3:05 AM // Format: July 27th, 3:05 AM //console.log("Edited time: ", revision.edited) @@ -21402,9 +21406,9 @@ const releaseToConnectLabel = "Release to Connect" setElements([]) } - // // Remove all edges - // cy.edges().remove() - // cy.nodes().remove() + // Remove all edges + cy.edges().remove() + cy.nodes().remove() // Remove all cy nodes setTimeout(() => { @@ -21456,6 +21460,7 @@ const releaseToConnectLabel = "Release to Connect" {translatedDate} + {/* {newrevision.edited.toString().slice(6,10)} | {newrevision.revision_id.slice(0,5)} */} @@ -21538,39 +21543,65 @@ const releaseToConnectLabel = "Release to Connect" ) } - - const drawerData = originalWorkflow !== undefined && originalWorkflow !== null && originalWorkflow !== {} ? -
- + //! Logs + console.log("Selected Revision", selectedRevision) + console.log("Workflow state", workflow) + console.log("All revision", allRevisions) + const drawerData = originalWorkflow !== undefined && originalWorkflow !== null ? +
+ Version History (Beta) +
+
+
+ + Current Version + + +
- + +
- {allRevisions.length > 0 ? - allRevisions.map((revision, index) => { - if (revision.edited === originalWorkflow.edited) { - return null - } - return ( - - ) - }) - : -
- - No other revisions found. Save your workflow with changes to create a revision. - -
- } -
+ {allRevisions.length > 0 ? +
+ { + allRevisions.map((revision, index) => { + if(revision.edited === selectedRevision.edited){ + return null + } + + return ( + + ) + }) + } +
+ + : +
+ + No other revisions found. Save your workflow with changes to create a revision. + +
+ } +
+
: null const workflowRevisions = !showWorkflowRevisions ? null : @@ -21581,7 +21612,7 @@ const releaseToConnectLabel = "Release to Connect" onClose={() => { //setShowWorkflowRevisions(false) }} - style={{ resize: "both", overflow: "auto", zIndex: 10005 }} + style={{ resize: "both", overflow: "hidden", zIndex: 10005 }} hideBackdrop={true} variant="persistent" BackdropProps={{ @@ -21592,7 +21623,7 @@ const releaseToConnectLabel = "Release to Connect" PaperProps={{ style: { resize: "both", - overflow: "auto", + overflow: "hidden", minWidth: isMobile ? "100%" : 360, maxWidth: isMobile ? "100%" : 360, backgroundColor: theme.palette.platformColor, @@ -21600,7 +21631,6 @@ const releaseToConnectLabel = "Release to Connect" fontSize: 18, zIndex: 15001, borderRight: theme.palette.defaultBorder, - paddingTop: 15, }, }} >