correct is DC link

This commit is contained in:
mr 2024-08-20 14:59:06 +02:00
parent f599131708
commit b6d9b6910f

View File

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"slices"
"strings" "strings"
"time" "time"
@ -25,10 +24,10 @@ type AbstractWorkflow struct {
} }
func (w *AbstractWorkflow) isDCLink(link graph.GraphLink) (bool, string) { func (w *AbstractWorkflow) isDCLink(link graph.GraphLink) (bool, string) {
if slices.Contains(w.Datacenters, link.Source.ID) { if d, ok := w.Graph.Items[link.Source.ID]; ok && d.Datacenter != nil {
return true, link.Source.ID return true, link.Source.ID
} }
if slices.Contains(w.Datacenters, link.Destination.ID) { if d, ok := w.Graph.Items[link.Destination.ID]; ok && d.Datacenter != nil {
return true, link.Destination.ID return true, link.Destination.ID
} }
return false, "" return false, ""