diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 1ab2376721a..ee8babec92f 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -84,6 +84,8 @@ Bug Fixes * SOLR-9237: DefaultSolrHighlighter.doHighlightingByFastVectorHighlighter can't be overidden (janhoy) +* SOLR-8626: 404 error when clicking nodes in cloud graph view in angular UI. (janhoy, Trey Grainger via shalin) + Optimizations ---------------------- diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js index cb6a50dd2fe..c150c5a21ff 100644 --- a/solr/webapp/web/js/angular/controllers/cloud.js +++ b/solr/webapp/web/js/angular/controllers/cloud.js @@ -313,6 +313,32 @@ solrAdminApp.directive('graph', function(Constants) { } }); + + function setNodeNavigationBehavior(node, view){ + node + .attr('data-href', function (d) { + if (d.type == "node"){ + return getNodeUrl(d, view); + } + else{ + return ""; + } + }) + .on('click', function(d) { + if (d.data.type == "node"){ + location.href = getNodeUrl(d, view); + } + }); + } + + function getNodeUrl(d, view){ + var url = d.name + Constants.ROOT_URL + "#/~cloud"; + if (view != undefined){ + url += "?view=" + view; + } + return url; + } + var flatGraph = function(element, graphData, leafCount) { var w = element.width(), h = leafCount * 20; @@ -358,14 +384,10 @@ solrAdminApp.directive('graph', function(Constants) { }) .attr('text-anchor', function (d) { return 0 === d.depth ? 'end' : 'start'; - }) - .attr('data-href', function (d) { - return d.name + Constants.ROOT_URL + "#/~cloud"; - }) - .text(helper_node_text) - .on('click', function(d,i) { - location.href = d.name+Constants.ROOT_URL+"#/~cloud"; - }); + }) + .text(helper_node_text); + + setNodeNavigationBehavior(node); }; var radialGraph = function(element, graphData, leafCount) { @@ -417,13 +439,9 @@ solrAdminApp.directive('graph', function(Constants) { .attr('transform', function (d) { return d.x < 180 ? null : 'rotate(180)'; }) - .attr('data-href', function (d) { - return d.name; - }) - .text(helper_node_text) - .on('click', function(d,i) { - location.href = d.name+Constants.ROOT_URL+"#/~cloud"; - }); + .text(helper_node_text); + + setNodeNavigationBehavior(node, "rgraph"); } } };