workflow partial allows

This commit is contained in:
mr
2025-02-05 16:41:16 +01:00
parent a8e2445c10
commit 7201cabb43
4 changed files with 87 additions and 8 deletions

View File

@@ -9,9 +9,29 @@ import (
// Graph is a struct that represents a graph
type Graph struct {
Zoom float64 `bson:"zoom" json:"zoom" default:"1"` // Zoom is the graphical zoom of the graph
Items map[string]GraphItem `bson:"items" json:"items" default:"{}" validate:"required"` // Items is the list of elements in the graph
Links []GraphLink `bson:"links" json:"links" default:"{}" validate:"required"` // Links is the list of links between elements in the graph
Partial bool `json:"partial" default:"false"` // Partial is a flag that indicates if the graph is partial
Zoom float64 `bson:"zoom" json:"zoom" default:"1"` // Zoom is the graphical zoom of the graph
Items map[string]GraphItem `bson:"items" json:"items" default:"{}" validate:"required"` // Items is the list of elements in the graph
Links []GraphLink `bson:"links" json:"links" default:"{}" validate:"required"` // Links is the list of links between elements in the graph
}
func (g *Graph) Clear(id string) {
realItems := map[string]GraphItem{}
for k, it := range g.Items {
if k == id {
realinks := []GraphLink{}
for _, link := range g.Links {
if link.Source.ID != id && link.Destination.ID != id {
realinks = append(realinks, link)
}
}
g.Links = realinks
g.Partial = true
} else {
realItems[k] = it
}
}
g.Items = realItems
}
func (wf *Graph) IsProcessing(item GraphItem) bool {

View File

@@ -28,3 +28,11 @@ func (g *GraphItem) GetResource() (tools.DataType, resources.ResourceInterface)
}
return tools.INVALID, nil
}
func (g *GraphItem) Clear() {
g.Data = nil
g.Compute = nil
g.Workflow = nil
g.Processing = nil
g.Storage = nil
}