Setup
This commit is contained in:
@@ -132,6 +132,7 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
||||
},
|
||||
"ComputeUnit": func() resources.ResourceInterface {
|
||||
return &resources.ComputeResource{
|
||||
|
||||
AbstractInstanciatedResource: resources.AbstractInstanciatedResource[*resources.ComputeResourceInstance]{
|
||||
Instances: []*resources.ComputeResourceInstance{},
|
||||
},
|
||||
@@ -146,6 +147,7 @@ func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.A
|
||||
for n, new := range resourceCatalog {
|
||||
if strings.Contains(line, n+"(") && !strings.Contains(line, "!procedure") { // should exclude declaration of type.
|
||||
newRes := new()
|
||||
newRes.SetID(uuid.New().String())
|
||||
varName, graphItem, err := d.extractResourcePlantUML(line, newRes, n, request.PeerID)
|
||||
fmt.Println(varName, graphItem, err)
|
||||
if err != nil {
|
||||
@@ -231,11 +233,10 @@ func (d *Workflow) extractLink(line string, graphVarName map[string]*graph.Graph
|
||||
link.Source = tmp
|
||||
}
|
||||
splittedComments := strings.Split(line, "'")
|
||||
if len(splittedComments) <= 1 {
|
||||
return errors.New("Can't deserialize Object, there's no commentary")
|
||||
}
|
||||
if len(splittedComments) > 1 {
|
||||
comment := strings.ReplaceAll(splittedComments[1], "'", "") // for now it's a json.
|
||||
json.Unmarshal([]byte(comment), link)
|
||||
}
|
||||
d.Graph.Links = append(d.Graph.Links, *link)
|
||||
return nil
|
||||
}
|
||||
@@ -257,7 +258,7 @@ func (d *Workflow) extractResourcePlantUML(line string, resource resources.Resou
|
||||
if len(splitted) <= 1 {
|
||||
return "", nil, errors.New("Can't deserialize Object, there's no name")
|
||||
}
|
||||
resource.SetName(splitted[1])
|
||||
resource.SetName(strings.ReplaceAll(splitted[1], "\\\\n", ""))
|
||||
|
||||
splittedComments := strings.Split(line, "'")
|
||||
if len(splittedComments) > 1 {
|
||||
@@ -291,12 +292,10 @@ func (d *Workflow) getNewGraphItem(dataName string, resource resources.ResourceI
|
||||
case "Data":
|
||||
d.Datas = append(d.Datas, resource.GetID())
|
||||
d.DataResources = append(d.DataResources, resource.(*resources.DataResource))
|
||||
fmt.Println("r", graphItem, resource)
|
||||
graphItem.Data = resource.(*resources.DataResource)
|
||||
case "Processing":
|
||||
d.Processings = append(d.Processings, resource.GetID())
|
||||
d.ProcessingResources = append(d.ProcessingResources, resource.(*resources.ProcessingResource))
|
||||
fmt.Println("r", graphItem, resource)
|
||||
graphItem.Processing = resource.(*resources.ProcessingResource)
|
||||
case "Event":
|
||||
access := resources.NewAccessor[*resources.NativeTool](tools.NATIVE_TOOL, &tools.APIRequest{
|
||||
@@ -310,12 +309,10 @@ func (d *Workflow) getNewGraphItem(dataName string, resource resources.ResourceI
|
||||
case "Storage":
|
||||
d.Storages = append(d.Storages, resource.GetID())
|
||||
d.StorageResources = append(d.StorageResources, resource.(*resources.StorageResource))
|
||||
fmt.Println("r", graphItem, resource)
|
||||
graphItem.Storage = resource.(*resources.StorageResource)
|
||||
case "ComputeUnit":
|
||||
d.Computes = append(d.Computes, resource.GetID())
|
||||
d.ComputeResources = append(d.ComputeResources, resource.(*resources.ComputeResource))
|
||||
fmt.Println("r", graphItem, resource)
|
||||
graphItem.Compute = resource.(*resources.ComputeResource)
|
||||
default:
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user