Repository: ambari
Updated Branches:
  refs/heads/trunk 5474d7961 -> 48eb11e78


AMBARI-9842. Top menu markup issue (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/48eb11e7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/48eb11e7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/48eb11e7

Branch: refs/heads/trunk
Commit: 48eb11e78d533de6a9252634bed6de4ee9a9a352
Parents: 5474d79
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Tue Mar 3 12:14:05 2015 +0200
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Tue Mar 3 12:14:05 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/app.js                    |  8 +++++
 ambari-web/app/styles/application.less   |  1 -
 ambari-web/app/templates/application.hbs | 50 ++++++++++++++-------------
 ambari-web/test/app_test.js              | 27 +++++++++++++++
 4 files changed, 61 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/48eb11e7/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index b5ca7d8..bd5090e 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -65,6 +65,14 @@ module.exports = Em.Application.create({
   }.property('upgradeState'),
 
   /**
+   * RU is running
+   * @type {boolean}
+   */
+  upgradeIsRunning: function() {
+    return this.get('upgradeInProgress') || this.get('upgradeHolding');
+  }.property('upgradeInProgress', 'upgradeHolding'),
+
+  /**
    * compute user access rights by permission type
    * types:
    *  - ADMIN

http://git-wip-us.apache.org/repos/asf/ambari/blob/48eb11e7/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less 
b/ambari-web/app/styles/application.less
index 69310e7..6b51006 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -66,7 +66,6 @@ footer {
 
 .ru-badge {
   text-align: center;
-  margin: 10px 0;
 }
 
 #top-nav, .ru-badge {

http://git-wip-us.apache.org/repos/asf/ambari/blob/48eb11e7/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs 
b/ambari-web/app/templates/application.hbs
index 12eda07..dd63a11 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -95,38 +95,40 @@
   </div>
   <div class="container main-container">
     <div id="content">
-      <div class="ru-badge span12">
-        <div class="navbar navbar-static-top clearfix">
-          <div class="span4 offset4">
-            {{#if isExistingClusterDataLoaded}}
-              <a class="brand cluster-name" href="#">
-                {{#if App.upgradeInProgress}}
-                  {{#if 
App.router.mainAdminStackAndUpgradeController.isDowngrade}}
-                    <span
-                        class="label upgrade-in-progress" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
+      {{#if App.upgradeIsRunning}}
+        <div class="ru-badge span12">
+          <div class="navbar navbar-static-top clearfix">
+            <div class="span4 offset4">
+              {{#if isExistingClusterDataLoaded}}
+                <a class="brand cluster-name" href="#">
+                  {{#if App.upgradeInProgress}}
+                    {{#if 
App.router.mainAdminStackAndUpgradeController.isDowngrade}}
+                      <span
+                          class="label upgrade-in-progress" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
                              <i class="icon-cog"></i>&nbsp;{{t 
admin.stackVersions.version.downgrade.running}}</span>
-                  {{else}}
-                    <span
-                        class="label upgrade-in-progress" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
+                    {{else}}
+                      <span
+                          class="label upgrade-in-progress" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
                              <i class="icon-cog"></i>&nbsp;{{t 
admin.stackVersions.version.upgrade.running}}</span>
+                    {{/if}}
                   {{/if}}
-                {{/if}}
-                {{#if App.upgradeHolding}}
-                  {{#if 
App.router.mainAdminStackAndUpgradeController.isDowngrade}}
-                    <span
-                        class="label upgrade-holding" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
+                  {{#if App.upgradeHolding}}
+                    {{#if 
App.router.mainAdminStackAndUpgradeController.isDowngrade}}
+                      <span
+                          class="label upgrade-holding" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
                           <i class="icon-pause"></i>&nbsp;{{t 
admin.stackVersions.version.downgrade.pause}}</span>
-                  {{else}}
-                    <span
-                        class="label upgrade-holding" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
+                    {{else}}
+                      <span
+                          class="label upgrade-holding" {{action 
"openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}>
                           <i class="icon-pause"></i>&nbsp;{{t 
admin.stackVersions.version.upgrade.pause}}</span>
+                    {{/if}}
                   {{/if}}
-                {{/if}}
-              </a>
-            {{/if}}
+                </a>
+              {{/if}}
+            </div>
           </div>
         </div>
-      </div>
+      {{/if}}
       {{outlet}}
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48eb11e7/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 8f6a30a..9a2a0f6 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -529,4 +529,31 @@ describe('App', function () {
 
   });
 
+  describe('#upgradeIsRunning', function () {
+
+    Em.A([
+        {
+          upgradeState: 'IN_PROGRESS',
+          m: 'should be true (1)',
+          e: true
+        },
+        {
+          upgradeState: 'HOLDING',
+          m: 'should be true (2)',
+          e: true
+        },
+        {
+          upgradeState: 'FAKE',
+          m: 'should be false',
+          e: false
+        }
+      ]).forEach(function (test) {
+        it(test.m, function () {
+          App.set('upgradeState', test.upgradeState);
+          expect(App.get('upgradeIsRunning')).to.equal(test.e);
+        });
+      });
+
+  });
+
 });

Reply via email to