From e682a7d2a74c91435210aca825cd3a8cf96d3041 Mon Sep 17 00:00:00 2001 From: Frikky Date: Mon, 26 Feb 2024 23:15:57 +0100 Subject: [PATCH] Added Docs update, missing images and Tenzir pipelines --- frontend/public/images/workflows/tenzir2.png | Bin 0 -> 2384 bytes .../public/images/workflows/user_input.svg | 30 ++ frontend/src/components/CacheView.jsx | 95 ++++- frontend/src/views/Admin.jsx | 8 +- frontend/src/views/AngularWorkflow.jsx | 384 +++++++++++++++--- frontend/src/views/Docs.jsx | 15 +- functions/onprem/orborus/orborus.go | 4 +- 7 files changed, 461 insertions(+), 75 deletions(-) create mode 100644 frontend/public/images/workflows/tenzir2.png create mode 100644 frontend/public/images/workflows/user_input.svg diff --git a/frontend/public/images/workflows/tenzir2.png b/frontend/public/images/workflows/tenzir2.png new file mode 100644 index 0000000000000000000000000000000000000000..12c702bca1b9a42009800d96b62c372cb0872232 GIT binary patch literal 2384 zcmd6p`#;m|AICq=hYn_P%8gr@+hHc5kV7q}nNxFS=2Xf;79w>!WN4^p*kTh6A>nIb z+Q=B|4k7m#nmCZ{B%m5dh>=5e~#Ct|T--jS zf_kmsI=t7h;ETkFEGA{@+NK01wK>HkWlFp9iUYAuk$)QG=EVZh!j|{%ljIYu>JZnh zV1ePWYPkt-$Ia;L!lvZ$8JW(qTk{;sL}Qm-#cGpw1}Mu59Rbcmy1{V-gg(qvjt$YP zV)W_mA(8PsF!A3Zey-Jf5mFZ}rPbitQW zQ12~-UEMpLUf>e2Yy=$pVpr`lvD#m{9wQd7l(7n5_mP-A5@$AZy?N6jV5^H%v zctD^773c*vH};`Q5A59-YFa#l2a0h6zy?Vzx@G~HTQuXauIeHU!3 zf@)AHr?c&Y?&Z)j3UWd&<7Msl7N`6%8?f(Po+RQY<1oMqNb%h8h>Ks5biG{EO$5Oy zg2#7w0%xA~S97u|%6_o~)LT=68T71N`E$PTk%dLKc>K;DLiCoztjb|qaI?g6A&m6RfvxjX%jH|Yy7YK1}A_Y$2Z@OxY!Fkz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qj68-Fsl|Jli+>*m3wL@D z#9a+U*C!}pY4y+-=-%Qp1YsNBJF*mDaRzwws)J=WOml3c) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/components/CacheView.jsx b/frontend/src/components/CacheView.jsx index 89cde359..607e0030 100644 --- a/frontend/src/components/CacheView.jsx +++ b/frontend/src/components/CacheView.jsx @@ -4,6 +4,7 @@ import { toast } from 'react-toastify'; import ReactJson from "react-json-view"; import { + Typography, Tooltip, Divider, TextField, @@ -21,6 +22,8 @@ import { } from "@mui/material"; import { + Link as LinkIcon, + AutoFixHigh as AutoFixHighIcon, Edit as EditIcon, FileCopy as FileCopyIcon, SelectAll as SelectAllIcon, @@ -79,7 +82,6 @@ const CacheView = (props) => { useEffect(() => { listOrgCache(orgId); - console.log("orgid", orgId); }, []); const listOrgCache = (orgId) => { @@ -189,8 +191,6 @@ const CacheView = (props) => { const editOrgCache = (orgId) => { const cache = { key: dataValue.key , value: value }; setCacheInput([cache]); - console.log("cache:", cache) - console.log("cache input: ", cacheInput) fetch(globalUrl + `/api/v1/orgs/${orgId}/set_cache`, { @@ -255,6 +255,20 @@ const CacheView = (props) => { }); }; + const isValidJson = validateJson(value) + const autoFixJson = (inputvalue) => { + console.log("inputvalue: ", inputvalue) + try { + var parsedjson = JSON.parse(inputvalue) + + // setValue() with the parsed json as string + setValue(JSON.stringify(parsedjson, null, 2)) + } catch (e) { + console.log("Error parsing JSON: ", e) + //return JSON.stringify(inputvalue); + } + } + const modalView = ( // console.log("key:", dataValue.key), //console.log("value:",dataValue.value), @@ -301,14 +315,27 @@ const CacheView = (props) => { onChange={(e) => setKey(e.target.value)} /> -
- Value +
+
+ + Value - ({isValidJson.valid === true ? "Valid" : "Invalid"} JSON) + + + { + autoFixJson(value) + }} + > + + + +
{ id="Valuefield" margin="normal" variant="outlined" - defaultValue={editCache ? dataValue.value : ""} + multiline + minRows={4} + maxRows={12} + //defaultValue={editCache ? dataValue.value : ""} + value={value} onChange={(e) => setValue(e.target.value)} />
@@ -417,10 +456,8 @@ const CacheView = (props) => { } const validate = validateJson(data.value); - console.log("Past validate: ", validate); - return ( - + { /> @@ -473,7 +510,11 @@ const CacheView = (props) => { style={{ padding: "6px" }} onClick={() => { setEditCache(true) - setDataValue({"key":data.key,"value":data.value}) + setDataValue({ + "key": data.key, + "value":data.value + }) + setValue(data.value) setModalOpen(true) }} > @@ -483,9 +524,27 @@ const CacheView = (props) => { + + + { + window.open(`${globalUrl}/api/v1/orgs/${orgId}/cache/${data.key}?type=text&authorization=${data.public_authorization}`, "_blank"); + }} + > + + + + diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 984ebb30..2c5175eb 100755 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -1261,7 +1261,7 @@ If you're interested, please let me know a time that works for you, or set up a }; const rerunCloudWorkflows = (environment) => { - toast("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`, { @@ -1292,6 +1292,7 @@ If you're interested, please let me know a time that works for you, or set up a const abortEnvironmentWorkflows = (environment) => { //console.log("Aborting all workflows started >10 minutes ago, not finished"); + toast("Clearing the queue - this may take some time. A new will show up when finished.") fetch( `${globalUrl}/api/v1/environments/${environment.id}/stop?deleteall=true`, @@ -1306,7 +1307,9 @@ If you're interested, please let me know a time that works for you, or set up a toast("Failed aborting dangling workflows"); return; } else { - toast("Aborted all dangling workflows"); + toast("Successfully cleared the queue") + + getEnvironments() } return response.json(); @@ -4597,7 +4600,6 @@ If you're interested, please let me know a time that works for you, or set up a + +
+ + + const ScheduleSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined && selectedTrigger.trigger_type !== "SCHEDULE" ? null :
@@ -13211,7 +13494,7 @@ const AngularWorkflow = (defaultprops) => { workflow.triggers[selectedTriggerIndex].parameters === undefined ? "" : workflow.triggers[selectedTriggerIndex].parameters[0].value } color="primary" - placeholder="defaultValue" + placeholder="" onBlur={(e) => { setTriggerCronWrapper(e.target.value); }} @@ -13801,10 +14084,8 @@ const AngularWorkflow = (defaultprops) => {
: null - - const RightsideBar = () => { - const [hovered, setHovered] = useState(false) + const [hovered, setHovered] = useState(false) useEffect(() => { const handleKeyDown = (event) => { @@ -13856,9 +14137,8 @@ const AngularWorkflow = (defaultprops) => { return () => { document.removeEventListener('keydown', handleKeyDown); - }; - }, [executeWorkflow, executionText, workflow, lastSaved, executionRequestStarted]); - + } + }, [executeWorkflow, executionText, workflow, lastSaved, executionRequestStarted]) return (
{ } const boxSize = isMobile ? 50 : 100; - - const executionButton = executionRunning ? ( @@ -14333,6 +14611,8 @@ const AngularWorkflow = (defaultprops) => { defaultReturn = null } else if (selectedTrigger.trigger_type === "SUBFLOW") { defaultReturn = + // } else if (selectedTrigger.trigger_type === "PIPELINE") { + // defaultReturn = } else if (selectedTrigger.trigger_type === "EMAIL") { defaultReturn = } else if (selectedTrigger.trigger_type === "USERINPUT") { @@ -16317,7 +16597,7 @@ const AngularWorkflow = (defaultprops) => { style: { pointerEvents: "auto", color: "white", - minWidth: isMobile ? "90%" : 650, + minWidth: isMobile ? "90%" : 750, padding: 30, maxHeight: 550, overflowY: "auto", @@ -16327,17 +16607,19 @@ const AngularWorkflow = (defaultprops) => { }, }} > - + {/* Have a sticky top bar */} + { @@ -16356,7 +16638,7 @@ const AngularWorkflow = (defaultprops) => { style={{ zIndex: 5000, position: "absolute", - top: 34, + top: 4, right: 170, }} onClick={(e) => { @@ -16400,7 +16682,7 @@ const AngularWorkflow = (defaultprops) => { style={{ zIndex: 5000, position: "absolute", - top: 34, + top: 4, right: 136, }} onClick={(e) => { @@ -16440,7 +16722,7 @@ const AngularWorkflow = (defaultprops) => { style={{ zIndex: 10011 }} > { e.preventDefault(); const executionIndex = workflowExecutions.findIndex((data) => data.execution_id === selectedResult.execution_id); @@ -16470,7 +16752,7 @@ const AngularWorkflow = (defaultprops) => { style={{ zIndex: 10011 }} > { e.preventDefault(); setCodeModalOpen(false); @@ -16481,8 +16763,8 @@ const AngularWorkflow = (defaultprops) => { -
-
+
+
{curapp === null ? null : ( {selectedResult.action.app_name} { {/* Looks for triggers" */} {/* Only fixed the ones that require scrolling on a small screen */} {/* Most important: Actions. But these are a lot more complex */} - {rightSideBarOpen && (selectedTrigger.trigger_type === "SCHEDULE" || selectedTrigger.trigger_type === "WEBHOOK") ? + {rightSideBarOpen && (selectedTrigger.trigger_type === "SCHEDULE" || selectedTrigger.trigger_type === "WEBHOOK" || selectedTrigger.trigger_type === "PIPELINE") ?
{Object.getOwnPropertyNames(selectedTrigger).length > 0 ? selectedTrigger.trigger_type === "SCHEDULE" ? ScheduleSidebar + : selectedTrigger.trigger_type === "PIPELINE" ? + PipelineSidebar : selectedTrigger.trigger_type === "WEBHOOK" ? WebhookSidebar : null @@ -18404,14 +18688,14 @@ const AngularWorkflow = (defaultprops) => { {newView} - {executionArgumentModal} - {aiQueryModal} + {aiQueryModal} {conditionsModal} - {authenticationModal} {codePopoutModal} - {configureWorkflowModal} - {/*editWorkflowModal*/} {workflowRevisions} + {authenticationModal} + {/*editWorkflowModal*/} + {executionArgumentModal} + {configureWorkflowModal} {codeEditorModalOpen ? diff --git a/frontend/src/views/Docs.jsx b/frontend/src/views/Docs.jsx index 027aad59..03d5ceda 100755 --- a/frontend/src/views/Docs.jsx +++ b/frontend/src/views/Docs.jsx @@ -118,8 +118,6 @@ export const Img = (props) => { export const CodeHandler = (props) => { const propvalue = props.value !== undefined && props.value !== null ? props.value : props.children !== undefined && props.children !== null && props.children.length > 0 ? props.children[0] : "" - - const validate = validateJson(propvalue) var newprop = propvalue @@ -137,6 +135,17 @@ export const CodeHandler = (props) => { //} } + // Need to check if it's singletick or multi + console.log("PROP: ", propvalue, props) + if (props.inline === true) { + // Show it inline + return ( + + {newprop} + + ) + } + return (
{ maxWidth: "100%", backgroundColor: theme.palette.inputColor, overflowY: "auto", + // Have it inline + borderRadius: theme.palette.borderRadius, }} > {validate.valid === true ? diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 80ac4713..f175595e 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -1822,7 +1822,6 @@ func deployPipeline(image, identifier, command string) error { envVariables := []string{ } - config := &container.Config{ Image: image, Env: envVariables, @@ -1831,6 +1830,7 @@ func deployPipeline(image, identifier, command string) error { // Add label to container in case of zombies config.Labels = map[string]string{ + "name": identifier, "shuffle": "shuffle", } @@ -1920,7 +1920,7 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error { } image := "tenzir/tenzir:latest" - identifier := strings.ToLower(strings.ReplaceAll(incRequest.ExecutionSource, " ", "-")) + identifier := fmt.Sprintf("shuffle-%s", strings.ToLower(strings.ReplaceAll(incRequest.ExecutionSource, " ", "-"))) command := incRequest.ExecutionArgument if incRequest.Type == "PIPELINE_CREATE" {