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