mirror of https://github.com/MISP/misp-dashboard
Convert node click into label click if needed
parent
90b4ad28c1
commit
154835f9eb
|
@ -234,7 +234,7 @@
|
|||
// setup onclick on link label
|
||||
if (this.options.interaction) {
|
||||
linkEnter.on("click", function(d, i) {
|
||||
that.clickLabel(d, i, this);
|
||||
that.clickLabel(d);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -333,12 +333,26 @@
|
|||
var notClicked = d.id != c_id;
|
||||
return c1 && c2;
|
||||
});
|
||||
} else {
|
||||
// check if children is leaf
|
||||
var child = clicked.data()[0].children[0];
|
||||
if (that.isObject(child) || Array.isArray(child)) {
|
||||
// First child is not a node, should highlight the label instead
|
||||
// --> simulate label click
|
||||
let source = clicked.data()[0];
|
||||
let target = clicked.data()[0].children[0];
|
||||
var resL = this.svg.selectAll("path.link").filter(function(d) {
|
||||
return d.source.id == source.id && d.target.id == target.id;
|
||||
});
|
||||
that.clickLabel(resL.data()[0]);
|
||||
return;
|
||||
} else {
|
||||
res = d3.selectAll(".node circle")
|
||||
.filter(function(d) {
|
||||
return d.parent !== null && d.parent.id == clicked.data()[0].id;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
res.data().forEach(function(elem) {
|
||||
if (elem.picked !== undefined && elem.picked != '') {
|
||||
|
@ -364,18 +378,15 @@
|
|||
this.add_instruction(instructions);
|
||||
},
|
||||
|
||||
clickLabel: function(d, i, clickedContext) {
|
||||
clickLabel: function(d) {
|
||||
var u_id = d.source.id + '-' + d.target.id;
|
||||
var l_id = '#'+u_id;
|
||||
var link_html = d3.select($(l_id));
|
||||
console.log(clickedContext);
|
||||
|
||||
var that = this;
|
||||
var o_depth = d.source.depth;
|
||||
var dest_depth = d.target.depth;
|
||||
var c_id = d.source.id;
|
||||
var c_index; // no index as the index is the label itself
|
||||
var clicked = d3.select(clickedContext);
|
||||
var itemColor = this.itemColors.get(this.currentPicking);
|
||||
|
||||
this.reset_selected();
|
||||
|
|
Loading…
Reference in New Issue