More App SDK fixes around indexing in recursions, and another workflow config handler fix

This commit is contained in:
frikky
2022-01-26 17:21:33 +01:00
parent 7b673ccdb4
commit 2f324e6862
12 changed files with 68 additions and 45 deletions
+18 -8
View File
@@ -1010,8 +1010,12 @@ class AppBase:
}
# Simple validation of parameters in general
replace_params = False
try:
tmp_parameters = action["parameters"]
for param in tmp_parameters:
if param["value"] == "SHUFFLE_AUTO_REMOVED":
replace_params = True
except KeyError:
action["parameters"] = []
except TypeError:
@@ -1509,17 +1513,23 @@ class AppBase:
newvalue, is_loop = (tmpitem, parsersplit[outercnt+1:])
else:
print("[INFO] In ELSE - handling %s and %s" % (firstitem, seconditem))
if firstitem.lower() == "max" or firstitem.lower() == "last" or firstitem.lower() == "end":
firstitem = len(basejson)-1
elif firstitem.lower() == "min" or firstitem.lower() == "first":
firstitem = 0
if isinstance(firstitem, str):
if firstitem.lower() == "max" or firstitem.lower() == "last" or firstitem.lower() == "end":
firstitem = len(basejson)-1
elif firstitem.lower() == "min" or firstitem.lower() == "first":
firstitem = 0
else:
firstitem = int(firstitem)
else:
firstitem = int(firstitem)
if seconditem.lower() == "max" or seconditem.lower() == "last" or firstitem.lower() == "end":
seconditem = len(basejson)-1
elif seconditem.lower() == "min" or seconditem.lower() == "first":
seconditem = 0
if isinstance(seconditem, str):
if seconditem.lower() == "max" or seconditem.lower() == "last" or firstitem.lower() == "end":
seconditem = len(basejson)-1
elif seconditem.lower() == "min" or seconditem.lower() == "first":
seconditem = 0
else:
seconditem = int(seconditem)
else:
seconditem = int(seconditem)
+2 -2
View File
@@ -2,7 +2,7 @@ module main
go 1.16
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -23,7 +23,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.1.84
github.com/shuffle/shuffle-shared v0.1.86
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0
+2 -2
View File
@@ -1,7 +1,7 @@
version: '3'
services:
frontend:
#build: ./frontend
build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:nightly
container_name: shuffle-frontend
hostname: shuffle-frontend
@@ -16,7 +16,7 @@ services:
depends_on:
- backend
backend:
#build: ./backend
build: ./backend
image: ghcr.io/frikky/shuffle-backend:nightly
container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME}
@@ -556,7 +556,7 @@ const ConfigureWorkflow = (props) => {
{action.must_activate ? (
<Button
color="primary"
variant="outlined"
variant="contained"
onClick={() => {
console.log("ACTION: ", action)
activateApp(action.action.app_id, action.app_name, action.app_version);
@@ -666,7 +666,7 @@ const ConfigureWorkflow = (props) => {
}
}}
>
Finish setup
Close window
</Button>
</ButtonGroup>
</div>
+21 -18
View File
@@ -180,23 +180,21 @@ const ParsedAction = (props) => {
const [hiddenDescription, setHiddenDescription] = React.useState(true);
useEffect(() => {
//if (data.startsWith("${") && data.endsWith("}")) {
//}
// PARAM FIX - Gonna use the ID field, even though it's a hack
const paramcheck = selectedAction.parameters.find(param => param.name === "body")
//console.log("LOADED! Change hideBody based on input? Action: ", selectedAction, paramcheck)
if (paramcheck !== undefined && paramcheck !== null) {
if (paramcheck.id === "TOGGLED"){
setHideBody(false)
setActivateHidingBodyButton(false)
console.log("TOGGLED BODY!")
} else {
setHideBody(true)
if (paramcheck.id === "UNTOGGLED") {
if (selectedAction.parameters !== null && selectedAction.parameters !== undefined) {
const paramcheck = selectedAction.parameters.find(param => param.name === "body")
//console.log("LOADED! Change hideBody based on input? Action: ", selectedAction, paramcheck)
if (paramcheck !== undefined && paramcheck !== null) {
if (paramcheck.id === "TOGGLED"){
setHideBody(false)
setActivateHidingBodyButton(false)
console.log("UNTOGGLED!")
console.log("TOGGLED BODY!")
} else {
setHideBody(true)
if (paramcheck.id === "UNTOGGLED") {
setActivateHidingBodyButton(false)
console.log("UNTOGGLED!")
}
}
}
}
@@ -513,9 +511,11 @@ const ParsedAction = (props) => {
const valid = validateJson(foundResult)
if (valid.valid) {
exampledata = JSON.parse(foundResult.result);
exampledata = valid.result;
break;
}
} else {
exampledata = foundResult;
}
}
}
@@ -2382,9 +2382,12 @@ const ParsedAction = (props) => {
<Select
defaultValue={selectedAction.app_version}
onChange={(event) => {
console.log("VAL: ", event.target.value)
console.log("App: ", selectedApp)
const newversion = selectedApp.versions.find(
(tmpApp) => tmpApp.version == event.target.value
);
console.log("NEWVERSION: ", newversion);
if (newversion !== undefined && newversion !== null) {
getApp(newversion.id, true);
@@ -92,6 +92,7 @@ const CodeEditor = (props) => {
color: "white",
minWidth: 600,
padding: 25,
border: theme.palette.defaultBorder,
},
}}
>
+1
View File
@@ -16,6 +16,7 @@ const theme = createMuiTheme({
surfaceColor: "#27292d",
inputColor: "#383B40",
borderRadius: 5,
defaultBorder: "1px solid rgba(255,255,255,0.3)",
jsonTheme: "brewer",
reactJsonStyle: {
borderRadius: 5,
+11 -3
View File
@@ -1132,14 +1132,18 @@ const AngularWorkflow = (defaultprops) => {
})
.then((responseJson) => {
if (executionArgument !== undefined && startNode !== undefined) {
console.log("Running execution AFTER saving");
//console.log("Running execution AFTER saving");
executeWorkflow(executionArgument, startNode, true);
return;
}
if (!responseJson.success) {
console.log(responseJson);
alert.error("Failed to save: " + responseJson.reason);
if (responseJson.reason !== undefined && responseJson.reason !== null) {
alert.error("Failed to save: " + responseJson.reason);
} else {
alert.error("Failed to save. Please contact your admin if this is unexpected.")
}
} else {
if (
responseJson.new_id !== undefined &&
@@ -6279,6 +6283,7 @@ const AngularWorkflow = (defaultprops) => {
backgroundColor: surfaceColor,
color: "white",
minWidth: 800,
border: theme.palette.defaultBorder,
},
}}
onClose={() => {
@@ -11211,7 +11216,7 @@ const AngularWorkflow = (defaultprops) => {
color="primary"
style={{ float: "right", marginTop: 20, marginLeft: 10 }}
onClick={() => {
console.log("DATA: ", executionData);
//console.log("DATA: ", executionData);
executeWorkflow(
executionData.execution_argument,
executionData.start,
@@ -11830,6 +11835,7 @@ const AngularWorkflow = (defaultprops) => {
overflowY: "auto",
overflowX: "hidden",
zIndex: 10012,
border: theme.palette.defaultBorder,
},
}}
>
@@ -12773,6 +12779,7 @@ const AngularWorkflow = (defaultprops) => {
color: "white",
minWidth: 600,
padding: 50,
border: theme.palette.defaultBorder,
},
}}
>
@@ -12836,6 +12843,7 @@ const AngularWorkflow = (defaultprops) => {
padding: 15,
overflow: "hidden",
zIndex: 10012,
border: theme.palette.defaultBorder,
},
}}
>
+3 -2
View File
@@ -472,8 +472,9 @@ const LoginDialog = (props) => {
type="button"
style={{ flex: "1", marginTop: 5 }}
onClick={() => {
console.log("CLICK");
navigate(ssoUrl)
//console.log("CLICK SSO");
window.location.href = ssoUrl
//navigate(ssoUrl)
}}
>
Use SSO
+4 -5
View File
@@ -77,7 +77,7 @@ const Settings = (props) => {
//Returns the value from a storage position at a given address.
const isCloud =
window.location.host === "localhost:3002" ||
window.location.host === "shuffler.io";
window.location.host === "shuffler.io"
const bodyDivStyle = {
margin: "auto",
@@ -409,8 +409,6 @@ const Settings = (props) => {
// : imageData;
const imageData = userSettings.image === undefined || userSettings.image == null || userSettings.image.length === 0 ? theme.palette.defaultImage : userSettings.image
console.log("settings: ", userSettings)
console.log("Image: ", imageData)
const imageInfo = (
<img
src={imageData}
@@ -921,11 +919,11 @@ const Settings = (props) => {
};
const handleGithubConnection = () => {
console.log("GITHUB CONNECT WOO")
console.log("GITHUB CONNECT WOO: ", isCloud)
//result = RestClient.post('https://github.com/login/oauth/access_token',
console.log("HOST: ", window.location.host);
console.log("HOST: ", window.location);
console.log("Location: ", window.location);
const redirectUri = isCloud
? window.location.host === "localhost:3002"
? "http%3A%2F%2Flocalhost:3002%2Fset_authentication"
@@ -935,6 +933,7 @@ const Settings = (props) => {
:
`https%3A%2F%2F${window.location.host}%2Fset_authentication`
console.log("redirect: ", redirectUri)
const client_id = "3d272b1b782b100b1e61"
const username = userdata.id;
+2 -2
View File
@@ -381,7 +381,7 @@ const chipStyle = {
};
export const validateJson = (showResult) => {
console.log("INPUT: ", showResult, typeof showResult)
//console.log("INPUT: ", showResult, typeof showResult)
if (typeof showResult === 'string') {
//showResult = showResult.split(" None").join(" \"None\"")
showResult = showResult.split(" False").join(" false");
@@ -2451,7 +2451,7 @@ const Workflows = (props) => {
</Tooltip>
) : null}
{isCloud ? null : (
<Tooltip color="primary" title={"Download workflows"} placement="top">
<Tooltip color="primary" title={"Import workflows to Shuffle"} placement="top">
<Button
color="primary"
style={{}}
+1 -1
View File
@@ -805,7 +805,7 @@ func main() {
// Run by default from now
zombiecheck(ctx, workerTimeout)
log.Printf("[INFO] Running towards %s with Org %s", baseUrl, orgId)
log.Printf("[INFO] Running towards %s (BASE_URL) with Org %s", baseUrl, orgId)
httpProxy := os.Getenv("HTTP_PROXY")
httpsProxy := os.Getenv("HTTPS_PROXY")