Fixed App overwrites and bad app function names
This commit is contained in:
+30
-36
@@ -510,39 +510,38 @@ func generateYaml(swagger *openapi3.Swagger, newmd5 string) (*openapi3.Swagger,
|
|||||||
for actualPath, path := range swagger.Paths {
|
for actualPath, path := range swagger.Paths {
|
||||||
// FIXME: Add everything from here:
|
// FIXME: Add everything from here:
|
||||||
// https://godoc.org/github.com/getkin/kin-openapi/openapi3#PathItem
|
// https://godoc.org/github.com/getkin/kin-openapi/openapi3#PathItem
|
||||||
firstQuery := true
|
|
||||||
if path.Get != nil {
|
if path.Get != nil {
|
||||||
action, curCode := handleGet(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handleGet(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Connect != nil {
|
if path.Connect != nil {
|
||||||
action, curCode := handleConnect(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handleConnect(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Head != nil {
|
if path.Head != nil {
|
||||||
action, curCode := handleHead(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handleHead(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Delete != nil {
|
if path.Delete != nil {
|
||||||
action, curCode := handleDelete(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handleDelete(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Post != nil {
|
if path.Post != nil {
|
||||||
action, curCode := handlePost(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handlePost(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Patch != nil {
|
if path.Patch != nil {
|
||||||
action, curCode := handlePatch(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handlePatch(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
if path.Put != nil {
|
if path.Put != nil {
|
||||||
action, curCode := handlePut(swagger, api, extraParameters, path, actualPath, firstQuery)
|
action, curCode := handlePut(swagger, api, extraParameters, path, actualPath)
|
||||||
api.Actions = append(api.Actions, action)
|
api.Actions = append(api.Actions, action)
|
||||||
pythonFunctions = append(pythonFunctions, curCode)
|
pythonFunctions = append(pythonFunctions, curCode)
|
||||||
}
|
}
|
||||||
@@ -736,7 +735,7 @@ func fixFunctionName(functionName, actualPath string) string {
|
|||||||
return functionName
|
return functionName
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Connect.Summary, actualPath)
|
functionName := fixFunctionName(path.Connect.Summary, actualPath)
|
||||||
|
|
||||||
@@ -756,7 +755,7 @@ func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -818,11 +817,10 @@ func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -843,7 +841,7 @@ func handleConnect(swagger *openapi3.Swagger, api WorkflowApp, extraParameters [
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Get.Summary, actualPath)
|
functionName := fixFunctionName(path.Get.Summary, actualPath)
|
||||||
|
|
||||||
@@ -863,7 +861,7 @@ func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
|
|
||||||
// FIXME - remove this when authentication is properly introduced
|
// FIXME - remove this when authentication is properly introduced
|
||||||
@@ -930,11 +928,12 @@ func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
|
log.Printf("NOT FIRST QUERY!: %s", baseUrl)
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
log.Printf("AFTER: %s", baseUrl)
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -955,7 +954,7 @@ func handleGet(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Head.Summary, actualPath)
|
functionName := fixFunctionName(path.Head.Summary, actualPath)
|
||||||
|
|
||||||
@@ -975,7 +974,7 @@ func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -1037,11 +1036,10 @@ func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1062,7 +1060,7 @@ func handleHead(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Delete.Summary, actualPath)
|
functionName := fixFunctionName(path.Delete.Summary, actualPath)
|
||||||
|
|
||||||
@@ -1082,7 +1080,7 @@ func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -1144,11 +1142,10 @@ func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1169,7 +1166,7 @@ func handleDelete(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
//log.Printf("PATH: %s", actualPath)
|
//log.Printf("PATH: %s", actualPath)
|
||||||
functionName := fixFunctionName(path.Post.Summary, actualPath)
|
functionName := fixFunctionName(path.Post.Summary, actualPath)
|
||||||
@@ -1192,7 +1189,7 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -1256,11 +1253,10 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1281,7 +1277,7 @@ func handlePost(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wo
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Patch.Summary, actualPath)
|
functionName := fixFunctionName(path.Patch.Summary, actualPath)
|
||||||
|
|
||||||
@@ -1301,7 +1297,7 @@ func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []W
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -1363,11 +1359,10 @@ func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []W
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1388,7 +1383,7 @@ func handlePatch(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []W
|
|||||||
return action, curCode
|
return action, curCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string, firstQuery bool) (WorkflowAppAction, string) {
|
func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []WorkflowAppActionParameter, path *openapi3.PathItem, actualPath string) (WorkflowAppAction, string) {
|
||||||
// What to do with this, hmm
|
// What to do with this, hmm
|
||||||
functionName := fixFunctionName(path.Put.Summary, actualPath)
|
functionName := fixFunctionName(path.Put.Summary, actualPath)
|
||||||
|
|
||||||
@@ -1408,7 +1403,7 @@ func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
|
|
||||||
// Parameters: []WorkflowAppActionParameter{},
|
// Parameters: []WorkflowAppActionParameter{},
|
||||||
// FIXME - add data for POST stuff
|
// FIXME - add data for POST stuff
|
||||||
firstQuery = true
|
firstQuery := true
|
||||||
optionalQueries := []string{}
|
optionalQueries := []string{}
|
||||||
parameters := []string{}
|
parameters := []string{}
|
||||||
optionalParameters := []WorkflowAppActionParameter{}
|
optionalParameters := []WorkflowAppActionParameter{}
|
||||||
@@ -1471,11 +1466,10 @@ func handlePut(swagger *openapi3.Swagger, api WorkflowApp, extraParameters []Wor
|
|||||||
|
|
||||||
if firstQuery {
|
if firstQuery {
|
||||||
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s?%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
} else {
|
} else {
|
||||||
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
baseUrl = fmt.Sprintf("%s&%s={%s}", baseUrl, param.Value.Name, param.Value.Name)
|
||||||
firstQuery = false
|
|
||||||
}
|
}
|
||||||
|
firstQuery = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-3
@@ -1906,6 +1906,7 @@ func checkAdminLogin(resp http.ResponseWriter, request *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err)))
|
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err)))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
@@ -5536,8 +5537,26 @@ func verifySwagger(resp http.ResponseWriter, request *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Functions: %d", swagger.Paths)
|
// FIXME: CHECK IF SAME NAME AS NORMAL APP
|
||||||
log.Printf("Actions: %d", len(api.Actions))
|
// Can't overwrite existing normal app
|
||||||
|
workflowApps, err := getAllWorkflowApps(ctx)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed getting all workflow apps from database to verify: %s", err)
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(`{"success": false, "reason": "Failed to verify existence"}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same name only?
|
||||||
|
lowerName := strings.ToLower(swagger.Info.Title)
|
||||||
|
for _, app := range workflowApps {
|
||||||
|
if app.Downloaded && !app.Generated && strings.ToLower(app.Name) == lowerName {
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Normal app with name %s already exists. Delete it first."}`, swagger.Info.Title)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
api.Owner = user.Id
|
api.Owner = user.Id
|
||||||
|
|
||||||
err = dumpApi(basePath, api)
|
err = dumpApi(basePath, api)
|
||||||
@@ -5843,7 +5862,7 @@ func init() {
|
|||||||
log.Printf("Running INIT process")
|
log.Printf("Running INIT process")
|
||||||
dbclient, err = datastore.NewClient(ctx, gceProject)
|
dbclient, err = datastore.NewClient(ctx, gceProject)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("DBclient error during init: %s", err)
|
panic(fmt.Sprintf("DBclient error during init: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
go runInit(ctx)
|
go runInit(ctx)
|
||||||
|
|||||||
@@ -1355,12 +1355,12 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
curapp := WorkflowApp{}
|
curapp := WorkflowApp{}
|
||||||
// FIXME - can this work with ONLY AppID?
|
// FIXME - can this work with ONLY AppID?
|
||||||
for _, app := range workflowApps {
|
for _, app := range workflowApps {
|
||||||
log.Printf("Name Version: %s_%s, other: %s_%s", app.Name, app.AppVersion, action.AppName, action.AppVersion)
|
|
||||||
if app.ID == action.AppID {
|
if app.ID == action.AppID {
|
||||||
curapp = app
|
curapp = app
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Has to NOT be generated
|
||||||
//if app.Name == action.AppName && app.AppVersion == action.AppVersion {
|
//if app.Name == action.AppName && app.AppVersion == action.AppVersion {
|
||||||
// curapp = app
|
// curapp = app
|
||||||
// break
|
// break
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
#build: ./frontend
|
build: ./frontend
|
||||||
image: frikky/shuffle:frontend
|
image: frikky/shuffle:frontend
|
||||||
container_name: shuffle-frontend
|
container_name: shuffle-frontend
|
||||||
hostname: shuffle-frontend
|
hostname: shuffle-frontend
|
||||||
@@ -26,7 +26,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${DB_LOCATION}:/etc/shuffle
|
- ${DB_LOCATION}:/etc/shuffle
|
||||||
backend:
|
backend:
|
||||||
#build: ./backend
|
build: ./backend
|
||||||
image: frikky/shuffle:backend
|
image: frikky/shuffle:backend
|
||||||
container_name: shuffle-backend
|
container_name: shuffle-backend
|
||||||
hostname: ${BACKEND_HOSTNAME}
|
hostname: ${BACKEND_HOSTNAME}
|
||||||
|
|||||||
@@ -807,12 +807,13 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
// FIXME - check if they have value before overriding like this for no reason.
|
// FIXME - check if they have value before overriding like this for no reason.
|
||||||
// Would save a lot of time (400~ ms -> 30ms)
|
// Would save a lot of time (400~ ms -> 30ms)
|
||||||
//setSelectedAction({})
|
//console.log("ACTION: ", selectedAction)
|
||||||
|
//console.log("APP: ", selectedApp)
|
||||||
|
setSelectedAction({})
|
||||||
//setSelectedApp({})
|
//setSelectedApp({})
|
||||||
//setSelectedTrigger({})
|
//setSelectedTrigger({})
|
||||||
//setSelectedEdge({})
|
//setSelectedEdge({})
|
||||||
|
|
||||||
|
|
||||||
// setSelectedTriggerIndex(-1)
|
// setSelectedTriggerIndex(-1)
|
||||||
//setSelectedActionEnvironment({})
|
//setSelectedActionEnvironment({})
|
||||||
//setSelectedEdge({})
|
//setSelectedEdge({})
|
||||||
@@ -2635,7 +2636,7 @@ const AngularWorkflow = (props) => {
|
|||||||
value={selectedActionName}
|
value={selectedActionName}
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={setNewSelectedAction}
|
onChange={setNewSelectedAction}
|
||||||
style={{backgroundColor: inputColor, color: "white", height: "50px"}}
|
style={{backgroundColor: inputColor, color: "white", height: 50}}
|
||||||
SelectDisplayProps={{
|
SelectDisplayProps={{
|
||||||
style: {
|
style: {
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
@@ -2643,24 +2644,24 @@ const AngularWorkflow = (props) => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectedApp.actions.map(data => {
|
{selectedApp.actions.map(data => {
|
||||||
var newActionname = data.name
|
var newActionname = data.name
|
||||||
if (data.label !== undefined && data.label !== null && data.label.length > 0) {
|
if (data.label !== undefined && data.label !== null && data.label.length > 0) {
|
||||||
newActionname = data.label
|
newActionname = data.label
|
||||||
}
|
}
|
||||||
// ROFL FIXME - loop
|
// ROFL FIXME - loop
|
||||||
newActionname = newActionname.replace("_", " ")
|
newActionname = newActionname.replace("_", " ")
|
||||||
newActionname = newActionname.replace("_", " ")
|
newActionname = newActionname.replace("_", " ")
|
||||||
newActionname = newActionname.replace("_", " ")
|
newActionname = newActionname.replace("_", " ")
|
||||||
newActionname = newActionname.replace("_", " ")
|
newActionname = newActionname.replace("_", " ")
|
||||||
newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1)
|
newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1)
|
||||||
return (
|
return (
|
||||||
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data.name}>
|
<MenuItem style={{backgroundColor: inputColor, color: "white"}} value={data.name}>
|
||||||
{newActionname}
|
{newActionname}
|
||||||
|
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</Select>
|
</Select>
|
||||||
<div style={{marginTop: "10px", borderColor: "white", borderWidth: "2px", marginBottom: 200}}>
|
<div style={{marginTop: "10px", borderColor: "white", borderWidth: "2px", marginBottom: 200}}>
|
||||||
<AppActionArguments key={selectedAction.id} selectedAction={selectedAction} />
|
<AppActionArguments key={selectedAction.id} selectedAction={selectedAction} />
|
||||||
@@ -4521,7 +4522,7 @@ const AngularWorkflow = (props) => {
|
|||||||
<div style={{display: "flex", marginTop: 10, marginBottom: 30,}}>
|
<div style={{display: "flex", marginTop: 10, marginBottom: 30,}}>
|
||||||
<b>Actions</b>
|
<b>Actions</b>
|
||||||
<div>
|
<div>
|
||||||
{executionData.status !== undefined && executionData.status !== "ABORTED" && executionData.status !== "FINISHED" ? <CircularProgress style={{marginLeft: 20}}/> : null}
|
{executionData.status !== undefined && executionData.status !== "ABORTED" && executionData.status !== "FINISHED" && executionData.status !== "FAILURE" ? <CircularProgress style={{marginLeft: 20}}/> : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{executionData.results === undefined || executionData.results === null || executionData.results.length === 0 && executionData.status === "EXECUTING" ?
|
{executionData.results === undefined || executionData.results === null || executionData.results.length === 0 && executionData.status === "EXECUTING" ?
|
||||||
|
|||||||
+25
-12
@@ -43,6 +43,7 @@ const actionListStyle = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const boxStyle = {
|
const boxStyle = {
|
||||||
|
color: "white",
|
||||||
flex: "1",
|
flex: "1",
|
||||||
marginLeft: "10px",
|
marginLeft: "10px",
|
||||||
marginRight: "10px",
|
marginRight: "10px",
|
||||||
@@ -672,8 +673,10 @@ const AppCreator = (props) => {
|
|||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (!responseJson.success) {
|
if (!responseJson.success) {
|
||||||
setErrorCode(responseJson.reason)
|
if (responseJson.reason !== undefined) {
|
||||||
alert.error("Failed to verify: ")
|
setErrorCode(responseJson.reason)
|
||||||
|
alert.error("Failed to verify: "+responseJson.reason)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert.success("Successfully uploaded openapi")
|
alert.success("Successfully uploaded openapi")
|
||||||
if (window.location.pathname.includes("/new")) {
|
if (window.location.pathname.includes("/new")) {
|
||||||
@@ -940,6 +943,9 @@ const AppCreator = (props) => {
|
|||||||
const setActionField = (field, value) => {
|
const setActionField = (field, value) => {
|
||||||
currentAction[field] = value
|
currentAction[field] = value
|
||||||
setCurrentAction(currentAction)
|
setCurrentAction(currentAction)
|
||||||
|
//if (updater !== value) {
|
||||||
|
// setUpdater(value)
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bodyInfo = actionBodyRequest.includes(currentActionMethod) ?
|
const bodyInfo = actionBodyRequest.includes(currentActionMethod) ?
|
||||||
@@ -1114,6 +1120,7 @@ const AppCreator = (props) => {
|
|||||||
open={actionsModalOpen}
|
open={actionsModalOpen}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
|
console.log("CLOSED?")
|
||||||
setUrlPath("")
|
setUrlPath("")
|
||||||
setCurrentAction({
|
setCurrentAction({
|
||||||
"name": "",
|
"name": "",
|
||||||
@@ -1139,7 +1146,7 @@ const AppCreator = (props) => {
|
|||||||
Name
|
Name
|
||||||
<TextField
|
<TextField
|
||||||
required
|
required
|
||||||
style={{flex: "1", marginTop: "5px", marginRight: "15px", backgroundColor: inputColor}}
|
style={{flex: "1", marginTop: 5, marginRight: 15, backgroundColor: inputColor}}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
type="name"
|
type="name"
|
||||||
@@ -1148,9 +1155,14 @@ const AppCreator = (props) => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
defaultValue={currentAction["name"]}
|
defaultValue={currentAction["name"]}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
|
setActionField("name", e.target.value)
|
||||||
|
}}
|
||||||
|
onBlur={e => {
|
||||||
// Fix basic issues in frontend. Python functions run a-zA-Z0-9_
|
// Fix basic issues in frontend. Python functions run a-zA-Z0-9_
|
||||||
const regex = /[A-Z-a-z0-9 _]/g;
|
console.log(e.target.value)
|
||||||
|
const regex = /[A-Za-z0-9 _]/g;
|
||||||
const found = e.target.value.match(regex);
|
const found = e.target.value.match(regex);
|
||||||
|
console.log("FOUND: ", found)
|
||||||
if (found !== null) {
|
if (found !== null) {
|
||||||
setActionField("name", found.join(""))
|
setActionField("name", found.join(""))
|
||||||
}
|
}
|
||||||
@@ -1165,7 +1177,7 @@ const AppCreator = (props) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div style={{marginTop: "10px"}}/>
|
<div style={{marginTop: 10}}/>
|
||||||
Description
|
Description
|
||||||
<TextField
|
<TextField
|
||||||
required
|
required
|
||||||
@@ -1327,15 +1339,16 @@ const AppCreator = (props) => {
|
|||||||
{bodyInfo}
|
{bodyInfo}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button style={{borderRadius: "0px"}} onClick={() => {
|
<Button style={{borderRadius: "0px"}} onClick={() => {
|
||||||
setActionsModalOpen(false)}}>
|
setActionsModalOpen(false)}}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="primary" variant="outlined" style={{borderRadius: "0px"}} onClick={() => {
|
<Button color="primary" variant="outlined" style={{borderRadius: "0px"}} onClick={() => {
|
||||||
const errors = getActionErrors()
|
const errors = getActionErrors()
|
||||||
addActionToView(errors)
|
addActionToView(errors)
|
||||||
setActionsModalOpen(false)
|
setActionsModalOpen(false)
|
||||||
setUrlPathQueries([])
|
setUrlPathQueries([])
|
||||||
|
setUrlPath("")
|
||||||
}}>
|
}}>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1462,7 +1475,7 @@ const AppCreator = (props) => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={name}
|
value={name}
|
||||||
onChange={e => setName(e.target.value)}
|
onChange={e => setName(e.target.value)}
|
||||||
color="primary"
|
color="primary"
|
||||||
InputProps={{
|
InputProps={{
|
||||||
style:{
|
style:{
|
||||||
@@ -1570,7 +1583,7 @@ const AppCreator = (props) => {
|
|||||||
}}>
|
}}>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
{errorCode}
|
{errorCode.length > 0 ? `Error: ${errorCode}` : null}
|
||||||
</Paper>
|
</Paper>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user