Added appcreator autocomplete feature for GET {PATH}
This commit is contained in:
@@ -3306,7 +3306,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
if len(action.Label) == 0 {
|
if len(action.Label) == 0 {
|
||||||
action.Label = action.ID
|
action.Label = action.ID
|
||||||
}
|
}
|
||||||
log.Printf("LABEL: %s", action.Label)
|
//log.Printf("LABEL: %s", action.Label)
|
||||||
newActions = append(newActions, action)
|
newActions = append(newActions, action)
|
||||||
|
|
||||||
// If the node is NOT found, it's supposed to be set to SKIPPED,
|
// If the node is NOT found, it's supposed to be set to SKIPPED,
|
||||||
@@ -3360,7 +3360,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, trigger := range workflowExecution.Workflow.Triggers {
|
for _, trigger := range workflowExecution.Workflow.Triggers {
|
||||||
log.Printf("[INFO] ID: %s vs %s", trigger.ID, workflowExecution.Start)
|
//log.Printf("[INFO] ID: %s vs %s", trigger.ID, workflowExecution.Start)
|
||||||
if trigger.ID == workflowExecution.Start {
|
if trigger.ID == workflowExecution.Start {
|
||||||
if trigger.AppName == "User Input" {
|
if trigger.AppName == "User Input" {
|
||||||
startFound = true
|
startFound = true
|
||||||
|
|||||||
@@ -1784,7 +1784,20 @@ const AppCreator = (props) => {
|
|||||||
}}
|
}}
|
||||||
onBlur={event => {
|
onBlur={event => {
|
||||||
var parsedurl = event.target.value
|
var parsedurl = event.target.value
|
||||||
if (parsedurl.startsWith("curl")) {
|
if (parsedurl.startsWith("PUT ") || parsedurl.startsWith("GET ") ||parsedurl.startsWith("POST ") || parsedurl.startsWith("DELETE ") ||parsedurl.startsWith("PATCH ") || parsedurl.startsWith("CONNECT ")) {
|
||||||
|
const tmp = parsedurl.split(" ")
|
||||||
|
|
||||||
|
if (tmp.length > 1) {
|
||||||
|
parsedurl = tmp[1]
|
||||||
|
setActionField("url", parsedurl)
|
||||||
|
setUrlPath(parsedurl)
|
||||||
|
|
||||||
|
setCurrentActionMethod(tmp[0].toUpperCase())
|
||||||
|
setActionField("method", tmp[0].toUpperCase())
|
||||||
|
}
|
||||||
|
|
||||||
|
setUpdate(Math.random())
|
||||||
|
} else if (parsedurl.startsWith("curl")) {
|
||||||
const request = parseCurl(event.target.value)
|
const request = parseCurl(event.target.value)
|
||||||
if (request !== event.target.value) {
|
if (request !== event.target.value) {
|
||||||
if (request.method.toUpperCase() !== currentAction.Method) {
|
if (request.method.toUpperCase() !== currentAction.Method) {
|
||||||
@@ -1819,7 +1832,8 @@ const AppCreator = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsedurl !== undefined) {
|
console.log("PARSED: ", parsedurl)
|
||||||
|
if (parsedurl !== undefined) {
|
||||||
if (parsedurl.includes("<") && parsedurl.includes(">")) {
|
if (parsedurl.includes("<") && parsedurl.includes(">")) {
|
||||||
parsedurl = parsedurl.split("<").join("{")
|
parsedurl = parsedurl.split("<").join("{")
|
||||||
parsedurl = parsedurl.split(">").join("}")
|
parsedurl = parsedurl.split(">").join("}")
|
||||||
@@ -1920,9 +1934,9 @@ const AppCreator = (props) => {
|
|||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="primary" variant="outlined" style={{borderRadius: "0px"}} onClick={() => {
|
<Button color="primary" variant="outlined" style={{borderRadius: "0px"}} onClick={() => {
|
||||||
console.log(urlPathQueries)
|
//console.log(urlPathQueries)
|
||||||
console.log(urlPath)
|
//console.log(urlPath)
|
||||||
console.log(currentAction)
|
//console.log(currentAction)
|
||||||
const errors = getActionErrors()
|
const errors = getActionErrors()
|
||||||
addActionToView(errors)
|
addActionToView(errors)
|
||||||
setActionsModalOpen(false)
|
setActionsModalOpen(false)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
NAME=shuffle-worker
|
NAME=shuffle-worker
|
||||||
VERSION=0.8.54
|
VERSION=0.8.56
|
||||||
|
|
||||||
echo "Running docker build with $NAME:$VERSION"
|
echo "Running docker build with $NAME:$VERSION"
|
||||||
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
|
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
|
||||||
|
|||||||
@@ -774,22 +774,24 @@ func shutdown(executionId, workflowId string) {
|
|||||||
|
|
||||||
// Might not be necessary because of cleanupEnv hostconfig autoremoval
|
// Might not be necessary because of cleanupEnv hostconfig autoremoval
|
||||||
if cleanupEnv == "true" && len(containerIds) > 0 {
|
if cleanupEnv == "true" && len(containerIds) > 0 {
|
||||||
ctx := context.Background()
|
/*
|
||||||
dockercli, err := dockerclient.NewEnvClient()
|
ctx := context.Background()
|
||||||
if err == nil {
|
dockercli, err := dockerclient.NewEnvClient()
|
||||||
log.Printf("[INFO] Cleaning up %d containers", len(containerIds))
|
if err == nil {
|
||||||
removeOptions := types.ContainerRemoveOptions{
|
log.Printf("[INFO] Cleaning up %d containers", len(containerIds))
|
||||||
RemoveVolumes: true,
|
removeOptions := types.ContainerRemoveOptions{
|
||||||
Force: true,
|
RemoveVolumes: true,
|
||||||
}
|
Force: true,
|
||||||
|
}
|
||||||
|
|
||||||
for _, containername := range containerIds {
|
for _, containername := range containerIds {
|
||||||
log.Printf("[INFO] Stopping and removing container %s", containername)
|
log.Printf("[INFO] Should stop and and remove container %s (deprecated)", containername)
|
||||||
dockercli.ContainerStop(ctx, containername, nil)
|
//dockercli.ContainerStop(ctx, containername, nil)
|
||||||
dockercli.ContainerRemove(ctx, containername, removeOptions)
|
//dockercli.ContainerRemove(ctx, containername, removeOptions)
|
||||||
//removeContainers = append(removeContainers, containername)
|
//removeContainers = append(removeContainers, containername)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[INFO] NOT cleaning up containers. IDS: %d, CLEANUP env: %s", len(containerIds), cleanupEnv)
|
log.Printf("[INFO] NOT cleaning up containers. IDS: %d, CLEANUP env: %s", len(containerIds), cleanupEnv)
|
||||||
}
|
}
|
||||||
@@ -866,9 +868,9 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Removing because log extraction should happen first
|
// Removing because log extraction should happen first
|
||||||
//if cleanupEnv == "true" {
|
if cleanupEnv == "true" {
|
||||||
// hostConfig.AutoRemove = true
|
hostConfig.AutoRemove = true
|
||||||
//}
|
}
|
||||||
|
|
||||||
config := &container.Config{
|
config := &container.Config{
|
||||||
Image: image,
|
Image: image,
|
||||||
@@ -885,7 +887,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
|
|||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Container CREATE error: %s", err)
|
log.Printf("[WARNING] Container CREATE error: %s", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1481,55 +1483,100 @@ func handleExecutionResult(workflowExecution WorkflowExecution) {
|
|||||||
// 3. Add remote repo location
|
// 3. Add remote repo location
|
||||||
// 4. Actually download last repo
|
// 4. Actually download last repo
|
||||||
|
|
||||||
err = deployApp(dockercli, image, identifier, env)
|
images := []string{
|
||||||
if err != nil {
|
fmt.Sprintf("%s/%s:%s_%s", registryName, baseimagename, strings.ToLower(action.AppName), action.AppVersion),
|
||||||
// Trying to replace with lowercase to deploy again. This seems to work with Dockerhub well.
|
image,
|
||||||
// FIXME: Should try to remotely download directly if this persists.
|
fmt.Sprintf("%s:%s_%s", baseimagename, strings.ToLower(action.AppName), action.AppVersion),
|
||||||
image = fmt.Sprintf("%s:%s_%s", baseimagename, strings.ToLower(action.AppName), action.AppVersion)
|
}
|
||||||
if strings.Contains(image, " ") {
|
|
||||||
image = strings.ReplaceAll(image, " ", "-")
|
// If cleanup is set, it should run for efficiency
|
||||||
}
|
pullOptions := types.ImagePullOptions{}
|
||||||
|
if cleanupEnv == "true" {
|
||||||
|
err = deployApp(dockercli, images[0], identifier, env)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[WARNING] Failed CLEANUP execution. Downloading image remotely.")
|
||||||
|
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Failed getting %s. The couldn't be find locally, AND is missing.", image)
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
buildBuf := new(strings.Builder)
|
||||||
|
_, err = io.Copy(buildBuf, reader)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Error in IO copy: %s", err)
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
} else {
|
||||||
|
if strings.Contains(buildBuf.String(), "errorDetail") {
|
||||||
|
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("[INFO] Successfully downloaded %s", image)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = deployApp(dockercli, image, identifier, env)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
||||||
|
if strings.Contains(err.Error(), "No such image") {
|
||||||
|
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
||||||
|
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
pullOptions := types.ImagePullOptions{}
|
|
||||||
err = deployApp(dockercli, image, identifier, env)
|
err = deployApp(dockercli, image, identifier, env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
image = fmt.Sprintf("%s/%s:%s_%s", registryName, baseimagename, strings.ToLower(action.AppName), action.AppVersion)
|
// Trying to replace with lowercase to deploy again. This seems to work with Dockerhub well.
|
||||||
|
// FIXME: Should try to remotely download directly if this persists.
|
||||||
|
image = fmt.Sprintf("%s:%s_%s", baseimagename, strings.ToLower(action.AppName), action.AppVersion)
|
||||||
if strings.Contains(image, " ") {
|
if strings.Contains(image, " ") {
|
||||||
image = strings.ReplaceAll(image, " ", "-")
|
image = strings.ReplaceAll(image, " ", "-")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = deployApp(dockercli, image, identifier, env)
|
err = deployApp(dockercli, image, identifier, env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[WARNING] Failed deploying image THRICE. Attempting to download the latter as last resort.")
|
image = fmt.Sprintf("%s/%s:%s_%s", registryName, baseimagename, strings.ToLower(action.AppName), action.AppVersion)
|
||||||
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
if strings.Contains(image, " ") {
|
||||||
if err != nil {
|
image = strings.ReplaceAll(image, " ", "-")
|
||||||
log.Printf("[ERROR] Failed getting %s. The couldn't be find locally, AND is missing.", image)
|
|
||||||
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
buildBuf := new(strings.Builder)
|
|
||||||
_, err = io.Copy(buildBuf, reader)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("[ERROR] Error in IO copy: %s", err)
|
|
||||||
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
|
||||||
} else {
|
|
||||||
if strings.Contains(buildBuf.String(), "errorDetail") {
|
|
||||||
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
|
||||||
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("[INFO] Successfully downloaded %s", image)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = deployApp(dockercli, image, identifier, env)
|
err = deployApp(dockercli, image, identifier, env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("[WARNING] Failed deploying image THRICE. Attempting to download the latter as last resort.")
|
||||||
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
||||||
if strings.Contains(err.Error(), "No such image") {
|
if err != nil {
|
||||||
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
log.Printf("[ERROR] Failed getting %s. The couldn't be find locally, AND is missing.", image)
|
||||||
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
|
||||||
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildBuf := new(strings.Builder)
|
||||||
|
_, err = io.Copy(buildBuf, reader)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Error in IO copy: %s", err)
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
} else {
|
||||||
|
if strings.Contains(buildBuf.String(), "errorDetail") {
|
||||||
|
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("[INFO] Successfully downloaded %s", image)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = deployApp(dockercli, image, identifier, env)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
||||||
|
if strings.Contains(err.Error(), "No such image") {
|
||||||
|
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
||||||
|
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
||||||
|
shutdown(workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user