Upgraded for 7.0.0

This commit is contained in:
frikky
2020-09-05 13:10:27 +02:00
parent b1eb0f5a08
commit 70bcdb2ae2
10 changed files with 145 additions and 103 deletions
+9 -1
View File
@@ -804,7 +804,15 @@ class AppBase:
#submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})" #submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})" submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
actualitem = re.findall(submatch, value, re.MULTILINE) 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: if len(actualitem) > 0:
multiexecution = True multiexecution = True
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
NAME=app_sdk NAME=app_sdk
VERSION=0.6.0 VERSION=0.6.1
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force 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 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
+3 -1
View File
@@ -644,7 +644,9 @@ func handleStartHookDocker(resp http.ResponseWriter, request *http.Request) {
// Checks if an image exists // Checks if an image exists
func imageCheckBuilder(images []string) error { func imageCheckBuilder(images []string) error {
log.Printf("ImageNames: %#v", images) log.Printf("[FIXME] ImageNames to check: %#v", images)
return nil
ctx := context.Background() ctx := context.Background()
client, err := client.NewEnvClient() client, err := client.NewEnvClient()
if err != nil { if err != nil {
+22 -16
View File
@@ -122,19 +122,20 @@ type WorkflowApp struct {
} }
type WorkflowAppActionParameter struct { type WorkflowAppActionParameter struct {
Description string `json:"description" datastore:"description,noindex" yaml:"description"` Description string `json:"description" datastore:"description,noindex" yaml:"description"`
ID string `json:"id" datastore:"id" yaml:"id,omitempty"` ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
Name string `json:"name" datastore:"name" yaml:"name"` Name string `json:"name" datastore:"name" yaml:"name"`
Example string `json:"example" datastore:"example" yaml:"example"` Example string `json:"example" datastore:"example" yaml:"example"`
Value string `json:"value" datastore:"value" yaml:"value,omitempty"` Value string `json:"value" datastore:"value" yaml:"value,omitempty"`
Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"` Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
Options []string `json:"options" datastore:"options" yaml:"options"` Options []string `json:"options" datastore:"options" yaml:"options"`
ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"` ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"`
Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"` Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"`
Required bool `json:"required" datastore:"required" yaml:"required"` Required bool `json:"required" datastore:"required" yaml:"required"`
Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"` Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"`
Tags []string `json:"tags" datastore:"tags" yaml:"tags"` Tags []string `json:"tags" datastore:"tags" yaml:"tags"`
Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"` Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
SkipMulticheck bool `json:"skip_multicheck" datastore:"skip_multicheck" yaml:"skip_multicheck"`
} }
type SchemaDefinition struct { type SchemaDefinition struct {
@@ -540,6 +541,7 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque
return return
} }
// FIXME: Add authentication?
id := request.Header.Get("Org-Id") id := request.Header.Get("Org-Id")
if len(id) == 0 { if len(id) == 0 {
log.Printf("No Org-Id header set - confirm") log.Printf("No Org-Id header set - confirm")
@@ -626,7 +628,8 @@ func handleGetWorkflowqueueConfirm(resp http.ResponseWriter, request *http.Reque
resp.Write([]byte("OK")) 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) { func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
cors := handleCors(resp, request) cors := handleCors(resp, request)
if cors { if cors {
@@ -653,6 +656,8 @@ func handleGetWorkflowqueue(resp http.ResponseWriter, request *http.Request) {
if len(executionRequests.Data) == 0 { if len(executionRequests.Data) == 0 {
executionRequests.Data = []ExecutionRequest{} executionRequests.Data = []ExecutionRequest{}
} else {
log.Printf("[INFO] Executionrequests: %d", len(executionRequests.Data))
} }
newjson, err := json.Marshal(executionRequests) 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) //log.Printf("Execution request: %#v", executionRequest)
err = setWorkflowQueue(ctx, executionRequestWrapper, environment) err = setWorkflowQueue(ctx, executionRequestWrapper, environment)
if err != nil { if err != nil {
log.Printf("Failed adding to db: %s", err) log.Printf("Failed adding to db: %s", err)
} }
} }
} else {
log.Printf("[ERROR] Cloud not implemented yet")
} }
err = increaseStatisticsField(ctx, "workflow_executions", workflow.ID, 1) 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") log.Printf("Deleting private app")
var privateApps []WorkflowApp var privateApps []WorkflowApp
for _, item := range user.PrivateApps { for _, item := range user.PrivateApps {
log.Println(item.ID, fileId)
if item.ID == fileId { if item.ID == fileId {
continue continue
} }
@@ -4466,6 +4471,7 @@ func iterateOpenApiGithub(fs billy.Filesystem, dir []os.FileInfo, extra string,
if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") { if strings.Contains(filename, "yaml") || strings.Contains(filename, "yml") {
//log.Printf("File: %s", filename) //log.Printf("File: %s", filename)
//log.Printf("Found file: %s", filename) //log.Printf("Found file: %s", filename)
log.Printf("OpenAPI app: %s", filename)
tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name()) tmpExtra := fmt.Sprintf("%s%s/", extra, file.Name())
fileReader, err := fs.Open(tmpExtra) fileReader, err := fs.Open(tmpExtra)
+3 -3
View File
@@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
frontend: frontend:
build: ./frontend #build: ./frontend
image: ghcr.io/frikky/shuffle-frontend:0.7.1 image: ghcr.io/frikky/shuffle-frontend:0.7.1
container_name: shuffle-frontend container_name: shuffle-frontend
hostname: shuffle-frontend hostname: shuffle-frontend
@@ -16,7 +16,7 @@ services:
depends_on: depends_on:
- backend - backend
backend: backend:
build: ./backend #build: ./backend
image: ghcr.io/frikky/shuffle-backend:0.7.1 image: ghcr.io/frikky/shuffle-backend:0.7.1
container_name: shuffle-backend container_name: shuffle-backend
hostname: ${BACKEND_HOSTNAME} hostname: ${BACKEND_HOSTNAME}
@@ -42,7 +42,7 @@ services:
depends_on: depends_on:
- database - database
orborus: orborus:
build: ./functions/onprem/orborus #build: ./functions/onprem/orborus
image: ghcr.io/frikky/orborus:0.6.2 image: ghcr.io/frikky/orborus:0.6.2
container_name: shuffle-orborus container_name: shuffle-orborus
hostname: shuffle-orborus hostname: shuffle-orborus
+1 -1
View File
@@ -960,7 +960,7 @@ const AppCreator = (props) => {
margin="normal" margin="normal"
variant="outlined" variant="outlined"
value={parameterName} value={parameterName}
helperText={<div style={{color:"white", marginBottom: "2px",}}>Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$</div>} helperText={<span style={{color:"white", marginBottom: "2px",}}>Can't be empty. Can't contain any of the following characters: !#$%&'^+-._~|]+$</span>}
onChange={e => setParameterName(e.target.value)} onChange={e => setParameterName(e.target.value)}
InputProps={{ InputProps={{
classes: { classes: {
+104 -77
View File
@@ -403,6 +403,7 @@ const Apps = (props) => {
const activateUrl = "/apps/new?id="+selectedApp.id const activateUrl = "/apps/new?id="+selectedApp.id
var downloadButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? var downloadButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ?
<Tooltip title={"Download OpenAPI"}>
<Button <Button
onClick={() => {downloadApp(selectedApp)}} onClick={() => {downloadApp(selectedApp)}}
variant="outlined" variant="outlined"
@@ -412,31 +413,53 @@ const Apps = (props) => {
> >
<CloudDownload /> <CloudDownload />
</Button> </Button>
</Tooltip>
: null : null
var editButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ? var editButton = selectedApp.activated && selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated ?
<Link to={editUrl} style={{textDecoration: "none"}}> <Link to={editUrl} style={{textDecoration: "none"}}>
<Button <Tooltip title={"Edit OpenAPI app"}>
variant="outlined" <Button
component="label" variant="outlined"
color="primary" component="label"
style={{marginTop: 10, marginRight: 10,}} color="primary"
> style={{marginTop: 10, marginRight: 10,}}
<EditIcon /> >
</Button></Link> : null <EditIcon />
</Button>
</Tooltip>
</Link> : null
var activateButton = selectedApp.generated && !selectedApp.activated ? var activateButton = selectedApp.generated && !selectedApp.activated ?
<Link to={activateUrl} style={{textDecoration: "none"}}> <div>
<Button <Link to={activateUrl} style={{textDecoration: "none"}}>
variant="contained" <Button
component="label" variant="contained"
color="primary" component="label"
style={{marginTop: 10}} color="primary"
> style={{marginTop: 10}}
Activate App >
</Button></Link> : null Activate App
</Button>
</Link>
<Tooltip title={"Delete app"}>
<Button
variant="outlined"
component="label"
color="primary"
style={{marginLeft: 5, marginTop: 10}}
onClick={() => {
setDeleteModalOpen(true)
}}
>
<DeleteIcon />
</Button>
</Tooltip>
</div>
: null
var deleteButton = ((selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated) || (selectedApp.downloaded != undefined && selectedApp.downloaded == true)) && activateButton === null ? var deleteButton = ((selectedApp.private_id !== undefined && selectedApp.private_id.length > 0 && selectedApp.generated) || (selectedApp.downloaded != undefined && selectedApp.downloaded == true)) && activateButton === null ?
<Tooltip title={"Delete app"}>
<Button <Button
variant="outlined" variant="outlined"
component="label" component="label"
@@ -447,7 +470,9 @@ const Apps = (props) => {
}} }}
> >
<DeleteIcon /> <DeleteIcon />
</Button> : null </Button>
</Tooltip>
: null
var imageline = selectedApp.large_image === undefined || selectedApp.large_image.length === 0 ? var imageline = selectedApp.large_image === undefined || selectedApp.large_image.length === 0 ?
<img alt={selectedApp.title} style={{width: 100, height: 100}} /> <img alt={selectedApp.title} style={{width: 100, height: 100}} />
@@ -589,74 +614,76 @@ const Apps = (props) => {
{/*<p><b>Owner:</b> {selectedApp.owner}</p>*/} {/*<p><b>Owner:</b> {selectedApp.owner}</p>*/}
{selectedApp.privateId !== undefined && selectedApp.privateId.length > 0 ? <p><b>PrivateID:</b> {selectedApp.privateId}</p> : null} {selectedApp.privateId !== undefined && selectedApp.privateId.length > 0 ? <p><b>PrivateID:</b> {selectedApp.privateId}</p> : null}
<Divider style={{marginBottom: 10, marginTop: 10, backgroundColor: dividerColor}}/> <Divider style={{marginBottom: 10, marginTop: 10, backgroundColor: dividerColor}}/>
{selectedApp.link.length > 0 ? <p><b>URL:</b> {selectedApp.link}</p> : null} <div style={{padding: 20}}>
<div style={{marginTop: 15, marginBottom: 15}}> {selectedApp.link.length > 0 ? <p><b>URL:</b> {selectedApp.link}</p> : null}
<b>Actions</b> <div style={{marginTop: 15, marginBottom: 15}}>
{selectedApp.actions !== null && selectedApp.actions.length > 0 ? <b>Actions</b>
<Select {selectedApp.actions !== null && selectedApp.actions.length > 0 ?
fullWidth <Select
value={selectedAction} fullWidth
onChange={(event) => { value={selectedAction}
setSelectedAction(event.target.value) onChange={(event) => {
}} setSelectedAction(event.target.value)
style={{backgroundColor: inputColor, color: "white", height: "50px"}} }}
SelectDisplayProps={{ style={{backgroundColor: inputColor, color: "white", height: "50px"}}
style: { SelectDisplayProps={{
marginLeft: 10, style: {
} marginLeft: 10,
}} }
> }}
{selectedApp.actions.map(data => { >
var newActionname = data.label !== undefined && data.label.length > 0 ? data.label : data.name {selectedApp.actions.map(data => {
var newActionname = data.label !== undefined && data.label.length > 0 ? data.label : data.name
// 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 (
<MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}>
{newActionname}
</MenuItem>
)
})}
</Select>
:
<div style={{marginTop: 10}}>
There are no actions defined for this app.
</div>
}
</div>
{selectedAction.parameters !== undefined && selectedAction.parameters !== null ?
<div style={{marginTop: 15, marginBottom: 15}}>
<b>Arguments</b>
{selectedAction.parameters.map(data => {
var itemColor = "#f85a3e"
if (!data.required) {
itemColor = "#ffeb3b"
}
const circleSize = 10
return ( return (
<MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}> <MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}>
{newActionname} <div style={{width: circleSize, height: circleSize, borderRadius: circleSize / 2, backgroundColor: itemColor, marginRight: "10px"}}/>
{data.name}
</MenuItem> </MenuItem>
) )
})} })}
</Select>
:
<div style={{marginTop: 10}}>
There are no actions defined for this app.
</div> </div>
}
</div>
{selectedAction.parameters !== undefined && selectedAction.parameters !== null ?
<div style={{marginTop: 15, marginBottom: 15}}>
<b>Arguments</b>
{selectedAction.parameters.map(data => {
var itemColor = "#f85a3e"
if (!data.required) {
itemColor = "#ffeb3b"
}
const circleSize = 10
return (
<MenuItem key={data.name} style={{backgroundColor: inputColor, color: "white"}} value={data}>
<div style={{width: circleSize, height: circleSize, borderRadius: circleSize / 2, backgroundColor: itemColor, marginRight: "10px"}}/>
{data.name}
</MenuItem>
)
})}
</div>
: null}
{selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 ?
<div>
<b>Action Description</b><div/>
{selectedAction.description}
</div>
: null} : null}
<GetAppExample /> {selectedAction.description !== undefined && selectedAction.description !== null && selectedAction.description.length > 0 ?
<div>
<b>Action Description</b><div/>
{selectedAction.description}
</div>
: null}
<GetAppExample />
</div>
</div> </div>
: :
null null
-1
View File
@@ -398,7 +398,6 @@ const Workflows = (props) => {
} }
// dropdown with copy etc I guess // dropdown with copy etc I guess
console.log("Why reset?")
const WorkflowPaper = (props) => { const WorkflowPaper = (props) => {
const { data } = props; const { data } = props;
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=orborus NAME=orborus
VERSION=0.6.1 VERSION=0.6.2
echo "Running docker build with $NAME:$VERSION" echo "Running docker build with $NAME:$VERSION"
#docker rmi frikky/shuffle:$NAME --force #docker rmi frikky/shuffle:$NAME --force
+1 -1
View File
@@ -263,7 +263,7 @@ func main() {
// FIXME - during init, BUILD and/or LOAD worker and app_sdk // 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 // 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!") log.Printf("[INFO] Setting up Docker environment. Downloading worker and App SDK!")
initializeImages() go initializeImages()
//workerName := "worker" //workerName := "worker"
//workerVersion := "0.1.0" //workerVersion := "0.1.0"