AMBARI-7384 Broken dashboard loaded when there's no cluster installed. (Max Shepel via ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/19bf2a6a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/19bf2a6a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/19bf2a6a Branch: refs/heads/branch-alerts-dev Commit: 19bf2a6a8f81e6a336cbf2617326065c36dc9dbd Parents: 38a1812 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Thu Sep 18 15:53:08 2014 +0300 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Thu Sep 18 15:53:08 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/application.js | 8 ++++---- ambari-web/app/routes/installer.js | 1 + ambari-web/app/templates/application.hbs | 27 +++++++++++--------------- 3 files changed, 16 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/19bf2a6a/ambari-web/app/controllers/application.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js index ed5e3c8..8706fff 100644 --- a/ambari-web/app/controllers/application.js +++ b/ambari-web/app/controllers/application.js @@ -23,10 +23,6 @@ App.ApplicationController = Em.Controller.extend(App.UserPref, { name: 'applicationController', - clusterExists: function() { - return !Em.isNone(App.router.get('clusterController.clusterName')); - }.property('App.router.clusterController.clusterName'), - clusterName: function () { return (App.router.get('clusterController.clusterName') || 'My Cluster'); }.property('App.router.clusterController.clusterName'), @@ -47,6 +43,10 @@ App.ApplicationController = Em.Controller.extend(App.UserPref, { return App.router.get('clusterController.isLoaded') && App.router.get('loggedIn'); }.property('App.router.clusterController.isLoaded','App.router.loggedIn'), + isExistingClusterDataLoaded: function () { + return !Em.isNone(App.router.get('clusterController.clusterName')) && this.get('isClusterDataLoaded'); + }.property('App.router.clusterController.clusterName', 'isClusterDataLoaded'), + init: function(){ this._super(); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/19bf2a6a/ambari-web/app/routes/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js index a414ff4..2a081ea 100644 --- a/ambari-web/app/routes/installer.js +++ b/ambari-web/app/routes/installer.js @@ -439,6 +439,7 @@ module.exports = Em.Route.extend({ controller.setClusterProvisioningState('INSTALLED', function () { // We need to do recovery based on whether we are in Add Host or Installer wizard controller.saveClusterState('DEFAULT'); + App.router.set('clusterController.isLoaded', false); router.transitionTo('main.dashboard.index'); }); } http://git-wip-us.apache.org/repos/asf/ambari/blob/19bf2a6a/ambari-web/app/templates/application.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs index 6401500..3e1b303 100644 --- a/ambari-web/app/templates/application.hbs +++ b/ambari-web/app/templates/application.hbs @@ -21,29 +21,24 @@ <div class="navbar navbar-static-top"> <div class="navbar-inner"> <div class="container main-container"> - {{#if isClusterDataLoaded}} + {{#if isExistingClusterDataLoaded}} <a {{translateAttr href="topnav.logo.href"}} class="logo"><img src="/img/logo-white.png" alt="Apache Ambari" title="Apache Ambari"></a> <a class="brand" {{translateAttr href="topnav.logo.href"}} title="Apache Ambari">{{t app.name}}</a> + <a class="brand cluster-name" href="javascript:void(null);" {{bindAttr title="clusterName"}}> + <span {{action "showPopup" target="App.router.backgroundOperationsController"}} >{{clusterDisplayName}} </span> + {{#with App.router.backgroundOperationsController}} + {{#if allOperationsCount}} + <i class="icon-caret-left ops-count"></i><span class="label operations-count" {{action "showPopup" target="App.router.backgroundOperationsController"}}> {{allOperationsCount}} {{t ops}}</span> + {{else}} + <i class="icon-caret-left"></i><span class="label" {{action "showPopup" target="App.router.backgroundOperationsController"}}>{{allOperationsCount}} {{t ops}}</span> + {{/if}} + {{/with}} + </a> {{else}} <a class="logo"><img src="/img/logo-white.png" alt="Apache Ambari" title="Apache Ambari"></a> <a class="brand" title="Apache Ambari">{{t app.name}}</a> {{/if}} - {{#if isClusterDataLoaded}} - {{#if clusterExists}} - <a class="brand cluster-name" href="javascript:void(null);" {{bindAttr title="clusterName"}}> - <span {{action "showPopup" target="App.router.backgroundOperationsController"}} >{{clusterDisplayName}} </span> - {{#with App.router.backgroundOperationsController}} - {{#if allOperationsCount}} - <i class="icon-caret-left ops-count"></i><span class="label operations-count" {{action "showPopup" target="App.router.backgroundOperationsController"}}> {{allOperationsCount}} {{t ops}}</span> - {{else}} - <i class="icon-caret-left"></i><span class="label" {{action "showPopup" target="App.router.backgroundOperationsController"}}>{{allOperationsCount}} {{t ops}}</span> - {{/if}} - {{/with}} - </a> - {{/if}} - {{/if}} - {{#if App.router.loggedIn}} <div class="top-nav-user btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown">