workflow partial allows
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user