+
{modalView}
{cloudSyncModal}
{editUserModal}
diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx
index d5146d66..54dd6a70 100755
--- a/frontend/src/views/AngularWorkflow.jsx
+++ b/frontend/src/views/AngularWorkflow.jsx
@@ -69,6 +69,7 @@ import {
AvatarGroup,
Autocomplete,
Radio,
+ ButtonGroup,
} from "@mui/material";
import {
@@ -185,6 +186,20 @@ export const triggers = [
description: "Schedule time trigger",
long_description: "Create a schedule based on cron",
id: "",
+ },
+ {
+ name: "Pipelines",
+ type: "TRIGGER",
+ status: "uninitialized",
+ description: "Run a pipeline trigger",
+ trigger_type: "PIPELINE",
+ errors: null,
+ is_valid: true,
+ label: "Pipeline",
+ environment: "onprem",
+ large_image: "/images/workflows/tenzir2.png",
+ long_description: "Controls a pipeline to run things",
+ id: "",
},
{
name: "Shuffle Workflow",
@@ -215,20 +230,6 @@ export const triggers = [
long_description: "Take user input to continue execution",
id: "",
},
- {
- name: "Pipelines",
- type: "TRIGGER",
- status: "uninitialized",
- description: "Run a pipeline trigger",
- trigger_type: "PIPELINE",
- errors: null,
- is_valid: true,
- label: "Pipeline",
- environment: "onprem",
- large_image: "/images/workflows/tenzir2.png",
- long_description: "Controls a pipeline to run things",
- id: "",
- },
];
// Adds specific text to items
@@ -404,7 +405,6 @@ const AngularWorkflow = (defaultprops) => {
const [toolsApp, setToolsApp] = React.useState({});
const [currentView, setCurrentView] = React.useState(0);
const [triggerAuthentication, setTriggerAuthentication] = React.useState({});
- const [triggerFolders, setTriggerFolders] = React.useState([]);
const [workflows, setWorkflows] = React.useState([]);
const [parentWorkflows, setParentWorkflows] = React.useState([]);
const [showEnvironment, setShowEnvironment] = React.useState(false);
@@ -458,6 +458,7 @@ const AngularWorkflow = (defaultprops) => {
const [showSkippedActions, setShowSkippedActions] = React.useState(false);
const [lastExecution, setLastExecution] = React.useState("");
const [configureWorkflowModalOpen, setConfigureWorkflowModalOpen] = React.useState(false);
+ const [autoCompleting, setAutocompleting] = React.useState(false);
const [authgroupModalOpen, setAuthgroupModalOpen] = React.useState(false);
const [authGroups, setAuthGroups] = React.useState([])
@@ -529,6 +530,7 @@ const AngularWorkflow = (defaultprops) => {
// eslint-disable-next-line no-unused-vars
const [_, setUpdate] = useState(""); // Used to force rendring, don't remove
+ const [executionFilter, setExecutionFilter] = React.useState("ALL")
const [workflowExecutions, setWorkflowExecutions] = React.useState([]);
const [workflowExecutionCount, setWorkflowExecutionCount] = React.useState(0);
const [defaultEnvironmentIndex, setDefaultEnvironmentIndex] = React.useState(0);
@@ -543,6 +545,7 @@ const AngularWorkflow = (defaultprops) => {
const [distributedFromParent, setDistributedFromParent] = React.useState("")
const [suborgWorkflows, setSuborgWorkflows] = React.useState([])
+ const [allTriggers, setAllTriggers] = React.useState(undefined)
const [suggestionBox, setSuggestionBox] = React.useState({
"position": {
@@ -670,6 +673,8 @@ const releaseToConnectLabel = "Release to Connect"
"field_number": -1,
"actionlist": [],
"field_id": "",
+
+ "example": "",
})
const [loadedApps, setLoadedApps] = React.useState([])
@@ -1033,6 +1038,7 @@ const releaseToConnectLabel = "Release to Connect"
};
const getWorkflowExecutionCount = (workflowId) => {
+
fetch(`${globalUrl}/api/v1/workflows/${workflowId}/executions/count`, {
method: "GET",
headers: {
@@ -1302,15 +1308,41 @@ const releaseToConnectLabel = "Release to Connect"
});
};
- const getWorkflowExecution = (id, execution_id) => {
- fetch(`${globalUrl}/api/v2/workflows/${id}/executions`, {
- method: "GET",
+ const getWorkflowExecution = (id, execution_id, filter) => {
+ var url = `${globalUrl}/api/v2/workflows/${id}/executions`
+ var method = "GET"
+ if (filter === undefined || filter === null || filter.toUpperCase() === "ALL") {
+
+ // Check for
+ if (executionFilter !== undefined && executionFilter !== null && executionFilter.length > 0) {
+ filter = executionFilter
+ } else {
+ filter = "ALL"
+ }
+ }
+
+ var formattedBody = {
+ method: method,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
- })
+ }
+
+ if (filter !== "ALL") {
+ formattedBody.method = "POST"
+
+ formattedBody.body = JSON.stringify({
+ "status": filter,
+ "workflow_id": id,
+ })
+
+ url = `${globalUrl}/api/v1/workflows/search`
+
+ }
+
+ fetch(url, formattedBody)
.then((response) => {
if (response.status !== 200) {
console.log("Status not 200 for WORKFLOW EXECUTION :O!");
@@ -1319,6 +1351,10 @@ const releaseToConnectLabel = "Release to Connect"
return response.json();
})
.then((responseJson) => {
+ if (responseJson !== undefined && responseJson !== null && responseJson.runs !== undefined && responseJson.runs !== null) {
+ responseJson.executions = responseJson.runs
+ }
+
if (responseJson !== undefined && responseJson !== null && responseJson.executions !== undefined && responseJson.executions !== null) {
// - means it's opposite
@@ -1383,8 +1419,6 @@ const releaseToConnectLabel = "Release to Connect"
} else {
const cursearch = typeof window === "undefined" || window.location === undefined ? "" : window.location.search;
var tmpView = new URLSearchParams(cursearch).get("execution_id");
- console.log("Alertnative execution id check: ", tmpView)
-
if (tmpView === undefined || tmpView === null || tmpView.length === 0) {
const execution_id = tmpView;
setExecutionModalView(1);
@@ -1500,44 +1534,7 @@ const releaseToConnectLabel = "Release to Connect"
if (selectedOption === "Kafka Queue") {
trigger.parameters = []
- const topic = document.getElementById('topic')?.value
- const bootstrapServers = document.getElementById('bootstrap_servers')?.value
- const groupId = document.getElementById('group_id')?.value
- const autoOffsetReset = document.getElementById('auto_offset_reset')?.value;
-
- if(topic) {
- trigger.parameters.push({
- name: "topic",
- value: topic
- })
- } else {
- toast("Please enter the topic name");
- return;
- }
-
- if (bootstrapServers) {
- trigger.parameters.push({
- name: "bootstrap_servers",
- value: bootstrapServers
- });
- } else {
- toast("please enter bootstrap server details");
- return;
- }
-
- if (groupId) {
- trigger.parameters.push({
- name: "group_id",
- value: groupId
- });
- }
-
- if (autoOffsetReset) {
- trigger.parameters.push({
- name: "auto_offset_reset",
- value: autoOffsetReset
- });
- }
+ const pipeline = document.getElementById('pipeline')?.value
setTenzirConfigModalOpen(false);
} else if (selectedOption === "Syslog listener") {
@@ -3457,9 +3454,7 @@ const releaseToConnectLabel = "Release to Connect"
if (responseJson.childorg_workflow_ids !== undefined && responseJson.childorg_workflow_ids !== null && responseJson.childorg_workflow_ids.length > 0) {
getChildWorkflows(responseJson.id)
- }
-
- if (responseJson.parentorg_workflow !== undefined && responseJson.parentorg_workflow !== null && responseJson.parentorg_workflow.length > 0) {
+ } else if (responseJson.parentorg_workflow !== undefined && responseJson.parentorg_workflow !== null && responseJson.parentorg_workflow.length > 0) {
getChildWorkflows(responseJson.parentorg_workflow)
}
@@ -3805,13 +3800,9 @@ const releaseToConnectLabel = "Release to Connect"
setSelectedAction({});
setSelectedApp({});
setSelectedComment({})
- setSelectedEdge({});
-
-
setSelectedEdge({})
//setSelectedActionEnvironment({})
setTriggerAuthentication({})
- setTriggerFolders([])
setLocalFirstrequest(true)
setSelectedTrigger({});
@@ -4036,13 +4027,9 @@ const releaseToConnectLabel = "Release to Connect"
var found = false;
for (let nodekey in allNodes) {
const currentNode = allNodes[nodekey];
- if (
- currentNode.data.attachedTo === nodedata.id &&
- currentNode.data.isDescriptor
- ) {
- found = true;
- console.log("FOUND THE NODE!");
- break;
+ if (currentNode.data.attachedTo === nodedata.id && currentNode.data.isDescriptor) {
+ found = true
+ break
}
}
@@ -4391,10 +4378,14 @@ const releaseToConnectLabel = "Release to Connect"
// This is to find sample response and parse it as string
var AppContext = []
+ var originalParams = []
+
if (inputAction !== undefined && inputAction !== null) {
+ // Reload the data without copying
+ inputAction = JSON.parse(JSON.stringify(inputAction))
+ originalParams = JSON.parse(JSON.stringify(inputAction.parameters))
const parents = getParents(inputAction)
- console.log("Parents: ", parents)
var actionlist = []
if (parents.length > 1) {
for (let [key,keyval] in Object.entries(parents)) {
@@ -4473,9 +4464,26 @@ const releaseToConnectLabel = "Release to Connect"
"action_name": item.action_name,
"label": item.label,
"example": exampledata,
- "example_response": exampledata,
+ //"example_response": exampledata,
})
}
+
+ var params = []
+ for (var paramkey in inputAction.parameters) {
+ const param = inputAction.parameters[paramkey]
+ if (param.configuration) {
+ continue
+ }
+
+ // Mainly for booleans
+ if (param.options !== undefined && param.options !== null && param.options.length > 0) {
+ continue
+ }
+
+ params.push(param)
+ }
+
+ inputAction.parameters = params
}
var conversationData = {
@@ -4486,6 +4494,7 @@ const releaseToConnectLabel = "Release to Connect"
"workflow_id": workflow.id,
}
+
if (inputAction !== undefined) {
console.log("Add app context! This should them get parameters directly")
conversationData.output_format = "action_parameters"
@@ -4494,16 +4503,13 @@ const releaseToConnectLabel = "Release to Connect"
conversationData.app_name = inputAction.app_name
conversationData.action_name = inputAction.name
conversationData.parameters = inputAction.parameters
-
- if (!value.includes(inputAction.label)) {
- conversationData.query = inputAction.label.replaceAll("_", " ")
- }
}
// Onprem not available yet (April 2023)
// Should: Make OpenAI work for them with their own key
- //fetch("https://shuffler.io/api/v1/conversation", {
- fetch(`${globalUrl}/api/v1/conversation`, {
+ //fetch(`${globalUrl}/api/v1/conversation`, {
+ const url = `${globalUrl}/api/v1/conversation`
+ fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -4513,12 +4519,16 @@ const releaseToConnectLabel = "Release to Connect"
credentials: "include",
})
.then((response) => {
+ setAiQueryModalOpen(false)
+ setAutocompleting(false)
if (setSuggestionLoading !== undefined) {
setSuggestionLoading(false)
}
if (response.status !== 200) {
console.log("Status not 200 for stream results :O!");
+ } else {
+ toast("Completion finished. Please verify your action!")
}
return response.json();
@@ -4543,52 +4553,71 @@ const releaseToConnectLabel = "Release to Connect"
}
var changed = false
-
- for (let paramkey in inputAction.parameters) {
- const actionParam = inputAction.parameters[paramkey]
-
- if (actionParam.autocompleted === true) {
+ for (let respParamKey in responseJson.parameters) {
+ var respParam = responseJson.parameters[respParamKey]
+ if (respParam.value === undefined || respParam.value === null || respParam.value === "" ) {
continue
}
- if (actionParam.configuration === true && actionParam.name !== "url") {
- continue
- }
-
- if (actionParam.value !== "" && actionParam.value !== actionParam.example) {
- console.log("Skipping: ", actionParam)
- continue
- }
-
- for (let respParam of responseJson.parameters) {
- if (respParam.name === actionParam.name) {
- console.log("Found match for param: ", respParam)
-
- if (respParam.value === "") {
- break
- }
-
- changed = true
-
- inputAction.parameters[paramkey].autocompleted = true
- inputAction.parameters[paramkey].value = respParam.value
- break
+ for (let paramkey in originalParams) {
+ const actionParam = originalParams[paramkey]
+ /*
+ if (actionParam.value !== "" && actionParam.value !== actionParam.example) {
+ console.log("Skipping: ", actionParam)
+ continue
}
+ */
+
+ if (respParam.name !== actionParam.name) {
+ continue
+ }
+
+ const codeeditor = document.getElementById("shuffle-codeeditor")
+ if (codeeditor !== undefined && codeeditor !== null) {
+ const editorInstance = window?.ace?.edit("shuffle-codeeditor")
+ if (editorInstance === undefined || editorInstance === null) {
+ toast.error("Failed to find code editor instance")
+ return
+ } else {
+ editorInstance.setValue(respParam.value)
+ originalParams[paramkey].autocompleted = true
+ changed = true
+ }
+ }
+
+ if (!changed) {
+ console.log("Found match for param: ", respParam)
+ changed = true
+ originalParams[paramkey].autocompleted = true
+ originalParams[paramkey].value = respParam.value
+ }
+
+ break
}
}
if (changed === true) {
+ inputAction.parameters = originalParams
console.log("Setting action! Force update pls :)")
setUpdate(Math.random())
+
setSelectedAction(inputAction)
+
+ // Find it in cytoscape and update the action
+ if (cy !== undefined && cy !== null) {
+ const cyAction = cy.getElementById(inputAction.id)
+ if (cyAction !== undefined && cyAction !== null) {
+ cyAction.data("parameters", inputAction.parameters)
+ }
+ }
+
}
return
}
- console.log("Suggestionbox location: ", suggestionBox)
-
// Add action
+ console.log("Suggestionbox location: ", suggestionBox)
if (responseJson.app_name !== undefined && responseJson.app_name !== null) {
// Always added to 0, 0
// Should use suggestionBox.position.x, suggestionBox.position.y
@@ -4640,6 +4669,8 @@ const releaseToConnectLabel = "Release to Connect"
}
})
.catch((error) => {
+ setAiQueryModalOpen(false)
+ setAutocompleting(false)
if (setSuggestionLoading !== undefined) {
setSuggestionLoading(false)
}
@@ -5278,9 +5309,6 @@ const releaseToConnectLabel = "Release to Connect"
authenticationOptions[latestindex].last_modified = true
}
-
- console.log("auth options 2: ", authenticationOptions)
-
curaction.authentication = authenticationOptions
if (
curaction.selectedAuthentication === null ||
@@ -5290,7 +5318,6 @@ const releaseToConnectLabel = "Release to Connect"
curaction.selectedAuthentication = {};
}
} else {
- console.log("auth option 3")
curaction.authentication = []
curaction.authentication_id = "";
@@ -5374,7 +5401,7 @@ const releaseToConnectLabel = "Release to Connect"
var trigger_index = workflow.triggers.findIndex(
(a) => a.id === data.id
- );
+ )
if (trigger_index === -1) {
workflow.triggers.push(data)
@@ -5393,7 +5420,6 @@ const releaseToConnectLabel = "Release to Connect"
}
} else if (data.app_name === "Webhook") {
if (workflow.triggers[trigger_index].parameters !== undefined && workflow.triggers[trigger_index].parameters !== null && workflow.triggers[trigger_index].parameters.length > 0) {
- console.log("Can set params here!")
workflow.triggers[trigger_index].parameters[0] = {
name: "url",
value: referenceUrl + "webhook_" + workflow.triggers[trigger_index].id,
@@ -5481,6 +5507,34 @@ const releaseToConnectLabel = "Release to Connect"
}
}
+ if (allTriggers !== undefined && allTriggers !== null) {
+
+ // Just checking all three. Could just make a new list, but meh
+ if (allTriggers.pipelines !== undefined && allTriggers.pipelines !== null) {
+ for (var pipelineKey in allTriggers.pipelines) {
+ if (allTriggers.pipelines[pipelineKey].id === data.id) {
+ data.status = allTriggers.pipelines[pipelineKey].status
+ }
+ }
+ }
+
+ if (allTriggers.webhooks !== undefined && allTriggers.webhooks !== null) {
+ for (var webhookKey in allTriggers.webhooks) {
+ if (allTriggers.webhooks[webhookKey].id === data.id) {
+ data.status = allTriggers.webhooks[webhookKey].status
+ }
+ }
+ }
+
+ if (allTriggers.schedules !== undefined && allTriggers.schedules !== null) {
+ for (var scheduleKey in allTriggers.schedules) {
+ if (allTriggers.schedules[scheduleKey].id === data.id) {
+ data.status = allTriggers.schedules[scheduleKey].status
+ }
+ }
+ }
+ }
+
setSelectedTriggerIndex(trigger_index)
setSelectedTrigger(data)
setSelectedActionEnvironment(data.env)
@@ -7392,6 +7446,7 @@ const releaseToConnectLabel = "Release to Connect"
console.log("NODE UNFINISHED (hover in): ", nodedata)
// Should just be 1, so this should be fast enough :3
+ /*
const incomingEdges = event.target.incomers("edge").jsons()
if (incomingEdges !== undefined && incomingEdges !== null) {
for (var i = 0; i < incomingEdges.length; i++) {
@@ -7410,6 +7465,7 @@ const releaseToConnectLabel = "Release to Connect"
}
return
+ */
}
@@ -8315,13 +8371,39 @@ const releaseToConnectLabel = "Release to Connect"
}
setAllRevisions(responseJson)
- setSelectedVersion(responseJson[0])
+ setSelectedVersion(responseJson[0])
})
.catch((error) => {
console.log("Error getting workflow revisions: ", error)
});
}
+ const loadTriggers = () => {
+ const url = `${globalUrl}/api/v1/triggers`
+ fetch(url,
+ {
+ method: "GET",
+ headers: { "content-type": "application/json" },
+ credentials: "include",
+ }
+ )
+ .then((response) => {
+ if (response.status !== 200) {
+ throw new Error("No folders :o!");
+ }
+
+ return response.json();
+ })
+ .then((responseJson) => {
+ if (responseJson.success !== false) {
+ setAllTriggers(responseJson)
+ }
+ })
+ .catch((error) => {
+ console.log("Get outlook folders error: ", error.toString());
+ });
+ }
+
// eslint-disable-next-line react-hooks/exhaustive-deps
//useEffect(() => {
if (firstrequest) {
@@ -8329,6 +8411,7 @@ const releaseToConnectLabel = "Release to Connect"
getWorkflow(props.match.params.key, {});
getChildWorkflows(props.match.params.key)
getRevisionHistory(props.match.params.key)
+ loadTriggers()
getApps()
fetchUsecases()
@@ -8374,8 +8457,6 @@ const releaseToConnectLabel = "Release to Connect"
// 2nd load - configures cytoscape
//} else if (!established && cy !== undefined && ((apps !== null && apps !== undefined && apps.length > 0) || workflow.public === true) && Object.getOwnPropertyNames(workflow).length > 0 && appAuthentication !== undefined && workflowRecommendations !== undefined) {
} else if (!established && cy !== undefined && ((apps !== null && apps !== undefined && apps.length > 0) || workflow.public === true) && Object.getOwnPropertyNames(workflow).length > 0 && appAuthentication !== undefined) {
- console.log("In POST graph setup!")
-
//This part has to load LAST, as it's kind of not async.
//This means we need everything else to happen first.
@@ -8383,8 +8464,6 @@ const releaseToConnectLabel = "Release to Connect"
setEstablished(true);
// Validate if the node is just a node lol
- console.log("CY grid: ", cy.gridGuide)
-
// https://www.npmjs.com/package/cytoscape-grid-guide
//
if (cy.gridGuide !== undefined) {
@@ -8441,7 +8520,6 @@ const releaseToConnectLabel = "Release to Connect"
}
// preview: true,
- console.log("In POST graph setup 2")
cy.fit(null, 200);
cy.on("boxselect", "node", (e) => {
@@ -8493,7 +8571,6 @@ const releaseToConnectLabel = "Release to Connect"
document.title = "Workflow - " + workflow.name;
- console.log("In POST graph setup 3")
startWorkflowStream(props.match.params.key);
registerKeys();
@@ -8551,7 +8628,6 @@ const releaseToConnectLabel = "Release to Connect"
if (alledges !== undefined && alledges !== null && alledges.length > 0) {
for (let edgekey in alledges) {
const tmp = alledges[edgekey];
- console.log("TMP: ", tmp, tmp.data.source);
if (tmp.data.source === trigger.id) {
mappedStartnode = tmp.data.target;
break;
@@ -8712,7 +8788,7 @@ const releaseToConnectLabel = "Release to Connect"
};
const paperAppStyle = {
- borderRadius: theme.palette.borderRadius,
+ borderRadius: theme.palette?.borderRadius,
minHeight: isMobile ? 50 : 70,
maxHeight: isMobile ? 50 : 70,
minWidth: isMobile ? 50 : "100%",
@@ -8725,7 +8801,7 @@ const releaseToConnectLabel = "Release to Connect"
};
const paperVariableStyle = {
- borderRadius: theme.palette.borderRadius,
+ borderRadius: theme.palette?.borderRadius,
minHeight: 50,
maxHeight: 50,
minWidth: "100%",
@@ -9114,27 +9190,19 @@ const releaseToConnectLabel = "Release to Connect"
{triggers.map((trigger, index) => {
- /*
- if (trigger.trigger_type === "PIPELINE") {
- if (userdata.support !== true) {
- return null
- }
- }
- */
-
// Hiding since March 2024
if (trigger.trigger_type === "EMAIL") {
return null
}
const imagesize = isMobile ? 40 : trigger.large_image.includes("svg") ? 50 : 50
- var imageline = trigger.large_image.length === 0 ?
![]()
+ var imageline = trigger.large_image.length === 0 ?
![]()
:

{
+ if (env.archived) {
+ return false
+ }
+
+ if (env.Name === "cloud" || env.Type === "cloud") {
+ return false
+ }
+
+ return true
+ })
+
+ console.log("NEWENV: ", environments, newenv)
+ if (newenv !== undefined && newenv !== null) {
+ newAppData.environment = newenv.Name
+ } else {
+ newAppData.environment = ""
+ }
+ }
+ console.log("NEW DATA: ", newAppData)
// Can all the data be in here? hmm
const nodeToBeAdded = {
@@ -9419,6 +9509,8 @@ const releaseToConnectLabel = "Release to Connect"
const handleAppDrag = (e, app) => {
const cycontainer = cy.container();
+ console.log("APPDRAG!")
+
if (app.type === "TRIGGER") {
handleTriggerDrag(e, app)
@@ -9816,7 +9908,7 @@ const releaseToConnectLabel = "Release to Connect"
pointerEvents: "none",
userDrag: "none",
userSelect: "none",
- borderRadius: theme.palette.borderRadius,
+ borderRadius: theme.palette?.borderRadius,
height: isMobile ? 40 : 55,
width: isMobile ? 40 : 55,
}}
@@ -9915,7 +10007,7 @@ const releaseToConnectLabel = "Release to Connect"
}}>
+ const submitQueryModal = () => {
+ const changeActionTextfield = document.getElementById("change-action-textfield")
+ if (changeActionTextfield === undefined || changeActionTextfield === null) {
+ setAiQueryModalOpen(false)
+ toast.error("Failed to find textfield")
+ return
+ }
+
+ if (changeActionTextfield.value === undefined || changeActionTextfield.value === null || changeActionTextfield.value === "") {
+ toast("Please provide how you want formatting to happen")
+ return
+ }
+
+ setAutocompleting(true)
+ if (codeEditorModalOpen === true) {
+ autoFormatCodemodal(changeActionTextfield.value)
+ } else {
+ aiSubmit(changeActionTextfield.value, undefined, undefined, selectedAction)
+ }
+ }
+
+ const autoFormatCodemodal = (input) => {
+ if (codeEditorModalOpen !== true) {
+ toast.error("Code editor is not open")
+ return
+ }
+
+ if (editorData.name === undefined || editorData.name === null || editorData.name === "") {
+ toast.error("Failed to find editor field name")
+ return
+ }
+
+ const codeeditor = document.getElementById("shuffle-codeeditor")
+ if (codeeditor === undefined || codeeditor === null) {
+ toast.error("Failed to find code editor html")
+ return
+ }
+
+ const editorInstance = window?.ace?.edit("shuffle-codeeditor")
+ if (editorInstance === undefined || editorInstance === null) {
+ toast.error("Failed to find code editor instance")
+ return
+ }
+
+ //console.log("ACE data: ", editorInstance.getValue())
+ //editorInstance.setValue("HELO")
+
+ // Should try to automatically fix this input
+ console.log("Running AI input fixer: ", selectedResult)
+ if (aiSubmit === undefined || selectedAction === undefined) {
+ toast.error("Failed to find AI submit function")
+ return
+ }
+
+ // Should remove params from selectedAction that aren't parameterName
+ var tmpAction = JSON.parse(JSON.stringify(selectedAction))
+ var tmpParams = tmpAction.parameters.filter((param) => param.name === editorData.name)
+ if (tmpParams.length !== 1) {
+ toast.error("Failed to find correct parameter in action")
+ return
+ }
+
+ tmpParams[0].value = editorInstance.getValue()
+ tmpAction.parameters = tmpParams
+ aiSubmit(input, undefined, undefined, tmpAction)
+ }
+
const aiQueryModal =
@@ -12159,659 +12392,6 @@ const releaseToConnectLabel = "Release to Connect"
);
};
- // 1. GET the trigger authentication data
- // 2. Parse the fields that are used (outlook & gmail)
- // 3. Parse the folders that are selected
- // 4. Start / stop
- const EmailSidebar = () => {
- if (Object.getOwnPropertyNames(selectedTrigger).length === 0) {
- return null;
- }
-
- if (workflow.triggers[selectedTriggerIndex] === undefined) {
- return null;
- }
-
- if (
- workflow.triggers[selectedTriggerIndex].parameters === undefined ||
- workflow.triggers[selectedTriggerIndex].parameters === null ||
- workflow.triggers[selectedTriggerIndex].parameters.length === 0
- ) {
- workflow.triggers[selectedTriggerIndex].parameters = [
- { value: "No folders selected yet", name: "outlookfolder" },
- ];
- selectedTrigger.parameters = [
- { value: "No folders selected yet", name: "outlookfolder" },
- ];
- setWorkflow(workflow);
- setSelectedTrigger(selectedTrigger);
- }
-
- const setGmailFolders = () => {
- console.log("In set gmail folders");
- fetch(
- globalUrl +
- "/api/v1/triggers/gmail/getFolders?trigger_id=" +
- selectedTrigger.id,
- {
- method: "GET",
- headers: { "content-type": "application/json" },
- credentials: "include",
- }
- )
- .then((response) => {
- if (response.status !== 200) {
- throw new Error("No folders :o!");
- }
-
- return response.json();
- })
- .then((responseJson) => {
- if (
- responseJson !== undefined &&
- responseJson !== null &&
- responseJson.success !== false &&
- responseJson.length > 0
- ) {
- setTriggerFolders(responseJson);
- }
-
- if (
- workflow.triggers[selectedTriggerIndex].parameters.length === 0 &&
- responseJson.length > 0
- ) {
- workflow.triggers[selectedTriggerIndex].parameters = [
- {
- value: responseJson[0].displayName,
- name: "outlookfolder",
- id: responseJson[0].id,
- },
- ];
- selectedTrigger.parameters = [
- {
- value: responseJson[0].displayName,
- name: "outlookfolder",
- id: responseJson[0].id,
- },
- ];
- setWorkflow(workflow);
- setSelectedTrigger(selectedTrigger);
- }
- })
- .catch((error) => {
- console.log("Get gmail folder error: ", error.toString());
- });
- };
-
- const setOutlookFolders = () => {
- fetch(
- globalUrl +
- "/api/v1/triggers/outlook/getFolders?trigger_id=" +
- selectedTrigger.id,
- {
- method: "GET",
- headers: { "content-type": "application/json" },
- credentials: "include",
- }
- )
- .then((response) => {
- if (response.status !== 200) {
- throw new Error("No folders :o!");
- }
-
- return response.json();
- })
- .then((responseJson) => {
- if (
- responseJson !== null &&
- responseJson.success !== false &&
- responseJson.length > 0
- ) {
- console.log("Got trigger folders: ", triggerFolders)
- setTriggerFolders(responseJson);
- }
-
- if (
- workflow.triggers[selectedTriggerIndex].parameters.length === 0 &&
- responseJson.length > 0
- ) {
- workflow.triggers[selectedTriggerIndex].parameters = [
- {
- value: responseJson[0].displayName,
- name: "outlookfolder",
- id: responseJson[0].id,
- },
- ]
- selectedTrigger.parameters = [
- {
- value: responseJson[0].displayName,
- name: "outlookfolder",
- id: responseJson[0].id,
- },
- ];
- setWorkflow(workflow);
- setSelectedTrigger(selectedTrigger);
- }
- })
- .catch((error) => {
- console.log("Get outlook folders error: ", error.toString());
- });
- };
-
- const getTriggerAuth = () => {
- fetch(`${globalUrl}/api/v1/triggers/${selectedTrigger.id}`, {
- method: "GET",
- headers: { "content-type": "application/json" },
- credentials: "include",
- })
- .then((response) => {
- if (response.status !== 200) {
- throw new Error("No trigger info :o!");
- }
-
- return response.json();
- })
- .then((responseJson) => {
-
- setTriggerAuthentication(responseJson);
- })
- .catch((error) => {
- //console.log(error.toString());
- console.log("Set trigger auth error: ", error.toString());
- });
- };
-
- // Getting the triggers and the folders if they exist
- if (localFirstrequest) {
- //console.log("Trigger: ", selectedTrigger)
- //console.log("Triggername: ", selectedTrigger.name)
- //if (selectedTrigger.name.toLowerCase() === "gmail") {
- setGmailFolders();
- setOutlookFolders();
-
- getTriggerAuth();
- setLocalFirstrequest(false);
- }
-
- const gmailButton =
- selectedTrigger.name !== "Gmail" ? null : (
-
- );
-
- const outlookButton =
- selectedTrigger.name !== "Office365" ? null : (
-
- );
-
- // FIXME - set everything in here to multifolder etc
- var triggerInfo = "SET UP BUT NO TYPE :)";
- if (Object.getOwnPropertyNames(triggerAuthentication).length > 0) {
- // Should get the folders if they don't already exist
-
- if (
- triggerAuthentication.type === "outlook" ||
- triggerAuthentication.type === "gmail"
- ) {
- triggerInfo = (
-
- {selectedTrigger.status === "running" ? null : (
-
-
- {outlookButton}
- {gmailButton}
-
- If you have trouble using this trigger, please contact us to get access
-
-
- )}
-
- {triggerFolders === undefined || triggerFolders === null ? null : (
-
-
-
-
- Select {triggerAuthentication.type === "gmail" ? "labels" : "a folder"}
-
-
- {triggerFolders.length === 0 ?
-
- No folders found. Please authenticate first. If this persists, contact us.
-
- :
-
- }
-
- )}
-
- );
- } else if (triggerAuthentication.type === "gmail") {
- console.log("AUTH: ", triggerAuthentication);
- triggerInfo = "SPECIAL GMAIL";
- }
- }
-
- // Check
- const argumentView =
- Object.getOwnPropertyNames(triggerAuthentication).length > 0 ? (
- {triggerInfo}
- ) : (
-
-
- {outlookButton}
- {gmailButton}
-
- If you have trouble using this trigger, please {
- 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 to get access
-
-
- );
-
- return (
-
-
- {selectedTrigger.app_name}: {selectedTrigger.status}
-
-
- What are email triggers?
-
-
-
Name
-
- {/*
-
- Environment:
-
-
- */}
-
- {argumentView}
-
-
-
-
-
-
-
-
-
-
- );
- };
-
const handleWorkflowSelectionUpdate = (e, isUserinput) => {
if (e.target.value === undefined || e.target.value === null || e.target.value.id === undefined) {
@@ -13380,7 +12960,7 @@ const releaseToConnectLabel = "Release to Connect"
color: "white",
height: 35,
marginleft: 10,
- borderRadius: theme.palette.borderRadius,
+ borderRadius: theme.palette?.borderRadius,
color: "rgba(255,255,255,0.4)",
}}
SelectDisplayProps={{
@@ -13428,7 +13008,7 @@ const releaseToConnectLabel = "Release to Connect"
{
setLastSaved(false)
@@ -13613,7 +13193,7 @@ const releaseToConnectLabel = "Release to Connect"
{data.image !== undefined && data.image !== null && data.image.length > 0 ?
-
+
: null}
Choose Subflow '{data.name}'
@@ -13627,7 +13207,7 @@ const releaseToConnectLabel = "Release to Connect"
}}
value={data}
onClick={() => {
- getWorkflowApps(data.id);
+ getWorkflowApps(data.id);
handleWorkflowSelectionUpdate({
target: {
value: data
@@ -13646,7 +13226,7 @@ const releaseToConnectLabel = "Release to Connect"
{
setLastSaved(false)
@@ -13752,7 +13332,7 @@ const releaseToConnectLabel = "Release to Connect"
{
// Workaround with event lol
@@ -14609,7 +14189,7 @@ const releaseToConnectLabel = "Release to Connect"
variant="body1"
style={{
backgroundColor: theme.palette.inputColor,
- borderRadius: theme.palette.borderRadius,
+ borderRadius: theme.palette?.borderRadius,
}}
{...params}
label="Find Associated App (optional)"
@@ -14628,7 +14208,20 @@ const releaseToConnectLabel = "Release to Connect"
MenuProps={{
disableScrollLock: true,
}}
- value={selectedTrigger.environment}
+ value={selectedTrigger.environment === undefined || selectedTrigger.environment === null || selectedTrigger.environment === "" ?
+ environments?.find((env) => {
+ if (env.archived) {
+ return false
+ }
+
+ if (env.name === "cloud" || env.type === "cloud") {
+ return false
+ }
+
+
+ return true
+ }).name
+ : selectedTrigger.environment}
disabled={selectedTrigger.status === "running"}
SelectDisplayProps={{
style: {
@@ -14663,7 +14256,7 @@ const releaseToConnectLabel = "Release to Connect"
>
{triggerEnvironments.map((data) => {
if (data.archived) {
- return null;
+ return null
}
return (
@@ -14713,7 +14306,7 @@ const releaseToConnectLabel = "Release to Connect"
{
@@ -14845,7 +14438,7 @@ const releaseToConnectLabel = "Release to Connect"
-
+ >
+
+
+
+
+
+
) : (
-
-
- There are no executions yet, or they are not loaded.
-
-
-
+
+
+
+ No executions found for the '{executionFilter}' filter.
+
+
+
+
+
)}
) : (
@@ -19258,7 +18762,7 @@ const releaseToConnectLabel = "Release to Connect"
{
- window.open("/admin?tab=environments", "_blank")
+ window.open("/admin?tab=locations", "_blank")
}}>
{executionData.workflow.actions[0].environment}
@@ -19434,7 +18938,7 @@ const releaseToConnectLabel = "Release to Connect"
{environments.length > 0 && defaultEnvironmentIndex < environments.length && nonskippedResults.length === 0 && environments[defaultEnvironmentIndex].Name !== "Cloud" ?
- No results yet. Is Orborus running for the "{environments[defaultEnvironmentIndex].Name}" environment? Find out here. If the Workflow doesn't start within 30 seconds with Orborus running, contact support: support@shuffler.io
+ No results yet. Is Orborus running for the "{environments[defaultEnvironmentIndex].Name}" environment? Find out here. If the Workflow doesn't start within 30 seconds with Orborus running, contact support: support@shuffler.io
: null}
@@ -19450,7 +18954,7 @@ const releaseToConnectLabel = "Release to Connect"