#170: Added parameter looping check for special apps

This commit is contained in:
frikky
2020-12-15 16:12:53 +01:00
parent 11c41f7e70
commit 50bcf3bf3d
2 changed files with 28 additions and 10 deletions
+26 -8
View File
@@ -105,21 +105,36 @@ class AppBase:
listlengths = [] listlengths = []
all_lists = [] all_lists = []
all_list_keys = [] all_list_keys = []
#check_value = "$Filter_list_testing.wrapper.#.tmp"
#self.action = action
for key, value in baseparams.items(): for key, value in baseparams.items():
check_value = ""
for param in self.action["parameters"]:
if param["name"] == key:
check_value = param["value"]
break
print("\nCHECK: %s" % check_value)
if isinstance(value, list): if isinstance(value, list):
if len(value) <= 1: if len(value) <= 1:
if len(value) == 1: if len(value) == 1:
baseparams[key] = value[0] baseparams[key] = value[0]
else: else:
if len(value) not in listlengths: if not check_value.endswith("#"):
listlengths.append(len(value)) print("Adding WITHOUT looping list")
else:
if len(value) not in listlengths:
listlengths.append(len(value))
listitems.append( listitems.append(
{ {
key: len(value) key: len(value)
} }
) )
all_list_keys.append(key) all_list_keys.append(key)
all_lists.append(baseparams[key]) all_lists.append(baseparams[key])
@@ -132,6 +147,7 @@ class AppBase:
paramlist.append(baseparams) paramlist.append(baseparams)
elif len(listlengths) == 1: elif len(listlengths) == 1:
print("NO MULTIPLIER NECESSARY. Length is %d" % len(listitems)) print("NO MULTIPLIER NECESSARY. Length is %d" % len(listitems))
for item in listitems: for item in listitems:
# This loops should always be length 1 # This loops should always be length 1
for key, value in item.items(): for key, value in item.items():
@@ -244,7 +260,7 @@ class AppBase:
elif isinstance(tmp, list): elif isinstance(tmp, list):
ret.append(tmp) ret.append(tmp)
else: else:
tmp = tmp.replace("\"", "\\\"", -1) #tmp = tmp.replace("\"", "\\\"", -1)
try: try:
ret.append(json.loads(tmp)) ret.append(json.loads(tmp))
@@ -432,6 +448,8 @@ class AppBase:
"started_at": int(time.time()), "started_at": int(time.time()),
"status": "EXECUTING" "status": "EXECUTING"
} }
self.action = action
self.logger.info("ACTION RESULT (start): %s", action_result) self.logger.info("ACTION RESULT (start): %s", action_result)
if len(self.action) == 0: if len(self.action) == 0:
+2 -2
View File
@@ -589,10 +589,10 @@ const Apps = (props) => {
<div style={{marginRight: 15, marginTop: 10}}> <div style={{marginRight: 15, marginTop: 10}}>
{imageline} {imageline}
</div> </div>
<div style={{maxWidth: "75%", overflow: "hidden"}}> <div style={{maxWidth: "85%", overflow: "hidden"}}>
<h2 style={{marginTop: 20, marginBottom: 0, }}>{newAppname}</h2> <h2 style={{marginTop: 20, marginBottom: 0, }}>{newAppname}</h2>
<p style={{marginTop: 5, marginBottom: 0,}}>Version {selectedApp.app_version}</p> <p style={{marginTop: 5, marginBottom: 0,}}>Version {selectedApp.app_version}</p>
<p style={{marginTop: 5, marginBottom: 0}}>{description}</p> <p style={{marginTop: 5, marginBottom: 0, maxHeight: 150, overflowY: "auto", overflowX: "hidden",}}>{description}</p>
</div> </div>
</div> </div>
{activateButton} {activateButton}