adding inputs output struct based on argo naming for now
This commit is contained in:
		@@ -17,6 +17,7 @@ import (
 | 
				
			|||||||
	"cloud.o-forge.io/core/oc-lib/models"
 | 
						"cloud.o-forge.io/core/oc-lib/models"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/collaborative_area"
 | 
						"cloud.o-forge.io/core/oc-lib/models/collaborative_area"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
 | 
						"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
 | 
				
			||||||
 | 
						mm "cloud.o-forge.io/core/oc-lib/models/common/models"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/order"
 | 
						"cloud.o-forge.io/core/oc-lib/models/order"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/peer"
 | 
						"cloud.o-forge.io/core/oc-lib/models/peer"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/resources"
 | 
						"cloud.o-forge.io/core/oc-lib/models/resources"
 | 
				
			||||||
@@ -206,13 +207,19 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
 | 
				
			|||||||
	for _, model := range []string{tools.DATA_RESOURCE.String(), tools.PROCESSING_RESOURCE.String(), tools.STORAGE_RESOURCE.String(), tools.COMPUTE_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} {
 | 
						for _, model := range []string{tools.DATA_RESOURCE.String(), tools.PROCESSING_RESOURCE.String(), tools.STORAGE_RESOURCE.String(), tools.COMPUTE_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} {
 | 
				
			||||||
		data, code, _ := accessor.Search(nil, model, true)
 | 
							data, code, _ := accessor.Search(nil, model, true)
 | 
				
			||||||
		if code == 404 || len(data) == 0 {
 | 
							if code == 404 || len(data) == 0 {
 | 
				
			||||||
			refs := map[string]string{}
 | 
								var modelref map[string]map[string]resource_model.Model
 | 
				
			||||||
			m := map[string]resource_model.Model{}
 | 
								outputs := []mm.Param{}
 | 
				
			||||||
			// for now only processing is specified here (not an elegant way)
 | 
								// for now only processing is specified here (not an elegant way)
 | 
				
			||||||
			if model == tools.DATA_RESOURCE.String() || model == tools.STORAGE_RESOURCE.String() {
 | 
								if model == tools.DATA_RESOURCE.String() || model == tools.STORAGE_RESOURCE.String() {
 | 
				
			||||||
				refs["path"] = "string"
 | 
									outputs = []mm.Param{
 | 
				
			||||||
 | 
										mm.Param{
 | 
				
			||||||
 | 
											Attr:     "source",
 | 
				
			||||||
 | 
											Readonly: true,
 | 
				
			||||||
 | 
										},
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if model == tools.PROCESSING_RESOURCE.String() {
 | 
								if model == tools.PROCESSING_RESOURCE.String() {
 | 
				
			||||||
 | 
									m := map[string]resource_model.Model{}
 | 
				
			||||||
				m["command"] = resource_model.Model{
 | 
									m["command"] = resource_model.Model{
 | 
				
			||||||
					Type:     "string",
 | 
										Type:     "string",
 | 
				
			||||||
					ReadOnly: false,
 | 
										ReadOnly: false,
 | 
				
			||||||
@@ -229,13 +236,15 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
 | 
				
			|||||||
					Type:     "map[string]string",
 | 
										Type:     "map[string]string",
 | 
				
			||||||
					ReadOnly: false,
 | 
										ReadOnly: false,
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									modelref = map[string]map[string]resource_model.Model{
 | 
				
			||||||
 | 
										"container": m,
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			accessor.StoreOne(&resource_model.ResourceModel{
 | 
								accessor.StoreOne(&resource_model.ResourceModel{
 | 
				
			||||||
				ResourceType: model,
 | 
									ResourceType: model,
 | 
				
			||||||
				VarRefs:      refs,
 | 
									Outputs:      outputs,
 | 
				
			||||||
				Model: map[string]map[string]resource_model.Model{
 | 
									Model:        modelref,
 | 
				
			||||||
					"container": m,
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package resource_model
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"cloud.o-forge.io/core/oc-lib/models/common/models"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/models/utils"
 | 
						"cloud.o-forge.io/core/oc-lib/models/utils"
 | 
				
			||||||
	"cloud.o-forge.io/core/oc-lib/tools"
 | 
						"cloud.o-forge.io/core/oc-lib/tools"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -21,8 +22,8 @@ type ResourceModel struct {
 | 
				
			|||||||
	utils.AbstractObject
 | 
						utils.AbstractObject
 | 
				
			||||||
	ResourceType string                      `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
 | 
						ResourceType string                      `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
 | 
				
			||||||
	Model        map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
 | 
						Model        map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
 | 
				
			||||||
	Inputs       []string                    `json:"inputs,omitempty" bson:"inputs,omitempty"`
 | 
						Inputs       []models.Param              `json:"inputs,omitempty" bson:"inputs,omitempty"`
 | 
				
			||||||
	Outputs      []string                    `json:"outputs,omitempty" bson:"outputs,omitempty"`
 | 
						Outputs      []models.Param              `json:"outputs,omitempty" bson:"outputs,omitempty"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (d *ResourceModel) StoreDraftDefault() {
 | 
					func (d *ResourceModel) StoreDraftDefault() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user