diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 6d1833b7..5f05ea65 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -145,6 +145,37 @@ def flatten(a): flat_list = [a for xs in xss for a in xs] return flat_list +@shuffle_filters.register +def csv_parse(a): + a = str(a) + splitdata = a.split("\n") + columns = [] + if len(splitdata) > 1: + columns = splitdata[0].split(",") + else: + return a.split("\n") + + allitems = [] + cnt = -1 + for item in splitdata[1:]: + cnt += 1 + commasplit = item.split(",") + + fullitem = {} + fullitem["unparsed"] = item + fullitem["index"] = cnt + fullitem["parsed"] = {} + if len(columns) != len(commasplit): + allitems.append(fullitem) + continue + + for key in range(len(columns)): + fullitem["parsed"][columns[key]] = commasplit[key] + + allitems.append(fullitem) + + return allitems + #print(standard_filter_manager.filters) #print(shuffle_filters.filters) #print(Liquid("{{ '10' | plus: 1}}", filters=shuffle_filters.filters).render()) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 485b995b..37f874c5 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -419,7 +419,7 @@ const AngularWorkflow = (defaultprops) => { console.log("RESPONSE FOR APP: ", responseJson.reason); if (responseJson.reason !== undefined && responseJson.reason !== undefined && responseJson.reason.length > 0) { - if (!responseJson.reason.includes("404: Not Found") && responseJson.reason.length > 50) { + if (!responseJson.reason.includes("404: Not Found") && responseJson.reason.length > 25) { selectedApp.documentation = responseJson.reason setSelectedApp(selectedApp) setUpdate(Math.random()) @@ -1654,7 +1654,7 @@ const AngularWorkflow = (defaultprops) => { }; // Searhc by username, userId, workflow, appId should all work - const getUserProfile = (username) => { + const getUserProfile = (username, rerun) => { fetch(`${globalUrl}/api/v1/users/creators/${username}`, { method: "GET", headers: { @@ -1675,6 +1675,15 @@ const AngularWorkflow = (defaultprops) => { if (responseJson.success !== false) { console.log("Found creator: ", responseJson) setCreatorProfile(responseJson) + } else { + console.log("Couldn't find the creator profile (rerun?): ", responseJson, rerun) + // If the current user is any of the Shuffle Creators + // AND the workflow doesn't have an owner: allow editing. + // else: Allow suggestions? + //console.log("User: ", userdata) + //if (rerun !== true) { + // getUserProfile(userdata.id, true) + //} } }) .catch((error) => { @@ -1758,10 +1767,11 @@ const AngularWorkflow = (defaultprops) => { if (responseJson.public) { //alert.info("This workflow is public. Save the workflow to use it in your organization."); + setAuthLoaded(true) console.log("RESP: ", responseJson) if (Object.getOwnPropertyNames(creatorProfile).length === 0) { //getUserProfile("frikky") - getUserProfile(responseJson.id) + getUserProfile(responseJson.id, false) } //{appGroup.map((data, index) => { @@ -11444,10 +11454,13 @@ const AngularWorkflow = (defaultprops) => { //}}>Execute websocket // - + // A list used for FRONTEND handling of whether a public workflow + // should be change-able + const allowList = ["frikky", "m1nk-code", "DavidtheGoliath"] + // console.log(allowList, userdata.public_username) const leftView = workflow.public === true ? -