Fixed app generation and usage problems with quotes and dollarsigns
This commit is contained in:
@@ -572,7 +572,7 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("New found: ", new_occurences))
|
console.log("New found: ", new_occurences)
|
||||||
found = new_occurences.valueOf()
|
found = new_occurences.valueOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,10 +632,12 @@ const ParsedAction = (props) => {
|
|||||||
);
|
);
|
||||||
if (paramcheck !== undefined) {
|
if (paramcheck !== undefined) {
|
||||||
// Escapes all double quotes
|
// Escapes all double quotes
|
||||||
const toReplace = event.target.value
|
var toReplace = event.target.value.trim()
|
||||||
.trim()
|
|
||||||
.replaceAll('\\"', '"')
|
|
||||||
.replaceAll('"', '\\"');
|
if (!toReplace.startsWith("{") && !toReplace.startsWith("[")) {
|
||||||
|
toReplace = toReplace.replaceAll('\\"', '"').replaceAll('"', '\\"')
|
||||||
|
}
|
||||||
|
|
||||||
console.log("REPLACE WITH: ", toReplace);
|
console.log("REPLACE WITH: ", toReplace);
|
||||||
if (
|
if (
|
||||||
@@ -1459,7 +1461,9 @@ const ParsedAction = (props) => {
|
|||||||
if (found === null || !hideBody) {
|
if (found === null || !hideBody) {
|
||||||
if (found === null) {
|
if (found === null) {
|
||||||
setActivateHidingBodyButton(true);
|
setActivateHidingBodyButton(true);
|
||||||
}
|
} else {
|
||||||
|
console.log("In found: ", found, hideBody)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//console.log("SHOW BUTTON");
|
//console.log("SHOW BUTTON");
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { useAlert } from "react-alert";
|
|||||||
import theme from '../theme';
|
import theme from '../theme';
|
||||||
import { isMobile } from "react-device-detect"
|
import { isMobile } from "react-device-detect"
|
||||||
import aa from 'search-insights'
|
import aa from 'search-insights'
|
||||||
|
import Drift from "react-driftjs";
|
||||||
|
|
||||||
import { InstantSearch, Configure, connectSearchBox, connectHits, Index } from 'react-instantsearch-dom';
|
import { InstantSearch, Configure, connectSearchBox, connectHits, Index } from 'react-instantsearch-dom';
|
||||||
import algoliasearch from 'algoliasearch/lite';
|
import algoliasearch from 'algoliasearch/lite';
|
||||||
@@ -6336,7 +6337,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
window.open(parsedUrl, '_blank')
|
window.open(parsedUrl, '_blank')
|
||||||
}, 2000)
|
}, 2000)
|
||||||
} else {
|
} else {
|
||||||
alert.info(`Activating ${name} and refreshing apps.`)
|
alert.info(`Activating ${name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("CLICK: ", hit)
|
console.log("CLICK: ", hit)
|
||||||
@@ -8176,7 +8177,8 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
`https%3A%2F%2F${window.location.host}%2Fapi%2Fv1%2Ftriggers%2Foutlook%2Fregister`
|
`https%3A%2F%2F${window.location.host}%2Fapi%2Fv1%2Ftriggers%2Foutlook%2Fregister`
|
||||||
|
|
||||||
//const client_id = "fd55c175-aa30-4fa6-b303-09a29fb3f750"
|
//const client_id = "fd55c175-aa30-4fa6-b303-09a29fb3f750"
|
||||||
const client_id = "bb4bff85-0d0b-4f5d-8a69-3cee8029b11a";
|
//const client_id = "bb4bff85-0d0b-4f5d-8a69-3cee8029b11a";
|
||||||
|
const client_id = "efe4c3fe-84a1-4821-a84f-23a6cfe8e72d";
|
||||||
|
|
||||||
const username = userdata.id;
|
const username = userdata.id;
|
||||||
console.log(redirectUri);
|
console.log(redirectUri);
|
||||||
@@ -8392,6 +8394,15 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
</div>
|
</div>
|
||||||
{outlookButton}
|
{outlookButton}
|
||||||
{gmailButton}
|
{gmailButton}
|
||||||
|
<Typography variant="body2" color="textSecondary" style={{marginTop: 5}}>
|
||||||
|
If you have trouble using this trigger, please <span style={{ textDecoration: "none", color: "#f86a3e"}} onClick={() => {
|
||||||
|
if (window.drift !== undefined) {
|
||||||
|
window.drift.api.startInteraction({ interactionId: 340043 })
|
||||||
|
} else {
|
||||||
|
console.log("Couldn't find drift in window.drift and not .drift-open-chat with querySelector: ", window.drift)
|
||||||
|
}
|
||||||
|
}}>contact us</span> to get access
|
||||||
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1982,7 +1982,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
item.body !== null &&
|
item.body !== null &&
|
||||||
item.body.length > 0
|
item.body.length > 0
|
||||||
) {
|
) {
|
||||||
console.log("GOT BODY: ", item.url, item.method)
|
console.log("GOT BODY: ", item.url, item.method, item.body)
|
||||||
|
|
||||||
// Replacing dollarsign insertions that aren't escaped
|
// Replacing dollarsign insertions that aren't escaped
|
||||||
// This is to stop it from messing with systems in Shuffle.
|
// This is to stop it from messing with systems in Shuffle.
|
||||||
@@ -1994,8 +1994,11 @@ const AppCreator = (defaultprops) => {
|
|||||||
if (item.body[key] === "$") {
|
if (item.body[key] === "$") {
|
||||||
if (key > 0) {
|
if (key > 0) {
|
||||||
//console.log("Found: ", item.body[key-1])
|
//console.log("Found: ", item.body[key-1])
|
||||||
if (item.body[key-1] !== "\\") {
|
const newkey = parseInt(key, 10)
|
||||||
newbody += "\\"
|
if (item.body[newkey-1] !== "\\") {
|
||||||
|
if (item.body[newkey+1] !== "\{") {
|
||||||
|
newbody += "\\"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newbody += item.body[key]
|
newbody += item.body[key]
|
||||||
@@ -2009,8 +2012,8 @@ const AppCreator = (defaultprops) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("New body: ", newbody)
|
||||||
if (newbody !== item.body) {
|
if (newbody !== item.body) {
|
||||||
//console.log("New body: ", newbody)
|
|
||||||
item.body = newbody
|
item.body = newbody
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3272,7 +3275,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
multiline
|
multiline
|
||||||
rows="5"
|
minRows="5"
|
||||||
defaultValue={currentAction["body"]}
|
defaultValue={currentAction["body"]}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setActionField("body", e.target.value);
|
setActionField("body", e.target.value);
|
||||||
@@ -3310,7 +3313,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
multiline
|
multiline
|
||||||
rows="2"
|
minRows="2"
|
||||||
defaultValue={currentAction["example_response"]}
|
defaultValue={currentAction["example_response"]}
|
||||||
onChange={(e) => setActionField("example_response", e.target.value)}
|
onChange={(e) => setActionField("example_response", e.target.value)}
|
||||||
helperText={
|
helperText={
|
||||||
@@ -3990,7 +3993,7 @@ const AppCreator = (defaultprops) => {
|
|||||||
id="standard-required"
|
id="standard-required"
|
||||||
defaultValue={currentAction["headers"]}
|
defaultValue={currentAction["headers"]}
|
||||||
multiline
|
multiline
|
||||||
rows="2"
|
minRows="2"
|
||||||
onChange={(e) => setActionField("headers", e.target.value)}
|
onChange={(e) => setActionField("headers", e.target.value)}
|
||||||
helperText={
|
helperText={
|
||||||
<span style={{ color: "white", marginBottom: "2px" }}>
|
<span style={{ color: "white", marginBottom: "2px" }}>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import React, { useEffect, useContext } from "react";
|
import React, { useEffect, useContext } from "react";
|
||||||
|
import ReactDOM from "react-dom"
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import { useTheme } from "@material-ui/core/styles";
|
import { useTheme } from "@material-ui/core/styles";
|
||||||
import { Navigate } from "react-router-dom";
|
import { Navigate } from "react-router-dom";
|
||||||
//import { Redirect } from "react-router-dom";
|
//import { Redirect } from "react-router-dom";
|
||||||
|
|
||||||
import SecurityFramework from '../components/SecurityFramework.jsx';
|
import SecurityFramework from '../components/SecurityFramework.jsx';
|
||||||
|
import EditWorkflow from "../components/EditWorkflow.jsx"
|
||||||
import { ShepherdTour, ShepherdTourContext } from 'react-shepherd'
|
import { ShepherdTour, ShepherdTourContext } from 'react-shepherd'
|
||||||
import { isMobile } from "react-device-detect"
|
import { isMobile } from "react-device-detect"
|
||||||
|
|
||||||
@@ -406,6 +408,13 @@ export const validateJson = (showResult) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showResult[0] === "\"") {
|
||||||
|
return {
|
||||||
|
valid: false,
|
||||||
|
result: showResult,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var jsonvalid = true
|
var jsonvalid = true
|
||||||
try {
|
try {
|
||||||
if (!showResult.includes("{") && !showResult.includes("[")) {
|
if (!showResult.includes("{") && !showResult.includes("[")) {
|
||||||
@@ -523,6 +532,7 @@ const Workflows = (props) => {
|
|||||||
const [exportData, setExportData] = React.useState("");
|
const [exportData, setExportData] = React.useState("");
|
||||||
|
|
||||||
const [modalOpen, setModalOpen] = React.useState(false);
|
const [modalOpen, setModalOpen] = React.useState(false);
|
||||||
|
const [isEditing, setIsEditing] = React.useState(true);
|
||||||
const [newWorkflowName, setNewWorkflowName] = React.useState("");
|
const [newWorkflowName, setNewWorkflowName] = React.useState("");
|
||||||
const [newWorkflowDescription, setNewWorkflowDescription] =
|
const [newWorkflowDescription, setNewWorkflowDescription] =
|
||||||
React.useState("");
|
React.useState("");
|
||||||
@@ -545,12 +555,14 @@ const Workflows = (props) => {
|
|||||||
const [firstLoad, setFirstLoad] = React.useState(true);
|
const [firstLoad, setFirstLoad] = React.useState(true);
|
||||||
const [showMoreClicked, setShowMoreClicked] = React.useState(false);
|
const [showMoreClicked, setShowMoreClicked] = React.useState(false);
|
||||||
const [usecases, setUsecases] = React.useState([]);
|
const [usecases, setUsecases] = React.useState([]);
|
||||||
|
const [appFramework, setAppFramework] = React.useState({});
|
||||||
|
|
||||||
const isCloud =
|
const isCloud =
|
||||||
window.location.host === "localhost:3002" ||
|
window.location.host === "localhost:3002" ||
|
||||||
window.location.host === "shuffler.io";
|
window.location.host === "shuffler.io";
|
||||||
|
|
||||||
const findWorkflow = (filters) => {
|
const findWorkflow = (filters) => {
|
||||||
|
console.log("Using filters: ", filters)
|
||||||
if (filters.length === 0) {
|
if (filters.length === 0) {
|
||||||
setFilteredWorkflows(workflows);
|
setFilteredWorkflows(workflows);
|
||||||
return;
|
return;
|
||||||
@@ -565,27 +577,44 @@ const Workflows = (props) => {
|
|||||||
found = filters.map((filter) =>
|
found = filters.map((filter) =>
|
||||||
curWorkflow.name.toLowerCase().includes(filter)
|
curWorkflow.name.toLowerCase().includes(filter)
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (found.every((v) => v !== true)) {
|
||||||
found = filters.map((filter) => {
|
found = filters.map((filter) => {
|
||||||
const newfilter = filter.toLowerCase();
|
if (filter === undefined || filter === null) {
|
||||||
if (filter === undefined) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const newfilter = filter.toLowerCase();
|
||||||
|
|
||||||
if (curWorkflow.name.toLowerCase().includes(filter.toLowerCase())) {
|
if (curWorkflow.name.toLowerCase().includes(filter.toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
} else if (curWorkflow.tags.includes(filter)) {
|
} else if (curWorkflow.tags !== undefined && curWorkflow.tags !== null && curWorkflow.tags.includes(filter)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (curWorkflow.owner === filter) {
|
} else if (curWorkflow.owner === filter) {
|
||||||
return true;
|
return true;
|
||||||
} else if (curWorkflow.org_id === filter) {
|
} else if (curWorkflow.org_id === filter) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (curWorkflow.usecase_ids !== undefined && curWorkflow.usecase_ids !== null && curWorkflow.usecase_ids.length > 0) {
|
||||||
|
// Check if the usecase is the right category
|
||||||
|
for (var key in usecases) {
|
||||||
|
if (usecases[key].name.toLowerCase() !== newfilter) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var subkey in usecases[key].list) {
|
||||||
|
if (curWorkflow.usecase_ids.includes(usecases[key].list[subkey].name)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
curWorkflow.actions !== null &&
|
curWorkflow.actions !== null &&
|
||||||
curWorkflow.actions !== undefined
|
curWorkflow.actions !== undefined
|
||||||
) {
|
) {
|
||||||
for (var key in curWorkflow.actions) {
|
for (var key in curWorkflow.actions) {
|
||||||
const action = curWorkflow.actions[key];
|
const action = curWorkflow.actions[key];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
action.app_name.toLowerCase() === newfilter ||
|
action.app_name.toLowerCase() === newfilter ||
|
||||||
action.app_name.toLowerCase().includes(newfilter)
|
action.app_name.toLowerCase().includes(newfilter)
|
||||||
@@ -593,7 +622,7 @@ const Workflows = (props) => {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -612,14 +641,17 @@ const Workflows = (props) => {
|
|||||||
|
|
||||||
const addFilter = (data) => {
|
const addFilter = (data) => {
|
||||||
if (data === null || data === undefined) {
|
if (data === null || data === undefined) {
|
||||||
|
console.log("No filter data")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.includes("<") && data.includes(">")) {
|
if (data.includes("<") && data.includes(">")) {
|
||||||
|
console.log("Filter includes < or >")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.includes(data) || filters.includes(data.toLowerCase())) {
|
if (filters.includes(data) || filters.includes(data.toLowerCase())) {
|
||||||
|
console.log("Filter already has the data")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,6 +918,39 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
}, [isDropzone]);
|
}, [isDropzone]);
|
||||||
|
|
||||||
|
const getFramework = () => {
|
||||||
|
fetch(globalUrl + "/api/v1/apps/frameworkConfiguration", {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
credentials: "include",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status !== 200) {
|
||||||
|
console.log("Status not 200 for framework!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((responseJson) => {
|
||||||
|
if (responseJson.success === false) {
|
||||||
|
setAppFramework({})
|
||||||
|
if (responseJson.reason !== undefined) {
|
||||||
|
//alert.error("Failed loading: " + responseJson.reason)
|
||||||
|
} else {
|
||||||
|
//alert.error("Failed to load framework for your org.")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setAppFramework(responseJson)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log("err in framework: ", error.toString());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const getAvailableWorkflows = () => {
|
const getAvailableWorkflows = () => {
|
||||||
fetch(globalUrl + "/api/v1/workflows", {
|
fetch(globalUrl + "/api/v1/workflows", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -904,7 +969,6 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alert.info("Failed getting workflows.");
|
alert.info("Failed getting workflows.");
|
||||||
setWorkflowDone(true);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -922,7 +986,7 @@ const Workflows = (props) => {
|
|||||||
newarray.push(wf)
|
newarray.push(wf)
|
||||||
}
|
}
|
||||||
|
|
||||||
setWorkflows(newarray);
|
// Workflows are set in here
|
||||||
fetchUsecases(newarray)
|
fetchUsecases(newarray)
|
||||||
|
|
||||||
var setProdFilter = false
|
var setProdFilter = false
|
||||||
@@ -965,7 +1029,6 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensures the zooming happens only once per load
|
// Ensures the zooming happens only once per load
|
||||||
setWorkflowDone(true);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setFirstLoad(false)
|
setFirstLoad(false)
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -1001,6 +1064,7 @@ const Workflows = (props) => {
|
|||||||
|
|
||||||
if (workflow.usecase_ids !== undefined && workflow.usecase_ids !== null) {
|
if (workflow.usecase_ids !== undefined && workflow.usecase_ids !== null) {
|
||||||
for (var usecasekey in workflow.usecase_ids) {
|
for (var usecasekey in workflow.usecase_ids) {
|
||||||
|
|
||||||
if (workflow.usecase_ids[usecasekey].toLowerCase() === subcategory.name.toLowerCase()) {
|
if (workflow.usecase_ids[usecasekey].toLowerCase() === subcategory.name.toLowerCase()) {
|
||||||
//console.log("Got match: ", workflow.usecase_ids[usecasekey])
|
//console.log("Got match: ", workflow.usecase_ids[usecasekey])
|
||||||
|
|
||||||
@@ -1027,6 +1091,8 @@ const Workflows = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
setUsecases(categorydata)
|
setUsecases(categorydata)
|
||||||
}
|
}
|
||||||
|
setWorkflows(workflows);
|
||||||
|
setWorkflowDone(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchUsecases = (workflows) => {
|
const fetchUsecases = (workflows) => {
|
||||||
@@ -1048,11 +1114,16 @@ const Workflows = (props) => {
|
|||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (responseJson.success !== false) {
|
if (responseJson.success !== false) {
|
||||||
handleKeysetting(responseJson, workflows)
|
handleKeysetting(responseJson, workflows)
|
||||||
|
} else {
|
||||||
|
setWorkflows(workflows);
|
||||||
|
setWorkflowDone(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
//alert.error("ERROR: " + error.toString());
|
//alert.error("ERROR: " + error.toString());
|
||||||
console.log("ERROR: " + error.toString());
|
console.log("ERROR: " + error.toString());
|
||||||
|
setWorkflows(workflows);
|
||||||
|
setWorkflowDone(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1065,6 +1136,7 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAvailableWorkflows();
|
getAvailableWorkflows();
|
||||||
|
getFramework()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -1452,7 +1524,10 @@ const Workflows = (props) => {
|
|||||||
<Paper
|
<Paper
|
||||||
square
|
square
|
||||||
style={setupPaperStyle}
|
style={setupPaperStyle}
|
||||||
onClick={() => setModalOpen(true)}
|
onClick={() => {
|
||||||
|
setModalOpen(true)
|
||||||
|
setIsEditing(false)
|
||||||
|
}}
|
||||||
onMouseOver={() => {
|
onMouseOver={() => {
|
||||||
setHover(true);
|
setHover(true);
|
||||||
}}
|
}}
|
||||||
@@ -1505,7 +1580,7 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!data.previously_saved) {
|
if (!data.previously_saved) {
|
||||||
boxColor = "#f85a3e";
|
boxColor = "#f86a3e";
|
||||||
}
|
}
|
||||||
|
|
||||||
const menuClick = (event) => {
|
const menuClick = (event) => {
|
||||||
@@ -1539,25 +1614,27 @@ const Workflows = (props) => {
|
|||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
style={{ backgroundColor: inputColor, color: "white" }}
|
style={{ backgroundColor: inputColor, color: "white" }}
|
||||||
onClick={() => {
|
onClick={(event) => {
|
||||||
setModalOpen(true);
|
event.stopPropagation()
|
||||||
setEditingWorkflow(JSON.parse(JSON.stringify(data)));
|
ReactDOM.unstable_batchedUpdates(() => {
|
||||||
setNewWorkflowName(data.name);
|
setModalOpen(true);
|
||||||
setNewWorkflowDescription(data.description);
|
setEditingWorkflow(JSON.parse(JSON.stringify(data)));
|
||||||
setDefaultReturnValue(data.default_return_value);
|
setNewWorkflowName(data.name);
|
||||||
if (data.tags !== undefined && data.tags !== null) {
|
setNewWorkflowDescription(data.description);
|
||||||
setNewWorkflowTags(JSON.parse(JSON.stringify(data.tags)));
|
setDefaultReturnValue(data.default_return_value);
|
||||||
}
|
if (data.tags !== undefined && data.tags !== null) {
|
||||||
|
setNewWorkflowTags(JSON.parse(JSON.stringify(data.tags)));
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Editing: ", data)
|
if (data.usecase_ids !== undefined && data.usecase_ids !== null && data.usecase_ids.length > 0) {
|
||||||
if (data.usecase_ids !== undefined && data.usecase_ids !== null && data.usecase_ids.length > 0) {
|
setSelectedUsecases(data.usecase_ids)
|
||||||
setSelectedUsecases(data.usecase_ids)
|
}
|
||||||
}
|
})
|
||||||
}}
|
}}
|
||||||
key={"change"}
|
key={"change"}
|
||||||
>
|
>
|
||||||
<EditIcon style={{ marginLeft: 0, marginRight: 8 }} />
|
<EditIcon style={{ marginLeft: 0, marginRight: 8 }} />
|
||||||
{"Change details"}
|
{"Edit details"}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
style={{ backgroundColor: inputColor, color: "white" }}
|
style={{ backgroundColor: inputColor, color: "white" }}
|
||||||
@@ -1702,20 +1779,60 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var selectedCategory = ""
|
||||||
|
if (data.usecase_ids !== undefined && data.usecase_ids !== null && data.usecase_ids.length > 0 && usecases !== null && usecases !== undefined && usecases.length > 0) {
|
||||||
|
const oldcolor = boxColor.valueOf()
|
||||||
|
|
||||||
|
// Find the first usecase and use that ones' ID
|
||||||
|
for (var key in usecases) {
|
||||||
|
var category = usecases[key]
|
||||||
|
category.matches = []
|
||||||
|
|
||||||
|
for (var subcategorykey in category.list) {
|
||||||
|
var subcategory = category.list[subcategorykey]
|
||||||
|
subcategory.matches = []
|
||||||
|
|
||||||
|
for (var usecasekey in data.usecase_ids) {
|
||||||
|
if (data.usecase_ids[usecasekey].toLowerCase() === subcategory.name.toLowerCase()) {
|
||||||
|
boxColor = category.color
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boxColor !== oldcolor) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boxColor !== oldcolor) {
|
||||||
|
selectedCategory = category.name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{width: "100%", position: "relative",}}>
|
<div style={{width: "100%", position: "relative",}}>
|
||||||
<Paper square style={paperAppStyle}>
|
<Paper square style={paperAppStyle}>
|
||||||
<div
|
{selectedCategory !== "" ?
|
||||||
style={{
|
<Tooltip title={`Usecase Category: ${selectedCategory}`} placement="bottom">
|
||||||
position: "absolute",
|
<div
|
||||||
bottom: 1,
|
style={{
|
||||||
left: 1,
|
cursor: "pointer",
|
||||||
height: 12,
|
position: "absolute",
|
||||||
width: 12,
|
top: 0,
|
||||||
backgroundColor: boxColor,
|
left: 0,
|
||||||
borderRadius: "0 100px 0 0",
|
height: paperAppStyle.minHeight,
|
||||||
}}
|
width: 2,
|
||||||
/>
|
backgroundColor: boxColor,
|
||||||
|
borderRadius: "0 100px 0 0",
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
addFilter(selectedCategory)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
: null}
|
||||||
<Grid
|
<Grid
|
||||||
item
|
item
|
||||||
style={{ display: "flex", flexDirection: "column", width: "100%" }}
|
style={{ display: "flex", flexDirection: "column", width: "100%" }}
|
||||||
@@ -2023,9 +2140,10 @@ const Workflows = (props) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method === "POST" && redirect) {
|
if (redirect) {
|
||||||
window.location.pathname = "/workflows/" + responseJson["id"];
|
//window.location.pathname = "/workflows/" + responseJson["id"];
|
||||||
setModalOpen(false);
|
navigate("/workflows/" + responseJson["id"])
|
||||||
|
//setModalOpen(false);
|
||||||
} else if (!redirect) {
|
} else if (!redirect) {
|
||||||
// Update :)
|
// Update :)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -2034,7 +2152,7 @@ const Workflows = (props) => {
|
|||||||
setImportLoading(false);
|
setImportLoading(false);
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
} else {
|
} else {
|
||||||
alert.info("Successfully changed basic info for workflow");
|
//alert.info("Successfully changed basic info for workflow");
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3498,11 +3616,25 @@ const Workflows = (props) => {
|
|||||||
>
|
>
|
||||||
<WorkflowView />
|
<WorkflowView />
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
{modalView}
|
{/*modalView*/}
|
||||||
{deleteModal}
|
{deleteModal}
|
||||||
{exportVerifyModal}
|
{exportVerifyModal}
|
||||||
{publishModal}
|
{publishModal}
|
||||||
{workflowDownloadModalOpen}
|
{workflowDownloadModalOpen}
|
||||||
|
|
||||||
|
{modalOpen === true ?
|
||||||
|
<EditWorkflow
|
||||||
|
globalUrl={globalUrl}
|
||||||
|
workflow={editingWorkflow}
|
||||||
|
setWorkflow={setEditingWorkflow}
|
||||||
|
modalOpen={modalOpen}
|
||||||
|
setModalOpen={setModalOpen}
|
||||||
|
usecases={usecases}
|
||||||
|
setNewWorkflow={setNewWorkflow}
|
||||||
|
appFramework={appFramework}
|
||||||
|
isEditing={isEditing}
|
||||||
|
/>
|
||||||
|
: null}
|
||||||
{/*<div style={{zIndex: 1, position: "fixed", bottom: 110, right: 110, display: "flex", }}>
|
{/*<div style={{zIndex: 1, position: "fixed", bottom: 110, right: 110, display: "flex", }}>
|
||||||
<Typography variant="body1" color="textSecondary" style={{zIndex: 1, marginRight: 0, maxWidth: 150, }}>
|
<Typography variant="body1" color="textSecondary" style={{zIndex: 1, marginRight: 0, maxWidth: 150, }}>
|
||||||
Need assistance? Ask our support team (it's free!).
|
Need assistance? Ask our support team (it's free!).
|
||||||
|
|||||||
Reference in New Issue
Block a user