Explorar el Código

AMBARI-7384 Broken dashboard loaded when there's no cluster installed. (Max Shepel via ababiichuk)

aBabiichuk hace 10 años
padre
commit
19bf2a6a8f

+ 4 - 4
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();
   },

+ 1 - 0
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');
       });
     }

+ 11 - 16
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">