Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17152: Better alignment of Admin UI graph (#2249)

Jan Høydahl4e62f98d8c2c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f7b8018b52b..cc2ee02252f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -104,7 +104,7 @@ Optimizations
Bug Fixes
---------------------
-(No changes)
+* SOLR-17152: Better alignment of Admin UI graph (janhoy)
Dependency Upgrades
---------------------
diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js
index 70b89611614..75eef23dae5 100644
--- a/solr/webapp/web/js/angular/controllers/cloud.js
+++ b/solr/webapp/web/js/angular/controllers/cloud.js
@@ -929,18 +929,21 @@ solrAdminApp.directive('graph', function(Constants) {
return name;
};
- scope.$watch("data", function(newValue, oldValue) {
+ var drawGraph = function(newValue, oldValue) {
if (newValue) {
- flatGraph(element, scope.data, scope.leafCount);
+ flatGraph(element, scope.data, scope.leafCount);
}
$('text').tooltip({
- content: function() {
- return $(this).attr('title');
- }
+ content: function() {
+ return $(this).attr('title');
+ }
});
- });
+ };
+
+ scope.$watch("data", drawGraph);
+ window.onresize = drawGraph;
function setNodeNavigationBehavior(node, view){
node
@@ -971,7 +974,10 @@ solrAdminApp.directive('graph', function(Constants) {
var w = element.width(),
h = leafCount * 20;
- var tree = d3.layout.tree().size([h, w - 400]);
+ // Calculate roughly the width of host name to align the graph
+ var hostnameWidth = graphData.children.length > 0 ?
+ graphData.children[0].children[0].children[0].name.length * 5.5 : 400;
+ var tree = d3.layout.tree().size([h, Math.max(w - 140 - hostnameWidth, 100)]);
var diagonal = d3.svg.diagonal().projection(function (d) {
return [d.y, d.x];
@@ -982,7 +988,7 @@ solrAdminApp.directive('graph', function(Constants) {
.attr('width', w)
.attr('height', h)
.append('g')
- .attr('transform', 'translate(100, 0)');
+ .attr('transform', 'translate(10, 0)');
var nodes = tree.nodes(graphData);