ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject [ambari] branch trunk updated: AMBARI-24864 Delete host confirm popup does not contain all master components
Date Thu, 08 Nov 2018 14:24:20 GMT
This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b88e72a  AMBARI-24864 Delete host confirm popup does not contain all master components
b88e72a is described below

commit b88e72a8ba8040fd3b8f85f37cd9c0f1d4681fb1
Author: Andrii Tkach <atkach@apache.org>
AuthorDate: Thu Nov 8 15:00:52 2018 +0200

    AMBARI-24864 Delete host confirm popup does not contain all master components
---
 ambari-web/app/models/stack_service_component.js   | 11 +++--
 .../test/models/stack_service_component_test.js    | 51 ++++------------------
 ambari-web/test/service_components.js              |  4 +-
 3 files changed, 16 insertions(+), 50 deletions(-)

diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index ecbe494..3611008 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -123,6 +123,9 @@ App.StackServiceComponent = DS.Model.extend({
 
   /** @property {Boolean} isMultipleAllowed - component can be assigned for more than one
host **/
   isMultipleAllowed: Em.computed.gt('maxToInstall', 1),
+  
+  /** @property {Boolean} isAddableAfterInstall - component can be added after it's service
was installed **/
+  isAddableAfterInstall: Em.computed.gtProperties('maxToInstall', 'minToInstall'),
 
   /** @property {Boolean} isSlave **/
   isSlave: Em.computed.equal('componentCategory', 'SLAVE'),
@@ -155,7 +158,7 @@ App.StackServiceComponent = DS.Model.extend({
 
   /** @property {Boolean} isAddableToHost - component can be added on host details page **/
   isAddableToHost: function() {
-    return (this.get('isMaster') && !this.get('isMasterAddableOnlyOnHA'))
+    return (this.get('isMaster') && !this.get('isMasterAddableOnlyOnHA') &&
this.get('isAddableAfterInstall'))
       || ((this.get('isSlave') || this.get('isClient'))
         && (!this.get('isHAComponentOnly') || (App.get('isHaEnabled') &&
this.get('componentName') === 'JOURNALNODE')));
   }.property('componentName'),
@@ -212,7 +215,7 @@ App.StackServiceComponent = DS.Model.extend({
    *
    * @property {Boolean} isMasterAddableInstallerWizard
    **/
-  isMasterAddableInstallerWizard: Em.computed.and('isMaster', 'isMultipleAllowed', '!isMasterAddableOnlyOnHA',
'!isNotAddableOnlyInInstall'),
+  isMasterAddableInstallerWizard: Em.computed.and('isMaster', 'isMultipleAllowed', '!isMasterAddableOnlyOnHA'),
 
   /**
    * Master components with cardinality more than 1 (n+ or n-n) that could not be added in
wizards
@@ -255,10 +258,6 @@ App.StackServiceComponent = DS.Model.extend({
     return !!App.StackServiceComponent.coHost[componentName];
   }.property('componentName'),
 
-  /** @property {Boolean} isNotAddableOnlyInInstall - is this component addable, except Install
and Add Service Wizards  **/
-  isNotAddableOnlyInInstall: Em.computed.existsIn('componentName', ['HIVE_METASTORE', 'HIVE_SERVER',
'RANGER_KMS_SERVER',
-    'OOZIE_SERVER', 'TIMELINE_READER', 'YARN_REGISTRY_DNS']),
-
   /** @property {Boolean} isNotAllowedOnSingleNodeCluster - is this component allowed on
single node  **/
   isNotAllowedOnSingleNodeCluster: Em.computed.existsIn('componentName', ['HAWQSTANDBY'])
 
diff --git a/ambari-web/test/models/stack_service_component_test.js b/ambari-web/test/models/stack_service_component_test.js
index 5aae86d..e3a6f91 100644
--- a/ambari-web/test/models/stack_service_component_test.js
+++ b/ambari-web/test/models/stack_service_component_test.js
@@ -201,9 +201,9 @@ var componentPropertiesValidationTests = [
     expected: {
       displayName: 'Hive Metastore',
       minToInstall: 1,
-      maxToInstall: 1,
+      maxToInstall: Infinity,
       isRequired: true,
-      isMultipleAllowed: false,
+      isMultipleAllowed: true,
       isSlave: false,
       isMaster: true,
       isRestartable: true,
@@ -216,8 +216,8 @@ var componentPropertiesValidationTests = [
       isShownOnInstallerAssignMasterPage: true,
       isShownOnInstallerSlaveClientPage: false,
       isShownOnAddServiceAssignMasterPage: true,
-      isMasterWithMultipleInstances: false,
-      isMasterAddableInstallerWizard: false,
+      isMasterWithMultipleInstances: true,
+      isMasterAddableInstallerWizard: true,
       isHAComponentOnly: false,
       isRequiredOnAllHosts: false,
       coHostedComponents: [],
@@ -230,9 +230,9 @@ var componentPropertiesValidationTests = [
     expected: {
       displayName: 'HiveServer2',
       minToInstall: 1,
-      maxToInstall: 1,
+      maxToInstall: Infinity,
       isRequired: true,
-      isMultipleAllowed: false,
+      isMultipleAllowed: true,
       isSlave: false,
       isMaster: true,
       isRestartable: true,
@@ -245,8 +245,8 @@ var componentPropertiesValidationTests = [
       isShownOnInstallerAssignMasterPage: true,
       isShownOnInstallerSlaveClientPage: false,
       isShownOnAddServiceAssignMasterPage: true,
-      isMasterWithMultipleInstances: false,
-      isMasterAddableInstallerWizard: false,
+      isMasterWithMultipleInstances: true,
+      isMasterAddableInstallerWizard: true,
       isHAComponentOnly: false,
       isRequiredOnAllHosts: false,
       coHostedComponents: [],
@@ -303,7 +303,7 @@ describe('App.StackServiceComponent', function() {
     modelSetup.setupStackServiceComponent();
   });
 
-  App.TestAliases.testAsComputedAnd(App.StackServiceComponent.createRecord(), 'isMasterAddableInstallerWizard',
['isMaster', 'isMultipleAllowed', '!isMasterAddableOnlyOnHA', '!isNotAddableOnlyInInstall']);
+  App.TestAliases.testAsComputedAnd(App.StackServiceComponent.createRecord(), 'isMasterAddableInstallerWizard',
['isMaster', 'isMultipleAllowed', '!isMasterAddableOnlyOnHA']);
 
   describe('component properties validation', function() {
     componentPropertiesValidationTests.forEach(function(test) {
@@ -348,39 +348,6 @@ describe('App.StackServiceComponent', function() {
 
   });
 
-  describe('#isNotAddableOnlyInInstall', function () {
-
-    var cases = [
-      {
-        componentName: 'HIVE_METASTORE',
-        isNotAddableOnlyInInstall: true
-      },
-      {
-        componentName: 'HIVE_SERVER',
-        isNotAddableOnlyInInstall: true
-      },
-      {
-        componentName: 'RANGER_KMS_SERVER',
-        isNotAddableOnlyInInstall: true
-      },
-      {
-        componentName: 'OOZIE_SERVER',
-        isNotAddableOnlyInInstall: true
-      },
-      {
-        componentName: 'NAMENODE',
-        isNotAddableOnlyInInstall: false
-      }
-    ];
-
-    cases.forEach(function (item) {
-      it(item.componentName, function () {
-        expect(App.StackServiceComponent.find().findProperty('componentName', item.componentName).get('isNotAddableOnlyInInstall')).to.equal(item.isNotAddableOnlyInInstall);
-      });
-    });
-
-  });
-
   after(function() {
     modelSetup.cleanStackServiceComponent();
   });
diff --git a/ambari-web/test/service_components.js b/ambari-web/test/service_components.js
index bcc4a29..8bf13f7 100644
--- a/ambari-web/test/service_components.js
+++ b/ambari-web/test/service_components.js
@@ -550,7 +550,7 @@ module.exports = {
         {
           "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1/services/HIVE/components/HIVE_METASTORE",
           "StackServiceComponents" : {
-            "cardinality" : "1",
+            "cardinality" : "1+",
             "component_category" : "MASTER",
             "component_name" : "HIVE_METASTORE",
             "display_name" : "Hive Metastore",
@@ -571,7 +571,7 @@ module.exports = {
         {
           "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.1/services/HIVE/components/HIVE_SERVER",
           "StackServiceComponents" : {
-            "cardinality" : "1",
+            "cardinality" : "1+",
             "component_category" : "MASTER",
             "component_name" : "HIVE_SERVER",
             "display_name" : "HiveServer2",


Mime
View raw message