Repository: ambari Updated Branches: refs/heads/branch-2.5 c562de6ec -> 0fedb802e
AMBARI-20388. Diff tool shows additional line when comparing configs from custom config group (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0fedb802 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0fedb802 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0fedb802 Branch: refs/heads/branch-2.5 Commit: 0fedb802e9f3e85491af4c44203dc2110de144a9 Parents: c562de6 Author: Alex Antonenko <[email protected]> Authored: Fri Mar 17 20:46:45 2017 +0200 Committer: Alex Antonenko <[email protected]> Committed: Fri Mar 17 20:47:01 2017 +0200 ---------------------------------------------------------------------- .../app/controllers/main/service/info/configs.js | 16 +++++++++++++--- .../app/mixins/common/configs/configs_comparator.js | 10 ++++++---- .../common/configs/service_config_category.hbs | 10 ++++++++++ ambari-web/app/views/common/controls_view.js | 6 +++++- 4 files changed, 34 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0fedb802/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 786c6f9..7eae5c3 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -518,13 +518,23 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi App.config.createOverride(serviceConfig, overridePlainObject, configGroup); } else { var isEditable = self.get('canEdit') && configGroup.get('name') === self.get('selectedConfigGroup.name'); - allConfigs.push(App.config.createCustomGroupConfig({ + var propValue = config.properties[prop]; + var newConfig = App.ServiceConfigProperty.create(App.config.createDefaultConfig(prop, fileName, false, { + overrides: [], + displayType: 'label', + value: 'Undefined', + isPropertyOverridable: false, + overrideValues: [propValue], + overrideIsFinalValues: [false] + })); + newConfig.get('overrides').push(App.config.createCustomGroupConfig({ propertyName: prop, filename: fileName, - value: config.properties[prop], - savedValue: config.properties[prop], + value: propValue, + savedValue: propValue, isEditable: isEditable }, configGroup)); + allConfigs.push(newConfig); } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0fedb802/ambari-web/app/mixins/common/configs/configs_comparator.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/configs/configs_comparator.js b/ambari-web/app/mixins/common/configs/configs_comparator.js index 18ab899..960a0bf 100644 --- a/ambari-web/app/mixins/common/configs/configs_comparator.js +++ b/ambari-web/app/mixins/common/configs/configs_comparator.js @@ -261,10 +261,12 @@ App.ConfigsComparator = Em.Mixin.create({ Em.get(serviceConfig, 'compareConfigs').push(compareObject); // user custom property or property that was added during upgrade } else { - var addToComparison = !Em.get(serviceConfig, 'isCustomGroupConfig') && (Em.get(serviceConfig, 'isUserProperty') || !isEmptyProp && !compareConfig && Em.get(serviceConfig, 'isRequiredByAgent') !== false); - if (addToComparison) { - Em.get(serviceConfig, 'compareConfigs').push(this.getMockComparisonConfig(serviceConfig, this.get('compareServiceVersion.version'))); - Em.set(serviceConfig, 'hasCompareDiffs', true); + if (Em.get(serviceConfig, 'value') !== 'Undefined') { + var addToComparison = !Em.get(serviceConfig, 'isCustomGroupConfig') && (Em.get(serviceConfig, 'isUserProperty') || !isEmptyProp && !compareConfig && Em.get(serviceConfig, 'isRequiredByAgent') !== false); + if (addToComparison) { + Em.get(serviceConfig, 'compareConfigs').push(this.getMockComparisonConfig(serviceConfig, this.get('compareServiceVersion.version'))); + Em.set(serviceConfig, 'hasCompareDiffs', true); + } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/0fedb802/ambari-web/app/templates/common/configs/service_config_category.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/service_config_category.hbs b/ambari-web/app/templates/common/configs/service_config_category.hbs index f6a4ed6..d9aa81c 100644 --- a/ambari-web/app/templates/common/configs/service_config_category.hbs +++ b/ambari-web/app/templates/common/configs/service_config_category.hbs @@ -78,6 +78,16 @@ {{#if this.isComparison}} {{#unless this.isOriginalSCP}} {{view viewClass serviceConfigBinding="this" categoryConfigsAllBinding="view.categoryConfigsAll" }} + {{#if controller.selectedConfigGroup.isDefault}} + <span + class="label label-info config-controls">{{t dashboard.configHistory.table.version.prefix}}{{controller.selectedVersion}}</span> + {{#if controller.isCurrentSelected}} + <span class="label label-success config-controls">{{t common.current}}</span> + {{/if}} + {{else}} + <span class="label label-info config-controls">{{t common.default}} + {{t services.service.config.configHistory.configGroup}}</span> + {{/if}} {{/unless}} {{view App.ServiceConfigView.SCPComparisonRowsView serviceConfigPropertyBinding="this"}} {{else}} http://git-wip-us.apache.org/repos/asf/ambari/blob/0fedb802/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 44d0d2f..a1e501b 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -867,7 +867,11 @@ App.ServiceConfigLabelView = Ember.View.extend(App.ServiceConfigHostPopoverSuppo valueBinding: 'serviceConfig.value', unitBinding: 'serviceConfig.unit', - fullValue: Em.computed.format('{0} {1}', 'value', 'unit'), + fullValue: function () { + var value = this.get('value'); + var unit = this.get('unit'); + return unit ? value + ' ' + unit : value; + }.property('value', 'unit'), template: Ember.Handlebars.compile('<i>{{formatWordBreak view.fullValue}}</i>') });
