multipart file over os.file

This commit is contained in:
mr
2026-01-12 14:26:29 +01:00
parent 27f295f17e
commit be770ec763

View File

@@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"os" "mime/multipart"
"strings" "strings"
"time" "time"
@@ -69,10 +69,11 @@ func (d *Workflow) GetResources(dt tools.DataType) []resources.ResourceInterface
return itf 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 { if plantUML == nil {
return d, errors.New("no file available to export") return d, errors.New("no file available to export")
} }
defer plantUML.Close() defer plantUML.Close()
d.Datas = []string{} d.Datas = []string{}
@@ -486,7 +487,7 @@ func (wf *Workflow) Planify(start time.Time, end *time.Time, request *tools.APIR
// is mapped to the list of its items (different appearance) in the graph // 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 // 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 // the list of GraphItem ID that correspond to the ID of each node
func (w *Workflow) GetItemsByResources() (map[tools.DataType]map[string][]string) { func (w *Workflow) GetItemsByResources() map[tools.DataType]map[string][]string {
res := make(map[tools.DataType]map[string][]string) res := make(map[tools.DataType]map[string][]string)
dtMethodMap := map[tools.DataType]func() []graph.GraphItem{ dtMethodMap := map[tools.DataType]func() []graph.GraphItem{
tools.STORAGE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsStorage) }, tools.STORAGE_RESOURCE: func() []graph.GraphItem { return w.GetGraphItems(w.Graph.IsStorage) },
@@ -502,7 +503,7 @@ func (w *Workflow) GetItemsByResources() (map[tools.DataType]map[string][]string
for _, i := range items { for _, i := range items {
_, r := i.GetResource() _, r := i.GetResource()
rId := r.GetID() rId := r.GetID()
res[dt][rId] = append(res[dt][rId],i.ID) res[dt][rId] = append(res[dt][rId], i.ID)
} }
} }