Fixed JSON parsing of static valus

This commit is contained in:
frikky
2020-05-14 19:29:27 +02:00
parent a8b133ffa2
commit e0369a0e50
3 changed files with 15 additions and 14 deletions
+1 -1
View File
@@ -509,7 +509,7 @@ const Workflows = (props) => {
theme="solarized"
collapsed={collapseJson}
displayDataTypes={false}
name={"Results for "+data.action.name}
name={"Results for "+data.action.label}
/>
} else {
// FIXME - have everything parsed as json, either just for frontend
+1 -1
View File
@@ -2,7 +2,7 @@
This is the SDK used for apps to behave like they should.
To change it in the backend, upload it to Buckets/shuffler.appspot.com/generated_apps/baseline.
## If you want to update apps.. Why doesn't this work every time..?:
## If you want to update apps.. PS: downloads from docker hub do overrides.. :)
1. Write your code & check if runtime works
2. Build app_base image
3. docker rm $(docker ps -aq) # Remove all stopped containers
+13 -12
View File
@@ -150,13 +150,14 @@ class AppBase:
print("HANDLE RECURSIVE LOOP")
pass
else:
print("BASE: ", basejson)
if isinstance(basejson[value], str):
print(f"LOADING STRING {basejson[value]} AS JSON?")
print(f"LOADING STRING '%s' AS JSON" % basejson[value])
try:
parsedjson = json.loads(basejson[value])
basejson = json.loads(basejson[value])
except json.decoder.JSONDecodeError as e:
print("RETURNING BECAUSE {basejson[value]} is a normal string")
return basejson
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
return basejson[value]
else:
basejson = basejson[value]
except KeyError as e:
@@ -168,8 +169,6 @@ class AppBase:
return basejson
def parse_params(action, fullexecution, parameter):
jsonparsevalue = "$."
@@ -189,13 +188,15 @@ class AppBase:
continue
value = get_json_value(fullexecution, to_be_replaced)
# Check if json inside string
if isinstance(value, str) > 0:
print(f"VALUE: {value}")
if isinstance(value, str):
parameter["value"] = value
elif isinstance(value, dict):
parameter["value"] = json.dumps(value)
self.logger.info(f"CONVERT DATA FROM {parameter['value']} to {data}")
parameter["value"] = data
# Check if json inside string
#self.logger.info(f"CONVERT DATA FROM {parameter['value']} to {data}")
#parameter["value"] = data
if parameter["variant"] == "WORKFLOW_VARIABLE":
for item in fullexecution["workflow"]["workflow_variables"]: