You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2016/03/24 10:51:00 UTC

ambari git commit: AMBARI-15532 ambari-web allows to delete a service that has running processes. (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 7242a8e51 -> 751e69209


AMBARI-15532 ambari-web allows to delete a service that has running processes. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 751e69209bbe4857c51997e076417afeaae73883
Parents: 7242a8e
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed Mar 23 16:07:46 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Mar 24 11:50:07 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js |  6 ++----
 ambari-web/app/messages.js                      |  2 +-
 ambari-web/app/models/client_component.js       |  9 +++++++++
 ambari-web/app/models/service.js                | 12 ++++++++++++
 4 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/751e6920/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 5290b2c..124fb0a 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -1082,11 +1082,9 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
    * @param serviceNames
    */
   allowUninstallServices: function(serviceNames) {
-    return !App.Service.find().filter(function (service) {
+    return App.Service.find().filter(function (service) {
       return serviceNames.contains(service.get('serviceName'));
-    }).mapProperty('workStatus').some(function (workStatus) {
-      return !App.Service.allowUninstallStates.contains(workStatus);
-    });
+    }).everyProperty('allowToDelete');
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/751e6920/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 4fa6ba5..b2bd456 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1742,7 +1742,7 @@ Em.I18n.translations = {
   'services.service.delete.configVersionNote.plural': 'Update configs after {0} have been removed',
   'services.service.delete.lastService.popup.body': 'The <b>{0}</b> service can\'t be deleted, at least one service must be installed.',
   'services.service.delete.popup.dependentServices': 'Prior to deleting <b>{0}</b>, you must delete the following dependent services:',
-  'services.service.delete.popup.mustBeStopped': 'Prior to deleting <b>{0}</b>, you must stop the service.',
+  'services.service.delete.popup.mustBeStopped': 'Prior to deleting <b>{0}</b>, you must stop the service and each slave and master component.',
   'services.service.delete.popup.mustBeStopped.dependent': ' Along with dependent service <b>{0}</b>.',
   'services.service.delete.popup.warning': 'The <b>{0} service will be removed from Ambari and all configurations' +
   ' and configuration history will be lost.</b>',

http://git-wip-us.apache.org/repos/asf/ambari/blob/751e6920/ambari-web/app/models/client_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/client_component.js b/ambari-web/app/models/client_component.js
index 7dde68a..492d5ef 100644
--- a/ambari-web/app/models/client_component.js
+++ b/ambari-web/app/models/client_component.js
@@ -29,6 +29,15 @@ App.ClientComponent = DS.Model.extend({
   stackInfo: DS.belongsTo('App.StackServiceComponent'),
   hostNames: DS.attr('array'),
 
+  /**
+   * Defines if all components are in 'INSTALLED' state
+   *
+   * @type {boolean}
+   */
+  allStopped: function() {
+    return this.get('installedCount') === this.get('totalCount');
+  }.property('installedCount', 'totalCount'),
+
   summaryLabelClassName:function(){
     return 'label_for_'+this.get('componentName').toLowerCase();
   }.property('componentName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/751e6920/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 3cf0a8c..3e25be9 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -41,6 +41,18 @@ App.Service = DS.Model.extend({
   masterComponents: DS.hasMany('App.MasterComponent'),
 
   /**
+   * Check master/slave component state of service
+   * and general services state to define if it can be removed
+   *
+   * @type {boolean}
+   */
+  allowToDelete: function() {
+    return App.Service.allowUninstallStates.contains(this.get('workStatus'))
+      && this.get('slaveComponents').everyProperty('allStopped')
+      && this.get('masterComponents').everyProperty('allStopped');
+  }.property('slaveComponents.@each.allStopped', 'masterComponents.@each.allStopped', 'workStatus'),
+
+  /**
    * @type {bool}
    */
   isInPassive: Em.computed.equal('passiveState', 'ON'),