Changed from Alert to Toast to work well with mui v18
This commit is contained in:
@@ -75,7 +75,8 @@ import {
|
||||
FmdGood as FmdGoodIcon,
|
||||
} from "@mui/icons-material";
|
||||
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import Dropzone from "../components/Dropzone.jsx";
|
||||
import HandlePaymentNew from "../views/HandlePaymentNew.jsx";
|
||||
import OrgHeader from "../components/OrgHeader.jsx";
|
||||
@@ -216,13 +217,13 @@ const Admin = (props) => {
|
||||
.then((responseJson) => {
|
||||
//console.log("RESPONSE: ", responseJson)
|
||||
if (responseJson.success === true) {
|
||||
//alert.info(responseJson.reason)
|
||||
//toast(responseJson.reason)
|
||||
setImage2FA(responseJson.reason);
|
||||
setSecret2FA(responseJson.extra);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -256,7 +257,7 @@ const Admin = (props) => {
|
||||
//}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -287,7 +288,7 @@ const Admin = (props) => {
|
||||
]
|
||||
*/
|
||||
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
const handleStatusChange = (event) => {
|
||||
const { value } = event.target;
|
||||
console.log("value: ", value)
|
||||
@@ -465,7 +466,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
}
|
||||
|
||||
const deleteAuthentication = (data) => {
|
||||
alert.info("Deleting auth " + data.label);
|
||||
toast("Deleting auth " + data.label);
|
||||
|
||||
// Just use this one?
|
||||
const url = globalUrl + "/api/v1/apps/authentication/" + data.id;
|
||||
@@ -480,13 +481,13 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed deleting auth");
|
||||
toast("Failed deleting auth");
|
||||
} else {
|
||||
// Need to wait because query in ES is too fast
|
||||
setTimeout(() => {
|
||||
getAppAuthentication();
|
||||
}, 1000);
|
||||
//alert.success("Successfully deleted authentication!")
|
||||
//toast("Successfully deleted authentication!")
|
||||
}
|
||||
})
|
||||
)
|
||||
@@ -518,12 +519,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
response.json().then((responseJson) => {
|
||||
console.log("RESP: ", responseJson);
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed stopping schedule");
|
||||
toast("Failed stopping schedule");
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
getSchedules();
|
||||
}, 1500);
|
||||
//alert.success("Successfully stopped schedule!")
|
||||
//toast("Successfully stopped schedule!")
|
||||
}
|
||||
})
|
||||
)
|
||||
@@ -534,7 +535,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
|
||||
|
||||
if (userdata.support === true && selectedOrganization.id !== "" && selectedOrganization.id !== undefined && selectedOrganization.id !== null && selectedOrganization.id !== userdata.active_org.id) {
|
||||
alert.info("Refreshing window to fix org support access")
|
||||
toast("Refreshing window to fix org support access")
|
||||
window.location.reload()
|
||||
return null
|
||||
}
|
||||
@@ -559,15 +560,15 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
} else {
|
||||
//alert.info("Wrong code sent.")
|
||||
//alert.info("Wrong code sent. Please try again.")
|
||||
//toast("Wrong code sent.")
|
||||
//toast("Wrong code sent. Please try again.")
|
||||
}
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === true) {
|
||||
alert.info("Successfully enabled 2fa");
|
||||
toast("Successfully enabled 2fa");
|
||||
|
||||
setTimeout(() => {
|
||||
getUsers();
|
||||
@@ -579,19 +580,19 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
setSelectedUserModalOpen(false);
|
||||
}, 1000);
|
||||
} else {
|
||||
alert.info("Wrong code sent. Please try again.");
|
||||
//alert.error("Failed setting 2fa: ", responseJson.reason)
|
||||
toast("Wrong code sent. Please try again.");
|
||||
//toast("Failed setting 2fa: ", responseJson.reason)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.info("Wrong code sent. Please try again.");
|
||||
//alert.error("Err: " + error.toString())
|
||||
toast("Wrong code sent. Please try again.");
|
||||
//toast("Err: " + error.toString())
|
||||
});
|
||||
};
|
||||
|
||||
const handleStopOrgSync = (org_id) => {
|
||||
if (org_id === undefined || org_id === null) {
|
||||
alert.error("Couldn't get org " + org_id);
|
||||
toast("Couldn't get org " + org_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,10 +613,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
console.log("Cloud sync success?");
|
||||
alert.success("Successfully stopped cloud sync");
|
||||
toast("Successfully stopped cloud sync");
|
||||
} else {
|
||||
console.log("Cloud sync fail?");
|
||||
alert.error(
|
||||
toast(
|
||||
"Failed stopping sync. Try again, and contact support if this persists."
|
||||
);
|
||||
}
|
||||
@@ -628,7 +629,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -672,16 +673,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
responseJson.reason !== undefined
|
||||
) {
|
||||
setOrgSyncResponse(responseJson.reason);
|
||||
alert.error("Failed to handle sync: " + responseJson.reason);
|
||||
toast("Failed to handle sync: " + responseJson.reason);
|
||||
} else if (!responseJson.success) {
|
||||
alert.error("Failed to handle sync.");
|
||||
toast("Failed to handle sync.");
|
||||
} else {
|
||||
getOrgs();
|
||||
if (disableSync) {
|
||||
alert.success("Successfully disabled sync!");
|
||||
toast("Successfully disabled sync!");
|
||||
setOrgSyncResponse("Successfully disabled syncronization");
|
||||
} else {
|
||||
alert.success("Cloud Syncronization successfully set up!");
|
||||
toast("Cloud Syncronization successfully set up!");
|
||||
setOrgSyncResponse(
|
||||
"Successfully started syncronization. Cloud features you now have access to can be seen below."
|
||||
);
|
||||
@@ -696,7 +697,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
.catch((error) => {
|
||||
setLoading(false);
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -718,16 +719,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed changing authentication");
|
||||
toast("Failed changing authentication");
|
||||
} else {
|
||||
//alert.success("Successfully password!")
|
||||
//toast("Successfully password!")
|
||||
setSelectedUserModalOpen(false);
|
||||
getAppAuthentication();
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -766,16 +767,16 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed updating org: ", responseJson.reason);
|
||||
toast("Failed updating org: ", responseJson.reason);
|
||||
} else {
|
||||
if (lead_info === undefined || lead_info === null || lead_info === []) {
|
||||
alert.success("Successfully edited org!");
|
||||
toast("Successfully edited org!");
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -800,9 +801,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed overwriting appauth in workflows");
|
||||
toast("Failed overwriting appauth in workflows");
|
||||
} else {
|
||||
alert.success("Successfully updated auth everywhere!");
|
||||
toast("Successfully updated auth everywhere!");
|
||||
setSelectedUserModalOpen(false);
|
||||
setTimeout(() => {
|
||||
getAppAuthentication();
|
||||
@@ -811,7 +812,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -835,12 +836,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error(responseJson.reason);
|
||||
toast(responseJson.reason);
|
||||
} else {
|
||||
alert.error("Failed creating suborg. Please try again");
|
||||
toast("Failed creating suborg. Please try again");
|
||||
}
|
||||
} else {
|
||||
alert.success(
|
||||
toast(
|
||||
"Successfully created suborg. Reloading in 3 seconds!"
|
||||
);
|
||||
setSelectedUserModalOpen(false);
|
||||
@@ -855,7 +856,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -878,18 +879,18 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error(responseJson.reason);
|
||||
toast(responseJson.reason);
|
||||
} else {
|
||||
alert.error("Failed setting new password");
|
||||
toast("Failed setting new password");
|
||||
}
|
||||
} else {
|
||||
alert.success("Successfully updated password!");
|
||||
toast("Successfully updated password!");
|
||||
setSelectedUserModalOpen(false);
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
alert.error("Err: " + error.toString());
|
||||
toast("Err: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -914,9 +915,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success && responseJson.reason !== undefined) {
|
||||
alert.error("Failed to deactivate user: " + responseJson.reason);
|
||||
toast("Failed to deactivate user: " + responseJson.reason);
|
||||
} else {
|
||||
alert.success("Changed activation for user " + data.id);
|
||||
toast("Changed activation for user " + data.id);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -939,7 +940,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
}
|
||||
|
||||
if (orgId.length === 0) {
|
||||
alert.error("Organization ID not defined. Please contact us on https://shuffler.io if this persists logout.");
|
||||
toast("Organization ID not defined. Please contact us on https://shuffler.io if this persists logout.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -960,7 +961,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error("Failed getting your org. If this persists, please contact support.");
|
||||
toast("Failed getting your org. If this persists, please contact support.");
|
||||
} else {
|
||||
if (
|
||||
responseJson.sync_features === undefined ||
|
||||
@@ -1032,7 +1033,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error getting org: ", error);
|
||||
alert.error("Error getting current organization");
|
||||
toast("Error getting current organization");
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1061,7 +1062,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
setLoginInfo("Error: " + responseJson.reason);
|
||||
alert.error("Failed to send email (2). Please try again and contact support if this persists.")
|
||||
toast("Failed to send email (2). Please try again and contact support if this persists.")
|
||||
} else {
|
||||
setLoginInfo("");
|
||||
setModalOpen(false);
|
||||
@@ -1069,13 +1070,13 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
getUsers();
|
||||
}, 1000);
|
||||
|
||||
alert.info("Invite sent! They will show up in the list when they have accepted the invite.")
|
||||
toast("Invite sent! They will show up in the list when they have accepted the invite.")
|
||||
}
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
console.log("Error in userdata: ", error);
|
||||
alert.error("Failed to send email. Please try again and contact support if this persists.")
|
||||
toast("Failed to send email. Please try again and contact support if this persists.")
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1117,12 +1118,12 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
// Horrible frontend fix for environments
|
||||
const setDefaultEnvironment = (environment) => {
|
||||
// FIXME - add more checks to this
|
||||
alert.info("Setting default env to " + environment.name);
|
||||
toast("Setting default env to " + environment.name);
|
||||
var newEnv = [];
|
||||
for (var key in environments) {
|
||||
if (environments[key].id == environment.id) {
|
||||
if (environments[key].archived) {
|
||||
alert.error("Can't set archived to default");
|
||||
toast("Can't set archived to default");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1150,7 +1151,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error(responseJson.reason);
|
||||
toast(responseJson.reason);
|
||||
setTimeout(() => {
|
||||
getEnvironments();
|
||||
}, 1500);
|
||||
@@ -1181,7 +1182,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error(responseJson.reason);
|
||||
toast(responseJson.reason);
|
||||
getEnvironments();
|
||||
} else {
|
||||
setLoginInfo("");
|
||||
@@ -1196,7 +1197,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
};
|
||||
|
||||
const rerunCloudWorkflows = (environment) => {
|
||||
alert.info("Starting execution reruns. This can run in the background.")
|
||||
toast("Starting execution reruns. This can run in the background.")
|
||||
fetch(
|
||||
`${globalUrl}/api/v1/environments/${environment.id}/rerun`,
|
||||
{
|
||||
@@ -1209,8 +1210,8 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
console.log("Status not 200 for apps :O!");
|
||||
return;
|
||||
} else {
|
||||
alert.error(response.reason);
|
||||
//alert.info("Aborted all dangling workflows");
|
||||
toast(response.reason);
|
||||
//toast("Aborted all dangling workflows");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -1221,7 +1222,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
//setFiles(responseJson)
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString())
|
||||
//toast(error.toString())
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1238,10 +1239,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for apps :O!");
|
||||
alert.error("Failed aborting dangling workflows");
|
||||
toast("Failed aborting dangling workflows");
|
||||
return;
|
||||
} else {
|
||||
alert.info("Aborted all dangling workflows");
|
||||
toast("Aborted all dangling workflows");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -1252,7 +1253,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
//setFiles(responseJson)
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString())
|
||||
//toast(error.toString())
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1260,17 +1261,17 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
// FIXME - add some check here ROFL
|
||||
//const name = environment.name
|
||||
|
||||
//alert.info("Modifying environment " + name)
|
||||
//toast("Modifying environment " + name)
|
||||
//var newEnv = []
|
||||
//for (var key in environments) {
|
||||
// if (environments[key].Name == name) {
|
||||
// if (environments[key].default) {
|
||||
// alert.error("Can't modify the default environment")
|
||||
// toast("Can't modify the default environment")
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (environments[key].type === "cloud" && !environments[key].archived) {
|
||||
// alert.error("Can't modify cloud environments")
|
||||
// toast("Can't modify cloud environments")
|
||||
// return
|
||||
// }
|
||||
|
||||
@@ -1281,17 +1282,17 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
//}
|
||||
const id = environment.id;
|
||||
|
||||
//alert.info("Modifying environment " + environment.Name)
|
||||
//toast("Modifying environment " + environment.Name)
|
||||
var newEnv = [];
|
||||
for (var key in environments) {
|
||||
if (environments[key].id == id) {
|
||||
if (environments[key].default) {
|
||||
alert.error("Can't modify the default environment");
|
||||
toast("Can't modify the default environment");
|
||||
return;
|
||||
}
|
||||
|
||||
if (environments[key].type === "cloud" && !environments[key].archived) {
|
||||
alert.error("Can't modify cloud environments");
|
||||
toast("Can't modify cloud environments");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1314,7 +1315,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((response) =>
|
||||
response.json().then((responseJson) => {
|
||||
if (responseJson["success"] === false) {
|
||||
alert.error(responseJson.reason);
|
||||
toast(responseJson.reason);
|
||||
getEnvironments();
|
||||
} else {
|
||||
setLoginInfo("");
|
||||
@@ -1387,7 +1388,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
setSchedules(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1414,11 +1415,11 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
//console.log(responseJson)
|
||||
setAuthentication(responseJson.data);
|
||||
} else {
|
||||
alert.error("Failed getting authentications");
|
||||
toast("Failed getting authentications");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1443,7 +1444,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
setEnvironments(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1471,7 +1472,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
setOrganizations(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1497,7 +1498,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
setUsers(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1672,10 +1673,10 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success && responseJson.reason !== undefined) {
|
||||
alert.error("Failed setting user: " + responseJson.reason);
|
||||
toast("Failed setting user: " + responseJson.reason);
|
||||
} else {
|
||||
//alert.success("Set the user field " + field + " to " + value);
|
||||
alert.success("Successfully updated user field " + field)
|
||||
//toast("Set the user field " + field + " to " + value);
|
||||
toast("Successfully updated user field " + field)
|
||||
|
||||
if (field !== "suborgs") {
|
||||
setSelectedUserModalOpen(false);
|
||||
@@ -1712,9 +1713,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
.then((responseJson) => {
|
||||
console.log("RESP: ", responseJson);
|
||||
if (!responseJson.success && responseJson.reason !== undefined) {
|
||||
alert.error("Failed getting new: " + responseJson.reason);
|
||||
toast("Failed getting new: " + responseJson.reason);
|
||||
} else {
|
||||
alert.success("Got new API key");
|
||||
toast("Got new API key");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -1808,9 +1809,9 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
}
|
||||
|
||||
if (error) {
|
||||
alert.error("All fields must have a new value");
|
||||
toast("All fields must have a new value");
|
||||
} else {
|
||||
alert.success("Saving new version of this authentication");
|
||||
toast("Saving new version of this authentication");
|
||||
selectedAuthentication.fields = authenticationFields;
|
||||
saveAuthentication(selectedAuthentication);
|
||||
setSelectedAuthentication({});
|
||||
@@ -1827,7 +1828,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
|
||||
const handleOrgEditChange = (event) => {
|
||||
if (userdata.id === selectedUser.id) {
|
||||
alert.info("Can't remove orgs from yourself");
|
||||
toast("Can't remove orgs from yourself");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2424,7 +2425,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
if (copyText !== null && copyText !== undefined) {
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2438,7 +2439,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
|
||||
alert.info(org_id + " copied to clipboard");
|
||||
toast(org_id + " copied to clipboard");
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -3115,7 +3116,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
) {
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error(
|
||||
toast(
|
||||
"Can only copy over HTTPS (port 3443)"
|
||||
);
|
||||
return;
|
||||
@@ -3131,7 +3132,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
|
||||
alert.info("Apikey copied to clipboard");
|
||||
toast("Apikey copied to clipboard");
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -3786,14 +3787,14 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
}
|
||||
} else {
|
||||
if (responseJson.success === false && responseJson.reason !== undefined) {
|
||||
alert.error("Failed change recommendation: ", responseJson.reason)
|
||||
toast("Failed change recommendation: ", responseJson.reason)
|
||||
} else {
|
||||
alert.error("Failed change recommendation");
|
||||
toast("Failed change recommendation");
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.info("Failed dismissing alert. Please contact support@shuffler.io if this persists.");
|
||||
toast("Failed dismissing alert. Please contact support@shuffler.io if this persists.");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3953,7 +3954,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
disabled={environment.Type === "cloud"}
|
||||
onClick={() => {
|
||||
if (environment.Type === "cloud") {
|
||||
alert.info("No Orborus necessary for environment cloud. Create and use a different environment to run executions on-premises.")
|
||||
toast("No Orborus necessary for environment cloud. Create and use a different environment to run executions on-premises.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3964,7 +3965,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
if (copyText !== null && copyText !== undefined) {
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3978,7 +3979,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
|
||||
alert.info("Orborus command copied to clipboard");
|
||||
toast("Orborus command copied to clipboard");
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -12,7 +12,8 @@ import { useBeforeunload } from "react-beforeunload";
|
||||
import ReactJson from "react-json-view";
|
||||
import { NestedMenuItem } from 'mui-nested-menu';
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import { isMobile } from "react-device-detect"
|
||||
import aa from 'search-insights'
|
||||
import Drift from "react-driftjs";
|
||||
@@ -384,7 +385,7 @@ const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e52
|
||||
const AngularWorkflow = (defaultprops) => {
|
||||
const { globalUrl, isLoggedIn, isLoaded, userdata, data_id } = defaultprops;
|
||||
const referenceUrl = globalUrl + "/api/v1/hooks/";
|
||||
const alert = useAlert()
|
||||
//const alert = useAlert()
|
||||
let navigate = useNavigate();
|
||||
const params = useParams();
|
||||
var props = JSON.parse(JSON.stringify(defaultprops))
|
||||
@@ -584,9 +585,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
//alert.success("Successfully GOT app "+appId)
|
||||
//toast("Successfully GOT app "+appId)
|
||||
} else {
|
||||
//alert.error("Failed getting app");
|
||||
//toast("Failed getting app");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -604,7 +605,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -644,7 +645,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setListCache(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -746,7 +747,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Workflow error: ", error.toString())
|
||||
});
|
||||
};
|
||||
@@ -893,17 +894,17 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to set app auth: " + responseJson.reason);
|
||||
toast("Failed to set app auth: " + responseJson.reason);
|
||||
} else {
|
||||
getAppAuthentication(true, false);
|
||||
setAuthenticationModalOpen(false);
|
||||
|
||||
// Needs a refresh with the new authentication..
|
||||
//alert.success("Successfully saved new app auth")
|
||||
//toast("Successfully saved new app auth")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("New auth error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -992,7 +993,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Get execution error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -1046,7 +1047,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return response.json();
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Abort error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -1159,7 +1160,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
if (!visited.includes(label)) {
|
||||
//if (item.action.result !== undefined && item.action.result !== null && !item.action.result.includes("failed condition")) {
|
||||
// alert.error("Error for " + item.action.label + " with result " + item.result);
|
||||
// toast("Error for " + item.action.label + " with result " + item.result);
|
||||
//}
|
||||
visited.push(label);
|
||||
setVisited(visited);
|
||||
@@ -1287,7 +1288,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Stream send error: ", error.toString())
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1458,7 +1459,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
newComments.push(curworkflowComment);
|
||||
} else {
|
||||
alert.info("No handler for type: " + type);
|
||||
toast("No handler for type: " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1519,9 +1520,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
if (!responseJson.success) {
|
||||
console.log(responseJson);
|
||||
if (responseJson.reason !== undefined && responseJson.reason !== null) {
|
||||
alert.error("Failed to save: " + responseJson.reason);
|
||||
toast("Failed to save: " + responseJson.reason);
|
||||
} else {
|
||||
alert.error("Failed to save. Please contact your support@shuffler.io or your local admin if this is unexpected.")
|
||||
toast("Failed to save. Please contact your support@shuffler.io or your local admin if this is unexpected.")
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1570,7 +1571,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
setSavingState(0);
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Save workflow error: ", error.toString());
|
||||
});
|
||||
|
||||
@@ -1615,12 +1616,12 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
|
||||
if (workflow.public) {
|
||||
alert.info("Save it to get a new version");
|
||||
toast("Save it to get a new version");
|
||||
}
|
||||
|
||||
var returncheck = monitorUpdates();
|
||||
if (!returncheck) {
|
||||
alert.error("No startnode set.");
|
||||
toast("No startnode set.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1656,7 +1657,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to start: " + responseJson.reason);
|
||||
toast("Failed to start: " + responseJson.reason);
|
||||
setExecutionRunning(false);
|
||||
setExecutionRequestStarted(false);
|
||||
stop();
|
||||
@@ -1676,7 +1677,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
responseJson.authorization === "" ||
|
||||
responseJson.authorization === undefined
|
||||
) {
|
||||
alert.error("Something went wrong during execution startup");
|
||||
toast("Something went wrong during execution startup");
|
||||
console.log("BAD RESPONSE FOR EXECUTION: ", responseJson);
|
||||
setExecutionRunning(false);
|
||||
setExecutionRequestStarted(false);
|
||||
@@ -1698,7 +1699,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
start();
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
setExecutionRequestStarted(false)
|
||||
console.log("Execute workflow err: ", error.toString());
|
||||
});
|
||||
@@ -1809,16 +1810,16 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setSelectedAction(selectedAction);
|
||||
setWorkflow(workflow);
|
||||
saveWorkflow(workflow);
|
||||
alert.info("Added and updated authentication!");
|
||||
toast("Added and updated authentication!");
|
||||
shouldClose = true
|
||||
} else {
|
||||
console.log("Closing auth modal? FAIL")
|
||||
|
||||
alert.error("Failed to find new authentication. See details in Oauth2 popup window where auth was attempted.");
|
||||
toast("Failed to find new authentication. See details in Oauth2 popup window where auth was attempted.");
|
||||
shouldClose = false
|
||||
}
|
||||
} else {
|
||||
alert.info("No authentication to update");
|
||||
toast("No authentication to update");
|
||||
}
|
||||
} else {
|
||||
shouldClose = true
|
||||
@@ -1835,7 +1836,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
setAppAuthentication([]);
|
||||
//alert.error("Auth loading error: " + error.toString());
|
||||
//toast("Auth loading error: " + error.toString());
|
||||
console.log("AppAuth error: " + error.toString());
|
||||
});
|
||||
};
|
||||
@@ -1867,7 +1868,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setFilteredApps(pretend_apps)
|
||||
setPrioritizedApps(pretend_apps);
|
||||
|
||||
alert.error("Something went wrong while loading apps. Please refresh the window to try again.")
|
||||
toast("Something went wrong while loading apps. Please refresh the window to try again.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1930,7 +1931,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
.catch((error) => {
|
||||
console.log("App loading error: " + error.toString());
|
||||
setAppsLoaded(true)
|
||||
//alert.error("App loading error: "+error.toString());
|
||||
//toast("App loading error: "+error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2008,7 +2009,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Error loading files: ", error)
|
||||
});
|
||||
};
|
||||
@@ -2027,9 +2028,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("Status not 200 for workflows :O!");
|
||||
|
||||
if (response.status >= 500) {
|
||||
alert.info("Something went wrong while loading the workflow. Please reload.")
|
||||
toast("Something went wrong while loading the workflow. Please reload.")
|
||||
} else {
|
||||
alert.info("You don't access to this workflow or loading failed.")
|
||||
toast("You don't access to this workflow or loading failed.")
|
||||
window.location.pathname = "/workflows";
|
||||
}
|
||||
}
|
||||
@@ -2064,7 +2065,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
fetchRecommendations(responseJson)
|
||||
|
||||
if (responseJson.public) {
|
||||
//alert.info("This workflow is public. Save the workflow to use it in your organization.");
|
||||
//toast("This workflow is public. Save the workflow to use it in your organization.");
|
||||
|
||||
setAppAuthentication([])
|
||||
console.log("RESP: ", responseJson)
|
||||
@@ -2280,7 +2281,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Get workflows error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -2411,7 +2412,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
event.target.data("type") !== "COMMENT" &&
|
||||
event.target.data().decorator
|
||||
) {
|
||||
alert.info("This edge can't be edited.");
|
||||
toast("This edge can't be edited.");
|
||||
} else {
|
||||
//console.log("DATA: ", event.target.data())
|
||||
const destinationId = event.target.data("target");
|
||||
@@ -2423,7 +2424,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
curaction.app_name === "Shuffle Tools" &&
|
||||
curaction.name === "router"
|
||||
) {
|
||||
alert.info("Router action can't have incoming conditions");
|
||||
toast("Router action can't have incoming conditions");
|
||||
event.target.unselect();
|
||||
return;
|
||||
}
|
||||
@@ -2455,7 +2456,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
if (nodedata.type === "TRIGGER" && (nodedata.app_name === "Shuffle Workflow" || nodedata.app_name === "User Input")) {
|
||||
|
||||
if (nodedata.parameters === null) {
|
||||
alert.error("Set a workflow first");
|
||||
toast("Set a workflow first");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3045,7 +3046,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
curaction = data
|
||||
} else {
|
||||
if (workflow.public !== true) {
|
||||
alert.error("Action not found. Please remake it.");
|
||||
toast("Action not found. Please remake it.");
|
||||
}
|
||||
|
||||
event.target.remove();
|
||||
@@ -3103,7 +3104,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
if (!curapp || curapp === undefined) {
|
||||
console.log("APPS - couldn't find it: ", newapps)
|
||||
//alert.error(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`);
|
||||
//toast(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`);
|
||||
|
||||
const tmpapp = {
|
||||
name: curaction.app_name,
|
||||
@@ -3295,7 +3296,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
// workflow.actions.push(data)
|
||||
// curaction = data
|
||||
//} else {
|
||||
// alert.error("Action not found. Please remake it.");
|
||||
// toast("Action not found. Please remake it.");
|
||||
// event.target.remove();
|
||||
// return;
|
||||
//}
|
||||
@@ -3329,7 +3330,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
} else if (data.type === "COMMENT") {
|
||||
setSelectedComment(data);
|
||||
} else {
|
||||
alert.error("Can't handle node type " + data.type);
|
||||
toast("Can't handle node type " + data.type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3383,16 +3384,16 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
alert.error("Failed to auto-activate the app. Go to /apps and activate it.")
|
||||
toast("Failed to auto-activate the app. Go to /apps and activate it.")
|
||||
} else {
|
||||
if (refresh === true) {
|
||||
//alert.success("App activated for your organization! Refresh the page to use the app.")
|
||||
//toast("App activated for your organization! Refresh the page to use the app.")
|
||||
getApps()
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
//alert.error(error.toString())
|
||||
//toast(error.toString())
|
||||
console.log("Activate app error: ", error.toString())
|
||||
});
|
||||
}
|
||||
@@ -3707,7 +3708,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
event.target.remove()
|
||||
|
||||
//console.log("Found branch already!")
|
||||
alert.info("Triggers can have exactly one target node")
|
||||
toast("Triggers can have exactly one target node")
|
||||
return
|
||||
|
||||
|
||||
@@ -3740,7 +3741,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
workflow.triggers[targetnode].app_name === "Shuffle Workflow"
|
||||
) {
|
||||
} else {
|
||||
alert.error("Can't have triggers as target of branch");
|
||||
toast("Can't have triggers as target of branch");
|
||||
event.target.remove();
|
||||
}
|
||||
}
|
||||
@@ -3793,7 +3794,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
workflow.branches[branchkey].destination_id === edge.source &&
|
||||
workflow.branches[branchkey].source_id === edge.target
|
||||
) {
|
||||
alert.error("A branch in the opposite direction already exists");
|
||||
toast("A branch in the opposite direction already exists");
|
||||
event.target.remove();
|
||||
found = true;
|
||||
break;
|
||||
@@ -3803,7 +3804,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
) {
|
||||
console.log(edge.source);
|
||||
|
||||
//alert.error("That branch already exists");
|
||||
//toast("That branch already exists");
|
||||
event.target.remove();
|
||||
|
||||
found = true;
|
||||
@@ -3814,7 +3815,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
);
|
||||
if (targetnode === -1) {
|
||||
if (targetnode.type !== "TRIGGER") {
|
||||
alert.error("Can't make arrow to starting node");
|
||||
toast("Can't make arrow to starting node");
|
||||
event.target.remove();
|
||||
break;
|
||||
}
|
||||
@@ -3829,7 +3830,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
// console.log("Destination: ", edge.target)
|
||||
// console.log("CHECK SOURCE IF ITS A TRIGGER: ", targetnode)
|
||||
// if (targetnode !== -1) {
|
||||
// alert.error("Triggers can only target one target (startnode)")
|
||||
// toast("Triggers can only target one target (startnode)")
|
||||
// event.target.remove()
|
||||
// found = true
|
||||
// break
|
||||
@@ -3844,7 +3845,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("TARGETNODE: ", targetnode)
|
||||
if (workflow.triggers[targetnode].app_name === "User Input" || workflow.triggers[targetnode].app_name === "Shuffle Workflow") {
|
||||
} else {
|
||||
alert.error("Can't have triggers as target of branch")
|
||||
toast("Can't have triggers as target of branch")
|
||||
event.target.remove()
|
||||
found = true
|
||||
break
|
||||
@@ -3937,7 +3938,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
/*
|
||||
var curaction = workflow.actions.find((a) => a.id === nodedata.id);
|
||||
if (curaction === null || curaction === undefined) {
|
||||
alert.error("Node not found. Please remake it.")
|
||||
toast("Node not found. Please remake it.")
|
||||
event.target.remove();
|
||||
}
|
||||
*/
|
||||
@@ -4016,7 +4017,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setWorkflow(workflow);
|
||||
} else if (nodedata.type === "TRIGGER") {
|
||||
if (nodedata.is_valid === false) {
|
||||
alert.info("This trigger is not available to you");
|
||||
toast("This trigger is not available to you");
|
||||
node.remove();
|
||||
return;
|
||||
}
|
||||
@@ -4101,7 +4102,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
data: newdata,
|
||||
})
|
||||
|
||||
alert.error("You must STOP the trigger before deleting its branches")
|
||||
toast("You must STOP the trigger before deleting its branches")
|
||||
} catch (e) {
|
||||
console.log("Failed re-adding edge: ", e)
|
||||
}
|
||||
@@ -4258,7 +4259,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
if (copyText !== null && copyText !== undefined) {
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4266,7 +4267,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); /* For mobile devices */
|
||||
document.execCommand("copy");
|
||||
alert.success(`Copied ${cydata.length} element(s)`);
|
||||
toast(`Copied ${cydata.length} element(s)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4279,7 +4280,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
/*
|
||||
const clipboard = navigator.clipboard
|
||||
if (clipboard === undefined || window === undefined || window === null) {
|
||||
alert.error("Can only use cliboard over HTTPS (port 3443)")
|
||||
toast("Can only use cliboard over HTTPS (port 3443)")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -4387,7 +4388,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Error pasting: ", e);
|
||||
//alert.info("Failed parsing clipboard: ", e)
|
||||
//toast("Failed parsing clipboard: ", e)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4458,7 +4459,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Get environments error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -5478,7 +5479,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
//}
|
||||
const parsedSelection = cy.$(":selected");
|
||||
if (selectedNode.data().decorator === true && selectedNode.data("type") !== "COMMENT") {
|
||||
alert.info("This node can't be deleted.");
|
||||
toast("This node can't be deleted.");
|
||||
} else {
|
||||
console.log("Deleted.")
|
||||
selectedNode.remove();
|
||||
@@ -5545,7 +5546,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR getting usecases: " + error.toString());
|
||||
})
|
||||
}
|
||||
@@ -5574,7 +5575,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR getting usecases: " + error.toString());
|
||||
})
|
||||
}
|
||||
@@ -5749,7 +5750,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("END: ", cy)
|
||||
var cydata = cy.$(":selected").jsons();
|
||||
if (cydata !== undefined && cydata !== null && cydata.length > 0) {
|
||||
alert.success(`Selected ${cydata.length} element(s). CTRL+C to copy them.`);
|
||||
toast(`Selected ${cydata.length} element(s). CTRL+C to copy them.`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5804,10 +5805,10 @@ const AngularWorkflow = (defaultprops) => {
|
||||
// No matter what, it's being stopped.
|
||||
if (!responseJson.success) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed to stop schedule: " + responseJson.reason);
|
||||
toast("Failed to stop schedule: " + responseJson.reason);
|
||||
}
|
||||
} else {
|
||||
alert.success("Successfully stopped schedule");
|
||||
toast("Successfully stopped schedule");
|
||||
}
|
||||
|
||||
workflow.triggers[triggerindex].status = "stopped";
|
||||
@@ -5817,14 +5818,14 @@ const AngularWorkflow = (defaultprops) => {
|
||||
saveWorkflow(workflow);
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Stop schedule error: ", error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const submitSchedule = (trigger, triggerindex) => {
|
||||
if (trigger.name.length <= 0) {
|
||||
alert.error("Error: name can't be empty");
|
||||
toast("Error: name can't be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5841,7 +5842,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
}
|
||||
|
||||
alert.info("Creating schedule")
|
||||
toast("Creating schedule")
|
||||
const data = {
|
||||
name: trigger.name,
|
||||
frequency: workflow.triggers[triggerindex].parameters[0].value,
|
||||
@@ -5872,9 +5873,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to set schedule: " + responseJson.reason);
|
||||
toast("Failed to set schedule: " + responseJson.reason);
|
||||
} else {
|
||||
alert.success("Successfully created schedule");
|
||||
toast("Successfully created schedule");
|
||||
workflow.triggers[triggerindex].status = "running";
|
||||
trigger.status = "running";
|
||||
setSelectedTrigger(trigger);
|
||||
@@ -5884,7 +5885,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Get schedule error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -6397,7 +6398,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
currentnode[0].renderedPosition("y", e.pageY - cycontainer.offsetTop);
|
||||
} else {
|
||||
if (workflow.start === "" || workflow.start === undefined) {
|
||||
alert.error("Define a starting action first.");
|
||||
toast("Define a starting action first.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6602,7 +6603,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
app.actions === null ||
|
||||
app.actions.length === 0
|
||||
) {
|
||||
alert.error(
|
||||
toast(
|
||||
"App " +
|
||||
app.name +
|
||||
" currently has no actions to perform. Please go to https://shuffler.io/apps to edit it."
|
||||
@@ -7131,13 +7132,13 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return (
|
||||
<div style={{ textDecoration: "none", color: "white", }} onClick={(event) => {
|
||||
//if (!isCloud) {
|
||||
// alert.info("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.")
|
||||
// toast("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.")
|
||||
// setTimeout(() => {
|
||||
// event.preventDefault()
|
||||
// window.open(parsedUrl, '_blank')
|
||||
// }, 2000)
|
||||
//} else {
|
||||
alert.info(`Activating ${name}`)
|
||||
toast(`Activating ${name}`)
|
||||
//}
|
||||
|
||||
console.log("CLICK: ", hit)
|
||||
@@ -7346,7 +7347,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
);
|
||||
|
||||
if (newaction === undefined || newaction === null) {
|
||||
alert.error("Failed to find the action");
|
||||
toast("Failed to find the action");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7696,7 +7697,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
// Max 1 folder for office for some reason. MailFolders('MAILBOX_ID') in resource
|
||||
// Can't parse URL with multiple folders.
|
||||
if (selectedTrigger.name === "Office365" & value !== undefined && value !== null && value.length > 1) {
|
||||
alert.info("Max 1 folder at a time allowed for Office365")
|
||||
toast("Max 1 folder at a time allowed for Office365")
|
||||
console.log("VALUE: ", value)
|
||||
value = [value[0]]
|
||||
}
|
||||
@@ -8900,7 +8901,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
(branch) => branch.source_id === selectedTrigger.id
|
||||
);
|
||||
if (branch === undefined || branch === null) {
|
||||
alert.error(
|
||||
toast(
|
||||
"No startnode connected to node. Connect it to an action."
|
||||
);
|
||||
return;
|
||||
@@ -8996,7 +8997,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
(branch) => branch.source_id === selectedTrigger.id
|
||||
);
|
||||
if (branch === undefined || branch === null) {
|
||||
alert.error(
|
||||
toast(
|
||||
"No startnode connected to node. Connect it to an action."
|
||||
);
|
||||
return;
|
||||
@@ -10982,7 +10983,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("NAVIGATOR: ", navigator);
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10995,7 +10996,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
alert.success("Copied Webhook URL");
|
||||
toast("Copied Webhook URL");
|
||||
} else {
|
||||
console.log("Couldn't find webhook URI field: ", copyText);
|
||||
}
|
||||
@@ -11207,7 +11208,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return;
|
||||
}
|
||||
|
||||
alert.info("Stopping mail trigger");
|
||||
toast("Stopping mail trigger");
|
||||
const requesttype = triggerAuthentication.type;
|
||||
fetch(
|
||||
`${globalUrl}/api/v1/workflows/${props.match.params.key}/${requesttype}/${trigger.id}`,
|
||||
@@ -11229,7 +11230,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success) {
|
||||
alert.success("Successfully stopped trigger");
|
||||
toast("Successfully stopped trigger");
|
||||
// Set the status
|
||||
workflow.triggers[triggerindex].status = "stopped";
|
||||
trigger.status = "stopped";
|
||||
@@ -11237,11 +11238,11 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setSelectedTrigger(trigger);
|
||||
saveWorkflow(workflow);
|
||||
} else {
|
||||
alert.error("Failed stopping trigger: " + responseJson.reason);
|
||||
toast("Failed stopping trigger: " + responseJson.reason);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Stop mailsub error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -11263,7 +11264,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
const item = splitItem[splitkey];
|
||||
const curfolder = triggerFolders.find((a) => a.displayName === item);
|
||||
if (curfolder === undefined) {
|
||||
alert.error("Something went wrong with folder selection: " + item);
|
||||
toast("Something went wrong with folder selection: " + item);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11277,7 +11278,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
};
|
||||
|
||||
const requesttype = triggerAuthentication.type;
|
||||
alert.info(
|
||||
toast(
|
||||
"Creating " + requesttype + " subscription with name " + trigger.name
|
||||
);
|
||||
|
||||
@@ -11306,9 +11307,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to start trigger: " + responseJson.reason);
|
||||
toast("Failed to start trigger: " + responseJson.reason);
|
||||
} else {
|
||||
alert.success(
|
||||
toast(
|
||||
"Successfully started folder subscription trigger. Test it by sending yoursend an email"
|
||||
);
|
||||
|
||||
@@ -11320,7 +11321,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
console.log("Start mailsub error: ", error.toString());
|
||||
});
|
||||
};
|
||||
@@ -11328,12 +11329,12 @@ const AngularWorkflow = (defaultprops) => {
|
||||
const newWebhook = (trigger) => {
|
||||
const hookname = trigger.label;
|
||||
if (hookname.length === 0) {
|
||||
alert.error("Missing name");
|
||||
toast("Missing name");
|
||||
return;
|
||||
}
|
||||
|
||||
if (trigger.id.length !== 36) {
|
||||
alert.error("Missing id");
|
||||
toast("Missing id");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11343,10 +11344,10 @@ const AngularWorkflow = (defaultprops) => {
|
||||
(branch) => branch.source_id === trigger.id
|
||||
);
|
||||
if (branch === undefined && (workflow.start === undefined || workflow.start === null || workflow.start.length === 0)) {
|
||||
alert.error("No webhook node defined");
|
||||
toast("No webhook node defined");
|
||||
}
|
||||
|
||||
alert.info("Starting webhook");
|
||||
toast("Starting webhook");
|
||||
if (branch !== undefined) {
|
||||
startNode = branch.destination_id;
|
||||
}
|
||||
@@ -11398,14 +11399,14 @@ const AngularWorkflow = (defaultprops) => {
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success) {
|
||||
// Set the status
|
||||
alert.success("Successfully started webhook");
|
||||
toast("Successfully started webhook");
|
||||
trigger.status = "running";
|
||||
setSelectedTrigger(trigger);
|
||||
workflow.triggers[selectedTriggerIndex].status = "running";
|
||||
setWorkflow(workflow);
|
||||
saveWorkflow(workflow);
|
||||
} else {
|
||||
alert.error("Failed starting webhook: " + responseJson.reason);
|
||||
toast("Failed starting webhook: " + responseJson.reason);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -11444,7 +11445,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
saveWorkflow(workflow);
|
||||
} else {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed stopping webhook: " + responseJson.reason);
|
||||
toast("Failed stopping webhook: " + responseJson.reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11453,8 +11454,8 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setSelectedTrigger(trigger);
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
alert.error("Delete webhook error. Contact support or check logs if this persists.")
|
||||
//toast(error.toString());
|
||||
toast("Delete webhook error. Contact support or check logs if this persists.")
|
||||
});
|
||||
};
|
||||
|
||||
@@ -13406,7 +13407,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13423,7 +13424,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
document.execCommand("copy");
|
||||
|
||||
console.log("COPYING!");
|
||||
alert.info("Copied value to clipboard, NOT json path.")
|
||||
toast("Copied value to clipboard, NOT json path.")
|
||||
} else {
|
||||
console.log("Failed to copy from " + elementName + ": ", copyText);
|
||||
}
|
||||
@@ -13494,7 +13495,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("NAVIGATOR: ", navigator);
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13505,7 +13506,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
console.log("COPYING!");
|
||||
alert.info("Copied JSON path to clipboard.")
|
||||
toast("Copied JSON path to clipboard.")
|
||||
} else {
|
||||
console.log("Couldn't find element ", elementName);
|
||||
}
|
||||
@@ -14875,7 +14876,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
console.log("NAVIGATOR: ", navigator);
|
||||
const clipboard = navigator.clipboard;
|
||||
if (clipboard === undefined) {
|
||||
alert.error("Can only copy over HTTPS (port 3443)");
|
||||
toast("Can only copy over HTTPS (port 3443)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15480,7 +15481,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
selectedApp.authentication.parameters[paramkey].name
|
||||
] = "false";
|
||||
} else {
|
||||
alert.info(
|
||||
toast(
|
||||
"Field " +
|
||||
selectedApp.authentication.parameters[paramkey].name +
|
||||
" can't be empty"
|
||||
|
||||
@@ -46,7 +46,8 @@ import { v4 as uuidv4 } from "uuid";
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import YAML from "yaml";
|
||||
import { MuiChipsInput } from "mui-chips-input";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import words from "shellwords";
|
||||
|
||||
import AvatarEditor from "react-avatar-editor";
|
||||
@@ -350,7 +351,7 @@ const getJsonObject = (properties) => {
|
||||
const AppCreator = (defaultprops) => {
|
||||
const { globalUrl, isLoaded } = defaultprops;
|
||||
const classes = useStyles();
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
|
||||
const params = useParams();
|
||||
var props = JSON.parse(JSON.stringify(defaultprops))
|
||||
@@ -451,7 +452,7 @@ const AppCreator = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
alert.error("Failed to get the app");
|
||||
toast("Failed to get the app");
|
||||
setIsAppLoaded(true);
|
||||
window.location.pathname = "/search";
|
||||
} else {
|
||||
@@ -459,7 +460,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -494,14 +495,14 @@ const AppCreator = (defaultprops) => {
|
||||
.then((responseJson) => {
|
||||
setIsAppLoaded(true);
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to get app config. Do you have access?");
|
||||
toast("Failed to get app config. Do you have access?");
|
||||
} else {
|
||||
parseIncomingOpenapiData(responseJson);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error: ", error.toString());
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -568,7 +569,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
|
||||
if (data.openapi === null) {
|
||||
alert.info("Failed to load OpenAPI for app. Please contact support if this persists.")
|
||||
toast("Failed to load OpenAPI for app. Please contact support if this persists.")
|
||||
setIsAppLoaded(true);
|
||||
return
|
||||
}
|
||||
@@ -600,7 +601,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
|
||||
if (!jsonvalid) {
|
||||
alert.info("OpenAPI data is invalid.");
|
||||
toast("OpenAPI data is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -726,7 +727,7 @@ const AppCreator = (defaultprops) => {
|
||||
|
||||
for (let [method, methodvalue] of Object.entries(pathvalue)) {
|
||||
if (methodvalue === null) {
|
||||
alert.info("Skipped method (null)" + method);
|
||||
toast("Skipped method (null)" + method);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -734,7 +735,7 @@ const AppCreator = (defaultprops) => {
|
||||
// Typical YAML issue
|
||||
if (method !== "parameters") {
|
||||
console.log("Invalid method: ", method, "data: ", methodvalue);
|
||||
//alert.info("Skipped method (not allowed): " + method);
|
||||
//toast("Skipped method (not allowed): " + method);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -1596,7 +1597,7 @@ const AppCreator = (defaultprops) => {
|
||||
setParameterLocation(value.in);
|
||||
if (!apikeySelection.includes(value.in)) {
|
||||
console.log("APIKEY SELECT: ", apikeySelection);
|
||||
alert.error("Might be error in setting up API key authentication");
|
||||
toast("Might be error in setting up API key authentication");
|
||||
}
|
||||
|
||||
console.log("PARAM NAME: ", value.name);
|
||||
@@ -1637,7 +1638,7 @@ const AppCreator = (defaultprops) => {
|
||||
optionset = true
|
||||
|
||||
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) {
|
||||
//alert.info("Can't handle Oauth2 auth yet.")
|
||||
//toast("Can't handle Oauth2 auth yet.")
|
||||
setAuthenticationOption("Oauth2");
|
||||
setAuthenticationRequired(true);
|
||||
optionset = true
|
||||
@@ -1686,7 +1687,7 @@ const AppCreator = (defaultprops) => {
|
||||
const scopekeysplit = scopekey.split("/");
|
||||
if (scopekeysplit.length < 5) {
|
||||
console.log("Skipping scope: ", scopekey);
|
||||
alert.info("Skipping scope: " + scopekey);
|
||||
toast("Skipping scope: " + scopekey);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1707,7 +1708,7 @@ const AppCreator = (defaultprops) => {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
alert.error("Couldn't handle AUTH type: ", key);
|
||||
toast("Couldn't handle AUTH type: ", key);
|
||||
//newauth.push({
|
||||
// "name": key,
|
||||
// "type": value.in,
|
||||
@@ -1716,7 +1717,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
alert.error("Failed to handle auth")
|
||||
toast("Failed to handle auth")
|
||||
console.log("Error: ", e)
|
||||
}
|
||||
|
||||
@@ -1790,7 +1791,7 @@ const AppCreator = (defaultprops) => {
|
||||
|
||||
//const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io"
|
||||
if (newActions.length > 1000 && isCloud) {
|
||||
alert.error("Cut down actions from " + newActions.length + " to 999 because of limit");
|
||||
toast("Cut down actions from " + newActions.length + " to 999 because of limit");
|
||||
newActions = newActions.slice(0, 999);
|
||||
}
|
||||
|
||||
@@ -1812,7 +1813,7 @@ const AppCreator = (defaultprops) => {
|
||||
// Saving the app that's been configured.
|
||||
// Save SAVE app
|
||||
const submitApp = () => {
|
||||
alert.info("Uploading and building app " + name);
|
||||
toast("Uploading and building app " + name);
|
||||
setAppBuilding(true);
|
||||
setErrorCode("");
|
||||
|
||||
@@ -1881,7 +1882,7 @@ const AppCreator = (defaultprops) => {
|
||||
for (let actionkey in actions) {
|
||||
var item = JSON.parse(JSON.stringify(actions[actionkey]))
|
||||
if (item.errors.length > 0) {
|
||||
alert.error("Saving with error in action " + item.name);
|
||||
toast("Saving with error in action " + item.name);
|
||||
}
|
||||
|
||||
if (item.name === undefined && item.description !== undefined) {
|
||||
@@ -2107,7 +2108,7 @@ const AppCreator = (defaultprops) => {
|
||||
|
||||
// Bad code as it doesn't allow for "anything".
|
||||
if (skipped) {
|
||||
alert.info(
|
||||
toast(
|
||||
"Bad configuration of " +
|
||||
item.name +
|
||||
". Skipping because queries are invalid."
|
||||
@@ -2358,7 +2359,7 @@ const AppCreator = (defaultprops) => {
|
||||
|
||||
if (authenticationOption === "API key") {
|
||||
if (parameterName.length === 0) {
|
||||
alert.error("A field name for the APIkey must be defined");
|
||||
toast("A field name for the APIkey must be defined");
|
||||
setAppBuilding(false);
|
||||
return;
|
||||
}
|
||||
@@ -2424,7 +2425,7 @@ const AppCreator = (defaultprops) => {
|
||||
const curauth = extraAuth[authkey];
|
||||
|
||||
if (curauth.name.toLowerCase() == "url") {
|
||||
alert.error("Can't add extra auth with Name URL");
|
||||
toast("Can't add extra auth with Name URL");
|
||||
setAppBuilding(false);
|
||||
return;
|
||||
}
|
||||
@@ -2459,10 +2460,10 @@ const AppCreator = (defaultprops) => {
|
||||
if (!responseJson.success) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
setErrorCode(responseJson.reason);
|
||||
alert.error("Failed to verify: " + responseJson.reason);
|
||||
toast("Failed to verify: " + responseJson.reason);
|
||||
}
|
||||
} else {
|
||||
alert.success("Successfully uploaded openapi");
|
||||
toast("Successfully uploaded openapi");
|
||||
if (window.location.pathname.includes("/new")) {
|
||||
if (responseJson.id !== undefined && responseJson.id !== null) {
|
||||
window.location = `/apps/edit/${responseJson.id}`;
|
||||
@@ -2473,7 +2474,7 @@ const AppCreator = (defaultprops) => {
|
||||
.catch((error) => {
|
||||
setAppBuilding(false);
|
||||
setErrorCode(error.toString());
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2805,7 +2806,7 @@ const AppCreator = (defaultprops) => {
|
||||
!tmpstring.startsWith("http") &&
|
||||
!tmpstring.startsWith("ftp")
|
||||
) {
|
||||
alert.error("Auth URL must start with http(s)://");
|
||||
toast("Auth URL must start with http(s)://");
|
||||
}
|
||||
|
||||
if (tmpstring.includes("?")) {
|
||||
@@ -2854,7 +2855,7 @@ const AppCreator = (defaultprops) => {
|
||||
!tmpstring.startsWith("http") &&
|
||||
!tmpstring.startsWith("ftp")
|
||||
) {
|
||||
alert.error("Token URL must start with http(s)://");
|
||||
toast("Token URL must start with http(s)://");
|
||||
}
|
||||
|
||||
if (tmpstring.includes("?")) {
|
||||
@@ -2900,7 +2901,7 @@ const AppCreator = (defaultprops) => {
|
||||
!tmpstring.startsWith("http") &&
|
||||
!tmpstring.startsWith("ftp")
|
||||
) {
|
||||
alert.error("Refresh URL must start with http(s)://");
|
||||
toast("Refresh URL must start with http(s)://");
|
||||
}
|
||||
|
||||
if (tmpstring.includes("?")) {
|
||||
@@ -3791,7 +3792,7 @@ const AppCreator = (defaultprops) => {
|
||||
value = keysplit[1].trim()
|
||||
|
||||
} else {
|
||||
alert.error("Removed key: ", key)
|
||||
toast("Removed key: ", key)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -4626,11 +4627,11 @@ const AppCreator = (defaultprops) => {
|
||||
setSelectedAction(selectedAction);
|
||||
}
|
||||
|
||||
//alert.error("Failed getting authentications")
|
||||
//toast("Failed getting authentications")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Auth loading error: " + error.toString());
|
||||
toast("Auth loading error: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -4686,17 +4687,17 @@ const AppCreator = (defaultprops) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to set app auth: " + responseJson.reason);
|
||||
toast("Failed to set app auth: " + responseJson.reason);
|
||||
} else {
|
||||
getAppAuthentication(true);
|
||||
setAuthenticationModalOpen(false);
|
||||
|
||||
// Needs a refresh with the new authentication..
|
||||
//alert.success("Successfully saved new app auth")
|
||||
//toast("Successfully saved new app auth")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -4747,7 +4748,7 @@ const AppCreator = (defaultprops) => {
|
||||
console.log("NEW AUTH: ", authenticationOption);
|
||||
if (authenticationOption.label.length === 0) {
|
||||
authenticationOption.label = `Auth for ${selectedApp.name}`;
|
||||
//alert.info("Label can't be empty")
|
||||
//toast("Label can't be empty")
|
||||
//return
|
||||
}
|
||||
|
||||
@@ -4757,7 +4758,7 @@ const AppCreator = (defaultprops) => {
|
||||
selectedApp.authentication.parameters[key].name
|
||||
].length === 0
|
||||
) {
|
||||
alert.info(
|
||||
toast(
|
||||
"Field " +
|
||||
selectedApp.authentication.parameters[key].name +
|
||||
" can't be empty"
|
||||
@@ -5165,7 +5166,7 @@ const AppCreator = (defaultprops) => {
|
||||
setFileBase64(canvasUrl);
|
||||
}
|
||||
} catch (e) {
|
||||
alert.error("Failed to parse canvasurl!");
|
||||
toast("Failed to parse canvasurl!");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5253,7 +5254,7 @@ const AppCreator = (defaultprops) => {
|
||||
setOpenImageModal(false);
|
||||
setDisableImageUpload(true);
|
||||
} catch (e) {
|
||||
alert.error("Failed to set image. Replace it if this persists.");
|
||||
toast("Failed to set image. Replace it if this persists.");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -5468,7 +5469,7 @@ const AppCreator = (defaultprops) => {
|
||||
const invalid = ["#", ":", "."];
|
||||
for (var key in invalid) {
|
||||
if (e.target.value.includes(invalid[key])) {
|
||||
alert.error("Can't use " + invalid[key] + " in name");
|
||||
toast("Can't use " + invalid[key] + " in name");
|
||||
setName(e.target.value.replaceAll(".", "").replaceAll("#", "").replaceAll(":", "").replaceAll(",", ""))
|
||||
|
||||
return;
|
||||
@@ -5476,7 +5477,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
|
||||
if (e.target.value.length > 29) {
|
||||
alert.error("Choose a shorter name (max 29).");
|
||||
toast("Choose a shorter name (max 29).");
|
||||
setName(e.target.value.slice(0,28))
|
||||
return;
|
||||
}
|
||||
@@ -5588,7 +5589,7 @@ const AppCreator = (defaultprops) => {
|
||||
!tmpstring.startsWith("http") &&
|
||||
!tmpstring.startsWith("ftp")
|
||||
) {
|
||||
alert.error("URL must start with http(s)://");
|
||||
toast("URL must start with http(s)://");
|
||||
}
|
||||
|
||||
if (tmpstring.includes("?")) {
|
||||
|
||||
+41
-40
@@ -59,7 +59,8 @@ import algoliasearch from 'algoliasearch/lite';
|
||||
|
||||
import YAML from "yaml";
|
||||
import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import Dropzone from "../components/Dropzone.jsx";
|
||||
|
||||
const surfaceColor = "#27292D";
|
||||
@@ -272,7 +273,7 @@ const Apps = (props) => {
|
||||
|
||||
//const [workflows, setWorkflows] = React.useState([]);
|
||||
const baseRepository = "https://github.com/frikky/shuffle-apps";
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
let navigate = useNavigate();
|
||||
|
||||
const [selectedApp, setSelectedApp] = React.useState({});
|
||||
@@ -454,7 +455,7 @@ const Apps = (props) => {
|
||||
//}, 5000)
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
setIsLoading(false);
|
||||
});
|
||||
};
|
||||
@@ -462,7 +463,7 @@ const Apps = (props) => {
|
||||
const downloadApp = (inputdata) => {
|
||||
const id = inputdata.id;
|
||||
|
||||
alert.info("Downloading..");
|
||||
toast("Downloading..");
|
||||
fetch(globalUrl + "/api/v1/apps/" + id + "/config", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
@@ -480,7 +481,7 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
alert.error("Failed to download file");
|
||||
toast("Failed to download file");
|
||||
} else {
|
||||
console.log(responseJson);
|
||||
const basedata = atob(responseJson.openapi);
|
||||
@@ -538,7 +539,7 @@ const Apps = (props) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1152,7 +1153,7 @@ const Apps = (props) => {
|
||||
<Select
|
||||
value={sharingConfiguration}
|
||||
onChange={(event) => {
|
||||
alert.info("Changing sharing to " + event.target.value);
|
||||
toast("Changing sharing to " + event.target.value);
|
||||
|
||||
setSharingConfiguration(event.target.value);
|
||||
|
||||
@@ -1479,7 +1480,7 @@ const Apps = (props) => {
|
||||
try {
|
||||
reader.readAsText(files[0]);
|
||||
} catch (error) {
|
||||
alert.error("Failed to read file");
|
||||
toast("Failed to read file");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1578,9 +1579,9 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
alert.error("Failed to activate the app")
|
||||
toast("Failed to activate the app")
|
||||
} else {
|
||||
alert.success("App activated for your organization! Refresh the page to use the app.")
|
||||
toast("App activated for your organization! Refresh the page to use the app.")
|
||||
|
||||
if (refresh === true) {
|
||||
getApps()
|
||||
@@ -1588,7 +1589,7 @@ const Apps = (props) => {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
//alert.error(error.toString())
|
||||
//toast(error.toString())
|
||||
console.log("Activate app error: ", error.toString())
|
||||
});
|
||||
}
|
||||
@@ -1692,13 +1693,13 @@ const Apps = (props) => {
|
||||
return (
|
||||
<div style={{ textDecoration: "none", color: "white", }} onClick={(event) => {
|
||||
//if (!isCloud) {
|
||||
// alert.info("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.")
|
||||
// toast("Since this is an on-prem instance. You will need to activate the app yourself. Opening link to download it in a new window.")
|
||||
// setTimeout(() => {
|
||||
// event.preventDefault()
|
||||
// window.open(parsedUrl, '_blank')
|
||||
// }, 2000)
|
||||
//} else {
|
||||
alert.info(`Activating ${name}`)
|
||||
toast(`Activating ${name}`)
|
||||
//}
|
||||
|
||||
console.log("CLICK: ", hit)
|
||||
@@ -2010,7 +2011,7 @@ const Apps = (props) => {
|
||||
|
||||
parsedData["force_update"] = forceUpdate;
|
||||
|
||||
alert.success("Getting specific apps from your URL.");
|
||||
toast("Getting specific apps from your URL.");
|
||||
var cors = "cors";
|
||||
fetch(globalUrl + "/api/v1/apps/get_existing", {
|
||||
method: "POST",
|
||||
@@ -2023,7 +2024,7 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
alert.success("Loaded existing apps!");
|
||||
toast("Loaded existing apps!");
|
||||
}
|
||||
|
||||
//stop()
|
||||
@@ -2034,12 +2035,12 @@ const Apps = (props) => {
|
||||
.then((responseJson) => {
|
||||
console.log("DATA: ", responseJson);
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed loading: " + responseJson.reason);
|
||||
toast("Failed loading: " + responseJson.reason);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("ERROR: ", error.toString());
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
//stop()
|
||||
|
||||
setIsLoading(false);
|
||||
@@ -2049,7 +2050,7 @@ const Apps = (props) => {
|
||||
|
||||
// Locally hotloads app from folder
|
||||
const hotloadApps = () => {
|
||||
alert.info("Hotloading apps from location in .env");
|
||||
toast("Hotloading apps from location in .env");
|
||||
setIsLoading(true);
|
||||
fetch(globalUrl + "/api/v1/apps/run_hotload", {
|
||||
mode: "cors",
|
||||
@@ -2061,7 +2062,7 @@ const Apps = (props) => {
|
||||
.then((response) => {
|
||||
setIsLoading(false);
|
||||
if (response.status === 200) {
|
||||
//alert.success("Hotloaded apps!")
|
||||
//toast("Hotloaded apps!")
|
||||
getApps();
|
||||
}
|
||||
|
||||
@@ -2069,14 +2070,14 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === true) {
|
||||
alert.info("Successfully finished hotload");
|
||||
toast("Successfully finished hotload");
|
||||
} else {
|
||||
alert.error("Failed hotload: ", responseJson.reason);
|
||||
toast("Failed hotload: ", responseJson.reason);
|
||||
//(responseJson.reason !== undefined && responseJson.reason.length > 0) {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2100,7 +2101,7 @@ const Apps = (props) => {
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2113,9 +2114,9 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
//alert.success("Successfully GOT app "+appId)
|
||||
//toast("Successfully GOT app "+appId)
|
||||
} else {
|
||||
alert.error("Failed getting app");
|
||||
toast("Failed getting app");
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -2138,7 +2139,7 @@ const Apps = (props) => {
|
||||
responseJson.loop_versions = selectedApp.loop_versions;
|
||||
}
|
||||
|
||||
//alert.info("Should set app to selected")
|
||||
//toast("Should set app to selected")
|
||||
if (
|
||||
responseJson.actions !== undefined &&
|
||||
responseJson.actions !== null &&
|
||||
@@ -2152,12 +2153,12 @@ const Apps = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const deleteApp = (appId) => {
|
||||
alert.info("Attempting to delete app");
|
||||
toast("Attempting to delete app");
|
||||
fetch(globalUrl + "/api/v1/apps/" + appId, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
@@ -2167,16 +2168,16 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
alert.success("Successfully deleted app");
|
||||
toast("Successfully deleted app");
|
||||
setTimeout(() => {
|
||||
getApps();
|
||||
}, 1000);
|
||||
} else {
|
||||
alert.error("Failed deleting app. Does it still exist?");
|
||||
toast("Failed deleting app. Does it still exist?");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2200,19 +2201,19 @@ const Apps = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
//console.log(responseJson)
|
||||
//alert.info(responseJson)
|
||||
//toast(responseJson)
|
||||
if (responseJson.success) {
|
||||
alert.success("Successfully updated app configuration");
|
||||
toast("Successfully updated app configuration");
|
||||
} else {
|
||||
if (responseJson.reason !== undefined && responseJson.reason !== null) {
|
||||
alert.error("Error: "+responseJson.reason);
|
||||
toast("Error: "+responseJson.reason);
|
||||
} else {
|
||||
alert.error("Error updating app configuration");
|
||||
toast("Error updating app configuration");
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2243,7 +2244,7 @@ const Apps = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2281,7 +2282,7 @@ const Apps = (props) => {
|
||||
validateOpenApi(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
setOpenApiError(error.toString());
|
||||
});
|
||||
};
|
||||
@@ -2338,12 +2339,12 @@ const Apps = (props) => {
|
||||
if (responseJson.reason !== undefined) {
|
||||
setOpenApiError(responseJson.reason);
|
||||
}
|
||||
alert.error("An error occurred in the response");
|
||||
toast("An error occurred in the response");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
setValidation(false);
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
setOpenApiError(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -9,7 +9,8 @@ import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
|
||||
// react plugin used to create charts
|
||||
//import { Line, Bar } from "react-chartjs-2";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
|
||||
import {
|
||||
Autocomplete,
|
||||
@@ -155,7 +156,7 @@ const UsecaseListComponent = ({keys, isCloud, globalUrl, frameworkData, isLogged
|
||||
}, 100);
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
setInputUsecase({})
|
||||
setExpandedIndex(index)
|
||||
setExpandedItem(subindex)
|
||||
@@ -212,16 +213,16 @@ const UsecaseListComponent = ({keys, isCloud, globalUrl, frameworkData, isLogged
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
//alert.error("Failed updating: " + responseJson.reason)
|
||||
//toast("Failed updating: " + responseJson.reason)
|
||||
} else {
|
||||
//alert.error("Failed to update framework for your org.")
|
||||
//toast("Failed to update framework for your org.")
|
||||
}
|
||||
} else {
|
||||
//alert.info("Updated usecase.")
|
||||
//toast("Updated usecase.")
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
//setFrameworkLoaded(true)
|
||||
})
|
||||
}
|
||||
@@ -249,9 +250,9 @@ const UsecaseListComponent = ({keys, isCloud, globalUrl, frameworkData, isLogged
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Error updating workflow: ", responseJson.reason)
|
||||
toast("Error updating workflow: ", responseJson.reason)
|
||||
} else {
|
||||
alert.error("Error updating workflow.")
|
||||
toast("Error updating workflow.")
|
||||
}
|
||||
|
||||
return
|
||||
@@ -260,7 +261,7 @@ const UsecaseListComponent = ({keys, isCloud, globalUrl, frameworkData, isLogged
|
||||
return responseJson;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Problem setting workflow: ", error.toString());
|
||||
toast("Problem setting workflow: ", error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1025,7 +1026,7 @@ const RadialChart = ({keys, setSelectedCategory}) => {
|
||||
// What data do we fill in here? Idk
|
||||
const Dashboard = (props) => {
|
||||
const { globalUrl, isLoggedIn } = props;
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
const [bigChartData, setBgChartData] = useState("data1");
|
||||
const [dayAmount, setDayAmount] = useState(7);
|
||||
const [firstRequest, setFirstRequest] = useState(true);
|
||||
@@ -1117,16 +1118,16 @@ const Dashboard = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
//alert.error("Failed loading: " + responseJson.reason)
|
||||
//toast("Failed loading: " + responseJson.reason)
|
||||
} else {
|
||||
//alert.error("Failed to load framework for your org.")
|
||||
//toast("Failed to load framework for your org.")
|
||||
}
|
||||
} else {
|
||||
setFrameworkData(responseJson)
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1157,7 +1158,7 @@ const Dashboard = (props) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
fetchUsecases()
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1257,7 +1258,7 @@ const Dashboard = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR: " + error.toString());
|
||||
});
|
||||
};
|
||||
@@ -1291,7 +1292,7 @@ const Dashboard = (props) => {
|
||||
setChangeme(stats_id);
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -8,7 +8,8 @@ import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
|
||||
// react plugin used to create charts
|
||||
//import { Line, Bar } from "react-chartjs-2";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import Draggable from "react-draggable";
|
||||
|
||||
import {
|
||||
@@ -332,7 +333,7 @@ const RadialChart = ({keys, setSelectedCategory}) => {
|
||||
// What data do we fill in here? Idk
|
||||
const Dashboard = (props) => {
|
||||
const { globalUrl, isLoggedIn } = props;
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
const [bigChartData, setBgChartData] = useState("data1");
|
||||
const [dayAmount, setDayAmount] = useState(7);
|
||||
const [firstRequest, setFirstRequest] = useState(true);
|
||||
@@ -427,9 +428,9 @@ const Dashboard = (props) => {
|
||||
console.log("Resp: ", responseJson)
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
//alert.error("Failed loading: " + responseJson.reason)
|
||||
//toast("Failed loading: " + responseJson.reason)
|
||||
} else {
|
||||
//alert.error("Failed to load framework for your org.")
|
||||
//toast("Failed to load framework for your org.")
|
||||
}
|
||||
} else {
|
||||
var tmpdata = responseJson
|
||||
@@ -452,7 +453,7 @@ const Dashboard = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error(error.toString());
|
||||
//toast(error.toString());
|
||||
})
|
||||
}
|
||||
|
||||
@@ -504,7 +505,7 @@ const Dashboard = (props) => {
|
||||
setChangeme(stats_id);
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react';
|
||||
import ReactDOM from "react-dom"
|
||||
|
||||
import AppFramework from "../components/AppFramework.jsx";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import theme from '../theme.jsx';
|
||||
|
||||
@@ -13,7 +14,7 @@ import {
|
||||
const Framework = (props) => {
|
||||
const {globalUrl, isLoaded, isLoggedIn, showOptions, selectedOption, rolling, } = props;
|
||||
|
||||
const alert = useAlert()
|
||||
//const alert = useAlert()
|
||||
const [frameworkLoaded, setFrameworkLoaded] = useState(false)
|
||||
const [frameworkData, setFrameworkData] = useState()
|
||||
|
||||
@@ -36,9 +37,9 @@ const Framework = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed loading: " + responseJson.reason)
|
||||
toast("Failed loading: " + responseJson.reason)
|
||||
} else {
|
||||
alert.error("Failed to load framework for your org.")
|
||||
toast("Failed to load framework for your org.")
|
||||
}
|
||||
|
||||
setFrameworkLoaded(true)
|
||||
@@ -51,7 +52,7 @@ const Framework = (props) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
setFrameworkLoaded(true)
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,8 @@ import { DataGrid, GridToolbar } from "@mui/x-data-grid";
|
||||
import Dropzone from "../components/Dropzone.jsx";
|
||||
|
||||
import { useNavigate, Link, useParams } from "react-router-dom";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import { MuiChipsInput } from "mui-chips-input";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
@@ -123,7 +124,7 @@ const GettingStarted = (props) => {
|
||||
const { globalUrl, isLoggedIn, isLoaded, userdata } = props;
|
||||
|
||||
document.title = "Getting Started with Shuffle";
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
const classes = useStyles(theme);
|
||||
let navigate = useNavigate();
|
||||
const imgSize = 60;
|
||||
@@ -442,7 +443,7 @@ const GettingStarted = (props) => {
|
||||
const files = isDropzone ? e.dataTransfer.files : e.target.files;
|
||||
|
||||
const reader = new FileReader();
|
||||
alert.info("Starting upload. Please wait while we validate the workflows");
|
||||
toast("Starting upload. Please wait while we validate the workflows");
|
||||
|
||||
try {
|
||||
reader.addEventListener("load", (e) => {
|
||||
@@ -451,7 +452,7 @@ const GettingStarted = (props) => {
|
||||
try {
|
||||
data = JSON.parse(reader.result);
|
||||
} catch (e) {
|
||||
alert.error("Invalid JSON: " + e);
|
||||
toast("Invalid JSON: " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -479,13 +480,13 @@ const GettingStarted = (props) => {
|
||||
false
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
alert.success(`Successfully imported ${data.name}`);
|
||||
toast(`Successfully imported ${data.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Import error: " + error.toString());
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -518,7 +519,7 @@ const GettingStarted = (props) => {
|
||||
window.location.pathname = "/login";
|
||||
}
|
||||
|
||||
alert.info("Failed getting workflows.");
|
||||
toast("Failed getting workflows.");
|
||||
setWorkflowDone(true);
|
||||
|
||||
return;
|
||||
@@ -559,7 +560,7 @@ const GettingStarted = (props) => {
|
||||
}, 100)
|
||||
} else {
|
||||
if (isLoggedIn) {
|
||||
alert.error("An error occurred while loading workflows");
|
||||
toast("An error occurred while loading workflows");
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -568,7 +569,7 @@ const GettingStarted = (props) => {
|
||||
.catch((error) => {
|
||||
setVideoViewOpen(true)
|
||||
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -685,7 +686,7 @@ const GettingStarted = (props) => {
|
||||
trigger.parameters[1].value = "webhook_" + trigger.id;
|
||||
// FIXME: Add auth here?
|
||||
} else {
|
||||
alert.info("Something is wrong with the webhook in the copy");
|
||||
toast("Something is wrong with the webhook in the copy");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +804,7 @@ const GettingStarted = (props) => {
|
||||
data = sanitizeWorkflow(data);
|
||||
|
||||
if (data.subflows !== null && data.subflows !== undefined) {
|
||||
alert.info(
|
||||
toast(
|
||||
"Not exporting with subflows when sanitizing. Please manually export them."
|
||||
);
|
||||
data.subflows = [];
|
||||
@@ -830,7 +831,7 @@ const GettingStarted = (props) => {
|
||||
const publishWorkflow = (data) => {
|
||||
data = JSON.parse(JSON.stringify(data));
|
||||
data = sanitizeWorkflow(data);
|
||||
alert.info("Sanitizing and publishing " + data.name);
|
||||
toast("Sanitizing and publishing " + data.name);
|
||||
|
||||
// This ALWAYS talks to Shuffle cloud
|
||||
fetch(globalUrl + "/api/v1/workflows/" + data.id + "/publish", {
|
||||
@@ -847,9 +848,9 @@ const GettingStarted = (props) => {
|
||||
console.log("Status not 200 for workflow publish :O!");
|
||||
} else {
|
||||
if (isCloud) {
|
||||
alert.success("Successfully published workflow");
|
||||
toast("Successfully published workflow");
|
||||
} else {
|
||||
alert.success(
|
||||
toast(
|
||||
"Successfully published workflow to https://shuffler.io"
|
||||
);
|
||||
}
|
||||
@@ -859,19 +860,19 @@ const GettingStarted = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed publishing: ", responseJson.reason);
|
||||
toast("Failed publishing: ", responseJson.reason);
|
||||
}
|
||||
|
||||
getAvailableWorkflows();
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const copyWorkflow = (data) => {
|
||||
data = JSON.parse(JSON.stringify(data));
|
||||
alert.success("Copying workflow " + data.name);
|
||||
toast("Copying workflow " + data.name);
|
||||
data.id = "";
|
||||
data.name = data.name + "_copy";
|
||||
data = deduplicateIds(data);
|
||||
@@ -898,7 +899,7 @@ const GettingStarted = (props) => {
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -914,9 +915,9 @@ const GettingStarted = (props) => {
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for setting workflows :O!");
|
||||
alert.error("Failed deleting workflow. Do you have access?");
|
||||
toast("Failed deleting workflow. Do you have access?");
|
||||
} else {
|
||||
alert.success("Deleted workflow " + id);
|
||||
toast("Deleted workflow " + id);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -927,7 +928,7 @@ const GettingStarted = (props) => {
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1272,7 +1273,7 @@ const GettingStarted = (props) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
if (subflows === 0) {
|
||||
alert.info("No subflows for " + data.name);
|
||||
toast("No subflows for " + data.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1434,9 +1435,9 @@ const GettingStarted = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Error setting workflow: ", responseJson.reason)
|
||||
toast("Error setting workflow: ", responseJson.reason)
|
||||
} else {
|
||||
alert.error("Error setting workflow.")
|
||||
toast("Error setting workflow.")
|
||||
}
|
||||
|
||||
return
|
||||
@@ -1453,14 +1454,14 @@ const GettingStarted = (props) => {
|
||||
setImportLoading(false);
|
||||
setModalOpen(false);
|
||||
} else {
|
||||
alert.info("Successfully changed basic info for workflow");
|
||||
toast("Successfully changed basic info for workflow");
|
||||
setModalOpen(false);
|
||||
}
|
||||
|
||||
return responseJson;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
setImportLoading(false);
|
||||
setModalOpen(false);
|
||||
setSubmitLoading(false);
|
||||
@@ -1476,7 +1477,7 @@ const GettingStarted = (props) => {
|
||||
const file = event.target.files[key];
|
||||
if (file.type !== "application/json") {
|
||||
if (file.type !== undefined) {
|
||||
alert.error("File has to contain valid json");
|
||||
toast("File has to contain valid json");
|
||||
setImportLoading(false);
|
||||
}
|
||||
|
||||
@@ -1490,7 +1491,7 @@ const GettingStarted = (props) => {
|
||||
try {
|
||||
data = JSON.parse(reader.result);
|
||||
} catch (e) {
|
||||
alert.error("Invalid JSON: " + e);
|
||||
toast("Invalid JSON: " + e);
|
||||
setImportLoading(false);
|
||||
return;
|
||||
}
|
||||
@@ -1522,13 +1523,13 @@ const GettingStarted = (props) => {
|
||||
false
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
alert.success("Successfully imported " + data.name);
|
||||
toast("Successfully imported " + data.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Import error: " + error.toString());
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1727,7 +1728,7 @@ const GettingStarted = (props) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
if (subflows === 0) {
|
||||
alert.info("No subflows for " + data.name);
|
||||
toast("No subflows for " + data.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2168,7 +2169,7 @@ const GettingStarted = (props) => {
|
||||
})
|
||||
return
|
||||
} else {
|
||||
alert.success("TBD: Coming in version 1.0.0");
|
||||
toast("TBD: Coming in version 1.0.0");
|
||||
}
|
||||
|
||||
const ele = document.getElementById("shuffle_search_field")
|
||||
@@ -2179,7 +2180,7 @@ const GettingStarted = (props) => {
|
||||
ele.style.borderWidth = "2px"
|
||||
|
||||
} else {
|
||||
//alert.success("TBD: Coming in version 1.0.0");
|
||||
//toast("TBD: Coming in version 1.0.0");
|
||||
}
|
||||
}}>
|
||||
workflows made by other creators</span>!
|
||||
@@ -2599,7 +2600,7 @@ const GettingStarted = (props) => {
|
||||
parsedData["field_2"] = field2;
|
||||
}
|
||||
|
||||
alert.success("Getting specific workflows from your URL.");
|
||||
toast("Getting specific workflows from your URL.");
|
||||
fetch(globalUrl + "/api/v1/workflows/download_remote", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
@@ -2611,7 +2612,7 @@ const GettingStarted = (props) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
alert.success("Successfully loaded workflows from " + downloadUrl);
|
||||
toast("Successfully loaded workflows from " + downloadUrl);
|
||||
setTimeout(() => {
|
||||
getAvailableWorkflows();
|
||||
}, 1000);
|
||||
@@ -2622,14 +2623,14 @@ const GettingStarted = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed loading: " + responseJson.reason);
|
||||
toast("Failed loading: " + responseJson.reason);
|
||||
} else {
|
||||
alert.error("Failed loading");
|
||||
toast("Failed loading");
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@ import {
|
||||
Divider,
|
||||
TextField,
|
||||
} from "@mui/material";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
|
||||
const Settings = (props) => {
|
||||
const { globalUrl, isLoaded, userdata, setUserData } = props;
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
let navigate = useNavigate();
|
||||
|
||||
const [username, setUsername] = useState("");
|
||||
@@ -142,7 +143,7 @@ const Settings = (props) => {
|
||||
if (responseJson["success"] === false) {
|
||||
setPasswordFormMessage(responseJson["reason"]);
|
||||
} else {
|
||||
alert.success("Changed password!");
|
||||
toast("Changed password!");
|
||||
setPasswordFormMessage("");
|
||||
}
|
||||
})
|
||||
@@ -294,22 +295,22 @@ const Settings = (props) => {
|
||||
// detectEthereumProvider().then((provider) => {
|
||||
// if (provider) {
|
||||
// if (!provider.isMetaMask) {
|
||||
// alert.error("Only MetaMask is supported as of now.");
|
||||
// toast("Only MetaMask is supported as of now.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Find the ethereum network
|
||||
// // Get the users' account(s)
|
||||
// //alert.info("Connecting to MetaMask")
|
||||
// //toast("Connecting to MetaMask")
|
||||
// //console.log("Connected: ", provider.isConnected())
|
||||
|
||||
// if (!provider.isConnected()) {
|
||||
// alert.error("Metamask is not connected.");
|
||||
// toast("Metamask is not connected.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// provider.on("message", (event) => {
|
||||
// alert.info("Ethereum message: ", event);
|
||||
// toast("Ethereum message: ", event);
|
||||
// });
|
||||
|
||||
// provider.on("chainChanged", (chainId) => {
|
||||
@@ -330,12 +331,12 @@ const Settings = (props) => {
|
||||
// console.log("INFO: ", userdata);
|
||||
// setUserData(userdata);
|
||||
// } else {
|
||||
// alert.error("Couldn't find balance: ", result);
|
||||
// toast("Couldn't find balance: ", result);
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// // If the request fails, the Promise will reject with an error.
|
||||
// alert.error("Failed getting info from ethereum API: " + error);
|
||||
// toast("Failed getting info from ethereum API: " + error);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
@@ -858,7 +859,7 @@ const Settings = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success && responseJson.reason !== undefined) {
|
||||
alert.error("Failed updating user: " + responseJson.reason);
|
||||
toast("Failed updating user: " + responseJson.reason);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -7,7 +7,8 @@ import {
|
||||
Button,
|
||||
} from "@mui/material";
|
||||
import theme from '../theme.jsx';
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
|
||||
import AuthenticationOauth2 from "../components/Oauth2Auth.jsx";
|
||||
import AuthenticationWindow from "../components/AuthenticationWindow.jsx";
|
||||
@@ -22,7 +23,7 @@ const SetAuthentication = (props) => {
|
||||
const [appAuthentication, setAppAuthentication] = React.useState([]);
|
||||
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
|
||||
const parseIncomingOpenapiData = (data) => {
|
||||
if (data.app === undefined || data.app === null) {
|
||||
@@ -84,7 +85,7 @@ const SetAuthentication = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false || responseJson.success === undefined) {
|
||||
alert.error("Failed to get the app. Does it exist?")
|
||||
toast("Failed to get the app. Does it exist?")
|
||||
setIsAppLoaded(true)
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +93,7 @@ const SetAuthentication = (props) => {
|
||||
parseIncomingOpenapiData(responseJson);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Error in app fetch: " + error.toString());
|
||||
toast("Error in app fetch: " + error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -195,9 +195,9 @@ const Welcome = (props) => {
|
||||
setFrameworkData({})
|
||||
|
||||
if (responseJson.reason !== undefined) {
|
||||
//alert.error("Failed loading: " + responseJson.reason)
|
||||
//toast("Failed loading: " + responseJson.reason)
|
||||
} else {
|
||||
//alert.error("Failed to load framework for your org.")
|
||||
//toast("Failed to load framework for your org.")
|
||||
}
|
||||
} else {
|
||||
setFrameworkData(responseJson)
|
||||
|
||||
@@ -80,7 +80,8 @@ import { DataGrid, GridToolbar } from "@mui/x-data-grid";
|
||||
import Dropzone from "../components/Dropzone.jsx";
|
||||
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { useAlert } from "react-alert";
|
||||
//import { useAlert
|
||||
import { ToastContainer, toast } from "react-toastify"
|
||||
import { MuiChipsInput } from "mui-chips-input";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import theme from "../theme.jsx";
|
||||
@@ -529,7 +530,7 @@ const Workflows = (props) => {
|
||||
document.title = "Shuffle - Workflows";
|
||||
let navigate = useNavigate();
|
||||
|
||||
const alert = useAlert();
|
||||
//const alert = useAlert();
|
||||
const classes = useStyles(theme);
|
||||
const imgSize = 60;
|
||||
|
||||
@@ -929,7 +930,7 @@ const Workflows = (props) => {
|
||||
const files = isDropzone ? e.dataTransfer.files : e.target.files;
|
||||
|
||||
const reader = new FileReader();
|
||||
alert.info("Starting upload. Please wait while we validate the workflows");
|
||||
toast("Starting upload. Please wait while we validate the workflows");
|
||||
|
||||
try {
|
||||
reader.addEventListener("load", (e) => {
|
||||
@@ -938,7 +939,7 @@ const Workflows = (props) => {
|
||||
try {
|
||||
data = JSON.parse(reader.result);
|
||||
} catch (e) {
|
||||
alert.error("Invalid JSON: " + e);
|
||||
toast("Invalid JSON: " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -972,13 +973,13 @@ const Workflows = (props) => {
|
||||
data.status
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
alert.success(`Successfully imported ${data.name}`);
|
||||
toast(`Successfully imported ${data.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Import error: " + error.toString());
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -1016,9 +1017,9 @@ const Workflows = (props) => {
|
||||
if (responseJson.success === false) {
|
||||
setAppFramework({})
|
||||
if (responseJson.reason !== undefined) {
|
||||
//alert.error("Failed loading: " + responseJson.reason)
|
||||
//toast("Failed loading: " + responseJson.reason)
|
||||
} else {
|
||||
//alert.error("Failed to load framework for your org.")
|
||||
//toast("Failed to load framework for your org.")
|
||||
}
|
||||
} else {
|
||||
setAppFramework(responseJson)
|
||||
@@ -1046,7 +1047,7 @@ const Workflows = (props) => {
|
||||
// navigate("/search?tab=workflows")
|
||||
//}
|
||||
|
||||
alert.info("Failed getting workflows. Are you logged in?");
|
||||
toast("Failed getting workflows. Are you logged in?");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1111,14 +1112,14 @@ const Workflows = (props) => {
|
||||
|
||||
} else {
|
||||
if (isLoggedIn) {
|
||||
alert.error("An error occurred while loading workflows");
|
||||
toast("An error occurred while loading workflows");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1198,7 +1199,7 @@ const Workflows = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//alert.error("ERROR: " + error.toString());
|
||||
//toast("ERROR: " + error.toString());
|
||||
console.log("ERROR: " + error.toString());
|
||||
setWorkflows(workflows);
|
||||
setWorkflowDone(true);
|
||||
@@ -1288,7 +1289,7 @@ const Workflows = (props) => {
|
||||
}, i * 200);
|
||||
}
|
||||
|
||||
alert.info(`exporting and keeping original for all ${allWorkflows.length} workflows`);
|
||||
toast(`exporting and keeping original for all ${allWorkflows.length} workflows`);
|
||||
};
|
||||
|
||||
const deduplicateIds = (data, skip_sanitize) => {
|
||||
@@ -1329,7 +1330,7 @@ const Workflows = (props) => {
|
||||
trigger.parameters[1].value = "webhook_" + trigger.id;
|
||||
// FIXME: Add auth here?
|
||||
} else {
|
||||
alert.info("Something is wrong with the webhook in the copy");
|
||||
toast("Something is wrong with the webhook in the copy");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1449,7 +1450,7 @@ const Workflows = (props) => {
|
||||
data = sanitizeWorkflow(data);
|
||||
|
||||
if (data.subflows !== null && data.subflows !== undefined) {
|
||||
alert.info(
|
||||
toast(
|
||||
"Not exporting with subflows when sanitizing. Please manually export them."
|
||||
);
|
||||
data.subflows = [];
|
||||
@@ -1477,7 +1478,7 @@ const Workflows = (props) => {
|
||||
const publishWorkflow = (data) => {
|
||||
data = JSON.parse(JSON.stringify(data));
|
||||
data = sanitizeWorkflow(data);
|
||||
alert.info("Sanitizing and publishing " + data.name);
|
||||
toast("Sanitizing and publishing " + data.name);
|
||||
|
||||
// This ALWAYS talks to Shuffle cloud
|
||||
fetch(globalUrl + "/api/v1/workflows/" + data.id + "/publish", {
|
||||
@@ -1494,9 +1495,9 @@ const Workflows = (props) => {
|
||||
console.log("Status not 200 for workflow publish :O!");
|
||||
} else {
|
||||
if (isCloud) {
|
||||
alert.success("Successfully published workflow");
|
||||
toast("Successfully published workflow");
|
||||
} else {
|
||||
alert.success(
|
||||
toast(
|
||||
"Successfully published workflow to https://shuffler.io"
|
||||
);
|
||||
}
|
||||
@@ -1506,20 +1507,20 @@ const Workflows = (props) => {
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed publishing: ", responseJson.reason);
|
||||
toast("Failed publishing: ", responseJson.reason);
|
||||
}
|
||||
|
||||
getAvailableWorkflows();
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Failed publishing: is the workflow valid? Remember to save the workflow first.")
|
||||
toast("Failed publishing: is the workflow valid? Remember to save the workflow first.")
|
||||
console.log(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
const copyWorkflow = (data) => {
|
||||
data = JSON.parse(JSON.stringify(data));
|
||||
alert.success("Copying workflow " + data.name);
|
||||
toast("Copying workflow " + data.name);
|
||||
data.id = "";
|
||||
data.name = data.name + "_copy";
|
||||
data = deduplicateIds(data, true);
|
||||
@@ -1546,7 +1547,7 @@ const Workflows = (props) => {
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1562,9 +1563,9 @@ const Workflows = (props) => {
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for setting workflows :O!");
|
||||
alert.error("Failed deleting workflow. Do you have access?");
|
||||
toast("Failed deleting workflow. Do you have access?");
|
||||
} else {
|
||||
alert.success("Deleted workflow " + id);
|
||||
toast("Deleted workflow " + id);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -1575,7 +1576,7 @@ const Workflows = (props) => {
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2032,7 +2033,7 @@ const Workflows = (props) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
if (subflows === 0) {
|
||||
alert.info("No subflows for " + data.name);
|
||||
toast("No subflows for " + data.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2207,9 +2208,9 @@ const Workflows = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Error setting workflow: ", responseJson.reason)
|
||||
toast("Error setting workflow: ", responseJson.reason)
|
||||
} else {
|
||||
alert.error("Error setting workflow.")
|
||||
toast("Error setting workflow.")
|
||||
}
|
||||
|
||||
return
|
||||
@@ -2227,14 +2228,14 @@ const Workflows = (props) => {
|
||||
setSubmitLoading(false)
|
||||
setModalOpen(false);
|
||||
} else {
|
||||
//alert.info("Successfully changed basic info for workflow");
|
||||
//toast("Successfully changed basic info for workflow");
|
||||
setModalOpen(false);
|
||||
}
|
||||
|
||||
return responseJson;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
setSubmitLoading(false)
|
||||
setModalOpen(false);
|
||||
setSubmitLoading(false);
|
||||
@@ -2251,7 +2252,7 @@ const Workflows = (props) => {
|
||||
const file = event.target.files[key];
|
||||
if (file.type !== "application/json") {
|
||||
if (file.type !== undefined) {
|
||||
alert.error("File has to contain valid json");
|
||||
toast("File has to contain valid json");
|
||||
setSubmitLoading(false)
|
||||
}
|
||||
|
||||
@@ -2265,7 +2266,7 @@ const Workflows = (props) => {
|
||||
try {
|
||||
data = JSON.parse(reader.result);
|
||||
} catch (e) {
|
||||
alert.error("Invalid JSON: " + e);
|
||||
toast("Invalid JSON: " + e);
|
||||
setSubmitLoading(false)
|
||||
return;
|
||||
}
|
||||
@@ -2305,13 +2306,13 @@ const Workflows = (props) => {
|
||||
data.status,
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
alert.success("Successfully imported " + data.name);
|
||||
toast("Successfully imported " + data.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error("Import error: " + error.toString());
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2535,7 +2536,7 @@ const Workflows = (props) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
if (subflows === 0) {
|
||||
alert.info("No subflows for " + data.name);
|
||||
toast("No subflows for " + data.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3554,7 +3555,7 @@ const Workflows = (props) => {
|
||||
parsedData["field_2"] = field2;
|
||||
}
|
||||
|
||||
alert.success("Getting specific workflows from your URL.");
|
||||
toast("Getting specific workflows from your URL.");
|
||||
fetch(globalUrl + "/api/v1/workflows/download_remote", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
@@ -3566,7 +3567,7 @@ const Workflows = (props) => {
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
alert.success("Successfully loaded workflows from " + downloadUrl);
|
||||
toast("Successfully loaded workflows from " + downloadUrl);
|
||||
setTimeout(() => {
|
||||
getAvailableWorkflows();
|
||||
}, 1000);
|
||||
@@ -3577,14 +3578,14 @@ const Workflows = (props) => {
|
||||
.then((responseJson) => {
|
||||
if (!responseJson.success) {
|
||||
if (responseJson.reason !== undefined) {
|
||||
alert.error("Failed loading: " + responseJson.reason);
|
||||
toast("Failed loading: " + responseJson.reason);
|
||||
} else {
|
||||
alert.error("Failed loading");
|
||||
toast("Failed loading");
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert.error(error.toString());
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user