debug service + dynamic
This commit is contained in:
@@ -13,10 +13,10 @@ type ResourceSet struct {
|
|||||||
Workflows []string `bson:"workflows,omitempty" json:"workflows,omitempty"`
|
Workflows []string `bson:"workflows,omitempty" json:"workflows,omitempty"`
|
||||||
NativeTool []string `bson:"native,omitempty" json:"native,omitempty"`
|
NativeTool []string `bson:"native,omitempty" json:"native,omitempty"`
|
||||||
Services []string `bson:"services,omitempty" json:"services,omitempty"`
|
Services []string `bson:"services,omitempty" json:"services,omitempty"`
|
||||||
|
Dynamics []string `bson:"dynamics,omitempty" json:"dynamics,omitempty"`
|
||||||
|
|
||||||
// DynamicResources are stored inline — no DB collection, resolved at runtime via SetAllowedInstances.
|
// DynamicResources are stored inline — no DB collection, resolved at runtime via SetAllowedInstances.
|
||||||
DynamicResources []*DynamicResource `bson:"dynamic_resources,omitempty" json:"dynamic_resources,omitempty"`
|
DynamicResources []*DynamicResource `bson:"-" json:"dynamic_resources,omitempty"`
|
||||||
|
|
||||||
DataResources []*DataResource `bson:"-" json:"data_resources,omitempty"`
|
DataResources []*DataResource `bson:"-" json:"data_resources,omitempty"`
|
||||||
StorageResources []*StorageResource `bson:"-" json:"storage_resources,omitempty"`
|
StorageResources []*StorageResource `bson:"-" json:"storage_resources,omitempty"`
|
||||||
ProcessingResources []*ProcessingResource `bson:"-" json:"processing_resources,omitempty"`
|
ProcessingResources []*ProcessingResource `bson:"-" json:"processing_resources,omitempty"`
|
||||||
@@ -33,6 +33,7 @@ func (r *ResourceSet) Clear() {
|
|||||||
r.ComputeResources = nil
|
r.ComputeResources = nil
|
||||||
r.WorkflowResources = nil
|
r.WorkflowResources = nil
|
||||||
r.ServiceResources = nil
|
r.ServiceResources = nil
|
||||||
|
r.DynamicResources = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
||||||
@@ -44,6 +45,7 @@ func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
|||||||
(&ProcessingResource{}): r.Processings,
|
(&ProcessingResource{}): r.Processings,
|
||||||
(&WorkflowResource{}): r.Workflows,
|
(&WorkflowResource{}): r.Workflows,
|
||||||
(&ServiceResource{}): r.Services,
|
(&ServiceResource{}): r.Services,
|
||||||
|
(&DynamicResource{}): r.Dynamics,
|
||||||
} {
|
} {
|
||||||
for _, id := range v {
|
for _, id := range v {
|
||||||
d, _, e := k.GetAccessor(request).LoadOne(id)
|
d, _, e := k.GetAccessor(request).LoadOne(id)
|
||||||
@@ -61,6 +63,8 @@ func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
|||||||
r.WorkflowResources = append(r.WorkflowResources, d.(*WorkflowResource))
|
r.WorkflowResources = append(r.WorkflowResources, d.(*WorkflowResource))
|
||||||
case *ServiceResource:
|
case *ServiceResource:
|
||||||
r.ServiceResources = append(r.ServiceResources, d.(*ServiceResource))
|
r.ServiceResources = append(r.ServiceResources, d.(*ServiceResource))
|
||||||
|
case *DynamicResource:
|
||||||
|
r.DynamicResources = append(r.DynamicResources, d.(*DynamicResource))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,13 @@ func (d *Workflow) GetResources(dt tools.DataType) []resources.ResourceInterface
|
|||||||
itf = append(itf, d)
|
itf = append(itf, d)
|
||||||
}
|
}
|
||||||
return itf
|
return itf
|
||||||
|
case tools.DYNAMIC_RESOURCE:
|
||||||
|
for _, d := range d.DynamicResources {
|
||||||
|
itf = append(itf, d)
|
||||||
|
}
|
||||||
|
return itf
|
||||||
}
|
}
|
||||||
|
|
||||||
return itf
|
return itf
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,12 +119,16 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
|||||||
d.Processings = []string{}
|
d.Processings = []string{}
|
||||||
d.Computes = []string{}
|
d.Computes = []string{}
|
||||||
d.Workflows = []string{}
|
d.Workflows = []string{}
|
||||||
|
d.Dynamics = []string{}
|
||||||
|
d.Services = []string{}
|
||||||
|
|
||||||
d.DataResources = []*resources.DataResource{}
|
d.DataResources = []*resources.DataResource{}
|
||||||
d.StorageResources = []*resources.StorageResource{}
|
d.StorageResources = []*resources.StorageResource{}
|
||||||
d.ProcessingResources = []*resources.ProcessingResource{}
|
d.ProcessingResources = []*resources.ProcessingResource{}
|
||||||
d.ComputeResources = []*resources.ComputeResource{}
|
d.ComputeResources = []*resources.ComputeResource{}
|
||||||
d.WorkflowResources = []*resources.WorkflowResource{}
|
d.WorkflowResources = []*resources.WorkflowResource{}
|
||||||
|
d.DynamicResources = []*resources.DynamicResource{}
|
||||||
|
d.ServiceResources = []*resources.ServiceResource{}
|
||||||
|
|
||||||
d.Graph = graph.NewGraph()
|
d.Graph = graph.NewGraph()
|
||||||
resourceCatalog := map[string]func() resources.ResourceInterface{
|
resourceCatalog := map[string]func() resources.ResourceInterface{
|
||||||
@@ -150,6 +160,16 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Service": func() resources.ResourceInterface {
|
||||||
|
return &resources.ServiceResource{
|
||||||
|
AbstractInstanciatedResource: resources.AbstractInstanciatedResource[*resources.ServiceInstance]{
|
||||||
|
Instances: []*resources.ServiceInstance{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Dynamic": func() resources.ResourceInterface {
|
||||||
|
return &resources.DynamicResource{}
|
||||||
|
},
|
||||||
// WorkflowEvent creates a NativeTool of Kind=WORKFLOW_EVENT directly,
|
// WorkflowEvent creates a NativeTool of Kind=WORKFLOW_EVENT directly,
|
||||||
// without DB lookup. It has no user-defined instance.
|
// without DB lookup. It has no user-defined instance.
|
||||||
"WorkflowEvent": func() resources.ResourceInterface {
|
"WorkflowEvent": func() resources.ResourceInterface {
|
||||||
@@ -239,6 +259,8 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
|||||||
d.generateResource(d.GetResources(tools.STORAGE_RESOURCE), request)
|
d.generateResource(d.GetResources(tools.STORAGE_RESOURCE), request)
|
||||||
d.generateResource(d.GetResources(tools.COMPUTE_RESOURCE), request)
|
d.generateResource(d.GetResources(tools.COMPUTE_RESOURCE), request)
|
||||||
d.generateResource(d.GetResources(tools.WORKFLOW_RESOURCE), request)
|
d.generateResource(d.GetResources(tools.WORKFLOW_RESOURCE), request)
|
||||||
|
d.generateResource(d.GetResources(tools.SERVICE_RESOURCE), request)
|
||||||
|
d.generateResource(d.GetResources(tools.DYNAMIC_RESOURCE), request)
|
||||||
d.Graph.Items = graphVarName
|
d.Graph.Items = graphVarName
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
@@ -417,6 +439,14 @@ func (d *Workflow) getNewGraphItem(dataName string, resource resources.ResourceI
|
|||||||
d.Processings = append(d.Processings, resource.GetID())
|
d.Processings = append(d.Processings, resource.GetID())
|
||||||
d.ProcessingResources = append(d.ProcessingResources, resource.(*resources.ProcessingResource))
|
d.ProcessingResources = append(d.ProcessingResources, resource.(*resources.ProcessingResource))
|
||||||
graphItem.Processing = resource.(*resources.ProcessingResource)
|
graphItem.Processing = resource.(*resources.ProcessingResource)
|
||||||
|
case "Service":
|
||||||
|
d.Services = append(d.Services, resource.GetID())
|
||||||
|
d.ServiceResources = append(d.ServiceResources, resource.(*resources.ServiceResource))
|
||||||
|
graphItem.Service = resource.(*resources.ServiceResource)
|
||||||
|
case "Dynamic":
|
||||||
|
d.Dynamics = append(d.Dynamics, resource.GetID())
|
||||||
|
d.DynamicResources = append(d.DynamicResources, resource.(*resources.DynamicResource))
|
||||||
|
graphItem.Dynamic = resource.(*resources.DynamicResource)
|
||||||
case "WorkflowEvent":
|
case "WorkflowEvent":
|
||||||
// The resource is already a *NativeTool with Kind=WORKFLOW_EVENT set by the
|
// The resource is already a *NativeTool with Kind=WORKFLOW_EVENT set by the
|
||||||
// catalog factory. We use it directly without any DB lookup.
|
// catalog factory. We use it directly without any DB lookup.
|
||||||
@@ -448,6 +478,8 @@ func (d *Workflow) getNewInstance(dataName string, name string, peerID string) r
|
|||||||
return resources.NewStorageResourceInstance(name, peerID)
|
return resources.NewStorageResourceInstance(name, peerID)
|
||||||
case "ComputeUnit":
|
case "ComputeUnit":
|
||||||
return resources.NewComputeResourceInstance(name, peerID)
|
return resources.NewComputeResourceInstance(name, peerID)
|
||||||
|
case "Service":
|
||||||
|
return resources.NewServiceInstance(name, peerID)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -821,6 +853,7 @@ func (w *Workflow) GetItemsByResources() map[tools.DataType]map[string][]string
|
|||||||
tools.PROCESSING_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsProcessing) },
|
tools.PROCESSING_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsProcessing) },
|
||||||
tools.SERVICE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsService) },
|
tools.SERVICE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsService) },
|
||||||
tools.WORKFLOW_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsWorkflow) },
|
tools.WORKFLOW_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsWorkflow) },
|
||||||
|
tools.DYNAMIC_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsDynamic) },
|
||||||
}
|
}
|
||||||
|
|
||||||
for dt, meth := range dtMethodMap {
|
for dt, meth := range dtMethodMap {
|
||||||
|
|||||||
Reference in New Issue
Block a user