ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-19877. Confirmation for deleting services show serviceName and not displayName (onechiporenko)
Date Mon, 06 Feb 2017 13:40:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 13f8f96b3 -> 9f2d1d9b6


AMBARI-19877. Confirmation for deleting services show serviceName and not displayName (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 9f2d1d9b6ef7019919e4a6fd1bd80569eaf4e97b
Parents: 13f8f96
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Mon Feb 6 13:57:39 2017 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Mon Feb 6 15:37:57 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 15 ++++--
 .../test/controllers/main/service/item_test.js  | 54 ++++++++++++++++++--
 2 files changed, 62 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9f2d1d9b/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 9758ac3..7010ab5 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1531,10 +1531,17 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   },
 
   confirmServiceDeletion: function() {
-    var progressPopup = this.get('deleteServiceProgressPopup'),
-      msg = this.get('interDependentServices.length')
-        ? Em.I18n.t('services.service.delete.service.success.confirmation.plural').format(this.get('serviceNamesToDelete').join(','))
-        : Em.I18n.t('services.service.delete.service.success.confirmation').format(this.get('content.serviceName'));
+    let serviceNames, msg;
+    if (this.get('interDependentServices.length')) {
+      serviceNames = this.get('serviceNamesToDelete').map(serviceName => App.format.role(serviceName,
true)).join(', ');
+      msg = Em.I18n.t('services.service.delete.service.success.confirmation.plural').format(serviceNames);
+    }
+    else {
+      serviceNames = App.format.role(this.get('content.serviceName'), true);
+      msg = Em.I18n.t('services.service.delete.service.success.confirmation').format(serviceNames);
+    }
+
+    var progressPopup = this.get('deleteServiceProgressPopup');
     if (progressPopup) {
       progressPopup.onClose();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9f2d1d9b/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index b582e86..302a9a5 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -28,7 +28,7 @@ require('controllers/main/service/reassign_controller');
 require('controllers/main/service/item');
 var batchUtils = require('utils/batch_scheduled_requests');
 var testHelpers = require('test/helpers');
-var stackSerivceModel = {
+var stackServiceModel = {
   'HDFS': Em.Object.create({
     serviceName: 'HDFS',
     requiredServices: ['ZOOKEEPER']
@@ -1352,7 +1352,7 @@ describe('App.MainServiceItemController', function () {
     beforeEach(function() {
       mainServiceItemController = App.MainServiceItemController.create({});
       sinon.stub(App.StackService, 'find', function (serviceName) {
-        return stackSerivceModel[serviceName];
+        return stackServiceModel[serviceName];
       });
       this.mockService = sinon.stub(App.Service, 'find');
     });
@@ -1644,7 +1644,7 @@ describe('App.MainServiceItemController', function () {
 
     beforeEach(function() {
       sinon.stub(App.StackService, 'find', function (serviceName) {
-        return stackSerivceModel[serviceName];
+        return stackServiceModel[serviceName];
       });
       mainServiceItemController = App.MainServiceItemController.create({
         content: {}
@@ -1802,6 +1802,54 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
+  describe('#confirmServiceDeletion', function () {
+
+    var mainServiceItemController = App.MainServiceItemController.create({deleteServiceProgressPopup:
null});
+
+    [
+      {
+        content: Em.Object.create({serviceName: 'DRUID'}),
+        stackServices: [
+          Em.Object.create({id: 'DRUID', displayName: 'Druid', serviceName: 'DRUID', requiredServices:
[]})
+        ],
+        m: 'No required services',
+        e: Em.I18n.t('services.service.delete.service.success.confirmation').format('Druid')
+      },
+      {
+        content: Em.Object.create({serviceName: 'MAPREDUCE2'}),
+        stackServices: [
+          Em.Object.create({id: 'MAPREDUCE2', serviceName: 'MAPREDUCE2', requiredServices:
['YARN'], displayName: 'MapReduce2'}),
+          Em.Object.create({id: 'YARN', serviceName: 'YARN', requiredServices: ['MAPREDUCE2'],
displayName: 'YARN'}),
+        ],
+        m: 'One required service',
+        e: Em.I18n.t('services.service.delete.service.success.confirmation.plural').format('MapReduce2,
YARN')
+      }
+    ].forEach(function(test) {
+      describe(test.m, function () {
+
+        beforeEach(function () {
+          sinon.stub(App.StackService, 'find', function (id) {
+            return arguments.length ? test.stackServices.findProperty('id', id) : test.stackServices;
+          });
+          sinon.spy(App, 'showAlertPopup');
+          mainServiceItemController.set('content', test.content);
+          mainServiceItemController.confirmServiceDeletion();
+        });
+
+        afterEach(function () {
+          App.StackService.find.restore();
+          App.showAlertPopup.restore();
+        });
+
+        it('Popup body has display service names', function () {
+          expect(App.showAlertPopup.args[0][1]).to.be.equal(test.e);
+        });
+
+      });
+    });
+
+  });
+
   describe("#isRangerPluginEnabled()", function () {
     var mainServiceItemController;
 


Mime
View raw message