Repository: qpid-dispatch Updated Branches: refs/heads/master 2cb5b7011 -> 785c5e023
DISPATCH-588 Move the auto-login code to the connect page Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/785c5e02 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/785c5e02 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/785c5e02 Branch: refs/heads/master Commit: 785c5e023084753470513d864ad42a7cae650958 Parents: 2cb5b70 Author: Ernest Allen <eal...@redhat.com> Authored: Fri Dec 2 12:24:10 2016 -0500 Committer: Ernest Allen <eal...@redhat.com> Committed: Fri Dec 2 12:24:10 2016 -0500 ---------------------------------------------------------------------- .../src/main/webapp/plugin/js/dispatchPlugin.js | 36 +++------------- console/stand-alone/plugin/js/dispatchPlugin.js | 44 ++------------------ console/stand-alone/plugin/js/qdrSettings.js | 7 ++++ 3 files changed, 17 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/785c5e02/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js ---------------------------------------------------------------------- diff --git a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js index 82a1de4..124eec0 100644 --- a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js +++ b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js @@ -214,44 +214,20 @@ var QDR = (function(QDR) { // our view viewRegistry[QDR.pluginName] = QDR.templatePath + "qdrLayout.html"; - var settings = angular.fromJson(localStorage[QDR.SETTINGS_KEY]); - QDRService.addConnectAction(function() { + QDRService.addUpdatedAction("initChartService", function() { + QDRService.delUpdatedAction("initChartService") QDRChartService.init(); // initialize charting service after we are connected }); - if (settings && settings.autostart) { - QDRService.addDisconnectAction( function () { - $location.path(QDR.pluginRoot + "/connect"); - $location.replace(); - $rootScope.$apply(); - }) - QDRService.addConnectAction(function() { - var searchObject = $location.search(); - // the redirect will be handled by QDRService when connected - if (searchObject.org) { - return; - } - if ($location.path().startsWith(QDR.pluginRoot)) { - var lastLocation = localStorage[QDR.LAST_LOCATION]; - if (!angular.isDefined(lastLocation)) - lastLocation = QDR.pluginRoot + "/overview"; - $location.path(lastLocation); - $location.replace(); - $rootScope.$apply(); - } - }); - QDRService.connect(settings); - } - - $rootScope.$on('$routeChangeSuccess', function() { - var path = $location.path(); + $rootScope.$on('$routeChangeSuccess', function() { + var path = $location.path(); if (path.startsWith(QDR.pluginRoot)) { if (path !== QDR.pluginRoot && path !== (QDR.pluginRoot + "/") && path !== (QDR.pluginRoot + "/connect")) { - localStorage[QDR.LAST_LOCATION] = path; + localStorage[QDR.LAST_LOCATION] = path; QDR.log.info("saving page changed to " + path) } } - }); + }); $rootScope.$on( "$routeChangeStart", function(event, next, current) { if (next && next.templateUrl == QDR.templatePath + "qdrConnect.html" && QDRService.connected) { http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/785c5e02/console/stand-alone/plugin/js/dispatchPlugin.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/dispatchPlugin.js b/console/stand-alone/plugin/js/dispatchPlugin.js index 5bc52b7..746fb19 100644 --- a/console/stand-alone/plugin/js/dispatchPlugin.js +++ b/console/stand-alone/plugin/js/dispatchPlugin.js @@ -179,50 +179,14 @@ var QDR = (function(QDR) { QDR.queue = d3.queue; QDRService.initProton(); - var settings = angular.fromJson(localStorage[QDR.SETTINGS_KEY]); QDRService.addUpdatedAction("initChartService", function() { QDRService.delUpdatedAction("initChartService") QDRChartService.init(); // initialize charting service after we are connected }); - if (settings && settings.autostart) { - QDRService.addDisconnectAction( function () { - $timeout(function () { - var lastLocation = localStorage[QDR.LAST_LOCATION] || "/overview"; - org = lastLocation.substr(1) - $location.path("/connect"); - $location.search('org', org) - }) - }) - QDRService.addConnectAction(function() { - QDRService.getSchema(function () { - QDR.log.debug("got schema after connection") - QDRService.addUpdatedAction("initialized", function () { - QDRService.delUpdatedAction("initialized") - QDR.log.debug("got initial topology") - $timeout(function() { - if ($location.path().startsWith(QDR.pluginRoot)) { - var searchObject = $location.search(); - var goto = "overview"; - if (searchObject.org && searchObject.org !== "connect") { - goto = searchObject.org; - } - $location.search('org', null) - $location.path(QDR.pluginRoot + "/" + goto); - } - }) - }) - QDR.log.debug("requesting a topology") - QDRService.setUpdateEntities([]) - QDRService.topology.get() - }) - }); - QDRService.connect(settings); - } else { - $timeout(function () { - $location.path('/connect') - $location.search('org', org) - }) - } + $timeout(function () { + $location.path('/connect') + $location.search('org', org) + }) $rootScope.$on('$routeChangeSuccess', function() { var path = $location.path(); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/785c5e02/console/stand-alone/plugin/js/qdrSettings.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/qdrSettings.js b/console/stand-alone/plugin/js/qdrSettings.js index e33be52..499b953 100644 --- a/console/stand-alone/plugin/js/qdrSettings.js +++ b/console/stand-alone/plugin/js/qdrSettings.js @@ -113,6 +113,13 @@ QDR.log.debug(QDR.pluginRoot + "/" + goto) QDRService.connect($scope.formEntity); } + var settings = angular.fromJson(localStorage[QDR.SETTINGS_KEY]); + if (settings && settings.autostart && !QDRService.connected) { + $scope.connectionError = false; + $scope.connecting = true; + doConnect() + } + }]); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org