Changed the UI for the Workflow revisions

This commit is contained in:
monilprajapati
2024-06-24 14:23:44 +05:30
parent 4276717ff6
commit fcafc620ae
+68 -38
View File
@@ -2094,12 +2094,14 @@ const releaseToConnectLabel = "Release to Connect"
} }
setWorkflow(workflow); setWorkflow(workflow);
setSelectedRevision(workflow);
} }
setSavingState(1); setSavingState(1);
setTimeout(() => { setTimeout(() => {
setSavingState(0); setSavingState(0);
}, 1500); }, 1500);
getRevisionHistory(useworkflow.id)
} }
}) })
.catch((error) => { .catch((error) => {
@@ -17027,6 +17029,10 @@ const releaseToConnectLabel = "Release to Connect"
style={{ height: 50, marginLeft: 10 }} style={{ height: 50, marginLeft: 10 }}
variant={"outlined"} variant={"outlined"}
onClick={() => { onClick={() => {
if(!lastSaved){
toast("Save the workflow first")
return
}
setShowWorkflowRevisions(true) setShowWorkflowRevisions(true)
setSelectedRevision(workflow) setSelectedRevision(workflow)
//setOriginalWorkflow(workflow) //setOriginalWorkflow(workflow)
@@ -21335,14 +21341,12 @@ const releaseToConnectLabel = "Release to Connect"
}*/ }*/
const RevisionBox = (props) => { const RevisionBox = (props) => {
const { revision, } = props const { revision, } = props
if (revision === undefined || revision === null) {
if (revision === undefined || revision === null || revision === {}) {
return null return null
} }
var newrevision = JSON.parse(JSON.stringify(revision)) var newrevision = JSON.parse(JSON.stringify(revision))
// Make unix timestamp into ISO timestamp in the format July 27th, 3:05 AM // Make unix timestamp into ISO timestamp in the format July 27th, 3:05 AM
// Format: July 27th, 3:05 AM // Format: July 27th, 3:05 AM
//console.log("Edited time: ", revision.edited) //console.log("Edited time: ", revision.edited)
@@ -21402,9 +21406,9 @@ const releaseToConnectLabel = "Release to Connect"
setElements([]) setElements([])
} }
// // Remove all edges // Remove all edges
// cy.edges().remove() cy.edges().remove()
// cy.nodes().remove() cy.nodes().remove()
// Remove all cy nodes // Remove all cy nodes
setTimeout(() => { setTimeout(() => {
@@ -21456,6 +21460,7 @@ const releaseToConnectLabel = "Release to Connect"
<span style={{flex: 5, }}> <span style={{flex: 5, }}>
<Typography variant="body1"> <Typography variant="body1">
{translatedDate} {translatedDate}
{/* {newrevision.edited.toString().slice(6,10)} | {newrevision.revision_id.slice(0,5)} */}
</Typography> </Typography>
</span> </span>
<span style={{flex: 2, }}> <span style={{flex: 2, }}>
@@ -21538,39 +21543,65 @@ const releaseToConnectLabel = "Release to Connect"
</Paper> </Paper>
) )
} }
//! Logs
const drawerData = originalWorkflow !== undefined && originalWorkflow !== null && originalWorkflow !== {} ? console.log("Selected Revision", selectedRevision)
<div style={{padding: "0px 25px 100px 25px", }}> console.log("Workflow state", workflow)
<Typography variant="h6" style={{marginTop: 10, marginBottom: 15, }}> console.log("All revision", allRevisions)
const drawerData = originalWorkflow !== undefined && originalWorkflow !== null ?
<div style={{ height: "100%"}}>
<Typography variant="h5" style={{ paddingLeft: 25, paddingTop:25, backgroundColor: theme.palette.surfaceColor, height: "8%" }}>
Version History (Beta) Version History (Beta)
</Typography> </Typography>
<div style={{height: "92%" }}>
<div style={{paddingLeft: "25px", paddingRight: "25px", paddingTop: "10px"}}>
<div style={{marginBottom: "20px", }}>
<Typography variant="h6" style={{marginTop: 10, marginBottom: 5, }}>
Current Version
</Typography>
<RevisionBox
revision={selectedRevision}
/>
</div>
<RevisionBox <Divider
revision={originalWorkflow} style={{
/> marginBottom: 15,
height: 1,
width: "100%",
backgroundColor: "rgb(91, 96, 100)",
}}
/>
</div>
{allRevisions.length > 0 ?
allRevisions.map((revision, index) => {
if (revision.edited === originalWorkflow.edited) {
return null
}
return ( {allRevisions.length > 0 ?
<RevisionBox <div style={{overflow: "auto", width: "100%" , height: "75%", paddingLeft: "25px", paddingRight: "20px", paddingTop: "10px", paddingBottom: "10px"}}>
revision={revision} {
key={index} allRevisions.map((revision, index) => {
index={index} if(revision.edited === selectedRevision.edited){
/> return null
) }
})
: return (
<div style={{padding: 5, }}> <RevisionBox
<Typography variant="body2"> revision={revision}
No other revisions found. Save your workflow with changes to create a revision. key={index}
</Typography> index={index}
</div> />
} )
</div> })
}
</div>
:
<div style={{padding: 5, }}>
<Typography variant="body2">
No other revisions found. Save your workflow with changes to create a revision.
</Typography>
</div>
}
</div>
</div>
: null : null
const workflowRevisions = !showWorkflowRevisions ? null : const workflowRevisions = !showWorkflowRevisions ? null :
@@ -21581,7 +21612,7 @@ const releaseToConnectLabel = "Release to Connect"
onClose={() => { onClose={() => {
//setShowWorkflowRevisions(false) //setShowWorkflowRevisions(false)
}} }}
style={{ resize: "both", overflow: "auto", zIndex: 10005 }} style={{ resize: "both", overflow: "hidden", zIndex: 10005 }}
hideBackdrop={true} hideBackdrop={true}
variant="persistent" variant="persistent"
BackdropProps={{ BackdropProps={{
@@ -21592,7 +21623,7 @@ const releaseToConnectLabel = "Release to Connect"
PaperProps={{ PaperProps={{
style: { style: {
resize: "both", resize: "both",
overflow: "auto", overflow: "hidden",
minWidth: isMobile ? "100%" : 360, minWidth: isMobile ? "100%" : 360,
maxWidth: isMobile ? "100%" : 360, maxWidth: isMobile ? "100%" : 360,
backgroundColor: theme.palette.platformColor, backgroundColor: theme.palette.platformColor,
@@ -21600,7 +21631,6 @@ const releaseToConnectLabel = "Release to Connect"
fontSize: 18, fontSize: 18,
zIndex: 15001, zIndex: 15001,
borderRight: theme.palette.defaultBorder, borderRight: theme.palette.defaultBorder,
paddingTop: 15,
}, },
}} }}
> >