Started creating introduction screen

This commit is contained in:
frikky
2020-08-26 20:02:46 +02:00
parent f61f59981c
commit 0fc9c78385
8 changed files with 380 additions and 21 deletions
+34
View File
@@ -456,6 +456,40 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger,
}
}
// Jesus what a clusterfuck.
// Handles parsing of categories from OpenApi3 custom field
if val, ok := swagger.Info.ExtensionProps.Extensions["x-categories"]; ok {
log.Printf("Categories: %#v", val)
j, err := json.Marshal(&val)
if err == nil {
if j[0] == 0x22 && j[len(j)-1] == 0x22 {
j = j[1 : len(j)-1]
}
parsedCategories := fmt.Sprintf(`{"categories": %s}`, string(j))
type parsed struct {
Categories []string `json:"categories"`
}
var parse parsed
err := json.Unmarshal([]byte(parsedCategories), &parse)
if err != nil {
log.Printf("Failed unmarshaling categories", err)
} else {
api.Categories = parse.Categories
}
}
}
if len(swagger.Tags) > 0 {
newTags := []string{}
for _, tag := range swagger.Tags {
newTags = append(newTags, tag.Name)
}
api.Tags = newTags
}
securitySchemes := swagger.Components.SecuritySchemes
if securitySchemes != nil {
//log.Printf("%#v", securitySchemes)
+2 -1
View File
@@ -1696,6 +1696,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
{
"success": true,
"admin": %s,
"tutorials": [],
"orgs": [{"name": "Shuffle", "id": "123", "role": "admin"}],
"selected_org": {"name": "Shuffle", "id": "123", "role": "admin"},
"cookies": [{"key": "session_token", "value": "%s", "expiration": %d}]
@@ -3129,7 +3130,7 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) {
}
for _, item := range hook.Workflows {
log.Printf("Running for workflow %s with startnode %s", item, hook.Start)
log.Printf("Running webhook for workflow %s with startnode %s", item, hook.Start)
workflow := Workflow{
ID: "",
}
+3 -2
View File
@@ -121,7 +121,7 @@ type WorkflowApp struct {
Actions []WorkflowAppAction `json:"actions" yaml:"actions" required:true datastore:"actions,noindex"`
Authentication Authentication `json:"authentication" yaml:"authentication" required:false datastore:"authentication"`
Tags []string `json:"tags" yaml:"tags" required:false datastore:"activated"`
Category []string `json:"category" yaml:"category" required:false datastore:"category"`
Categories []string `json:"categories" yaml:"categories" required:false datastore:"categories"`
}
type WorkflowAppActionParameter struct {
@@ -2308,10 +2308,10 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
//log.Println(string(mappedData))
log.Printf("STARTNODE: %s", workflowExecution.Start)
if len(workflowExecution.Start) == 0 {
workflowExecution.Start = workflowExecution.Workflow.Start
}
log.Printf("STARTNODE: %s", workflowExecution.Start)
childNodes := findChildNodes(workflowExecution, workflowExecution.Start)
@@ -2535,6 +2535,7 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
return
}
log.Printf("STARTING EXEC OF %s!", fileId)
workflowExecution, executionResp, err := handleExecution(fileId, *workflow, request)
if err == nil {