Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F28C17C06 for ; Wed, 30 Sep 2015 12:21:41 +0000 (UTC) Received: (qmail 4013 invoked by uid 500); 30 Sep 2015 12:15:01 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 3989 invoked by uid 500); 30 Sep 2015 12:15:01 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 3980 invoked by uid 99); 30 Sep 2015 12:15:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2015 12:15:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3CA1CE01E0; Wed, 30 Sep 2015 12:15:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: <226c14fc152a4f2dae5d18759de9aa09@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-13275. Comparing of config versions works incorrectly for DBs (onechiporenko) Date: Wed, 30 Sep 2015 12:15:01 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 50099dd40 -> e203fae4d 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/trunk Commit: e203fae4d8b37f1438fea93c9da7c72b504d613e Parents: 50099dd Author: Oleg Nechiporenko Authored: Wed Sep 30 15:14:02 2015 +0300 Committer: Oleg Nechiporenko 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}}
- {{view compareConfig.viewClass serviceConfigBinding="compareConfig" categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}} + {{view compareConfig.viewClass serviceConfigBinding="compareConfig" versionBinding="compareConfig.serviceVersion.version" categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}} {{compareConfig.serviceVersion.versionText}} {{#if compareConfig.serviceVersion.isCurrent}} {{t common.current}} 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 () {