Added copying to more JSON fields

This commit is contained in:
frikky
2021-11-22 04:01:06 +01:00
parent 857a3a405d
commit 3152f19ae5
5 changed files with 72 additions and 448 deletions
+16 -15
View File
@@ -3972,6 +3972,7 @@ const Admin = (props) => {
<Tabs
value={curTab}
indicatorColor="primary"
textColor="primary"
onChange={setConfig}
aria-label="disabled tabs example"
>
@@ -4004,21 +4005,21 @@ const Admin = (props) => {
Schedules
</span>
/>
{isCloud ? null : (
<Tab
label=<span>
<EcoIcon style={iconStyle} />
Environments
</span>
/>
)}
{isCloud ? null : (
<Tab
label=<span>
<BusinessIcon style={iconStyle} /> Organizations
</span>
/>
)}
<Tab
index={5}
disabled={isCloud}
label=<span>
<EcoIcon style={iconStyle} />
Environments
</span>
/>
<Tab
index={6}
value={6}
label=<span>
<BusinessIcon style={iconStyle} /> Organizations
</span>
/>
{/*window.location.protocol == "http:" && window.location.port === "3000" ? <Tab label=<span><CloudIcon style={iconStyle} /> Hybrid</span>/> : null*/}
{/*window.location.protocol === "http:" && window.location.port === "3000" ? <Tab label=<span><LockIcon style={iconStyle} />Categories</span>/> : null*/}
</Tabs>
+33 -13
View File
@@ -1397,7 +1397,7 @@ const AngularWorkflow = (props) => {
const getWorkflow = (workflow_id, sourcenode) => {
console.log(
`Getting workflow ${workflow_id} with append value ${sourcenode}`
//`Getting workflow ${workflow_id} with append value ${sourcenode}`
);
fetch(globalUrl + "/api/v1/workflows/" + workflow_id, {
@@ -2098,14 +2098,21 @@ const AngularWorkflow = (props) => {
// FIXME: Trust it to just work?
//event.target.data()
var curaction = workflow.actions.find((a) => a.id === data.id);
var newapps = JSON.parse(JSON.stringify(apps))
if (!curaction || curaction === undefined) {
alert.error("Action not found. Please remake it.");
console.log("NOT FOUND DATA: ", event.target.data())
event.target.remove();
return;
if (data.id !== undefined && data.app_name !== undefined) {
//newapps.push(data)
workflow.actions.push(data)
curaction = data
} else {
alert.error("Action not found. Please remake it.");
event.target.remove();
return;
}
}
const curapp = apps.find(
const curapp = newapps.find(
(a) =>
a.name === curaction.app_name &&
(a.app_version === curaction.app_version ||
@@ -2655,14 +2662,14 @@ const AngularWorkflow = (props) => {
setLastSaved(false);
const node = event.target;
const nodedata = event.target.data();
console.log("Node added: ", nodedata)
if (
nodedata.finished === false ||
if (nodedata.finished === false ||
(nodedata.id !== undefined && nodedata.is_valid === undefined)
) {
console.log("Returning because node is not valid: ", nodedata)
return;
}
//parsedApp.data.finished = true;
//console.log("IS IT ADDED TO THE WORKFLOW?: ", nodedata)
if (node.isNode() && cy.nodes().size() === 1) {
@@ -3413,16 +3420,20 @@ const AngularWorkflow = (props) => {
const onNodeHover = (event) => {
const nodedata = event.target.data();
/*
if (nodedata.finished === false) {
return;
}
*/
var parentNode = cy.$("#" + event.target.data("id"));
if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
//var parentNode = cy.$("#" + event.target.data("id"));
//if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
if (nodedata.app_name !== undefined) {
const allNodes = cy.nodes().jsons();
//if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
var found = false;
for (var key in allNodes) {
const currentNode = allNodes[key];
@@ -3443,8 +3454,11 @@ const AngularWorkflow = (props) => {
if (!found) {
addDeleteButton(event);
addCopyButton(event);
addStartnodeButton(event);
if (nodedata.type !== "TRIGGER") {
addCopyButton(event);
addStartnodeButton(event);
}
}
}
@@ -4772,12 +4786,13 @@ const AngularWorkflow = (props) => {
if (newAppname.length > maxlen) {
newAppname = newAppname.slice(0, maxlen) + "..";
}
newAppname = newAppname.replaceAll("_", " ");
const image = app.large_image;
const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle));
const pixelSize = !hover ? "2px" : "4px";
newAppStyle.borderLeft = app.is_valid
newAppStyle.borderLeft = app.is_valid && app.actions !== null && app.actions !== undefined && app.actions.length > 0
? `${pixelSize} solid ${green}`
: `${pixelSize} solid ${yellow}`;
@@ -9966,6 +9981,11 @@ const AngularWorkflow = (props) => {
copy.name = copy.name.replaceAll(" ", "_");
}
//lol
if (typeof base === 'object' || typeof base === 'dict') {
base = JSON.stringify(base)
}
console.log("COPY: ", copy);
var newitem = JSON.parse(base);
to_be_copied = "$" + base_node_name.toLowerCase().replaceAll(" ", "_");
+18
View File
@@ -726,6 +726,23 @@ const Apps = (props) => {
</Link>
) : null;
//var editNewButton = editButton === null ?
var editNewButton = null
/*
<Link to={editUrl} style={{ textDecoration: "none" }}>
<Tooltip title={"Add your version"}>
<Button
variant="contained"
component="label"
color="primary"
style={{ marginTop: 10, marginRight: 10 }}
>
<EditIcon />
</Button>
</Tooltip>
</Link>
*/
const activateButton =
selectedApp.generated && !selectedApp.activated ? (
<div>
@@ -972,6 +989,7 @@ const Apps = (props) => {
!selectedApp.generated ? (
<div>
{editButton}
{editNewButton}
{downloadButton}
{deleteButton}
</div>
+5 -1
View File
@@ -397,6 +397,10 @@ const Settings = (props) => {
);
};
const runFlex = userdata.eth_info !== undefined && userdata.eth_info.account !== undefined &&
userdata.eth_info.account.length > 0 && userdata.eth_info.parsed_balance !== undefined
// Random names for type & autoComplete. Didn't research :^)
var imageData = file.length > 0 ? file : fileBase64;
imageData =
@@ -721,7 +725,7 @@ const Settings = (props) => {
<h3>{passwordFormMessage}</h3>
<Divider style={{ marginTop: "40px" }} />
<h2>Platform Earnings</h2>
<div style={{ display: "flex", width: "100%" }}>
<div style={{ display: runFlex ? "flex" : "", width: "100%" }}>
<div style={{ flex: 1, display: "flex" }}>
<div>
{userdata.eth_info !== undefined &&