From a4a0362aae6cbd08cbbd6bfeef2117361f4704af Mon Sep 17 00:00:00 2001 From: Junghyun Kim Date: Fri, 31 Mar 2017 08:47:27 +0900 Subject: [PATCH] NEW FEATURE: packages build-triggered transitively This feature finds all packages build triggered by a package transitively. This means this feature finds all packages that can be built if a package is changed. Change-Id: I302285d693b56ff98a80e8d8527081c7bd06c452 Signed-off-by: Junghyun Kim --- common/dep_graph.php.template | 4 ++++ dep_graph/dep_graph_common.js | 55 +++++++++++++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/common/dep_graph.php.template b/common/dep_graph.php.template index 19894a6..c19641a 100644 --- a/common/dep_graph.php.template +++ b/common/dep_graph.php.template @@ -90,6 +90,10 @@ Packages build-triggered by this package + + Packages build-triggered transitively by this package + +
diff --git a/dep_graph/dep_graph_common.js b/dep_graph/dep_graph_common.js index e137546..87edfbd 100644 --- a/dep_graph/dep_graph_common.js +++ b/dep_graph/dep_graph_common.js @@ -172,6 +172,32 @@ function neighbourhoodHighlight(params) { highlightNode(params.nodes); } +function getAllPackagesBuildTriggered(node) { + var connectedNodes = network.getConnectedNodes(node); + var allPackages = {}; + + for( var i = 0; i < connectedNodes.length; ++i ) { + + if( allNodes[connectedNodes[i]].level < allNodes[node].level ) + continue; + + var label = allNodes[connectedNodes[i]].label; + + if( label === undefined ) { + label = allNodes[connectedNodes[i]].hiddenLabel; + } + allPackages[label] = 1; + + var nextPackages = getAllPackagesBuildTriggered(connectedNodes[i]); + + for(var j in nextPackages) { + allPackages[j] = 1; + } + } + + return allPackages; +} + function highlightNode(nodes) { // if something is selected: @@ -224,10 +250,8 @@ function highlightNode(nodes) // } // } - var packages_build_triggers=""; - var packages_build_triggered=""; - var packages_build_triggers_count=0; - var packages_build_triggered_count=0; + var packages_build_triggers=[]; + var packages_build_triggered=[]; // all first degree nodes get their own color and their label back for (i = 0; i < connectedNodes.length; i++) { if( allNodes[connectedNodes[i]].set_color === undefined ) { @@ -241,11 +265,9 @@ function highlightNode(nodes) allNodes[connectedNodes[i]].hiddenLabel = undefined; if( allNodes[selectedNode].level <= allNodes[connectedNodes[i]].level ) { - packages_build_triggered = packages_build_triggered+allNodes[connectedNodes[i]].label+","; - packages_build_triggered_count++; + packages_build_triggered.push(allNodes[connectedNodes[i]].label); } else { - packages_build_triggers = packages_build_triggers+allNodes[connectedNodes[i]].label+","; - packages_build_triggers_count++; + packages_build_triggers.push(allNodes[connectedNodes[i]].label); } } } @@ -269,12 +291,21 @@ function highlightNode(nodes) if( document.getElementById("build_triggers") ) { // set table contents. document.getElementById("build_triggers").innerHTML="Packages build-triggers "+ - allNodes[selectedNode].label+"("+packages_build_triggers_count+")"; - document.getElementById("packages_build_triggers").innerHTML=packages_build_triggers; + allNodes[selectedNode].label+"("+packages_build_triggers.length+")"; + document.getElementById("packages_build_triggers").innerHTML=packages_build_triggers.join(); document.getElementById("build_triggered").innerHTML="Packages build-triggered by "+ - allNodes[selectedNode].label+"("+packages_build_triggered_count+")"; - document.getElementById("packages_build_triggered").innerHTML=packages_build_triggered; + allNodes[selectedNode].label+"("+packages_build_triggered.length+")"; + document.getElementById("packages_build_triggered").innerHTML=packages_build_triggered.join(); } + + if( document.getElementById("build_triggered_transitively") ) { + var all_packages_build_triggered = Object.keys(getAllPackagesBuildTriggered(selectedNode)); + + document.getElementById("build_triggered_transitively").innerHTML="Packages build-triggered transitively by "+ + allNodes[selectedNode].label+"("+all_packages_build_triggered.length+")"; + document.getElementById("packages_build_triggered_transitively").innerHTML = all_packages_build_triggered.join(); + } + } else if (highlightActive === true) { // reset all nodes -- 2.7.4