You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2016/02/05 09:02:13 UTC

ambari git commit: AMBARI-14917. Edit WEB Alert issues (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 305a85fb5 -> 8397565cb


AMBARI-14917. Edit WEB Alert issues (onechiporenko)


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

Branch: refs/heads/branch-2.2
Commit: 8397565cb6779f99da86f20c175eb07d9979e330
Parents: 305a85f
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Feb 4 14:23:14 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Feb 5 10:02:03 2016 +0200

----------------------------------------------------------------------
 .../alerts/definition_configs_controller.js     | 13 +++++-----
 ambari-web/app/models/alerts/alert_config.js    |  1 +
 ambari-web/app/styles/alerts.less               |  2 +-
 .../definitions_configs_controller_test.js      | 27 ++++++++++++++++++++
 4 files changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8397565c/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
index 38f3fa0..77a47fa 100644
--- a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
@@ -480,12 +480,8 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
     var propertiesToUpdate = {};
     var configs = onlyChanged ? this.get('configs').filterProperty('wasChanged') : this.get('configs');
     configs.forEach(function (property) {
-      var apiProperties = property.get('apiProperty');
-      var apiFormattedValues = property.get('apiFormattedValue');
-      if (!Em.isArray(property.get('apiProperty'))) {
-        apiProperties = [property.get('apiProperty')];
-        apiFormattedValues = [property.get('apiFormattedValue')];
-      }
+      var apiProperties = Em.makeArray(property.get('apiProperty'));
+      var apiFormattedValues = Em.makeArray(property.get('apiFormattedValue'));
       apiProperties.forEach(function (apiProperty, i) {
         if (apiProperty.contains('source.')) {
           if (!propertiesToUpdate['AlertDefinition/source']) {
@@ -512,7 +508,6 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
             }
             Ember.setFullPath(propertiesToUpdate['AlertDefinition/source'], apiProperty.replace('source.', ''), apiFormattedValues[i]);
           }
-
         }
         else {
           if (apiProperty) {
@@ -522,6 +517,10 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
       }, this);
     }, this);
 
+    if (Em.get(propertiesToUpdate, 'AlertDefinition/source.uri.id')) {
+      delete propertiesToUpdate['AlertDefinition/source'].uri.id;
+    }
+
     return propertiesToUpdate;
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8397565c/ambari-web/app/models/alerts/alert_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_config.js b/ambari-web/app/models/alerts/alert_config.js
index b910339..839c80d 100644
--- a/ambari-web/app/models/alerts/alert_config.js
+++ b/ambari-web/app/models/alerts/alert_config.js
@@ -443,6 +443,7 @@ App.AlertConfigProperties = {
     displayType: 'textField',
     classNames: 'alert-connection-timeout',
     apiProperty: 'source.uri.connection_timeout',
+    unit: 'Seconds',
     isValid: function () {
       var value = this.get('value');
       return numericUtils.isPositiveNumber(value);

http://git-wip-us.apache.org/repos/asf/ambari/blob/8397565c/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index 2eabbe2..01d9df0 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -320,7 +320,7 @@
     padding-right: 13px;
   }
 
-  .alert-interval-input {
+  .alert-interval-input, .alert-connection-timeout {
     input {
       width: 20%;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8397565c/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index dce3935..04d2b54 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -470,6 +470,33 @@ describe('App.MainAlertDefinitionConfigsController', function () {
         expect(result).to.eql(testCase.result);
       });
     });
+
+    describe('Some fields should be removed', function () {
+
+      beforeEach(function () {
+        controller.set('content', Em.Object.create({
+          rawSourceData: {
+            uri: {
+              id: 123
+            }
+          }
+        }));
+        controller.set('configs', [
+          Em.Object.create({
+            apiProperty: 'source.uri.connection_timeout',
+            apiFormattedValue: 123,
+            wasChanged: true
+          })
+        ]);
+        this.result = controller.getPropertiesToUpdate();
+      });
+
+      it('`AlertDefinition/source.uri.id`', function () {
+        expect(this.result).to.not.have.deep.property('AlertDefinition/source.uri.id');
+      });
+
+    });
+
   });
 
   describe('#changeType()', function () {