Properly implemented default environment
This commit is contained in:
@@ -1240,11 +1240,16 @@ func setNewWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
workflowapps, err := getAllWorkflowApps(ctx)
|
workflowapps, err := getAllWorkflowApps(ctx)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// FIXME: Add real env
|
// FIXME: Add real env
|
||||||
//q := datastore.NewQuery("Environments").Limit(1)
|
envName := "Shuffle"
|
||||||
//count, err := dbclient.Get(ctx, q)
|
environments, err := getEnvironments(ctx)
|
||||||
//envName := "Shuffle"
|
if err == nil {
|
||||||
//if err == nil {
|
for _, env := range environments {
|
||||||
//}
|
if env.Default {
|
||||||
|
envName = env.Name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, item := range workflowapps {
|
for _, item := range workflowapps {
|
||||||
if item.Name == "Testing" && item.AppVersion == "1.0.0" {
|
if item.Name == "Testing" && item.AppVersion == "1.0.0" {
|
||||||
@@ -1253,7 +1258,7 @@ func setNewWorkflow(resp http.ResponseWriter, request *http.Request) {
|
|||||||
newActions = append(newActions, Action{
|
newActions = append(newActions, Action{
|
||||||
Label: "Start node",
|
Label: "Start node",
|
||||||
Name: "hello_world",
|
Name: "hello_world",
|
||||||
Environment: "Shuffle",
|
Environment: envName,
|
||||||
Parameters: []WorkflowAppActionParameter{},
|
Parameters: []WorkflowAppActionParameter{},
|
||||||
Position: struct {
|
Position: struct {
|
||||||
X float64 "json:\"x\" datastore:\"x\""
|
X float64 "json:\"x\" datastore:\"x\""
|
||||||
@@ -3104,6 +3109,18 @@ func getWorkflow(ctx context.Context, id string) (*Workflow, error) {
|
|||||||
return workflow, nil
|
return workflow, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getEnvironments(ctx context.Context) ([]Environment, error) {
|
||||||
|
var environments []Environment
|
||||||
|
q := datastore.NewQuery("Environments")
|
||||||
|
|
||||||
|
_, err := dbclient.GetAll(ctx, q, &environments)
|
||||||
|
if err != nil {
|
||||||
|
return []Environment{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return environments, nil
|
||||||
|
}
|
||||||
|
|
||||||
func getAllWorkflows(ctx context.Context) ([]Workflow, error) {
|
func getAllWorkflows(ctx context.Context) ([]Workflow, error) {
|
||||||
var allworkflows []Workflow
|
var allworkflows []Workflow
|
||||||
q := datastore.NewQuery("workflow")
|
q := datastore.NewQuery("workflow")
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -476,7 +476,7 @@ const Workflows = (props) => {
|
|||||||
var results = data.results.length
|
var results = data.results.length
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Paper square style={paperAppStyle} onClick={() => {
|
<Paper key={data.id} square style={paperAppStyle} onClick={() => {
|
||||||
setSelectedExecution(data)
|
setSelectedExecution(data)
|
||||||
}}>
|
}}>
|
||||||
<div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", width: boxWidth, backgroundColor: boxColor}} />
|
<div style={{marginLeft: "10px", marginTop: "5px", marginBottom: "5px", width: boxWidth, backgroundColor: boxColor}} />
|
||||||
@@ -851,7 +851,7 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modalView = modalOpen ?
|
const modalView = modalOpen ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={modalOpen}
|
open={modalOpen}
|
||||||
onClose={() => {setModalOpen(false)}}
|
onClose={() => {setModalOpen(false)}}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
@@ -1090,7 +1090,7 @@ const Workflows = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const workflowDownloadModalOpen = loadWorkflowsModalOpen ?
|
const workflowDownloadModalOpen = loadWorkflowsModalOpen ?
|
||||||
<Dialog modal
|
<Dialog
|
||||||
open={loadWorkflowsModalOpen}
|
open={loadWorkflowsModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user