Fix graphPath loop

Remove self-referential ACL rels
master
Rohan Vazarkar 2018-03-07 16:26:49 -05:00
parent 3355c3564d
commit 26214533a7
2 changed files with 14 additions and 15 deletions

View File

@ -665,10 +665,6 @@ export default class GraphContainer extends Component {
initializeSigma(){
var sigmaInstance, design;
sigma.classes.graph.addMethod('outNeighbors', function (id) {
return this.outNeighborsIndex.get(id).keyList();
});
sigmaInstance = new sigma(
{
container: 'graph'
@ -712,11 +708,11 @@ export default class GraphContainer extends Component {
sigmaInstance.bind('hovers', function(e){
if (e.data.enter.nodes.length > 0) {
if (appStore.endNode !== null) {
findGraphPath(this.state.sigmaInstance, false, e.data.enter.nodes[0].id);
findGraphPath(this.state.sigmaInstance, false, e.data.enter.nodes[0].id, []);
}
if (appStore.startNode !== null) {
findGraphPath(this.state.sigmaInstance, true, e.data.enter.nodes[0].id);
findGraphPath(this.state.sigmaInstance, true, e.data.enter.nodes[0].id, []);
}
sigmaInstance.refresh({'skipIndexation': true});

View File

@ -14,8 +14,9 @@ export function generateUniqueId(sigmaInstance, isNode) {
}
//Recursive function to highlight paths to start/end nodes
export function findGraphPath(sigmaInstance, reverse, nodeid) {
var target = reverse ? appStore.startNode : appStore.endNode;
export function findGraphPath(sigmaInstance, reverse, nodeid, traversed) {
let target = reverse ? appStore.startNode : appStore.endNode;
traversed.push(nodeid);
//This is our stop condition for recursing
if (nodeid !== target.id) {
var edges = sigmaInstance.graph.adjacentEdges(nodeid);
@ -27,10 +28,10 @@ export function findGraphPath(sigmaInstance, reverse, nodeid) {
//If an edge is pointing in the right direction, set its color
//Push the edge into our store and then
node = parseInt(node);
if (check === node) {
if (check === node && !traversed.includes(node)) {
edge.color = reverse ? 'blue' : 'red';
appStore.highlightedEdges.push(edge);
findGraphPath(sigmaInstance, reverse, node);
findGraphPath(sigmaInstance, reverse, node, traversed);
}
});
});
@ -237,7 +238,6 @@ export function buildGplinkProps(rows){
};
}
});
console.log(datadict)
return datadict;
}
@ -247,6 +247,9 @@ export function buildACLProps(rows) {
$.each(rows, function(index, row) {
var b = row.ObjectName.toUpperCase();
var a = row.PrincipalName.toUpperCase();
if (a === b){
return;
}
var btype = row.ObjectType.toTitleCase();
var atype = row.PrincipalType.toTitleCase();
var rel = row.ActiveDirectoryRights;