Skip to content

Commit fb975ae

Browse files
committed
additional detail added to node tooltips
1 parent 71bae33 commit fb975ae

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

utils/viz/viz.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package viz
66

77
import (
8+
"encoding/json"
9+
"fmt"
810
"strings"
911
"time"
1012

@@ -214,11 +216,17 @@ func newNode(db repository.Repository, idx int, a *types.Entity, since time.Time
214216
parts := []string{v.BuildingNumber, v.StreetName, v.City, v.Province, v.PostalCode}
215217
key = strings.Join(parts, " ")
216218
case *org.Organization:
217-
key = "Name: " + v.Name
219+
key = fmt.Sprintf("%s, %s", v.Name, v.ID)
218220
case *oamcert.TLSCertificate:
219-
key = "x509 Common Name: " + v.SubjectCommonName
221+
key = fmt.Sprintf("%s, %s", v.SubjectCommonName, v.SerialNumber)
220222
}
221-
title := atype + ": " + key
223+
224+
// JSON pretty-print indentation applied to the asset
225+
jsonBytes, err := json.MarshalIndent(asset, "", " ")
226+
if err != nil {
227+
return nil
228+
}
229+
title := fmt.Sprintf("%s\n%s", atype+": "+key, string(jsonBytes))
222230

223231
return &Node{
224232
ID: idx,

0 commit comments

Comments
 (0)