Merge pull request #1297 from alixander/again
use correct keys for nested
This commit is contained in:
commit
742389f8df
2 changed files with 23 additions and 4 deletions
|
|
@ -82,7 +82,17 @@ func ReconnectEdge(g *d2graph.Graph, edgeKey string, srcKey, dstKey *string) (_
|
|||
return nil, errors.New("edgeKey must refer to an existing edge")
|
||||
}
|
||||
|
||||
edge, ok := g.Root.HasEdge(mk)
|
||||
edgeTrimCommon(mk)
|
||||
obj := g.Root
|
||||
if mk.Key != nil {
|
||||
var ok bool
|
||||
obj, ok = g.Root.HasChild(d2graph.Key(mk.Key))
|
||||
if !ok {
|
||||
return nil, errors.New("edge not found")
|
||||
}
|
||||
}
|
||||
|
||||
edge, ok := obj.HasEdge(mk)
|
||||
if !ok {
|
||||
return nil, errors.New("edge not found")
|
||||
}
|
||||
|
|
@ -1856,7 +1866,16 @@ func ReconnectEdgeIDDeltas(g *d2graph.Graph, edgeKey string, srcKey, dstKey *str
|
|||
return nil, errors.New("edgeKey must refer to an existing edge")
|
||||
}
|
||||
|
||||
edge, ok := g.Root.HasEdge(mk)
|
||||
edgeTrimCommon(mk)
|
||||
obj := g.Root
|
||||
if mk.Key != nil {
|
||||
var ok bool
|
||||
obj, ok = g.Root.HasChild(d2graph.Key(mk.Key))
|
||||
if !ok {
|
||||
return nil, errors.New("edge not found")
|
||||
}
|
||||
}
|
||||
edge, ok := obj.HasEdge(mk)
|
||||
if !ok {
|
||||
return nil, errors.New("edge not found")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1557,7 +1557,7 @@ b -> a
|
|||
name: "contained",
|
||||
text: `a.x -> a.y
|
||||
a.z`,
|
||||
edgeKey: `(a.x -> a.y)[0]`,
|
||||
edgeKey: `a.(x -> y)[0]`,
|
||||
newDst: "a.z",
|
||||
exp: `a.x -> a.z
|
||||
a.y
|
||||
|
|
@ -5667,7 +5667,7 @@ a -> b
|
|||
text: `a.x -> a.y
|
||||
a.z
|
||||
`,
|
||||
edge: "(a.x -> a.y)[0]",
|
||||
edge: "a.(x -> y)[0]",
|
||||
newDst: "a.z",
|
||||
|
||||
exp: `{
|
||||
|
|
|
|||
Loading…
Reference in a new issue