Skip to content

Commit

Permalink
Visually identify outer nodes in graph with blue
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Jun 7, 2024
1 parent 7b16762 commit 39b8b5f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
11 changes: 11 additions & 0 deletions modules/analyze/analyzeobjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,17 @@ func AnalyzeObjects(opts AnalyzeObjectsOptions) AnalysisResults {

}

// Mark outer nodes for graph visualization
var outernodes []*engine.Object
if opts.Direction == engine.In {
outernodes = pg.StartingNodes()
} else {
outernodes = pg.EndingNodes()
}
for _, node := range outernodes {
pg.SetNodeData(node, "source", true)
}

ui.Info().Msgf("Graph query resulted in %v nodes", pg.Order())

pg.Nodes() // Trigger cleanup, important otherwise they get readded below
Expand Down
3 changes: 3 additions & 0 deletions modules/analyze/export-graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func GenerateCytoscapeJS(pg graph.Graph[*engine.Object, engine.EdgeBitmap], alld
if df["target"] == true {
newnode.Data["_querytarget"] = true
}
if df["source"] == true {
newnode.Data["_querysource"] = true
}
if df["canexpand"] != 0 {
newnode.Data["_canexpand"] = df["canexpand"]
}
Expand Down
34 changes: 32 additions & 2 deletions modules/analyze/html/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ cytostyle = [{
selector: "node.source",
style: {
"border-color": "green",
"border-width": 2
"border-width": 3
}
},
{
Expand Down Expand Up @@ -445,7 +445,15 @@ cytostyle = [{
{
selector: "node[?_querytarget]",
style: {
"background-color": "red"
"border-color": "red",
"border-width": 3,
}
},
{
selector: "node[?_querysource]",
style: {
"border-color": "blue",
"border-width": 3,
}
},
{
Expand Down Expand Up @@ -682,6 +690,28 @@ function rendernode(ele) {
return s
}

// Object with values from AD and possibly other places
function rendercard(data) {
var result = "<div>"
if (data.attributes["type"]) {

}
for (var attr in data.attributes) {
result += "<tr><td>" + attr + "</td><td>"
attrvalues = data.attributes[attr]
for (var i in attrvalues) {
if ($("#graphlabels").val() == "randomize") {
result += anonymizer.anonymize(attrvalues[i]) + "</br>";
} else {
result += attrvalues[i] + "</br>";
}
}
result += "</td></tr>"
}
result += "</table>"
return result
}

// Object with values from AD and possibly other places
function renderdetails(data) {
var result = "<table>"
Expand Down

0 comments on commit 39b8b5f

Please sign in to comment.