Repository: ambari Updated Branches: refs/heads/trunk 264c1c314 -> f003a20bf
AMBARI-8183. Install Wizard > Customize Services > Config Groups: the config group names do not show on overridden props (Max Shepel via onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f003a20b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f003a20b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f003a20b Branch: refs/heads/trunk Commit: f003a20bfeff82d7e03ccc2e55858c1c940738bb Parents: 264c1c3 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Thu Nov 6 17:52:21 2014 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Thu Nov 6 17:52:21 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + ambari-web/app/data/HDP2/site_properties.js | 1 - .../common/configs/overriddenProperty_view.js | 15 +++- .../configs/overriddenProperty_view_test.js | 83 ++++++++++++++++++++ 4 files changed, 98 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f003a20b/ambari-web/app/assets/test/tests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index b6cc4c0..dea7d1f 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -172,6 +172,7 @@ var files = ['test/init_model_test', 'test/views/main/service/item_test', 'test/views/main/service/info/config_test', 'test/views/main/service/info/summary_test', + 'test/views/common/configs/overriddenProperty_view_test', 'test/views/common/configs/services_config_test', 'test/views/wizard/step3/hostLogPopupBody_view_test', 'test/views/wizard/step3/hostWarningPopupBody_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/f003a20b/ambari-web/app/data/HDP2/site_properties.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js index a81a471..6ed2240 100644 --- a/ambari-web/app/data/HDP2/site_properties.js +++ b/ambari-web/app/data/HDP2/site_properties.js @@ -2848,7 +2848,6 @@ module.exports = "radioName": "hive-database", "isOverridable": false, "isVisible": true, - "isObserved": true, "serviceName": "HIVE", "filename": "hive-env.xml", "category": "HIVE_METASTORE", http://git-wip-us.apache.org/repos/asf/ambari/blob/f003a20b/ambari-web/app/views/common/configs/overriddenProperty_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/overriddenProperty_view.js b/ambari-web/app/views/common/configs/overriddenProperty_view.js index 079084e..8397c88 100644 --- a/ambari-web/app/views/common/configs/overriddenProperty_view.js +++ b/ambari-web/app/views/common/configs/overriddenProperty_view.js @@ -24,7 +24,20 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({ // we are declaring this from configs.hbs ( we are initializing this from UI ) categoryConfigs: null, // just declared as viewClass need it - didInsertElement: function (){ + init: function () { + this._super(); + this.addObserver('isDefaultGroupSelected', this, 'setSwitchText'); + }, + + didInsertElement: function () { + this.setSwitchText(); + }, + + willDestroyElement: function () { + this.removeObserver('isDefaultGroupSelected', this, 'setSwitchText'); + }, + + setSwitchText: function () { Em.$('body>.tooltip').remove(); if (this.get('isDefaultGroupSelected')) { var overrides = this.get('serviceConfigProperty.overrides'); http://git-wip-us.apache.org/repos/asf/ambari/blob/f003a20b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js new file mode 100644 index 0000000..7520cef --- /dev/null +++ b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); +require('views/common/configs/overriddenProperty_view'); + +describe('App.ServiceConfigView.SCPOverriddenRowsView', function () { + + var view = App.ServiceConfigView.SCPOverriddenRowsView.create(); + + describe('#didInsertElement', function () { + + beforeEach(function () { + sinon.spy(view, 'setSwitchText'); + sinon.stub(App, 'tooltip', Em.K); + }); + + afterEach(function () { + view.setSwitchText.restore(); + App.tooltip.restore(); + }); + + it('setSwitchLinks method should be executed', function () { + view.didInsertElement(); + expect(view.setSwitchText.calledOnce).to.be.true; + }); + + }); + + describe('#setSwitchText', function () { + + var view = App.ServiceConfigView.SCPOverriddenRowsView.create({ + serviceConfigProperty: { + overrides: [ + Em.Object.create({ + group: Em.Object.create({ + displayName: 'hcg', + switchGroupTextShort: 'short', + switchGroupTextFull: 'full' + }) + }) + ] + } + }); + + beforeEach(function () { + sinon.stub(App, 'tooltip', Em.K); + }); + + afterEach(function () { + App.tooltip.restore(); + }); + + it('should not modify overrides', function () { + view.set('isDefaultGroupSelected', false); + expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextShort')).to.equal('short'); + expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextFull')).to.equal('full'); + }); + + it('should set switchGroupTextShort and switchGroupTextFull', function () { + view.set('isDefaultGroupSelected', true); + expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextShort')).to.equal(Em.I18n.t('services.service.config_groups.switchGroupTextShort').format('hcg')); + expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextFull')).to.equal(Em.I18n.t('services.service.config_groups.switchGroupTextFull').format('hcg')); + }); + + }); + +});