multipart file over os.file
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"mime/multipart"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -69,10 +69,11 @@ func (d *Workflow) GetResources(dt tools.DataType) []resources.ResourceInterface
|
||||
return itf
|
||||
}
|
||||
|
||||
func (d *Workflow) ExtractFromPlantUML(plantUML *os.File, request *tools.APIRequest) (*Workflow, error) {
|
||||
func (d *Workflow) ExtractFromPlantUML(plantUML multipart.File, request *tools.APIRequest) (*Workflow, error) {
|
||||
if plantUML == nil {
|
||||
return d, errors.New("no file available to export")
|
||||
}
|
||||
|
||||
defer plantUML.Close()
|
||||
|
||||
d.Datas = []string{}
|
||||
@@ -482,18 +483,18 @@ func (wf *Workflow) Planify(start time.Time, end *time.Time, request *tools.APIR
|
||||
return longest, priceds, wf, nil
|
||||
}
|
||||
|
||||
// Returns a map of DataType (processing,computing,data,storage,worfklow) where each resource (identified by its UUID)
|
||||
// Returns a map of DataType (processing,computing,data,storage,worfklow) where each resource (identified by its UUID)
|
||||
// is mapped to the list of its items (different appearance) in the graph
|
||||
// ex: if the same Minio storage is represented by several nodes in the graph, in [tools.STORAGE_RESSOURCE] its UUID will be mapped to
|
||||
// the list of GraphItem ID that correspond to the ID of each node
|
||||
func (w *Workflow) GetItemsByResources() (map[tools.DataType]map[string][]string) {
|
||||
// the list of GraphItem ID that correspond to the ID of each node
|
||||
func (w *Workflow) GetItemsByResources() map[tools.DataType]map[string][]string {
|
||||
res := make(map[tools.DataType]map[string][]string)
|
||||
dtMethodMap := map[tools.DataType]func() []graph.GraphItem{
|
||||
tools.STORAGE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsStorage) },
|
||||
tools.DATA_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsData) },
|
||||
tools.COMPUTE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsCompute) },
|
||||
tools.PROCESSING_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsProcessing) },
|
||||
tools.WORKFLOW_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsWorkflow) },
|
||||
tools.STORAGE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsStorage) },
|
||||
tools.DATA_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsData) },
|
||||
tools.COMPUTE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsCompute) },
|
||||
tools.PROCESSING_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsProcessing) },
|
||||
tools.WORKFLOW_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsWorkflow) },
|
||||
}
|
||||
|
||||
for dt, meth := range dtMethodMap {
|
||||
@@ -502,7 +503,7 @@ func (w *Workflow) GetItemsByResources() (map[tools.DataType]map[string][]string
|
||||
for _, i := range items {
|
||||
_, r := i.GetResource()
|
||||
rId := r.GetID()
|
||||
res[dt][rId] = append(res[dt][rId],i.ID)
|
||||
res[dt][rId] = append(res[dt][rId], i.ID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user