Minor fixes for testing Singul locally

This commit is contained in:
Frikky
2025-05-20 01:07:16 +02:00
parent 3a8cbbe2e4
commit c2c4a9c323
3 changed files with 34 additions and 18 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ toolchain go1.23.8
//replace github.com/frikky/schemaless => ../../../schemaless //replace github.com/frikky/schemaless => ../../../schemaless
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
require ( require (
cloud.google.com/go/datastore v1.20.0 cloud.google.com/go/datastore v1.20.0
@@ -22,7 +22,7 @@ require (
github.com/gorilla/mux v1.8.1 github.com/gorilla/mux v1.8.1
github.com/h2non/filetype v1.1.3 github.com/h2non/filetype v1.1.3
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.8.58 github.com/shuffle/shuffle-shared v0.8.60
golang.org/x/crypto v0.37.0 golang.org/x/crypto v0.37.0
google.golang.org/api v0.228.0 google.golang.org/api v0.228.0
google.golang.org/grpc v1.71.1 google.golang.org/grpc v1.71.1
+12 -7
View File
@@ -1905,8 +1905,8 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
err = shuffle.SetSchedule(ctx, newSchedule) err = shuffle.SetSchedule(ctx, newSchedule)
if err != nil { if err != nil {
log.Printf("Failed setting cloud schedule: %s", err) log.Printf("[ERROR] Failed setting cloud schedule: %s", err)
resp.WriteHeader(401) resp.WriteHeader(400)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err)))
return return
} }
@@ -1941,17 +1941,22 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
// FIXME - real error message lol // FIXME - real error message lol
if err != nil { if err != nil {
log.Printf("Failed creating schedule: %s", err) log.Printf("[ERROR] Failed creating schedule: %s", err)
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. Try cron */15 * * * *"}`))) resp.WriteHeader(400)
if schedule.Environment == "cloud" {
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. For cloud schedules, try cron */15 * * * *"}`)))
} else {
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. For onprem schedules, try 60 for 60 seconds"}`)))
}
return return
} }
//workflow.Schedules = append(workflow.Schedules, schedule) //workflow.Schedules = append(workflow.Schedules, schedule)
err = shuffle.SetWorkflow(ctx, *workflow, workflow.ID) err = shuffle.SetWorkflow(ctx, *workflow, workflow.ID)
if err != nil { if err != nil {
log.Printf("Failed setting workflow for schedule: %s", err) log.Printf("[ERROR] Failed setting workflow for schedule: %s", err)
resp.WriteHeader(401) resp.WriteHeader(400)
resp.Write([]byte(`{"success": false}`)) resp.Write([]byte(`{"success": false}`))
return return
} }
+20 -9
View File
@@ -790,7 +790,7 @@ const AngularWorkflow = (defaultprops) => {
}, },
{ {
"name": "fields", "name": "fields",
"value": "", "value": '{\n "ticket_id": "123456",\n "comment": "This is a comment"\n}',
"required": false, "required": false,
"multiline": true, "multiline": true,
}, },
@@ -7000,7 +7000,11 @@ const AngularWorkflow = (defaultprops) => {
}) })
.then((responseJson) => { .then((responseJson) => {
if (responseJson.success === false) { if (responseJson.success === false) {
toast("Failed to auto-activate the app. Go to /apps and activate it.") if (responseJson.reason !== undefined && responseJson.reason !== null && responseJson.reason.length > 0) {
toast.error("Failed to auto-activate the app: " + responseJson.reason)
} else {
toast.error("Failed to auto-activate the app. Go to /apps and activate it.")
}
} else { } else {
if (refresh === true) { if (refresh === true) {
setHighlightedApp(appid) setHighlightedApp(appid)
@@ -10312,7 +10316,7 @@ const AngularWorkflow = (defaultprops) => {
} }
} }
toast("Creating schedule") toast.info("Creating schedule")
var data = { var data = {
name: trigger.name, name: trigger.name,
frequency: workflow.triggers[triggerindex].parameters[0].value, frequency: workflow.triggers[triggerindex].parameters[0].value,
@@ -10361,9 +10365,9 @@ const AngularWorkflow = (defaultprops) => {
}) })
.then((responseJson) => { .then((responseJson) => {
if (!responseJson.success) { if (!responseJson.success) {
toast("Failed to set schedule: " + responseJson.reason); toast.error("Failed to set schedule: " + responseJson.reason);
} else { } else {
toast("Successfully created schedule"); toast.success("Successfully created schedule");
workflow.triggers[triggerindex].status = "running"; workflow.triggers[triggerindex].status = "running";
trigger.status = "running"; trigger.status = "running";
setSelectedTrigger(trigger); setSelectedTrigger(trigger);
@@ -11876,8 +11880,9 @@ const AngularWorkflow = (defaultprops) => {
var type = "app" var type = "app"
const baseImage = <LibraryBooksIcon /> const baseImage = <LibraryBooksIcon />
const width = 230
return ( return (
<div style={{ position: "relative", marginTop: 15, marginLeft: 0, marginRight: 10, position: "absolute", color: theme.palette.textColor, zIndex: 1001, backgroundColor: theme.palette.textFieldStyle.backgroundColor, minWidth: leftBarSize+30, maxWidth: 340, boxShadows: "none", overflowX: "hidden", }}> <div style={{ position: "relative", marginTop: 15, marginLeft: 0, marginRight: 10, position: "absolute", color: theme.palette.textColor, zIndex: 1001, backgroundColor: theme.palette.textFieldStyle.backgroundColor, /*minWidth: leftBarSize+30,*/ minWidth: width, maxWidth: width, boxShadows: "none", overflowX: "hidden", }}>
<List style={{ backgroundColor: theme.palette.inputColor, }}> <List style={{ backgroundColor: theme.palette.inputColor, }}>
{hits.length === 0 ? {hits.length === 0 ?
<ListItem style={outerlistitemStyle}> <ListItem style={outerlistitemStyle}>
@@ -11971,7 +11976,7 @@ const AngularWorkflow = (defaultprops) => {
}} }}
defaultPosition={{ x: 0, y: 0 }} defaultPosition={{ x: 0, y: 0 }}
> >
<div style={{ textDecoration: "none", color: theme.palette.text.primary, }} onClick={(event) => { <div style={{ overflow: "hidden", textDecoration: "none", color: theme.palette.text.primary, }} onClick={(event) => {
clickedApp(hit) clickedApp(hit)
}}> }}>
@@ -12125,7 +12130,12 @@ const AngularWorkflow = (defaultprops) => {
} }
if ((app.id === "integration" || app.id === "shuffle_agent") && userdata.support !== true) { if ((app.id === "integration" || app.id === "shuffle_agent") && userdata.support !== true) {
return null console.log("APPID: ", app.id, isCloud)
if (isCloud === false && app.id === "integration") {
} else {
console.log("RETURNING", app.id)
return null
}
} }
if (viewedApps.includes(app.id)) { if (viewedApps.includes(app.id)) {
@@ -12190,7 +12200,7 @@ const AngularWorkflow = (defaultprops) => {
</div> </div>
) : apps.length > 0 ? ( ) : apps.length > 0 ? (
<div <div
style={{ textAlign: "center", width: leftBarSize, marginTop: 10, marginLeft: 5, marginRight: 5, }} style={{ textAlign: "center", width: leftBarSize, marginTop: 25, marginLeft: 10 , marginRight: 10, }}
onLoad={() => { onLoad={() => {
console.log("Should load in extra apps?") console.log("Should load in extra apps?")
}} }}
@@ -12198,6 +12208,7 @@ const AngularWorkflow = (defaultprops) => {
<Typography variant="body1" color="textSecondary"> <Typography variant="body1" color="textSecondary">
Couldn't find the apps you were looking for? Searching unactivated apps. Click one of these apps to Activate it for your organisation. Couldn't find the apps you were looking for? Searching unactivated apps. Click one of these apps to Activate it for your organisation.
</Typography> </Typography>
<InstantSearch searchClient={searchClient} indexName="appsearch" onClick={() => { <InstantSearch searchClient={searchClient} indexName="appsearch" onClick={() => {
console.log("CLICKED") console.log("CLICKED")
}}> }}>