Bugfixes for workflows and executions

This commit is contained in:
frikky
2021-04-13 21:52:32 +02:00
parent 8648daa95b
commit 033124b6ec
7 changed files with 18 additions and 10 deletions
+9 -2
View File
@@ -1592,16 +1592,15 @@ class AppBase:
"matches regex", "matches regex",
] ]
# FIXME - what should I do here?
if not condition["condition"]["value"] in available_checks: if not condition["condition"]["value"] in available_checks:
self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"])) self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"]))
continue continue
#print(destinationvalue) #print(destinationvalue)
# NEGATE # NEGATE
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
# Configuration = negated because of WorkflowAppActionParam.. # Configuration = negated because of WorkflowAppActionParam..
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
try: try:
if condition["condition"]["configuration"]: if condition["condition"]["configuration"]:
validation = not validation validation = not validation
@@ -1622,6 +1621,14 @@ class AppBase:
# THE START IS ACTUALLY RIGHT HERE :O # THE START IS ACTUALLY RIGHT HERE :O
# Checks whether conditions are met, otherwise set # Checks whether conditions are met, otherwise set
branchcheck, tmpresult = check_branch_conditions(action, fullexecution) branchcheck, tmpresult = check_branch_conditions(action, fullexecution)
if isinstance(tmpresult, object) or isinstance(tmpresult, list):
print("Fixing branch return as object -> string")
try:
tmpresult = tmpresult.replace("'", "\"")
tmpresult = json.dumps(tmpresult)
except json.decoder.JSONDecodeError as e:
print(f"[WARNING] Failed condition parsing {tmpresult} to string")
if not branchcheck: if not branchcheck:
self.logger.info("Failed one or more branch conditions.") self.logger.info("Failed one or more branch conditions.")
action_result["result"] = tmpresult action_result["result"] = tmpresult
+2
View File
@@ -102,6 +102,8 @@ github.com/frikky/shuffle-shared v0.0.23 h1:Pnlc2M6fHnFRLFd5K1iLTVv4/t4P04Ri1GJ5
github.com/frikky/shuffle-shared v0.0.23/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ= github.com/frikky/shuffle-shared v0.0.23/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ=
github.com/frikky/shuffle-shared v0.0.27 h1:BbibbAv3a5GWR/DfaoSC4D9+fh2cwSEvn9H+EVfd7BM= github.com/frikky/shuffle-shared v0.0.27 h1:BbibbAv3a5GWR/DfaoSC4D9+fh2cwSEvn9H+EVfd7BM=
github.com/frikky/shuffle-shared v0.0.27/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ= github.com/frikky/shuffle-shared v0.0.27/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ=
github.com/frikky/shuffle-shared v0.0.28 h1:VQqL3+ePwKSUxCOiCC8DpOEgbb2GhXI8XzFB/YlHbps=
github.com/frikky/shuffle-shared v0.0.28/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ=
github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE= github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE=
github.com/getkin/kin-openapi v0.8.0/go.mod h1:zZQMFkVgRHCdhgb6ihCTIo9dyDZFvX0k/xAKqw1FhPw= github.com/getkin/kin-openapi v0.8.0/go.mod h1:zZQMFkVgRHCdhgb6ihCTIo9dyDZFvX0k/xAKqw1FhPw=
github.com/getkin/kin-openapi v0.52.0 h1:6WqsF5d6PfJ8AscdD+9Rtb2RP2iBWyC7V6GcjssWg7M= github.com/getkin/kin-openapi v0.52.0 h1:6WqsF5d6PfJ8AscdD+9Rtb2RP2iBWyC7V6GcjssWg7M=
@@ -81,7 +81,7 @@ const Workflow = (props) => {
"app": {}, "app": {},
} }
const app = apps.find(app => app.name === action.app_name && (app.app_version === action.app_version || app.loop_versions.includes(action.app_version))) const app = apps.find(app => app.name === action.app_name && (app.app_version === action.app_version || (app.loop_versions !== null && app.loop_versions.includes(action.app_version))))
if (app === undefined || app === null) { if (app === undefined || app === null) {
console.log("App not found!") console.log("App not found!")
+1 -1
View File
@@ -1111,7 +1111,7 @@ const Admin = (props) => {
const generateApikey = (user) => { const generateApikey = (user) => {
const userId = isCloud ? user.username : user.id const userId = user.id
const data = { "user_id": userId } const data = { "user_id": userId }
fetch(globalUrl + "/api/v1/generateapikey", { fetch(globalUrl + "/api/v1/generateapikey", {
+1 -2
View File
@@ -1326,8 +1326,7 @@ const AngularWorkflow = (props) => {
return return
} }
//console.log(apps) const curapp = apps.find(a => a.name === curaction.app_name && ((a.app_version === curaction.app_version || (a.loop_versions !== null && a.loop_versions.includes(curaction.app_version)))))
const curapp = apps.find(a => a.name === curaction.app_name && (a.app_version === curaction.app_version || a.loop_versions.includes(curaction.app_version)))
if (!curapp || curapp === undefined) { if (!curapp || curapp === undefined) {
alert.error(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`) alert.error(`App ${curaction.app_name}:${curaction.app_version} not found. Is it activated?`)
+2 -2
View File
@@ -1461,7 +1461,7 @@ const Apps = (props) => {
style={{backgroundColor: inputColor}} style={{backgroundColor: inputColor}}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
defaultValue={userdata.active_org.defaults.app_download_repo !== undefined && userdata.active_org.defaults.app_download_repo.length > 0 ? userdata.active_org.defaults.app_download_repo : "https://github.com/frikky/shuffle-apps"} defaultValue={"https://github.com/frikky/shuffle-apps"}
InputProps={{ InputProps={{
style:{ style:{
color: "white", color: "white",
@@ -1479,7 +1479,7 @@ const Apps = (props) => {
style={{backgroundColor: inputColor}} style={{backgroundColor: inputColor}}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
defaultValue={userdata.active_org.defaults.app_download_branch !== undefined && userdata.active_org.defaults.app_download_branch.length > 0 ? userdata.active_org.defaults.app_download_branch : downloadBranch} defaultValue={downloadBranch}
InputProps={{ InputProps={{
style:{ style:{
color: "white", color: "white",
+2 -2
View File
@@ -1802,7 +1802,7 @@ const Workflows = (props) => {
style={{backgroundColor: inputColor}} style={{backgroundColor: inputColor}}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
defaultValue={userdata.active_org.defaults.workflow_download_repo !== undefined && userdata.active_org.defaults.workflow_download_repo.length > 0 ? userdata.active_org.defaults.workflow_download_repo : downloadUrl} defaultValue={downloadUrl}
InputProps={{ InputProps={{
style:{ style:{
color: "white", color: "white",
@@ -1821,7 +1821,7 @@ const Workflows = (props) => {
style={{backgroundColor: inputColor}} style={{backgroundColor: inputColor}}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
defaultValue={userdata.active_org.defaults.workflow_download_branch !== undefined && userdata.active_org.defaults.workflow_download_branch.length > 0 ? userdata.active_org.defaults.workflow_download_branch : downloadBranch} defaultValue={downloadBranch}
InputProps={{ InputProps={{
style:{ style:{
color: "white", color: "white",