#256: Added category dropdown to app editor

This commit is contained in:
frikky
2021-02-18 17:20:51 +01:00
parent 6d86207c8f
commit e7541320a1
5 changed files with 102 additions and 56 deletions
+17 -13
View File
@@ -541,9 +541,11 @@ class AppBase:
print(action["parameters"])
except KeyError:
action["parameters"] = []
except TypeError:
pass
self.action = copy.deepcopy(action)
self.logger.info("ACTION RESULT (start): %s", action_result)
self.logger.info("Sending starting action result (EXECUTING)")
headers = {
"Content-Type": "application/json",
@@ -1473,10 +1475,10 @@ class AppBase:
except KeyError:
pass
print("Return value: %s" % value)
#print("Return value: %s" % value)
actionname = action["name"]
#print("Multicheck ", actualitem)
print("ITEM LENGTH: %d, Actual item: %s" % (len(actualitem), actualitem))
#print("ITEM LENGTH: %d, Actual item: %s" % (len(actualitem), actualitem))
if len(actualitem) > 0:
multiexecution = True
@@ -1636,14 +1638,14 @@ class AppBase:
# With this parameter ready, add it to... a greater list of parameters. Rofl
print("LENGTH OF ARR: %d" % len(resultarray))
print("RESULTARRAY: %s" % resultarray)
#print("RESULTARRAY: %s" % resultarray)
if resultarray not in multi_execution_lists:
multi_execution_lists.append(resultarray)
multi_parameters[parameter["name"]] = resultarray
else:
# Parses things like int(value)
print("Normal parsing (not looping) with data %s" % value)
print("Normal parsing (not looping)")#with data %s" % value)
value = parse_wrapper_start(value)
if parameter["id"] == "body_replacement":
@@ -1663,7 +1665,7 @@ class AppBase:
# print("PARAM: %s" % parameter)
#if param.id == "body_replacement":
print("POST data value: %s" % value)
#print("POST data value: %s" % value)
params[parameter["name"]] = value
multi_parameters[parameter["name"]] = value
@@ -1719,9 +1721,9 @@ class AppBase:
#})
#print("[INFO] APP_SDK DONE: Starting NORMAL execution of function")
#print("[INFO] Running with params (0): %s" % params)
print("[INFO] Running execition\n")
newres = await func(**params)
print("[INFO] Returned from execution:", newres)
print("\n[INFO] Returned from execution:", newres)
if isinstance(newres, tuple):
print("[INFO] Handling return as tuple")
# Handles files.
@@ -1940,16 +1942,16 @@ class AppBase:
logger = logging.getLogger(f"{cls.__name__}")
logger.setLevel(logging.DEBUG)
print("Started execution: %s!!" % cls)
print("Action: %s" % action)
#print("Started execution: %s!!" % cls)
#print("Action: %s" % action)
#if isinstance(cls, object):
# self.action = cls
# Authorization for the app/function to control the workflow
# Function will crash if its wrong, which it probably should.
app = cls(redis=None, logger=logger, console_logger=logger)
if isinstance(action, object):
if isinstance(action, str):
print("Normal execution. Action is a string.")
elif isinstance(action, object):
app.action = action
try:
@@ -1967,5 +1969,7 @@ class AppBase:
app.base_url = action["base_url"]
except:
pass
else:
print("ACTION TYPE (unhandled): %s" % type(action))
await app.execute_action(app.action)
+4 -4
View File
@@ -6615,7 +6615,7 @@ func healthCheckHandler(resp http.ResponseWriter, request *http.Request) {
// Creates osfs from folderpath with a basepath as directory base
func createFs(basepath, pathname string) (billy.Filesystem, error) {
log.Printf("base: %s, pathname: %s", basepath, pathname)
log.Printf("[INFO] MemFS base: %s, pathname: %s", basepath, pathname)
fs := memfs.New()
err := filepath.Walk(pathname,
@@ -6676,19 +6676,19 @@ func handleAppHotload(location string, forceUpdate bool) error {
log.Printf("Failed memfs creation - probably bad path: %s", err)
return errors.New(fmt.Sprintf("Failed to find directory %s", location))
} else {
log.Printf("Memfs creation from %s done", location)
log.Printf("[INFO] Memfs creation from %s done", location)
}
dir, err := fs.ReadDir("")
if err != nil {
log.Printf("Failed reading folder: %s", err)
log.Printf("[WARNING] Failed reading folder: %s", err)
return err
}
//log.Printf("Reading app folder: %#v", dir)
_, _, err = iterateAppGithubFolders(fs, dir, "", "", forceUpdate)
if err != nil {
log.Printf("Err: %s", err)
log.Printf("[WARNING] Githubfolders error: %s", err)
return err
}
+3 -4
View File
@@ -820,7 +820,7 @@ func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
if len(executionRequests.Data) == 0 {
executionRequests.Data = []ExecutionRequest{}
} else {
log.Printf("[INFO] Executionrequests: %d", len(executionRequests.Data))
log.Printf("[INFO] Executionrequests (%s): %d", id, len(executionRequests.Data))
}
newjson, err := json.Marshal(executionRequests)
@@ -3135,7 +3135,6 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
// This one doesn't really matter.
log.Printf("[INFO] Running POST execution with body of length %d", len(string(body)))
a
if body[0] == 34 && body[len(body)-1] == 34 {
body = body[1 : len(body)-1]
}
@@ -5958,7 +5957,7 @@ func handleAppHotloadRequest(resp http.ResponseWriter, request *http.Request) {
return
}
log.Printf("Starting app hotloading")
log.Printf("[INFO] Starting app hotloading")
// Just need to be logged in
// FIXME - should have some permissions?
@@ -5983,7 +5982,7 @@ func handleAppHotloadRequest(resp http.ResponseWriter, request *http.Request) {
return
}
log.Printf("Hotloading from %s", location)
log.Printf("[INFO] Hotloading from %s", location)
err = handleAppHotload(location, true)
if err != nil {
log.Printf("Failed app hotload: %s", err)