From 70bcdb2ae23ea02855749bebdfd8790e131c0d61 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 5 Sep 2020 13:10:27 +0200 Subject: [PATCH] Upgraded for 7.0.0 --- backend/app_sdk/app_base.py | 10 +- backend/app_sdk/build.sh | 2 +- backend/go-app/docker.go | 4 +- backend/go-app/walkoff.go | 38 +++--- docker-compose.yml | 6 +- frontend/src/views/AppCreator.jsx | 2 +- frontend/src/views/Apps.jsx | 181 ++++++++++++++++------------ frontend/src/views/Workflows.jsx | 1 - functions/onprem/orborus/build.sh | 2 +- functions/onprem/orborus/orborus.go | 2 +- 10 files changed, 145 insertions(+), 103 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index ae57b0d2..29573512 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -804,7 +804,15 @@ class AppBase: #submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})" submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})" actualitem = re.findall(submatch, value, re.MULTILINE) - print("Multicheck ", actualitem) + try: + if action["skip_multicheck"]: + print("Skipping multicheck") + actualitem = [] + except KeyError: + pass + + actionname = action["name"] + #print("Multicheck ", actualitem) if len(actualitem) > 0: multiexecution = True diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index 7341b74b..0c7af3f7 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -1,6 +1,6 @@ #!/bin/bash NAME=app_sdk -VERSION=0.6.0 +VERSION=0.6.1 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -t frikky/shuffle:$NAME -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/app_sdk:0.6.0 diff --git a/backend/go-app/docker.go b/backend/go-app/docker.go index 1303b8e1..a68e1643 100644 --- a/backend/go-app/docker.go +++ b/backend/go-app/docker.go @@ -644,7 +644,9 @@ func handleStartHookDocker(resp http.ResponseWriter, request *http.Request) { // Checks if an image exists func imageCheckBuilder(images []string) error { - log.Printf("ImageNames: %#v", images) + log.Printf("[FIXME] ImageNames to check: %#v", images) + return nil + ctx := context.Background() client, err := client.NewEnvClient() if err != nil { diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 287d7d63..0d06dc37 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -122,19 +122,20 @@ type WorkflowApp struct { } type WorkflowAppActionParameter struct { - Description string `json:"description" datastore:"description,noindex" yaml:"description"` - ID string `json:"id" datastore:"id" yaml:"id,omitempty"` - Name string `json:"name" datastore:"name" yaml:"name"` - Example string `json:"example" datastore:"example" yaml:"example"` - Value string `json:"value" datastore:"value" yaml:"value,omitempty"` - Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"` - Options []string `json:"options" datastore:"options" yaml:"options"` - ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"` - Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"` - Required bool `json:"required" datastore:"required" yaml:"required"` - Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"` - Tags []string `json:"tags" datastore:"tags" yaml:"tags"` - Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"` + Description string `json:"description" datastore:"description,noindex" yaml:"description"` + ID string `json:"id" datastore:"id" yaml:"id,omitempty"` + Name string `json:"name" datastore:"name" yaml:"name"` + Example string `json:"example" datastore:"example" yaml:"example"` + Value string `json:"value" datastore:"value" yaml:"value,omitempty"` + Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"` + Options []string `json:"options" datastore:"options" yaml:"options"` + ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"` + Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"` + Required bool `json:"required" datastore:"required" yaml:"required"` + Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"` + Tags []string `json:"tags" datastore:"tags" yaml:"tags"` + Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"` + SkipMulticheck bool `json:"skip_multicheck" datastore:"skip_multicheck" yaml:"skip_multicheck"` } type SchemaDefinition struct { @@ -540,6 +541,7 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque return } + // FIXME: Add authentication? id := request.Header.Get("Org-Id") if len(id) == 0 { log.Printf("No Org-Id header set - confirm") @@ -626,7 +628,8 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque resp.Write([]byte("OK")) } -// FIXME: Authenticate this one (especially since we have a default: shuffle) +// FIXME: Authenticate this one? Can org ID be auth enough? +// (especially since we have a default: shuffle) func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) { cors := handleCors(resp, request) if cors { @@ -653,6 +656,8 @@ 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)) } newjson, err := json.Marshal(executionRequests) @@ -2479,12 +2484,13 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf } //log.Printf("Execution request: %#v", executionRequest) - err = setWorkflowQueue(ctx, executionRequestWrapper, environment) if err != nil { log.Printf("Failed adding to db: %s", err) } } + } else { + log.Printf("[ERROR] Cloud not implemented yet") } err = increaseStatisticsField(ctx, "workflow_executions", workflow.ID, 1) @@ -3312,7 +3318,6 @@ func deleteWorkflowApp(resp http.ResponseWriter, request *http.Request) { log.Printf("Deleting private app") var privateApps []WorkflowApp for _, item := range user.PrivateApps { - log.Println(item.ID, fileId) if item.ID == fileId { continue } @@ -4466,6 +4471,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string, if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") { //log.Printf("File: %s", filename) //log.Printf("Found file: %s", filename) + log.Printf("OpenAPI app: %s", filename) tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name()) fileReader, err := fs.Open(tmpExtra) diff --git a/docker-compose.yml b/docker-compose.yml index 7b5486ae..dce4ba78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: frontend: - build: ./frontend + #build: ./frontend image: ghcr.io/frikky/shuffle-frontend:0.7.1 container_name: shuffle-frontend hostname: shuffle-frontend @@ -16,7 +16,7 @@ services: depends_on: - backend backend: - build: ./backend + #build: ./backend image: ghcr.io/frikky/shuffle-backend:0.7.1 container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} @@ -42,7 +42,7 @@ services: depends_on: - database orborus: - build: ./functions/onprem/orborus + #build: ./functions/onprem/orborus image: ghcr.io/frikky/orborus:0.6.2 container_name: shuffle-orborus hostname: shuffle-orborus diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index 5c772da4..2303398f 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -960,7 +960,7 @@ const AppCreator = (props) => { margin="normal" variant="outlined" value={parameterName} - helperText={
Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$
} + helperText={Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$} onChange={e => setParameterName(e.target.value)} InputProps={{ classes: { diff --git a/frontend/src/views/Apps.jsx b/frontend/src/views/Apps.jsx index 0aece1c0..f6ae675d 100644 --- a/frontend/src/views/Apps.jsx +++ b/frontend/src/views/Apps.jsx @@ -403,6 +403,7 @@ const Apps = (props) => { const activateUrl = "/apps/new?id="+selectedApp.id var downloadButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? + + : null var editButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? - : null + + + + : null var activateButton = selectedApp.generated && !selectedApp.activated ? - - : null +
+ + + + + + +
+ : null var deleteButton = ((selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated) || (selectedApp.downloaded != undefined && selectedApp.downloaded == true)) && activateButton === null ? + : null + + + : null var imageline = selectedApp.large_image === undefined || selectedApp.large_image.length === 0 ? {selectedApp.title} @@ -589,74 +614,76 @@ const Apps = (props) => { {/*

Owner: {selectedApp.owner}

*/} {selectedApp.privateId !== undefined && selectedApp.privateId.length > 0 ?

PrivateID: {selectedApp.privateId}

: null} - {selectedApp.link.length > 0 ?

URL: {selectedApp.link}

: null} -
- Actions - {selectedApp.actions !== null && selectedApp.actions.length > 0 ? - { + setSelectedAction(event.target.value) + }} + style={{backgroundColor: inputColor, color: "white", height: "50px"}} + SelectDisplayProps={{ + style: { + marginLeft: 10, + } + }} + > + {selectedApp.actions.map(data => { + var newActionname = data.label !== undefined && data.label.length > 0 ? data.label : data.name - // ROFL FIXME - loop - newActionname = newActionname.replace("_", " ") - newActionname = newActionname.replace("_", " ") - newActionname = newActionname.replace("_", " ") - newActionname = newActionname.replace("_", " ") - newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1) + // ROFL FIXME - loop + newActionname = newActionname.replace("_", " ") + newActionname = newActionname.replace("_", " ") + newActionname = newActionname.replace("_", " ") + newActionname = newActionname.replace("_", " ") + newActionname = newActionname.charAt(0).toUpperCase()+newActionname.substring(1) + return ( + + {newActionname} + + + ) + })} + + : +
+ There are no actions defined for this app. +
+ } +
+ + {selectedAction.parameters !== undefined && selectedAction.parameters !== null ? +
+ Arguments + {selectedAction.parameters.map(data => { + var itemColor = "#f85a3e" + if (!data.required) { + itemColor = "#ffeb3b" + } + + const circleSize = 10 return ( - {newActionname} +
+ {data.name} ) })} - - : -
- There are no actions defined for this app.
- } -
- - {selectedAction.parameters !== undefined && selectedAction.parameters !== null ? -
- Arguments - {selectedAction.parameters.map(data => { - var itemColor = "#f85a3e" - if (!data.required) { - itemColor = "#ffeb3b" - } - - const circleSize = 10 - return ( - -
- {data.name} - - - ) - })} -
- : null} - {selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 ? -
- Action Description
- {selectedAction.description} -
: null} - + {selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 ? +
+ Action Description
+ {selectedAction.description} +
+ : null} + +
: null diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index a358a376..8542790d 100644 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -398,7 +398,6 @@ const Workflows = (props) => { } // dropdown with copy etc I guess - console.log("Why reset?") const WorkflowPaper = (props) => { const { data } = props; const [open, setOpen] = React.useState(false); diff --git a/functions/onprem/orborus/build.sh b/functions/onprem/orborus/build.sh index 4902adce..cbea526b 100644 --- a/functions/onprem/orborus/build.sh +++ b/functions/onprem/orborus/build.sh @@ -1,5 +1,5 @@ NAME=orborus -VERSION=0.6.1 +VERSION=0.6.2 echo "Running docker build with $NAME:$VERSION" #docker rmi frikky/shuffle:$NAME --force diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 993ad2e7..8e48ce62 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -263,7 +263,7 @@ func main() { // FIXME - during init, BUILD and/or LOAD worker and app_sdk // Build/load app_sdk so it can be loaded as 127.0.0.1:5000/walkoff_app_sdk log.Printf("[INFO] Setting up Docker environment. Downloading worker and App SDK!") - initializeImages() + go initializeImages() //workerName := "worker" //workerVersion := "0.1.0"