+
{foundresult?.action?.label?.replaceAll("_", " ")} - {foundresult.status}:
@@ -1807,7 +1854,7 @@ const RunWorkflow = (defaultprops) => {
{workflowQuestion !== "" ? null :
- Form submission data includes your Organization's unique ID while logged in, or a unique identifier for your browser otherwise. Your input will be automatically sanitized.
+ Form submission data includes your Organization's unique ID, or a unique identifier for your browser. Your input will be automatically sanitized.
}
diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx
index 702092da..7dbf6d9a 100755
--- a/frontend/src/views/Workflows.jsx
+++ b/frontend/src/views/Workflows.jsx
@@ -126,296 +126,6 @@ const useStyles = makeStyles(() => {
}
})
-// Takes an action in Shuffle and
-// Returns information about the icon, the color etc to be used
-// This can be used for actions of all types
-export const GetIconInfo = (action) => {
- // Finds the icon based on the action. Should be verbs.
- const iconList = [
- { key: "cases", values: ["cases"] },
- { key: "cache_add", values: ["set_cache"] },
- { key: "cache_get", values: ["get_cache"] },
- { key: "filter", values: ["filter"] },
- { key: "merge", values: ["join", "merge", "route", "router", "routing"] },
- {
- key: "search",
- values: ["search", "find", "locate", "index", "analyze", "anal", "match", "check cache", "check", "verify", "validate"],
- },
- { key: "list", values: ["list", "head", "options"] },
- {
- key: "download",
- values: [
- "capture",
- "get",
- "download",
- "return",
- "hello_world",
- "curl",
- "request",
- "export",
- "preview",
- ],
- },
- { key: "add", values: ["add", "accept",] },
- { key: "delete", values: ["delete", "remove", "clear", "clean", "dismiss",] },
- {
- key: "send",
- values: [
- "send",
- "dispatch",
- "mail",
- "forward",
- "post",
- "submit",
- "mark",
- "set",
- "release",
- ],
- },
- {
- key: "repeat",
- values: ["repeat", "retry", "pause", "skip", "copy", "replicat", "demo",],
- },
- { key: "code", values: ["code", "bash", "python", "react", "go"] },
- { key: "execute", values: ["execute", "run", "play", "raise"] },
- { key: "extract", values: ["extract", "unpack", "decompress", "open"] },
- { key: "inflate", values: ["inflate", "pack", "compress"] },
- {
- key: "edit",
- values: [
- "modify",
- "update",
- "create",
- "edit",
- "put",
- "patch",
- "change",
- "replace",
- "conver",
- "map",
- "format",
- "escape",
- "describe",
- ],
- },
- {
- key: "compare",
- values: ["compare", "convert", "to", "filter", "translate", "parse", "generate", ],
- },
- { key: "close", values: ["close", "stop", "cancel", "block"] },
- { key: "communication", values: ["communication", "comms", "email", "mail",] },
- ];
-
- var selectedKey = ""
- if (action.app_name == "Integration Framework") {
- selectedKey = "magic"
- } else if (action.name === undefined || action.name === null) {
- } else {
- const actionname = action.name.toLowerCase()
- for (var key in iconList) {
- //console.log(iconList[key], actionname)
- const found = iconList[key].values.find((value) =>
- actionname.includes(value)
- )
- if (found !== null && found !== undefined) {
- selectedKey = iconList[key].key
- break
- }
- }
- }
-
- // Some of these are manually parsed or created instead of material ui
- //M8 0C3.58 0 0 1.79 0 4C0 6.21 3.58 8 8 8C12.42 8 16 6.21 16 4C16 1.79 12.42 0 8 0ZM0 6V9C0 11.21 3.58 13 8 13C12.42 13 16 11.21 16 9V6C16 8.21 12.42 10 8 10C3.58 10 0 8.21 0 6ZM0 11V14C0 16.21 3.58 18 8 18C9.41 18 10.79 17.81 12 17.46V14.46C10.79 14.81 9.41 15 8 15C3.58 15 0 13.21 0 11ZM17 11V14H14V16H17V19H19V16H22V14H19V11
- //https://www.figma.com/file/uCfnMs5w6wnLx6ehPHEV74/Figma-Material-Design-System-v3_0?node-id=834%3A21
- //COLORS: https://www.pinterest.co.uk/pin/326299935499972946/
- const defaultColor = "#f76b1c";
- const defaultGradient = ["#fad961", "#f76b1c"];
- const parsedIcons = {
- magic: {
- icon: "M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z",
- iconColor: "white",
- iconBackgroundColor: "red",
- originalIcon: "",
- fillGradient: ["#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#0000FF", "#4B0082", "#8A2BE2"],
- },
- communication: {
- icon: "M9.89516 7.71433H8.60945V5.1429H9.89516V7.71433ZM9.89516 10.2858H8.60945V9.00004H9.89516V10.2858ZM14.3952 2.57147H4.10944C3.76845 2.57147 3.44143 2.70693 3.20031 2.94805C2.95919 3.18917 2.82373 3.51619 2.82373 3.85719V15.4286L5.39516 12.8572H14.3952C14.7362 12.8572 15.0632 12.7217 15.3043 12.4806C15.5454 12.2395 15.6809 11.9125 15.6809 11.5715V3.85719C15.6809 3.14361 15.1023 2.57147 14.3952 2.57147Z",
- iconColor: "white",
- iconBackgroundColor: "#8acc3f",
- originalIcon: "",
- fillGradient: ["#8acc3f", "#459622"],
- },
- cases: {
- icon: "M15.6408 8.39233H18.0922V10.0287H15.6408V8.39233ZM0.115234 8.39233H2.56663V10.0287H0.115234V8.39233ZM9.92083 0.21051V2.66506H8.28656V0.21051H9.92083ZM3.31839 2.25596L5.05889 4.00687L3.89856 5.16051L2.15807 3.42596L3.31839 2.25596ZM13.1485 3.99869L14.8808 2.25596L16.0493 3.42596L14.3088 5.16051L13.1485 3.99869ZM9.10369 4.30142C10.404 4.30142 11.651 4.81863 12.5705 5.73926C13.4899 6.65989 14.0065 7.90854 14.0065 9.21051C14.0065 11.0269 13.0178 12.6141 11.5551 13.4651V14.9378C11.5551 15.1548 11.469 15.3629 11.3158 15.5163C11.1625 15.6698 10.9547 15.756 10.738 15.756H7.46943C7.25271 15.756 7.04487 15.6698 6.89163 15.5163C6.73839 15.3629 6.6523 15.1548 6.6523 14.9378V13.4651C5.18963 12.6141 4.2009 11.0269 4.2009 9.21051C4.2009 7.90854 4.71744 6.65989 5.63689 5.73926C6.55635 4.81863 7.80339 4.30142 9.10369 4.30142ZM10.738 16.5741V17.3923C10.738 17.6093 10.6519 17.8174 10.4986 17.9709C10.3454 18.1243 10.1375 18.2105 9.92083 18.2105H8.28656C8.06984 18.2105 7.862 18.1243 7.70876 17.9709C7.55552 17.8174 7.46943 17.6093 7.46943 17.3923V16.5741H10.738ZM8.28656 14.1196H9.92083V12.3769C11.3345 12.0169 12.3722 10.7323 12.3722 9.21051C12.3722 8.34253 12.0279 7.5101 11.4149 6.89634C10.8019 6.28259 9.97056 5.93778 9.10369 5.93778C8.23683 5.93778 7.40546 6.28259 6.79249 6.89634C6.17953 7.5101 5.83516 8.34253 5.83516 9.21051C5.83516 10.7323 6.87292 12.0169 8.28656 12.3769V14.1196Z",
- iconColor: "white",
- iconBackgroundColor: "#8acc3f",
- originalIcon: "",
- fillGradient: ["#8acc3f", "#459622"],
- },
- cache_add: {
- icon: "M11 3C6.58 3 3 4.79 3 7C3 9.21 6.58 11 11 11C15.42 11 19 9.21 19 7C19 4.79 15.42 3 11 3ZM3 9V12C3 14.21 6.58 16 11 16C15.42 16 19 14.21 19 12V9C19 11.21 15.42 13 11 13C6.58 13 3 11.21 3 9ZM3 14V17C3 19.21 6.58 21 11 21C12.41 21 13.79 20.81 15 20.46V17.46C13.79 17.81 12.41 18 11 18C6.58 18 3 16.21 3 14ZM20 14V17H17V19H20V22H22V19H25V17H22V14",
- iconColor: "white",
- iconBackgroundColor: "#8acc3f",
- originalIcon: "",
- fillGradient: ["#8acc3f", "#459622"],
- },
- cache_get: {
- icon: "M12 2C7.58 2 4 3.79 4 6C4 8.06 7.13 9.74 11.15 9.96C12.45 8.7 14.19 8 16 8C16.8 8 17.59 8.14 18.34 8.41C19.37 7.74 20 6.91 20 6C20 3.79 16.42 2 12 2ZM4 8V11C4 12.68 6.08 14.11 9 14.71C9.06 13.7 9.32 12.72 9.77 11.82C6.44 11.34 4 9.82 4 8ZM15.93 9.94C14.75 9.95 13.53 10.4 12.46 11.46C8.21 15.71 13.71 22.5 18.75 19.17L23.29 23.71L24.71 22.29L20.17 17.75C22.66 13.97 19.47 9.93 15.93 9.94ZM15.9 12C17.47 11.95 19 13.16 19 15C19 15.7956 18.6839 16.5587 18.1213 17.1213C17.5587 17.6839 16.7956 18 16 18C13.33 18 12 14.77 13.88 12.88C14.47 12.29 15.19 12 15.9 12ZM4 13V16C4 18.05 7.09 19.72 11.06 19.95C10.17 19.07 9.54 17.95 9.22 16.74C6.18 16.17 4 14.72 4 13Z",
- iconColor: "white",
- iconBackgroundColor: "#8acc3f",
- originalIcon: "",
- fillGradient: ["#8acc3f", "#459622"],
- },
- repeat: {
- icon: "M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- add: {
- icon: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- edit: {
- icon: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- filter: {
- icon: "M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61z",
- iconColor: "white",
- iconBackgroundColor: "#f5515f",
- originalIcon: "",
- fillGradient: ["#f5515f", "#a1051d"],
- },
- merge: {
- icon: "M17 20.41 18.41 19 15 15.59 13.59 17 17 20.41zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5 7.5 8z",
- iconColor: "white",
- iconBackgroundColor: "#f5515f",
- originalIcon: "",
- fillGradient: ["#f5515f", "#a1051d"],
- },
- compare: {
- icon: "M10 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h5v2h2V1h-2v2zm0 15H5l5-6v6zm9-15h-5v2h5v13l-5-6v9h5c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- extract: {
- icon: "M3 3h18v2H3z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- inflate: {
- icon: "M6 19h12v2H6z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- list: {
- icon: "M3 9h14V7H3v2zm0 4h14v-2H3v2zm0 4h14v-2H3v2zm16 0h2v-2h-2v2zm0-10v2h2V7h-2zm0 6h2v-2h-2v2z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- code: {
- icon: "M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- fillGradient: ["#836ef5", "#3335eb"],
- },
- execute: {
- icon: "M8 5v14l11-7z",
- iconColor: "white",
- iconBackgroundColor: defaultColor,
- originalIcon:
,
- },
- delete: {
- icon: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",
- iconColor: "white",
- iconBackgroundColor: "#03030e",
- originalIcon:
,
- fillGradient: ["#03030e", "#205d66"],
- },
- close: {
- icon: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
- iconColor: "white",
- iconBackgroundColor: "#03030e",
- originalIcon:
,
- fillGradient: ["#03030e", "#205d66"],
- },
- send: {
- icon: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z",
- iconColor: "white",
- iconBackgroundColor: "#0373da",
- originalIcon:
,
- fillGradient: ["#0bc8bf", "#0373da"],
- },
- download: {
- icon: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",
- iconColor: "white",
- iconBackgroundColor: "#0373da",
- originalIcon:
,
- fillGradient: ["#0bc8bf", "#0373da"],
- },
- search: {
- icon: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",
- iconColor: "white",
- iconBackgroundColor: "green",
- originalIcon:
,
- },
- };
-
- var selectedItem = parsedIcons[selectedKey];
- if (selectedItem === undefined || selectedItem === null) {
- return {
- icon: "",
- iconColor: "",
- iconBackground: "black",
- originalIcon: "",
- };
- }
-
- if (selectedItem.fillGradient === undefined) {
- selectedItem.fillGradient = defaultGradient;
- selectedItem.iconBackgroundColor = defaultColor;
- }
-
- if (selectedItem.icon === "" || selectedItem.icon === undefined) {
- console.log(
- `MISSING PATH FOR ${selectedKey} (find in scope): `,
- selectedItem.originalIcon.type.type
- );
- }
-
- if (
- (selectedItem.originalIcon === undefined ||
- selectedItem.originalIcon === "") &&
- selectedItem.icon !== "" &&
- selectedItem.icon !== undefined
- ) {
- const svg_pin = (
-
- );
- selectedItem.originalIcon = svg_pin;
- }
-
- return selectedItem;
-};
-
const chipStyle = {
backgroundColor: "#3d3f43",
marginRight: 5,
@@ -427,292 +137,6 @@ const chipStyle = {
color: "white",
};
-export const collapseField = (field, inputdata) => {
- if (field === undefined || field === null) {
- return true
- }
-
- if (field.namespace !== undefined && field.namespace !== null && field.namespace.length === 1) {
- return false
- }
-
- if (field.name === "headers" || field.name === "cookies") {
- return true
- }
-
- if (field.name === "result") {
- return false
- }
-
- if (field.type === "array") {
- return true
- }
-
- // If more than 10 keys in object, collapse
- if (field.type === "object") {
- if (Object.keys(field.src).length > 7) {
- return true
- }
- }
-
- return false
-}
-
-export const HandleJsonCopy = (base, copy, base_node_name) => {
- if (typeof copy.name === "string") {
- copy.name = copy.name.replaceAll(" ", "_");
- }
-
- //lol
- if (typeof base === 'object' || typeof base === 'dict') {
- base = JSON.stringify(base)
- }
-
- if (base_node_name === "execution_argument" || base_node_name === "Runtime Argument") {
- base_node_name = "exec"
- }
-
- //console.log("COPY: ", base_node_name, copy);
-
- //var newitem = JSON.parse(base);
- var newitem = validateJson(base).result
-
- var to_be_copied = "$" + base_node_name?.toLowerCase()?.replaceAll(" ", "_");
- for (let copykey in copy.namespace) {
- if (copy.namespace[copykey].includes("Results for")) {
- continue;
- }
-
- if (newitem !== undefined && newitem !== null) {
- newitem = newitem[copy.namespace[copykey]];
- if (!isNaN(copy.namespace[copykey])) {
- to_be_copied += ".#";
- } else {
- to_be_copied += "." + copy.namespace[copykey];
- }
- }
- }
-
- if (newitem !== undefined && newitem !== null) {
- newitem = newitem[copy.name];
- if (!isNaN(copy.name)) {
- to_be_copied += ".#";
- } else {
- to_be_copied += "." + copy.name;
- }
- }
-
- to_be_copied = to_be_copied.replaceAll(" ", "_");
- console.log("COPY: ", to_be_copied);
- const elementName = "copy_element_shuffle";
- var copyText = document.getElementById(elementName);
- if (copyText !== null && copyText !== undefined) {
- //console.log("NAVIGATOR: ", navigator);
- const clipboard = navigator.clipboard;
- if (clipboard === undefined) {
- toast("Can only copy over HTTPS (port 3443)");
- return;
- }
-
- navigator.clipboard.writeText(to_be_copied);
- copyText.select();
- copyText.setSelectionRange(0, 99999); /* For mobile devices */
-
- /* Copy the text inside the text field */
- document.execCommand("copy");
- //console.log("COPYING!");
- toast("Copied JSON path to clipboard.")
- } else {
- console.log("Couldn't find element ", elementName);
- }
-}
-
-export const handleReactJsonClipboard = (copy) => {
- const elementName = "copy_element_shuffle";
- var copyText = document.getElementById(elementName);
- if (copyText !== null && copyText !== undefined) {
- if (
- copy.namespace !== undefined &&
- copy.name !== undefined &&
- copy.src !== undefined
- ) {
- copy = copy.src;
- }
-
- const clipboard = navigator.clipboard;
- if (clipboard === undefined) {
- toast("Can only copy over HTTPS (port 3443)");
- return;
- }
-
- var stringified = JSON.stringify(copy);
- if (stringified.startsWith('"') && stringified.endsWith('"')) {
- stringified = stringified.substring(1, stringified.length - 1);
- }
-
- navigator.clipboard.writeText(stringified);
- copyText.select();
- copyText.setSelectionRange(0, 99999); /* For mobile devices */
-
- /* Copy the text inside the text field */
- document.execCommand("copy");
-
- console.log("COPYING!");
- toast.success("Copied Value, NOT json path.")
- } else {
- console.log("Failed to copy from " + elementName + ": ", copyText);
- }
-}
-
-export const validateJson = (showResult) => {
- if (showResult === undefined || showResult === null) {
- return {
- valid: false,
- result: "",
- }
- }
-
- if (typeof showResult === 'string') {
- showResult = showResult.split(" False").join(" false")
- showResult = showResult.split(" True").join(" true")
-
- showResult.replaceAll("False,", "false,")
- showResult.replaceAll("True,", "true,")
- }
-
- if (typeof showResult === "object" || typeof showResult === "array") {
- return {
- valid: true,
- result: showResult,
- }
- }
-
- if (showResult[0] === "\"") {
- return {
- valid: false,
- result: showResult,
- }
- }
-
- var jsonvalid = true
- try {
- if (!showResult.includes("{") && !showResult.includes("[")) {
- jsonvalid = false
-
- return {
- valid: jsonvalid,
- result: showResult,
- };
- }
- } catch (e) {
-
- try {
- showResult = showResult.split("'").join('"');
- if (!showResult.includes("{") && !showResult.includes("[")) {
- jsonvalid = false;
- }
- } catch (e) {
-
- jsonvalid = false;
- }
- }
-
- var result = showResult;
- try {
- result = jsonvalid ? JSON.parse(showResult, {"storeAsString": true}) : showResult;
- } catch (e) {
- ////console.log("Failed parsing JSON even though its valid: ", e)
- jsonvalid = false;
- }
-
- if (jsonvalid === false) {
-
- if (typeof showResult === 'string') {
- showResult = showResult.trim()
- }
-
- try {
- var newstr = showResult.replaceAll("'", '"')
-
- // Basic workarounds for issues with Python Dicts -> JSON
- if (newstr.includes(": None")) {
- newstr = newstr.replaceAll(": None", ': null')
- }
-
- if (newstr.includes("[\"{") && newstr.includes("}\"]")) {
- newstr = newstr.replaceAll("[\"{", '[{')
- newstr = newstr.replaceAll("}\"]", '}]')
- }
-
- if (newstr.includes("{\"[") && newstr.includes("]\"}")) {
- newstr = newstr.replaceAll("{\"[", '[{')
- newstr = newstr.replaceAll("]\"}", '}]')
- }
-
- result = JSON.parse(newstr)
- jsonvalid = true
- } catch (e) {
-
- //console.log("Failed parsing JSON even though its valid (2): ", e)
- jsonvalid = false
- }
- }
-
- if (jsonvalid && typeof result === "number") {
- jsonvalid = false
- }
-
- // This is where we start recursing
- if (jsonvalid) {
- // Check fields if they can be parsed too
- try {
- for (const [key, value] of Object.entries(result)) {
- if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) {
- //console.log("CHECKING STRING: ", value)
-
- const inside_result = validateJson(value)
- if (inside_result.valid) {
- //console.log("INSIDE RESULT: ", inside_result.result)
-
- if (typeof inside_result.result === "string") {
- const newres = JSON.parse(inside_result.result)
-
- result[key] = newres
- } else {
- result[key] = inside_result.result
- }
- }
- } else {
-
- // Usually only reaches here if raw array > dict > value
- if (typeof showResult !== "array") {
- for (const [subkey, subvalue] of Object.entries(value)) {
- if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) {
- const inside_result = validateJson(subvalue)
- if (inside_result.valid) {
- if (typeof inside_result.result === "string") {
- const newres = JSON.parse(inside_result.result)
- result[key][subkey] = newres
- } else {
- result[key][subkey] = inside_result.result
- }
- }
- }
-
- }
- }
- }
- }
- } catch (e) {
- //console.log("Failed parsing inside json subvalues: ", e)
- }
- }
-
- return {
- valid: jsonvalid,
- result: result,
- };
-};
//Custom hook for handling styling of the dropzone
diff --git a/frontend/src/views/Workflows2.jsx b/frontend/src/views/Workflows2.jsx
index 157b7ee7..831382a9 100644
--- a/frontend/src/views/Workflows2.jsx
+++ b/frontend/src/views/Workflows2.jsx
@@ -102,6 +102,7 @@ import {
List as ListIcon,
Publish as PublishIcon,
GetApp as GetAppIcon,
+ Image as ImageIcon,
} from "@mui/icons-material";
// Additional Components
@@ -139,8 +140,115 @@ const getCookie = (name) => {
return "";
};
+export const HandleJsonCopy = (base, copy, base_node_name) => {
+ if (typeof copy.name === "string") {
+ copy.name = copy.name.replaceAll(" ", "_");
+ }
+ //lol
+ if (typeof base === 'object' || typeof base === 'dict') {
+ base = JSON.stringify(base)
+ }
+ if (base_node_name === "execution_argument" || base_node_name === "Runtime Argument") {
+ base_node_name = "exec"
+ }
+
+ //console.log("COPY: ", base_node_name, copy);
+
+ //var newitem = JSON.parse(base);
+ var newitem = validateJson(base).result
+
+ var to_be_copied = "$" + base_node_name?.toLowerCase()?.replaceAll(" ", "_");
+ for (let copykey in copy.namespace) {
+ if (copy.namespace[copykey].includes("Results for")) {
+ continue;
+ }
+
+ if (newitem !== undefined && newitem !== null) {
+ newitem = newitem[copy.namespace[copykey]];
+ if (!isNaN(copy.namespace[copykey])) {
+ to_be_copied += ".#";
+ } else {
+ to_be_copied += "." + copy.namespace[copykey];
+ }
+ }
+ }
+
+ if (newitem !== undefined && newitem !== null) {
+ newitem = newitem[copy.name];
+ if (!isNaN(copy.name)) {
+ to_be_copied += ".#";
+ } else {
+ to_be_copied += "." + copy.name;
+ }
+ }
+
+ to_be_copied = to_be_copied.replaceAll(" ", "_");
+ console.log("COPY: ", to_be_copied);
+ const elementName = "copy_element_shuffle";
+ var copyText = document.getElementById(elementName);
+ if (copyText !== null && copyText !== undefined) {
+ //console.log("NAVIGATOR: ", navigator);
+ const clipboard = navigator.clipboard;
+ if (clipboard === undefined) {
+ toast("Can only copy over HTTPS (port 3443)");
+ return;
+ }
+
+ navigator.clipboard.writeText(to_be_copied).catch(() => {
+ const temp = document.createElement("textarea");
+ temp.value = to_be_copied;
+ document.body.appendChild(temp);
+ temp.select();
+ document.execCommand("copy");
+ document.body.removeChild(temp);
+ });
+ //console.log("COPYING!");
+ toast("Copied JSON path to clipboard.")
+ } else {
+ console.log("Couldn't find element ", elementName);
+ }
+}
+
+export const handleReactJsonClipboard = (copy) => {
+ const elementName = "copy_element_shuffle";
+ var copyText = document.getElementById(elementName);
+ if (copyText !== null && copyText !== undefined) {
+ if (
+ copy.namespace !== undefined &&
+ copy.name !== undefined &&
+ copy.src !== undefined
+ ) {
+ copy = copy.src;
+ }
+
+ const clipboard = navigator.clipboard;
+ if (clipboard === undefined) {
+ toast("Can only copy over HTTPS (port 3443)");
+ return;
+ }
+
+ var stringified = JSON.stringify(copy);
+ if (stringified.startsWith('"') && stringified.endsWith('"')) {
+ stringified = stringified.substring(1, stringified.length - 1);
+ }
+
+ navigator.clipboard.writeText(stringified).catch(() => {
+ const temp = document.createElement("textarea");
+ temp.value = stringified;
+ document.body.appendChild(temp);
+ temp.select();
+ document.execCommand("copy");
+ document.body.removeChild(temp);
+ });
+
+ console.log("COPYING!");
+ toast.success("Copied Value, NOT json path.")
+ } else {
+ console.log("Failed to copy from " + elementName + ": ", copyText);
+ }
+}
@@ -150,7 +258,7 @@ const getCookie = (name) => {
export const GetIconInfo = (action) => {
// Finds the icon based on the action. Should be verbs.
const iconList = [
- { key: "cases", values: ["cases", "ticket", "alert"] },
+ { key: "cases", values: ["cases", "ticket", "tickets", "alert"] },
{ key: "cache_add", values: ["set_cache"] },
{ key: "cache_get", values: ["get_cache"] },
{ key: "filter", values: ["filter"] },
@@ -181,7 +289,7 @@ export const GetIconInfo = (action) => {
key: "repeat",
values: ["repeat", "retry", "pause", "skip", "copy", "replicat", "demo",],
},
- { key: "execute", values: ["execute", "run", "play", "raise"] },
+ { key: "execute", values: ["execute", "run", "play", "raise", "control", "ctrl"] },
{ key: "extract", values: ["extract", "unpack", "decompress", "open"] },
{ key: "inflate", values: ["inflate", "pack", "compress"] },
{
@@ -211,7 +319,6 @@ export const GetIconInfo = (action) => {
{ key: "communication", values: ["communication", "comms", "email", "mail",] },
{ key: "eradication", values: ["eradication", "edr", "xdr", "sigma", "yara",] },
{ key: "iam", values: ["iam", "identity", "access", "auth", "authentication", "authorization", "oauth", "sso", "openid"] },
- { key: "intel", values: ["intel", "feed", "threat intel", "threat intelligence", "ti", "t.i.", "t.i", "ti.", "rule", "technique", "tactic", "techniques", "tactics", "ioc", "indicator",] },
{ key: "network", values: ["network", "net", "networking", "firewall", "proxy", "vpn", "sdwan", "sd-wan"] },
{
key: "send",
@@ -235,7 +342,8 @@ export const GetIconInfo = (action) => {
"passwd",
"protect",
],
- }
+ },
+ { key: "intel", values: ["intel", "feed", "threat intel", "threat intelligence", "ti", "t.i.", "t.i", "ti.", "rule", "technique", "tactic", "techniques", "tactics", "ioc", "indicator", "hash", "ip", "url", "domain", ] },
];
var selectedKey = ""
@@ -482,29 +590,35 @@ export const GetIconInfo = (action) => {
return selectedItem;
};
+export const collapseField = (field, inputdata) => {
+ if (field === undefined || field === null) {
+ return true
+ }
+ if (field.namespace !== undefined && field.namespace !== null && field.namespace.length === 1) {
+ return false
+ }
-export const collapseField = (field) => {
- if (field === undefined || field === null) {
- return true
+ if (field.name === "headers" || field.name === "cookies") {
+ return true
+ }
+
+ if (field.name === "result") {
+ return false
+ }
+
+ if (field.type === "array") {
+ return true
+ }
+
+ // If more than 10 keys in object, collapse
+ if (field.type === "object") {
+ if (Object.keys(field.src).length > 7) {
+ return true
}
+ }
- if (field.name === "headers" || field.name === "cookies") {
- return true
- }
-
- if (field.type === "array") {
- return true
- }
-
- // If more than 10 keys in object, collapse
- if (field.type === "object") {
- if (Object.keys(field.src).length > 7) {
- return true
- }
- }
-
- return false
+ return false
}
export const validateJson = (showResult) => {
@@ -700,7 +814,8 @@ const Workflows2 = (props) => {
const [view, setView] = useState(localStorage?.getItem("workflowView") || "grid");
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
- const [showExecutionStats, setShowExecutionStats] = React.useState(localStorage?.getItem("showExecutionStats") === "true" || isCloud)
+ const [showExecutionStats, setShowExecutionStats] = React.useState(localStorage?.getItem("showExecutionStats") === "true")
+ const [showWorkflowImages, setShowWorkflowImages] = React.useState(localStorage?.getItem("showWorkflowImages") === "true")
const imgSize = 60;
@@ -2158,7 +2273,7 @@ const Workflows2 = (props) => {
position: "relative",
borderRadius: "8px",
// backgroundColor: "#212121",
- padding: "15px 15px 0px 20px",
+ padding: "15px 15px 0px 30px",
};
const gridContainer = {
@@ -2177,7 +2292,6 @@ const Workflows2 = (props) => {
justifyContent: "space-between",
fontFamily: theme.typography?.fontFamily,
textAlign: "center",
- margin: "auto",
};
const exportAllWorkflows = (allWorkflows) => {
@@ -2959,7 +3073,7 @@ const Workflows2 = (props) => {
const foundOrg = userdata.orgs.find((org) => org.id === data["org_id"]);
if (foundOrg !== undefined && foundOrg !== null) {
//position: "absolute", bottom: 5, right: -5,
- imageStyle.border = foundOrg.id === userdata.active_org.id ? `3px solid ${boxColor}` : null
+ imageStyle.border = foundOrg.id === userdata.active_org.id ? `2px solid ${boxColor}` : null
image =
@@ -2997,10 +3111,10 @@ const Workflows2 = (props) => {
relevantTrigger = trigger
if (trigger?.status === "running") {
- imageStyle.border = `3px solid ${green}`
+ imageStyle.border = `2px solid ${green}`
break
} else {
- imageStyle.border = `3px solid ${red}`
+ imageStyle.border = `2px solid ${red}`
}
@@ -3012,10 +3126,10 @@ const Workflows2 = (props) => {
relevantTrigger = trigger
if (trigger?.status === "running") {
- imageStyle.border = `3px solid ${green}`
+ imageStyle.border = `2px solid ${green}`
break
} else {
- imageStyle.border = `3px solid ${red}`
+ imageStyle.border = `2px solid ${red}`
}
}
@@ -3081,13 +3195,12 @@ const Workflows2 = (props) => {
}
//const isPublicWorkflow = data?.objectID === undefined || data?.objectID === null
- const foundImage = data?.image_url === undefined || data?.image_url === null || data?.image_url === "" ? data?.image : data?.image_url
-
+ const foundImage = currTab !== 2 && showWorkflowImages === false ? "" : data?.image_url === undefined || data?.image_url === null || data?.image_url === "" ? data?.image : data?.image_url
const foundTimeline = workflowTimelines.find((timeline) => timeline.id === data.id)
return (
{foundImage?.length > 0 ?
@@ -3140,26 +3253,7 @@ const Workflows2 = (props) => {
style={{ display: "flex", flexDirection: "column", width: "100%", fontFamily: theme.typography?.fontFamily }}
>
- {currTab === 2 ? null :
-
- {
- //navigate("/admin")
- }}
- >
- {image?.includes("data:image") ?
-

- :
- image
- }
-
-
- }
+
{
@@ -3228,7 +3322,7 @@ const Workflows2 = (props) => {
{
fontWeight: 500,
minWidth: 375,
maxWidth: 375,
- margin: "auto",
overflow: "hidden",
+
+ color: "rgba(255,255,255,0.85)",
}}
>
{
style={{
justifyContent: "left",
overflow: "hidden",
- marginTop: 13,
+ marginTop: 8,
maxHeight: 35,
fontFamily: theme.typography?.fontFamily,
- textAlign: "center",
+ textAlign: "left",
minWidth: 200,
maxWidth: 200,
- margin: "auto",
}}
>
{data.tags !== undefined && data.tags !== null
@@ -3478,7 +3572,7 @@ const Workflows2 = (props) => {
{(data.sharing !== undefined && data.sharing !== null && data.sharing === "form") || (data?.form_control?.input_markdown !== undefined && data?.form_control?.input_markdown !== null && data?.form_control?.input_markdown !== "") && type !== "public" ?
-
+
{
: null}
+ {currTab === 2 ? null :
+
+ {
+ //navigate("/admin")
+ }}
+ >
+ {image?.includes("data:image") ?
+

+ :
+ image
+ }
+
+
+ }
+
{showExecutionStats === true && foundTimeline !== undefined && foundTimeline?.timeline?.length > 0 &&
@@ -5305,6 +5420,21 @@ const Workflows2 = (props) => {
+
+ {
+
+ const newView = !showWorkflowImages
+ localStorage.setItem("showWorkflowImages", newView)
+ setShowWorkflowImages(!showWorkflowImages)
+ }}
+ disabled={currTab === 2}
+ >
+
+
+
+