ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [45/50] [abbrv] ambari git commit: AMBARI-21499 Move Stack-Specific Custom Actions Under the Stack Dropdown. (atkach)
Date Tue, 18 Jul 2017 15:03:21 GMT
AMBARI-21499 Move Stack-Specific Custom Actions Under the Stack Dropdown. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 15349983ed14804b83f99281b344a2339dcbf8c8
Parents: 1e09ad0
Author: Andrii Tkach <atkach@apache.org>
Authored: Mon Jul 17 19:38:04 2017 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Mon Jul 17 19:38:04 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  | 22 ++++++++++
 .../main/admin/stack_upgrade/versions.hbs       |  9 +---
 .../stack_upgrade/upgrade_version_box_view.js   | 11 ++++-
 .../main/admin/stack_upgrade/versions_view.js   | 26 -----------
 .../admin/stack_and_upgrade_controller_test.js  | 19 ++++++++
 .../admin/stack_upgrade/version_view_test.js    | 46 --------------------
 6 files changed, 52 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index db4df7f..8527e29 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1431,6 +1431,28 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     });
   },
 
+  removeIopSelect: function() {
+    return App.showConfirmationPopup(function () {
+      App.ajax.send({
+        name: 'admin.stack_versions.removeIopSelect',
+        sender: this,
+        data: {
+          hosts: App.get('allHostNames').join(',')
+        }
+      }).fail(function(xhr) {
+        App.ModalPopup.show({
+          header: Em.I18n.t('admin.stackVersions.removeIopSelect.fail'),
+          secondary: false,
+          bodyClass: App.AjaxDefaultErrorPopupBodyView.extend({
+            type: 'POST',
+            status: xhr.status,
+            message: xhr.responseText
+          })
+        });
+      });
+    });
+  },
+
   /**
    * sends request to install repoVersion to the cluster
    * and create clusterStackVersion resourse

http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/app/templates/main/admin/stack_upgrade/versions.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/versions.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/versions.hbs
index b7fac72..c185f10 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/versions.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/versions.hbs
@@ -40,13 +40,6 @@
       {{/each}}
     </ul>
   </div>
-  {{#isAuthorized "AMBARI.MANAGE_STACK_VERSIONS"}}
-    {{#if view.showRemoveIopSelect}}
-      <button class="btn btn-danger pull-right" {{action removeIopSelect target="view"}}
id="remove-iop-select">
-        {{t admin.stackVersions.removeIopSelect}}
-      </button>
-    {{/if}}
-  {{/isAuthorized}}
 </div>
 <div id="versions-section" class="row-fluid">
   <div class="span2 left-menu-table">
@@ -75,4 +68,4 @@
       {{view App.SpinnerView}}
     {{/if}}
   </div>
-</div>
\ No newline at end of file
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 46ef020..956339f 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -195,6 +195,13 @@ App.UpgradeVersionBoxView = Em.View.extend({
             action: 'installRepoVersionConfirmation',
             isDisabled: isDisabled
           });
+          if (App.get('currentStackName') === 'BigInsights' && !App.get('upgradeIsRunning'))
{
+            element.get('buttons').pushObject({
+              text: Em.I18n.t('admin.stackVersions.removeIopSelect'),
+              action: 'removeIopSelect',
+              isDisabled: isDisabled
+            });
+          }
         }
         element.set('isDisabled', isDisabled);
       }
@@ -241,7 +248,9 @@ App.UpgradeVersionBoxView = Em.View.extend({
     'isUpgrading',
     'controller.requestInProgress',
     'controller.requestInProgressRepoId',
-    'parentView.repoVersions.@each.status'
+    'parentView.repoVersions.@each.status',
+    'App.currentStackName',
+    'App.upgradeIsRunning'
   ),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
index 699ee5f..c87cb81 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
@@ -243,32 +243,6 @@ App.MainAdminStackVersionsView = Em.View.extend({
         self.doPolling();
       });
     }
-  },
-
-  showRemoveIopSelect: function() {
-    return App.get('currentStackName') === 'BigInsights' && !App.get('upgradeIsRunning');
-  }.property('App.currentStackName', 'App.upgradeIsRunning'),
-
-  removeIopSelect: function() {
-    return App.showConfirmationPopup(function () {
-      App.ajax.send({
-        name: 'admin.stack_versions.removeIopSelect',
-        sender: this,
-        data: {
-          hosts: App.get('allHostNames').join(',')
-        }
-      }).fail(function(xhr) {
-        App.ModalPopup.show({
-          header: Em.I18n.t('admin.stackVersions.removeIopSelect.fail'),
-          secondary: false,
-          bodyClass: App.AjaxDefaultErrorPopupBodyView.extend({
-            type: 'POST',
-            status: xhr.status,
-            message: xhr.responseText
-          })
-        });
-      });
-    });
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 2098fd6..c346c6f 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -3400,4 +3400,23 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
   });
 
+  describe('#removeIopSelect', function() {
+    beforeEach(function() {
+      sinon.stub(App, 'showConfirmationPopup', Em.clb);
+      sinon.stub(App, 'showAlertPopup');
+      sinon.stub(App.ModalPopup, 'show');
+    });
+    afterEach(function() {
+      App.showConfirmationPopup.restore();
+      App.showAlertPopup.restore();
+      App.ModalPopup.show.restore();
+    });
+
+    it('App.ajax.send should be called', function() {
+      controller.removeIopSelect();
+      var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.removeIopSelect');
+      expect(args[0]).exists;
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/15349983/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
index 6da0a19..cf9906f 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
@@ -485,50 +485,4 @@ describe('App.mainAdminStackVersionsView', function () {
       expect(view.get('controller').load.called).to.be.false;
     });
   });
-
-  describe('#showRemoveIopSelect', function() {
-    beforeEach(function() {
-      this.mockApp = sinon.stub(App, 'get');
-    });
-    afterEach(function() {
-      this.mockApp.restore();
-    });
-
-    it('should be true when BigInsights stack and upgrade not running', function() {
-      this.mockApp.withArgs('currentStackName').returns('BigInsights');
-      this.mockApp.withArgs('upgradeIsRunning').returns(false);
-      expect(view.get('showRemoveIopSelect')).to.be.true;
-    });
-
-    it('should be false when BigInsights stack and upgrade running', function() {
-      this.mockApp.withArgs('currentStackName').returns('BigInsights');
-      this.mockApp.withArgs('upgradeIsRunning').returns(true);
-      expect(view.get('showRemoveIopSelect')).to.be.false;
-    });
-
-    it('should be false when HDP stack and upgrade not running', function() {
-      this.mockApp.withArgs('currentStackName').returns('HDP');
-      this.mockApp.withArgs('upgradeIsRunning').returns(false);
-      expect(view.get('showRemoveIopSelect')).to.be.false;
-    });
-  });
-
-  describe('#removeIopSelect', function() {
-    beforeEach(function() {
-      sinon.stub(App, 'showConfirmationPopup', Em.clb);
-      sinon.stub(App, 'showAlertPopup');
-      sinon.stub(App.ModalPopup, 'show');
-    });
-    afterEach(function() {
-      App.showConfirmationPopup.restore();
-      App.showAlertPopup.restore();
-      App.ModalPopup.show.restore();
-    });
-
-    it('App.ajax.send should be called', function() {
-      view.removeIopSelect();
-      var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.removeIopSelect');
-      expect(args[0]).exists;
-    });
-  });
 });


Mime
View raw message