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" theme="solarized"
collapsed={collapseJson} collapsed={collapseJson}
displayDataTypes={false} displayDataTypes={false}
name={"Results for "+data.action.name} name={"Results for "+data.action.label}
/> />
} else { } else {
// FIXME - have everything parsed as json, either just for frontend // 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. 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. 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 1. Write your code & check if runtime works
2. Build app_base image 2. Build app_base image
3. docker rm $(docker ps -aq) # Remove all stopped containers 3. docker rm $(docker ps -aq) # Remove all stopped containers
+13 -12
View File
@@ -150,13 +150,14 @@ class AppBase:
print("HANDLE RECURSIVE LOOP") print("HANDLE RECURSIVE LOOP")
pass pass
else: else:
print("BASE: ", basejson)
if isinstance(basejson[value], str): if isinstance(basejson[value], str):
print(f"LOADING STRING {basejson[value]} AS JSON?") print(f"LOADING STRING '%s' AS JSON" % basejson[value])
try: try:
parsedjson = json.loads(basejson[value]) basejson = json.loads(basejson[value])
except json.decoder.JSONDecodeError as e: except json.decoder.JSONDecodeError as e:
print("RETURNING BECAUSE {basejson[value]} is a normal string") print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
return basejson return basejson[value]
else: else:
basejson = basejson[value] basejson = basejson[value]
except KeyError as e: except KeyError as e:
@@ -168,8 +169,6 @@ class AppBase:
return basejson return basejson
def parse_params(action, fullexecution, parameter): def parse_params(action, fullexecution, parameter):
jsonparsevalue = "$." jsonparsevalue = "$."
@@ -189,13 +188,15 @@ class AppBase:
continue continue
value = get_json_value(fullexecution, to_be_replaced) value = get_json_value(fullexecution, to_be_replaced)
if isinstance(value, str):
# Check if json inside string parameter["value"] = value
if isinstance(value, str) > 0: elif isinstance(value, dict):
print(f"VALUE: {value}") parameter["value"] = json.dumps(value)
self.logger.info(f"CONVERT DATA FROM {parameter['value']} to {data}") # Check if json inside string
parameter["value"] = data
#self.logger.info(f"CONVERT DATA FROM {parameter['value']} to {data}")
#parameter["value"] = data
if parameter["variant"] == "WORKFLOW_VARIABLE": if parameter["variant"] == "WORKFLOW_VARIABLE":
for item in fullexecution["workflow"]["workflow_variables"]: for item in fullexecution["workflow"]["workflow_variables"]: