Repository: qpid-dispatch Updated Branches: refs/heads/master 52b2d8d46 -> 6e559d779
DISPATCH-456 Console: Redirect to connect page when connection is dropped Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6e559d77 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6e559d77 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6e559d77 Branch: refs/heads/master Commit: 6e559d7798aed114a9447e63609617d99d6c5cd1 Parents: 52b2d8d Author: Ernest Allen <[email protected]> Authored: Fri Jul 22 13:59:11 2016 -0400 Committer: Ernest Allen <[email protected]> Committed: Fri Jul 22 13:59:11 2016 -0400 ---------------------------------------------------------------------- .../hawtio/src/main/webapp/plugin/js/qdrList.js | 8 +++-- .../src/main/webapp/plugin/js/qdrOverview.js | 8 +++-- .../src/main/webapp/plugin/js/qdrSchema.js | 10 +++--- .../src/main/webapp/plugin/js/qdrService.js | 37 ++++++++++++++++---- .../src/main/webapp/plugin/js/qdrSettings.js | 6 ---- .../src/main/webapp/plugin/js/qdrTopology.js | 9 +++-- 6 files changed, 54 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/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 d4a81b1..092fbb8 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrList.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrList.js @@ -34,10 +34,14 @@ var QDR = (function(QDR) { $scope.details = {}; if (!QDRService.connected) { // we are not connected. we probably got here from a bookmark or manual page reload - $location.path("/dispatch_plugin/connect") - $location.search('org', "list"); + QDRService.redirectWhenConnected("list"); return; } + // we are currently connected. setup a handler to get notified if we are ever disconnected + QDRService.addDisconnectAction( function () { + QDRService.redirectWhenConnected("list") + $scope.$apply(); + }) $scope.selectedEntity = localStorage['QDRSelectedEntity']; $scope.selectedNode = localStorage['QDRSelectedNode']; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/console/hawtio/src/main/webapp/plugin/js/qdrOverview.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrOverview.js b/console/hawtio/src/main/webapp/plugin/js/qdrOverview.js index 7262f32..be2fe64 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrOverview.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrOverview.js @@ -1137,10 +1137,14 @@ $scope.linksGrid.ngGrid.rowFactory.aggCache[rowIndex].toggleExpand(); $scope.template = {url: ''}; if (!QDRService.connected) { - // we are not connected. we probably got here from a bookmark or manual page reload - $location.path("/dispatch_plugin/connect") + QDRService.redirectWhenConnected("overview") return; } + // we are currently connected. setup a handler to get notified if we are ever disconnected + QDRService.addDisconnectAction( function () { + QDRService.redirectWhenConnected("overview") + $scope.$apply(); + }) /* -------------------------------------------------- * http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js b/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js index 33a27f3..656b159 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrSchema.js @@ -23,12 +23,14 @@ var QDR = (function (QDR) { QDR.module.controller("QDR.SchemaController", ['$scope', '$location', 'QDRService', function($scope, $location, QDRService) { if (!QDRService.connected) { - // we are not connected. we probably got here from a bookmark or manual page reload - $location.path("/dispatch_plugin/connect") - $location.search('org', "schema"); - + QDRService.redirectWhenConnected("schema") return; } + // we are currently connected. setup a handler to get notified if we are ever disconnected + QDRService.addDisconnectAction( function () { + QDRService.redirectWhenConnected("schema") + $scope.$apply(); + }) var keys2kids = function (tree, obj) { http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/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 2a8aaad..d053de9 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrService.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrService.js @@ -23,7 +23,7 @@ var QDR = (function(QDR) { // The QDR service handles the connection to // the server in the background - QDR.module.factory("QDRService", ['$rootScope', '$http', '$resource', '$location', function($rootScope, $http, $resource, $location) { + QDR.module.factory("QDRService", ['$rootScope', '$http', '$timeout', '$resource', '$location', function($rootScope, $http, $timeout, $resource, $location) { var self = { rhea: require("rhea"), @@ -57,21 +57,45 @@ var QDR = (function(QDR) { executeConnectActions: function() { self.connectActions.forEach(function(action) { //QDR.log.debug("executing connect action " + action); - action.apply(); + try { + action.apply(); + } catch (e) { + // in case the page that registered the handler has been unloaded + } }); self.connectActions = []; + $timeout( function () { + var searchObject = $location.search(); + var goto = "overview"; + if (searchObject.org) { + goto = searchObject.org; + } + $location.search('org', null) + $location.path(QDR.pluginRoot +"/" + goto); + }) + }, executeDisconnectActions: function() { self.disconnectActions.forEach(function(action) { - action.apply(); + try { + action.apply(); + } catch (e) { + // in case the page that registered the handler has been unloaded + } }); self.disconnectActions = []; }, executeUpdatedActions: function() { for (action in self.updatedActions) { - self.updatedActions[action].apply(); + try { + self.updatedActions[action].apply(); + } catch (e) {} } }, + redirectWhenConnected: function (org) { + $location.path("/" + QDR.pluginName + "/connect") + $location.search('org', org); + }, notifyTopologyDone: function() { //QDR.log.debug("got Toplogy done notice"); @@ -150,7 +174,6 @@ var QDR = (function(QDR) { onSubscription: function() { self.getSchema(); - self.topology.get(); }, startUpdating: function () { @@ -446,7 +469,6 @@ var QDR = (function(QDR) { //this.miniDump(); //this.dump(); self.notifyTopologyDone(); - }, dump: function (prefix) { if (prefix) @@ -607,7 +629,7 @@ var QDR = (function(QDR) { } } self.schema = response; - self.notifyTopologyDone(); + self.topology.get(); }, ret.error); }, @@ -768,6 +790,7 @@ var QDR = (function(QDR) { self.sender = null; self.receiver = null; self.sendable = false; + self.gotTopology = false; } var maybeStart = function () { if (okay.connection && okay.sender && okay.receiver && self.sendable && !self.connected) { http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/console/hawtio/src/main/webapp/plugin/js/qdrSettings.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrSettings.js b/console/hawtio/src/main/webapp/plugin/js/qdrSettings.js index ac9c111..e81463a 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrSettings.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrSettings.js @@ -82,12 +82,6 @@ var QDR = (function (QDR) { //QDR.log.debug("got connection notification"); $timeout( function () { $scope.connecting = false; - var searchObject = $location.search(); - var goto = "overview"; - if (searchObject.org) { - goto = searchObject.org; - } - $location.path(QDR.pluginRoot +"/" + goto); }) }); QDRService.connect($scope.formEntity); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6e559d77/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js index 5388391..2def8f4 100644 --- a/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js +++ b/console/hawtio/src/main/webapp/plugin/js/qdrTopology.js @@ -94,10 +94,14 @@ var QDR = (function (QDR) { if (!QDRService.connected) { // we are not connected. we probably got here from a bookmark or manual page reload - $location.path("/dispatch_plugin/connect") - $location.search('org', "topology"); + QDRService.redirectWhenConnected("topology"); return; } + // we are currently connected. setup a handler to get notified if we are ever disconnected + QDRService.addDisconnectAction( function () { + QDRService.redirectWhenConnected("topology"); + $scope.$apply(); + }) QDR.log.debug("started QDR.TopologyController with urlPrefix: " + $location.absUrl()); var urlPrefix = $location.absUrl(); @@ -483,7 +487,6 @@ var QDR = (function (QDR) { getLink(parent, nodes.length-1, dir); client++; } else { - normalsParent[nodeType].normals.push(node) } } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
