ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-13275. Comparing of config versions works incorrectly for DBs (onechiporenko)
Date Wed, 30 Sep 2015 12:12:31 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 77db05a49 -> 0cf552c9c


AMBARI-13275. Comparing of config versions works incorrectly for DBs (onechiporenko)


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

Branch: refs/heads/branch-2.1
Commit: 0cf552c9c8254321817260a9738c5fc9b8ff7b2b
Parents: 77db05a
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Sep 30 15:10:19 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Sep 30 15:10:19 2015 +0300

----------------------------------------------------------------------
 .../common/configs/compare_property.hbs         |  2 +-
 ambari-web/app/views/common/controls_view.js    | 14 +++-
 .../test/views/common/controls_view_test.js     | 71 ++++++++++++++++++++
 3 files changed, 85 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0cf552c9/ambari-web/app/templates/common/configs/compare_property.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/compare_property.hbs b/ambari-web/app/templates/common/configs/compare_property.hbs
index f593825..29c6ed7 100644
--- a/ambari-web/app/templates/common/configs/compare_property.hbs
+++ b/ambari-web/app/templates/common/configs/compare_property.hbs
@@ -18,7 +18,7 @@
 
 {{#each compareConfig in view.serviceConfigProperty.compareConfigs}}
     <div {{bindAttr class=":control-group :overrideField"}}>
-      {{view compareConfig.viewClass serviceConfigBinding="compareConfig" categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}}
+      {{view compareConfig.viewClass serviceConfigBinding="compareConfig" versionBinding="compareConfig.serviceVersion.version"
categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}}
       <span class="label label-info">{{compareConfig.serviceVersion.versionText}}</span>
       {{#if compareConfig.serviceVersion.isCurrent}}
         <span class="label label-success">{{t common.current}}</span>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0cf552c9/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index c3ae9e0..437f8bb 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -519,7 +519,19 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     }
   }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value'),
 
-  nameBinding: 'serviceConfig.radioName',
+  name: function () {
+    var name = this.get('serviceConfig.radioName');
+    if (!this.get('serviceConfig.isOriginalSCP')) {
+      if (this.get('serviceConfig.isComparison')) {
+        var version = this.get('serviceConfig.compareConfigs') ? this.get('controller.selectedVersion')
: this.get('version');
+        name += '-v' + version;
+      } else {
+        var group = this.get('serviceConfig.group.name');
+        name += '-' + group;
+      }
+    }
+    return name;
+  }.property('serviceConfig.radioName'),
 
   /**
    * Just property object for database name

http://git-wip-us.apache.org/repos/asf/ambari/blob/0cf552c9/ambari-web/test/views/common/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js
index c1906e2..09ad9fe 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -332,6 +332,77 @@ describe('App.ServiceConfigRadioButtons', function () {
     });
 
   });
+
+  describe('#name', function () {
+
+    var cases = [
+      {
+        serviceConfig: {
+          radioName: 'n0',
+          isOriginalSCP: true,
+          isComparison: false
+        },
+        name: 'n0',
+        title: 'original value'
+      },
+      {
+        serviceConfig: {
+          radioName: 'n1',
+          isOriginalSCP: false,
+          isComparison: true,
+          compareConfigs: []
+        },
+        controller: {
+          selectedVersion: 1
+        },
+        name: 'n1-v1',
+        title: 'comparison view, original value'
+      },
+      {
+        serviceConfig: {
+          radioName: 'n2',
+          isOriginalSCP: false,
+          isComparison: true,
+          compareConfigs: null
+        },
+        version: 2,
+        name: 'n2-v2',
+        title: 'comparison view, value to be compared with'
+      },
+      {
+        serviceConfig: {
+          radioName: 'n3',
+          isOriginalSCP: false,
+          isComparison: false,
+          group: {
+            name: 'g'
+          }
+        },
+        name: 'n3-g',
+        title: 'override value'
+      }
+    ];
+
+    beforeEach(function () {
+      view.reopen({
+        serviceConfig: Em.Object.create()
+      });
+    });
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        if (item.controller) {
+          view.reopen({
+            controller: item.controller
+          });
+        }
+        view.set('version', item.version);
+        view.get('serviceConfig').setProperties(item.serviceConfig);
+        expect(view.get('name')).to.equal(item.name);
+      });
+    });
+
+  });
 });
 
 describe('App.ServiceConfigRadioButton', function () {


Mime
View raw message