From fb626a7c21532ecb00d8bea5dd39add1bce21c1a Mon Sep 17 00:00:00 2001 From: Frikky Date: Wed, 28 Feb 2024 23:09:50 +0100 Subject: [PATCH] Fixed minor schedule location issues and app build revisions --- backend/go-app/go.mod | 2 +- backend/go-app/go.sum | 2 + backend/go-app/walkoff.go | 4 +- frontend/src/components/Billing.jsx | 22 ++++++--- frontend/src/components/Files.jsx | 41 ++++++++++++++--- frontend/src/views/AngularWorkflow.jsx | 62 +++++++++++++++++++------- frontend/src/views/Apps.jsx | 4 +- 7 files changed, 104 insertions(+), 33 deletions(-) diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index ccfc643b..c7094cb8 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -18,7 +18,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/h2non/filetype v1.1.3 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.5.78 + github.com/shuffle/shuffle-shared v0.5.81 golang.org/x/crypto v0.16.0 google.golang.org/api v0.125.0 google.golang.org/grpc v1.55.0 diff --git a/backend/go-app/go.sum b/backend/go-app/go.sum index bdd5b7b7..8033f69e 100644 --- a/backend/go-app/go.sum +++ b/backend/go-app/go.sum @@ -457,6 +457,8 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shuffle/shuffle-shared v0.5.78 h1:emHTEu+WboTZQUUcPDrxMx70RtVuZ1LtkYjG2KzncBE= github.com/shuffle/shuffle-shared v0.5.78/go.mod h1:Lg6/+qjQlWzNKwj4/4ATpvScyP2JQGLkTPlNlRM6RJk= +github.com/shuffle/shuffle-shared v0.5.81 h1:pt4lT42FrXN/kd/vlYtm7nXShZI0mOamXUMjpWLH7qI= +github.com/shuffle/shuffle-shared v0.5.81/go.mod h1:Lg6/+qjQlWzNKwj4/4ATpvScyP2JQGLkTPlNlRM6RJk= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 21a26f8e..40f9ba3a 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -3183,8 +3183,8 @@ func setNewWorkflowApp(resp http.ResponseWriter, request *http.Request) { workflowapp.Generated = false workflowapp.Activated = true - if !shuffle.ArrayContains(api.Contributors, user.Id) { - api.Contributors = append(api.Contributors, user.Id) + if !shuffle.ArrayContains(workflowapp.Contributors, user.Id) { + workflowapp.Contributors = append(workflowapp.Contributors, user.Id) } shuffle.SetAppRevision(ctx, workflowapp) diff --git a/frontend/src/components/Billing.jsx b/frontend/src/components/Billing.jsx index 4152ce2a..26e5b857 100644 --- a/frontend/src/components/Billing.jsx +++ b/frontend/src/components/Billing.jsx @@ -874,10 +874,11 @@ const Billing = (props) => { }); }; + const isChildOrg = userdata.active_org.creator_org !== "" && userdata.active_org.creator_org !== undefined && userdata.active_org.creator_org !== null return (
{addDealModal} - + Billing @@ -912,8 +913,16 @@ const Billing = (props) => { : null } + + + {isChildOrg ? + + Billing is handled by your parent organisation. Reach out to support@shuffler.io if you have questions about this. + + : null} +
- {isCloud && billingInfo.subscription !== undefined && billingInfo.subscription !== null ? + {isCloud && billingInfo.subscription !== undefined && billingInfo.subscription !== null ? isChildOrg ? null : { /> : null} + {isCloud && selectedOrganization.subscriptions !== undefined && selectedOrganization.subscriptions !== null && - selectedOrganization.subscriptions.length > 0 ? - + selectedOrganization.subscriptions.length > 0 && + !isChildOrg ? selectedOrganization.subscriptions .reverse() .map((sub, index) => { @@ -1224,9 +1234,9 @@ const Billing = (props) => {
- Shuffle Utilization + Utilization & Stats
{ }; const downloadFile = (file) => { - fetch(globalUrl + "/api/v1/files/" + file.id + "/content", { - method: "GET", - credentials: "include", - }) + fetch(globalUrl + "/api/v1/files/" + file.id + "/content", { + method: "GET", + credentials: "include", + }) .then((response) => { if (response.status !== 200) { console.log("Status not 200 for apps :O!"); @@ -972,6 +973,32 @@ const Files = (props) => { + {/* + + + { + // Open the file, without downloading it + window.open(`${globalUrl}/api/v1/files/${file.id}/content?type=text&authorization=${file.public_authorization}`, "_blank noreferrer noopener") + }} + > + + + + + */} { ReactDOM.unstable_batchedUpdates(() => { setSelectedAction({}); setSelectedApp({}); - setSelectedTrigger({}); setSelectedComment({}) setSelectedEdge({}); + setSelectedEdge({}) setSelectedActionEnvironment({}) setTriggerAuthentication({}) - setSelectedTriggerIndex(-1) setTriggerFolders([]) setLocalFirstrequest(true) + setSelectedTrigger({}); + setSelectedTriggerIndex(-1) + setUpdate(Math.random()) + // Can be used for right side view setRightSideBarOpen(false); setScrollConfig({ @@ -3551,7 +3554,9 @@ const AngularWorkflow = (defaultprops) => { const onNodeSelect = (event, newAppAuth) => { // Forces all states to update at the same time, // Otherwise everything is SUPER slow - const data = event.target.data(); + + //const data = JSON.parse(JSON.stringify(event.target.data())) + const data = event.target.data() if (data.isSuggestion === true) { console.log("Suggestion! Replace with a real action.") @@ -4171,9 +4176,11 @@ const AngularWorkflow = (defaultprops) => { console.log("TRIGGER: ", data) - setSelectedTriggerIndex(trigger_index); - setSelectedTrigger(data); - setSelectedActionEnvironment(data.env); + setTimeout(() => { + setSelectedTriggerIndex(trigger_index); + setSelectedTrigger(data) + setSelectedActionEnvironment(data.env) + }, 25) } else if (data.type === "COMMENT") { setSelectedComment(data); } else { @@ -6993,13 +7000,14 @@ const AngularWorkflow = (defaultprops) => { }); }; + const parsedHeight = isMobile ? bodyHeight - appBarSize * 4 : bodyHeight - appBarSize - 50 const appViewStyle = { marginLeft: 5, marginRight: 5, display: "flex", flexDirection: "column", - minHeight: isMobile ? bodyHeight - appBarSize * 4 : "100%", - maxHeight: isMobile ? bodyHeight - appBarSize * 4 : "100%", + minHeight: isMobile ? bodyHeight - appBarSize * 4 : parsedHeight, + maxHeight: isMobile ? bodyHeight - appBarSize * 4 : parsedHeight, }; const paperAppStyle = { @@ -7321,7 +7329,6 @@ const AngularWorkflow = (defaultprops) => { marginRight: 5, }; - const parsedHeight = isMobile ? bodyHeight - appBarSize * 4 : bodyHeight - appBarSize - 50 return (
{ workflow.triggers[selectedTriggerIndex].parameters[0] = { value: value, name: "cron", - }; + } } workflow.triggers[selectedTriggerIndex].parameters[1] = { @@ -13289,7 +13296,7 @@ const AngularWorkflow = (defaultprops) => { const pipelineConfig = { "name": selectedTrigger.label, "type": "create", - "command": "load tcp://0.0.0.0:514 | read syslog | to http://api.com X-Token:Secret", + "command": "load tcp://0.0.0.0:514 | read syslog | export", "environment": selectedTrigger.environment, } @@ -13299,6 +13306,29 @@ const AngularWorkflow = (defaultprops) => { Start Syslog listener
+
{ + const pipelineConfig = { + "name": selectedTrigger.label, + "type": "create", + "command": "export --live | sigma /path/to/rules | to http://192.168.86.44:5002/api/v1/hooks/webhook_665ace5f-f27b-496a-a365-6e07eb61078c write lines", + "environment": selectedTrigger.environment, + } + + submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig) + }} + > + Run Sigma Rulesearch +
+
{ }} fullWidth disabled={ - workflow.triggers[selectedTriggerIndex].status === "running" + selectedTrigger.status === "running" } defaultValue={ - workflow.triggers[selectedTriggerIndex].parameters === undefined ? "" : workflow.triggers[selectedTriggerIndex].parameters[0].value + selectedTrigger.parameters === undefined ? "" : selectedTrigger.parameters[0].value } color="primary" placeholder="" @@ -13544,7 +13574,7 @@ const AngularWorkflow = (defaultprops) => { multiline color="primary" defaultValue={ - workflow.triggers[selectedTriggerIndex] !== undefined && workflow.triggers[selectedTriggerIndex].parameters !== undefined && workflow.triggers[selectedTriggerIndex].parameters !== null && workflow.triggers[selectedTriggerIndex].parameters.length > 1 ? + workflow.triggers[selectedTriggerIndex] !== undefined && workflow.triggers[selectedTriggerIndex].parameters !== undefined && workflow.triggers[selectedTriggerIndex].parameters !== null && workflow.triggers[selectedTriggerIndex].parameters.length > 1 ? workflow.triggers[selectedTriggerIndex].parameters[1].value : "" } @@ -14022,8 +14052,8 @@ const AngularWorkflow = (defaultprops) => { }} > - - {workflow.errors.length} Workflow Issue{workflow.errors.length > 1 ? "s" : ""} + {/**/} + Workflow Issues: {workflow.errors.length} { })} - {isCloud && (selectedApp.sharing === true || selectedApp.public === true || creatorProfile.github_avatar !== undefined) && !internalIds.includes(selectedApp.name.toLowerCase()) ? + {/*isCloud && (selectedApp.sharing === true || selectedApp.public === true || creatorProfile.github_avatar !== undefined) && !internalIds.includes(selectedApp.name.toLowerCase()) */} + + {isCloud && !internalIds.includes(selectedApp.name.toLowerCase()) ?