ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [40/50] [abbrv] ambari git commit: AMBARI-18626 UI doesn't show validation errors for removed properties. (ababiichuk)
Date Wed, 19 Oct 2016 16:47:51 GMT
AMBARI-18626 UI doesn't show validation errors for removed properties. (ababiichuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 61cc3a9e6100216ccb114d07a64619d9191f17cd
Parents: a93c0f4
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Tue Oct 18 15:43:13 2016 +0300
Committer: ababiichuk <ababiichuk@hortonworks.com>
Committed: Tue Oct 18 15:43:13 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins/common/serverValidator.js | 22 ++++++++++++++++++--
 .../test/mixins/common/serverValidator_test.js  | 18 +++++++++++++---
 2 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/61cc3a9e/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index d8747d3..b251d84 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -183,7 +183,8 @@ App.ServerValidatorMixin = Em.Mixin.create({
 
     Em.assert('Unknown config error type ' + type, error.isError || error.isWarn || error.isGeneral);
     if (property) {
-      error.serviceName = App.StackService.find(Em.get(property, 'serviceName')).get('displayName');
+      error.id = Em.get(property, 'id');
+      error.serviceName = Em.get(property, 'serviceDisplayName') || App.StackService.find(Em.get(property,
'serviceName')).get('displayName');
       error.propertyName = Em.get(property, 'name');
       error.filename = Em.get(property, 'filename');
       error.value = Em.get(property, 'value');
@@ -214,7 +215,9 @@ App.ServerValidatorMixin = Em.Mixin.create({
             } else {
               configErrorsMap[configId] = {
                 type: item.level,
-                messages: [item.message]
+                messages: [item.message],
+                name: item['config-name'],
+                filename: item['config-type']
               }
             }
           } else {
@@ -261,6 +264,21 @@ App.ServerValidatorMixin = Em.Mixin.create({
       configErrorList.push(this.createErrorMessage(errorTypes.GENERAL, null, serverIssue.messages));
     }, this);
 
+    Em.keys(configErrorsMap).forEach(function (id) {
+      if (!configErrorList.someProperty('id', id)) {
+        var serverIssue = configErrorsMap[id],
+          filename = Em.get(serverIssue, 'filename'),
+          service = App.config.get('serviceByConfigTypeMap')[filename],
+          property = {
+            id: id,
+            name: Em.get(serverIssue, 'name'),
+            filename: App.config.getOriginalFileName(filename),
+            serviceDisplayName: service && Em.get(service, 'displayName')
+          };
+        configErrorList.push(this.createErrorMessage(serverIssue.type, property, serverIssue.messages));
+      }
+    }, this);
+
     return configErrorList;
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/61cc3a9e/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index 943eb57..cdd69fb 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -76,6 +76,10 @@ describe('App.ServerValidatorMixin', function () {
         'c4_f4': {
           type: 'ERROR',
           messages: ['error4']
+        },
+        'c5_f5': {
+          type: 'ERROR',
+          messages: ['error5']
         }
       },
       generalErrors: [{
@@ -116,10 +120,16 @@ describe('App.ServerValidatorMixin', function () {
       var error = result.find(function(r) { return r.propertyName === 'c4' && r.filename
=== 'f4'; });
       expect(error).to.be.undefined;
     });
+
+    it('should add issues for deleted properties', function () {
+      var error = result.find(function(r) { return r.id === 'c5_f5'; });
+      expect(error.messages).to.eql(['error5']);
+    });
   });
 
   describe('#createErrorMessage', function() {
     var property = {
+      id: 'p1_f1',
       name: 'p1',
       filename: 'f1',
       value: 'v1',
@@ -148,12 +158,13 @@ describe('App.ServerValidatorMixin', function () {
         filename: 'f1',
         value: 'v1',
         description: 'd1',
-        serviceName: 'sName'
+        serviceName: 'sName',
+        id: 'p1_f1'
       });
     });
 
     it('creates error object', function() {
-      expect(instanceObject.createErrorMessage('ERROR', property, ['msg2'])).to.eql({
+      expect(instanceObject.createErrorMessage('ERROR', $.extend({}, property, {serviceDisplayName:
'S Name'}), ['msg2'])).to.eql({
         type: 'ERROR',
         isError: true,
         isWarn: false,
@@ -163,7 +174,8 @@ describe('App.ServerValidatorMixin', function () {
         filename: 'f1',
         value: 'v1',
         description: 'd1',
-        serviceName: 'sName'
+        serviceName: 'S Name',
+        id: 'p1_f1'
       });
     });
 


Mime
View raw message