Repository: qpid-dispatch Updated Branches: refs/heads/master 8b1b7b979 -> d281644e7
DISPATCH-271 When GET-MGMT-NODES returns an empty list, use receiver's source address to derive the current router ID Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d281644e Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d281644e Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d281644e Branch: refs/heads/master Commit: d281644e74565ae61b0366e8d3f557ed0ceb2705 Parents: 8b1b7b9 Author: Ernest Allen <eal...@redhat.com> Authored: Wed Apr 13 14:04:48 2016 -0400 Committer: Ernest Allen <eal...@redhat.com> Committed: Wed Apr 13 14:04:48 2016 -0400 ---------------------------------------------------------------------- .../hawtio/src/main/webapp/plugin/js/qdrList.js | 13 +++--- .../src/main/webapp/plugin/js/qdrService.js | 42 +++++--------------- 2 files changed, 19 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d281644e/console/hawtio/src/main/webapp/plugin/js/qdrList.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrList.js b/console/hawtio/src/main/webapp/plugin/js/qdrList.js index 2c69a1c..601acf5 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrList.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrList.js @@ -97,11 +97,6 @@ var QDR = (function(QDR) { $scope.selectMode = function (mode) { $scope.currentMode = mode; if (mode.id === 'log') { - var ops = lookupOperations(); - if (ops.indexOf("LOG") == -1) { - $scope.currentMode = $scope.modes[0] - return; - } $scope.logResults = "getting recent log entries..."; QDRService.sendMethod($scope.currentNode.id, $scope.selectedEntity, {}, $scope.currentMode.op, function (nodeName, entity, response, context) { $scope.logResults = response.filter( function (entry) { @@ -407,7 +402,15 @@ var QDR = (function(QDR) { $scope.tableRows = []; var selectedRowIndex = 0; + + /* Called periodically to refresh the data on the page */ var updateTableData = function (entity, expand) { + if (!QDRService.connected) { + // we are no longer connected. bail back to the connect page + $location.path("/dispatch_plugin/connect") + $location.search('org', "list"); + return; + } // don't update the data when on the operations tab if ($scope.currentMode.id === 'operations') { return; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d281644e/console/hawtio/src/main/webapp/plugin/js/qdrService.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrService.js b/console/hawtio/src/main/webapp/plugin/js/qdrService.js index d944d92..c46e7ad 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrService.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrService.js @@ -288,10 +288,18 @@ var QDR = (function(QDR) { // get the list of nodes to query. // once this completes, we will get the info for each node returned - self.getRemoteNodeInfo( function (response) { + self.getRemoteNodeInfo( function (response, context) { //QDR.log.debug("got remote node list of "); //console.dump(response); if( Object.prototype.toString.call( response ) === '[object Array]' ) { + if (response.length === 0) { + // there is only one router, get its node id from the reeciiver + //"amqp:/_topo/0/Router.A/temp.aSO3+WGaoNUgGVx" + var address = context.receiver.remote.attach.source.address; + var addrParts = address.split('/') + addrParts.splice(addrParts.length-1, 1, '$management') + response = [addrParts.join('/')] + } // we expect a response for each of these nodes self.topology.wait(self.timeout); for (var i=0; i<response.length; ++i) { @@ -394,34 +402,6 @@ var QDR = (function(QDR) { if (this._expected[id].indexOf(key) == -1) this._expected[id].push(key); }, -/* -The response looks like: -{ - ".router": { - "results": [ - [4, "router/QDR.X", 1, "0", 3, 60, 60, 11, "QDR.X", 30, "interior", "org.apache.qpid.dispatch.router", 5, 12, "router/QDR.X"] - ], - "attributeNames": ["raIntervalFlux", "name", "helloInterval", "area", "helloMaxAge", "mobileAddrMaxAge", "remoteLsMaxAge", "addrCount", "routerId", "raInterval", "mode", "type", "nodeCount", "linkCount", "identity"] - }, - ".connection": { - "results": [ - ["QDR.B", "connection/0.0.0.0:20002", "operational", "0.0.0.0:20002", "inter-router", "connection/0.0.0.0:20002", "ANONYMOUS", "org.apache.qpid.dispatch.connection", "out"], - ["QDR.A", "connection/0.0.0.0:20001", "operational", "0.0.0.0:20001", "inter-router", "connection/0.0.0.0:20001", "ANONYMOUS", "org.apache.qpid.dispatch.connection", "out"], - ["b2de2f8c-ef4a-4415-9a23-000c2f86e85d", "connection/localhost:33669", "operational", "localhost:33669", "normal", "connection/localhost:33669", "ANONYMOUS", "org.apache.qpid.dispatch.connection", "in"] - ], - "attributeNames": ["container", "name", "state", "host", "role", "identity", "sasl", "type", "dir"] - }, - ".router.node": { - "results": [ - ["QDR.A", null], - ["QDR.B", null], - ["QDR.C", "QDR.A"], - ["QDR.D", "QDR.A"], - ["QDR.Y", "QDR.A"] - ], - "attributeNames": ["routerId", "nextHop"] - } -}*/ ondone: function () { clearTimeout(this.timerHandle); this._gettingTopo = false; @@ -464,8 +444,8 @@ The response looks like: // first get the list of remote node names self.correlator.request( ret = self.sendMgmtQuery('GET-MGMT-NODES') - ).then(ret.id, function(response) { - callback(response); + ).then(ret.id, function(response, context) { + callback(response, context); self.topology.cleanUp(response); }, ret.error); }, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org