Repository: ambari Updated Branches: refs/heads/trunk 79692547b -> 360662ed6
AMBARI-5191 UI get broken when routing to nonexistent host or service. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/360662ed Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/360662ed Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/360662ed Branch: refs/heads/trunk Commit: 360662ed6ccfd4c0d4f30b32cb713b6290b8d993 Parents: 7969254 Author: atkach <[email protected]> Authored: Tue Mar 25 13:49:21 2014 +0200 Committer: atkach <[email protected]> Committed: Tue Mar 25 13:49:21 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/routes/main.js | 10 +++++++--- ambari-web/app/views/main/host/details.js | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/360662ed/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 53d19cb..2b766ab 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -607,7 +607,7 @@ module.exports = Em.Route.extend({ var controller = router.get('mainController'); controller.dataLoading().done(function () { var service = router.get('mainServiceItemController.content'); - if (!service) { + if (!service || !service.get('isLoaded')) { service = App.Service.find().objectAt(0); // getting the first service to display } router.transitionTo('service.summary', service); @@ -631,8 +631,12 @@ module.exports = Em.Route.extend({ route: '/summary', connectOutlets: function (router, context) { var item = router.get('mainServiceItemController.content'); - var viewName = 'mainServiceInfoSummary'; - router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary', item); + //if service is not existed then route to default service + if (item.get('isLoaded')) { + router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary', item); + } else { + router.transitionTo('services.index'); + } } }), metrics: Em.Route.extend({ http://git-wip-us.apache.org/repos/asf/ambari/blob/360662ed/ambari-web/app/views/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js index a278630..5a01b92 100644 --- a/ambari-web/app/views/main/host/details.js +++ b/ambari-web/app/views/main/host/details.js @@ -40,6 +40,11 @@ App.MainHostDetailsView = Em.View.extend({ {action: 'deleteHost', liClass:'', cssClass: 'icon-remove', 'label': this.t('hosts.host.details.deleteHost')}]; }.property('controller.content','isActive', 'controller.content.isNotHeartBeating'), didInsertElement: function() { + //if host is not existed then route to list of hosts + if (!this.get('content.isLoaded')) { + App.router.transitionTo('main.hosts.index'); + return; + } App.tooltip($("[rel='HealthTooltip']")); } });
