소스 검색

AMBARI-11108. Incorrect warning message in popup window during host deleting (akovalenko)

Aleksandr Kovalenko 10 년 전
부모
커밋
597951c1f1
3개의 변경된 파일15개의 추가작업 그리고 14개의 파일을 삭제
  1. 1 1
      ambari-web/app/app.js
  2. 8 7
      ambari-web/app/models/stack_service_component.js
  3. 6 6
      ambari-web/test/models/stack_service_component_test.js

+ 1 - 1
ambari-web/app/app.js

@@ -320,7 +320,7 @@ module.exports = Em.Application.create({
     }.property('App.router.clusterController.isLoaded'),
 
     addableMasterInstallerWizard: function () {
-      return App.StackServiceComponent.find().filterProperty('isMasterAddableInstallerWizard').filterProperty('showAddBtnInInstall').mapProperty('componentName')
+      return App.StackServiceComponent.find().filterProperty('isMasterAddableInstallerWizard').mapProperty('componentName')
     }.property('App.router.clusterController.isLoaded'),
 
     multipleMasters: function () {

+ 8 - 7
ambari-web/app/models/stack_service_component.js

@@ -97,7 +97,7 @@ App.StackServiceComponent = DS.Model.extend({
 
   /** @property {Boolean} isAddableToHost - component can be added on host details page **/
   isAddableToHost: function() {
-    return ((this.get('isMasterAddableInstallerWizard') || (this.get('isSlave') && this.get('maxToInstall') > 2) || this.get('isClient')) && !this.get('isHAComponentOnly'));
+    return this.get('isMasterAddableInstallerWizard') || ((this.get('isNotAddableOnlyInInstall') || this.get('isSlave') || this.get('isClient')) && !this.get('isHAComponentOnly'));
   }.property('componentName'),
 
   /** @property {Boolean} isDeletable - component supports delete action **/
@@ -142,7 +142,7 @@ App.StackServiceComponent = DS.Model.extend({
    * @property {Boolean} isMasterAddableInstallerWizard
    **/
   isMasterAddableInstallerWizard: function() {
-    return this.get('isMaster') && this.get('isMultipleAllowed') && this.get('maxToInstall') > 1 && !this.get('isMasterAddableOnlyOnHA').contains(this.get('componentName'));
+    return this.get('isMaster') && this.get('isMultipleAllowed') && !this.get('isMasterAddableOnlyOnHA') && !this.get('isNotAddableOnlyInInstall');
   }.property('componentName'),
 
   /**
@@ -150,7 +150,9 @@ App.StackServiceComponent = DS.Model.extend({
    * New instances of these components are added in appropriate HA wizards
    * @property {Boolean} isMasterAddableOnlyOnHA
    */
-  isMasterAddableOnlyOnHA: ['NAMENODE', 'RESOURCEMANAGER', 'HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_ADMIN'],
+  isMasterAddableOnlyOnHA: function () {
+    return ['NAMENODE', 'RESOURCEMANAGER', 'RANGER_ADMIN'].contains(this.get('componentName'));
+  }.property('componentName'),
 
   /** @property {Boolean} isHAComponentOnly - Components that can be installed only if HA enabled **/
   isHAComponentOnly: function() {
@@ -193,10 +195,9 @@ App.StackServiceComponent = DS.Model.extend({
     return !!App.StackServiceComponent.coHost[componentName];
   }.property('componentName'),
 
-  /** @property {Boolean} showAddBtnInInstall - show add button for this component on Assign Masters  **/
-  showAddBtnInInstall: function() {
-    var doNotShowList = ['HIVE_METASTORE', 'HIVE_SERVER'];
-    return !doNotShowList.contains(this.get('componentName'));
+  /** @property {Boolean} isNotAddableOnlyInInstall - is this component addable, except Install and Add Service Wizards  **/
+  isNotAddableOnlyInInstall: function() {
+    return ['HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_KMS_SERVER'].contains(this.get('componentName'));
   }.property('componentName')
 
 });

+ 6 - 6
ambari-web/test/models/stack_service_component_test.js

@@ -208,11 +208,11 @@ var componentPropertiesValidationTests = [
       isMaster: true,
       isRestartable: true,
       isReassignable: true,
-      isDeletable: false,
+      isDeletable: true,
       isRollinRestartAllowed: false,
       isDecommissionAllowed: false,
       isRefreshConfigsAllowed: false,
-      isAddableToHost: false,
+      isAddableToHost: true,
       isShownOnInstallerAssignMasterPage: true,
       isShownOnInstallerSlaveClientPage: false,
       isShownOnAddServiceAssignMasterPage: true,
@@ -237,11 +237,11 @@ var componentPropertiesValidationTests = [
       isMaster: true,
       isRestartable: true,
       isReassignable: true,
-      isDeletable: false,
+      isDeletable: true,
       isRollinRestartAllowed: false,
       isDecommissionAllowed: false,
       isRefreshConfigsAllowed: false,
-      isAddableToHost: false,
+      isAddableToHost: true,
       isShownOnInstallerAssignMasterPage: true,
       isShownOnInstallerSlaveClientPage: false,
       isShownOnAddServiceAssignMasterPage: true,
@@ -286,13 +286,13 @@ var componentPropertiesValidationTests = [
   {
     componentName: 'POSTGRESQL_SERVER',
     expected: {
-      isShownOnInstallerAssignMasterPage: false,
+      isShownOnInstallerAssignMasterPage: false
     }
   },
   {
     componentName: 'MYSQL_SERVER',
     expected: {
-      isShownOnInstallerAssignMasterPage: false,
+      isShownOnInstallerAssignMasterPage: false
     }
   },
 ];