You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/09/30 16:46:08 UTC

[48/50] [abbrv] ambari git commit: AMBARI-13275. Comparing of config versions works incorrectly for DBs (onechiporenko)

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/e203fae4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e203fae4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e203fae4

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e203fae4d8b37f1438fea93c9da7c72b504d613e
Parents: 50099dd
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Sep 30 15:14:02 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Sep 30 15:14:02 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/e203fae4/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/e203fae4/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 17fab9f..28d3090 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -520,7 +520,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/e203fae4/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 fdf3739..b1914c0 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -333,6 +333,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 () {