AMBARI-22624 Modify display of compare of config versions. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45f2a6e4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45f2a6e4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45f2a6e4 Branch: refs/heads/branch-3.0-perf Commit: 45f2a6e44c1b92b1f841fbe5fde762783e41be35 Parents: b1fd131 Author: Andrii Tkach <atk...@apache.org> Authored: Mon Dec 11 14:23:44 2017 +0200 Committer: Andrii Tkach <atk...@apache.org> Committed: Mon Dec 11 14:23:44 2017 +0200 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 46 ++- ambari-web/app/messages.js | 1 + .../mixins/common/configs/configs_comparator.js | 1 - .../app/mixins/common/configs/configs_loader.js | 8 +- ambari-web/app/models/configs/config_group.js | 8 + ambari-web/app/styles/application.less | 3 + ambari-web/app/styles/common.less | 1 + .../app/styles/service_configurations.less | 292 +++++++++++++++++++ ambari-web/app/styles/widgets.less | 7 +- ambari-web/app/templates.js | 2 + .../common/configs/compare_property.hbs | 38 --- .../common/configs/configs_comparison_cell.hbs | 26 ++ .../common/configs/configs_comparison_row.hbs | 79 +++++ .../app/templates/common/configs/controls.hbs | 12 +- .../templates/common/configs/service_config.hbs | 30 +- .../common/configs/service_config_category.hbs | 120 ++++---- .../service_config_layout_tab_compare.hbs | 80 +++++ .../comparison/config_widget_comparison.hbs | 37 --- .../common/configs/widgets/controls.hbs | 15 - .../templates/common/filter_combo_cleanable.hbs | 7 +- ambari-web/app/views.js | 3 +- .../common/configs/compare_property_view.js | 25 -- .../configs/config_versions_control_view.js | 35 +-- .../configs/overriddenPropertyRow_view.js | 31 -- .../service_config_layout_tab_compare_view.js | 31 ++ .../views/common/configs/service_config_view.js | 7 +- .../configs/service_configs_by_category_view.js | 17 +- .../comparison/config_widget_comparison_view.js | 23 -- .../app/views/common/filter_combo_cleanable.js | 6 +- .../common/configs/configs_comparator_test.js | 5 - .../config_versions_control_view_test.js | 1 - .../configs/overriddenProperty_view_test.js | 42 --- .../service_configs_by_category_view_test.js | 18 +- 33 files changed, 699 insertions(+), 358 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/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 a3a4206..e143da8 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -43,11 +43,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi selectedConfigGroup: null, - /** - * currently displayed service config version - */ - displayedVersion: null, - groupsStore: App.ServiceConfigGroup.find(), /** @@ -75,6 +70,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi return this.get('groupsStore').filterProperty('serviceName', this.get('content.serviceName')); }.property('content.serviceName', 'groupsStore.@each.serviceName'), + defaultGroup: function() { + return this.get('configGroups').findProperty('isDefault'); + }.property('configGroups'), + + isNonDefaultGroupSelectedInCompare: function() { + return this.get('isCompareMode') && this.get('selectedConfigGroup') && !this.get('selectedConfigGroup.isDefault'); + }.property('selectedConfigGroup', 'isCompareMode'), + dependentConfigGroups: function() { if (this.get('dependentServiceNames.length') === 0) return []; return this.get('groupsStore').filter(function(group) { @@ -105,6 +108,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi selectedVersion: null, /** + * currently displayed service config version + * @type {App.ServiceConfigVersion} + */ + selectedVersionRecord: function() { + return App.ServiceConfigVersion.find().findProperty('version', this.get('selectedVersion')); + }.property('selectedVersion'), + + /** * note passed on configs save * @type {string} */ @@ -187,7 +198,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi { attributeName: 'isOverridden', attributeValue: true, - caption: 'common.combobox.dropdown.overridden' + caption: 'common.combobox.dropdown.overridden', + dependentOn: 'isNonDefaultGroupSelectedInCompare', + disabledOnCondition: 'isNonDefaultGroupSelectedInCompare' }, { attributeName: 'isFinal', @@ -198,7 +211,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi attributeName: 'hasCompareDiffs', attributeValue: true, caption: 'common.combobox.dropdown.changed', - dependentOn: 'isCompareMode' + dependentOn: 'isCompareMode', + canBeExcluded: true }, { attributeName: 'hasIssues', @@ -215,17 +229,19 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi var filterColumns = []; this.get('propertyFilters').forEach(function(filter) { - if (Em.isNone(filter.dependentOn) || this.get(filter.dependentOn)) { - filterColumns.push(Ember.Object.create({ - attributeName: filter.attributeName, - attributeValue: filter.attributeValue, - name: this.t(filter.caption), - selected: filter.dependentOn ? this.get(filter.dependentOn) : false - })); + if (this.get('canBeExcluded') && !(Em.isNone(filter.dependentOn) || this.get(filter.dependentOn))) { + return; // exclude column } + filterColumns.push(Ember.Object.create({ + attributeName: filter.attributeName, + attributeValue: filter.attributeValue, + name: this.t(filter.caption), + selected: filter.dependentOn ? this.get(filter.dependentOn) : false, + isDisabled: filter.disabledOnCondition ? this.get(filter.disabledOnCondition) : false + })); }, this); return filterColumns; - }.property('propertyFilters', 'isCompareMode'), + }.property('propertyFilters', 'isCompareMode', 'isNonDefaultGroupSelectedInCompare'), /** * Detects of some of the `password`-configs has not default value http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 74c050f..57999a8 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -361,6 +361,7 @@ Em.I18n.translations = { 'common.views': 'Views', 'common.critical.error': 'Critical', 'common.with': 'with', + 'common.propertyName': 'Property Name', 'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}", 'models.alert_definition.triggered.verbose': "Occurred on {0}", http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/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 45cd106..0af60ce 100644 --- a/ambari-web/app/mixins/common/configs/configs_comparator.js +++ b/ambari-web/app/mixins/common/configs/configs_comparator.js @@ -50,7 +50,6 @@ App.ConfigsComparator = Em.Mixin.create({ this.getCompareVersionConfigs(compareServiceVersions).done(function (json) { allConfigs.setEach('isEditable', false); self.initCompareConfig(allConfigs, json); - self.set('compareServiceVersion', null); dfd.resolve(true); }).fail(function () { self.set('compareServiceVersion', null); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/mixins/common/configs/configs_loader.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/configs/configs_loader.js b/ambari-web/app/mixins/common/configs/configs_loader.js index 403b871..eb9c512 100644 --- a/ambari-web/app/mixins/common/configs/configs_loader.js +++ b/ambari-web/app/mixins/common/configs/configs_loader.js @@ -104,6 +104,7 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, { */ loadCurrentVersions: function() { this.set('isCompareMode', false); + this.set('compareServiceVersion', null); this.set('versionLoaded', false); this.set('selectedVersion', this.get('currentDefaultVersion')); this.set('preSelectedConfigVersion', null); @@ -144,8 +145,11 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, { * loads selected versions of current service * @method loadSelectedVersion */ - loadSelectedVersion: function (version, switchToGroup) { - this.set('isCompareMode', false); + loadSelectedVersion: function (version, switchToGroup, stayInCompare) { + if (!stayInCompare) { + this.set('isCompareMode', false); + this.set('compareServiceVersion', null); + } this.set('versionLoaded', false); version = version || this.get('currentDefaultVersion'); this.clearRecommendationsInfo(); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/models/configs/config_group.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/config_group.js b/ambari-web/app/models/configs/config_group.js index e2993d8..6cdfb47 100644 --- a/ambari-web/app/models/configs/config_group.js +++ b/ambari-web/app/models/configs/config_group.js @@ -101,6 +101,14 @@ App.ServiceConfigGroup = DS.Model.extend({ */ displayNameHosts: Em.computed.format('{0} ({1})', 'displayName', 'hosts.length'), + switchGroupTextShort: function() { + return Em.I18n.t('services.service.config_groups.switchGroupTextShort').format(this.get('displayName')); + }.property('displayName'), + + switchGroupTextFull: function() { + return Em.I18n.t('services.service.config_groups.switchGroupTextFull').format(this.get('displayName')); + }.property('displayName'), + /** * Provides hosts which are available for inclusion in * non-default configuration groups. http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index b7c7635..b8ad4ac 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -2072,6 +2072,9 @@ i.glyphicon-asterisks { right:0; } } + i.disabled { + color: @gray-text; + } } input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox { http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/common.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less index 7202342..4a4f9ec 100644 --- a/ambari-web/app/styles/common.less +++ b/ambari-web/app/styles/common.less @@ -41,6 +41,7 @@ @health-status-yellow: #FFD13D; @health-status-orange: #e98a41; @maintenance-black: #000; +@gray-text: #666; /************************************************************************ * Health status(service/host/host component health)icon colors ends ***********************************************************************/ http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/service_configurations.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/service_configurations.less b/ambari-web/app/styles/service_configurations.less new file mode 100644 index 0000000..5c5abe47 --- /dev/null +++ b/ambari-web/app/styles/service_configurations.less @@ -0,0 +1,292 @@ +/** + * 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. + */ +@import 'common.less'; + +.settings-compare-layout { + .accordion .panel-group .panel { + padding: 0; + } + + .comparison-table-header { + margin: 0 0 10px 0; + line-height: 25px; + } + + .property-name-column { + width: 25% + } + + .property-value-column { + overflow: auto; + max-height: 300px; + } + + .comparison-row { + margin-left: -25px; + padding: 10px 0; + } + + .undefined { + font-style: italic; + color: @gray-text; + } + + .has-compare-diffs { + background-color: rgba(211, 237, 247, 0.39); + } +} + +#serviceConfig { + background: white; + padding: 15px; + + .alert{ + .glyphicon-refresh{ + margin-left:10px; + } + .glyphicon-warning-sign { + color: @health-status-yellow; + } + } + .collapsable { + cursor: pointer; + } + .directories { + min-width: 280px; + } + .panel-heading { + cursor: pointer; + } + .panel-group { + + .control-label { + text-align: left; + word-wrap: break-word; + font-weight: 500; + .glyphicon-lock { + color: #008000; + } + } + .service-config-section{ + .overridden-property{ + background-color: rgba(211, 237, 247, 0.39); + padding: 5px; + margin-left: -5px; + } + .checkbox { + line-height: 0.8em; + &.list-inline { + vertical-align: baseline; + &>.ember-checkbox{ + margin-left: -14px; + } + } + } + } + .entry-row.indent-1 { + margin-left: 2em; + } + .entry-row.indent-2 { + margin-left: 4em; + } + .entry-row { + margin: 0; + .action{ + margin-left: 3px; + margin-right: 1px; + font-size: 13px; + white-space: nowrap; + } + input[type="radio"] { + margin-right: 5px; + margin-left: -20px; + } + .control-group { + margin: 0; + .overrideField { + display: block; + margin-top: 5px; + margin-bottom: 5px; + } + .overridden-hosts-view { + display: inline-block; + } + &>.ember-checkbox{ + margin-bottom: 5px; + } + } + } + form { + margin-bottom: 0; + } + } + .badge { + margin-left: 4px; + } + + .master-host, .master-hosts, .slave-hosts { + padding-top: 5px; + line-height: 20px; + } + + .enhanced-config-tab-content { + .action { + display: inline-block; + } + } + .common-config-category, .enhanced-config-tab-content { + .panel-title { + line-height: 16px; + } + .action { + cursor: pointer; + } + .a-icon(@color) { + color: @color; + margin-right: 2px; + } + .glyphicon-plus-sign { + .a-icon(@health-status-green); + } + .glyphicon-minus-sign { + .a-icon(#FF4B4B); + } + .icon-undo { + .a-icon(rgb(243, 178, 11)); + } + .btn-final{ + background: transparent repeat scroll 0 0 #fff; + } + .btn-final .glyphicon-lock{ + color: #a6a6a6; + cursor: inherit; + } + .btn-final.active .glyphicon-lock { + color: blue; + } + .btn-final.active { //copied from Bootstrap .btn.active + background-color: #e6e6e6; + background-color: #d9d9d9 \9; + background-image: none; + outline: 0; + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + } + .btn-final.active[disabled] { + cursor: not-allowed; + } + a.panel-toggle:hover { + text-decoration: none; + .category-name { + color: #337ab7; + text-decoration: underline; + } + } + } + + .enhanced-config-tab-content + { + .action-button { + margin-left: 3px; + } + } + + .capacity-scheduler { + .header { + margin-bottom: 10px; + .col-md-1 { + padding-top: 10px; + font-weight: bold; + } + } + form.form-horizontal { + margin-left: 20px; + .control-label-span { + word-wrap: break-word; + } + } + table tr, svg { + cursor: pointer; + } + .marker { + margin: 0 5px; + display: inline-block; + width: 12px; + height: 12px; + } + + .frame{ + position:relative; + width: 200px; + height: 200px; + } + } + .nav-tabs > li > a { + padding-left: 8px; + padding-right: 8px; + &.new { + font-weight: 700; + } + } + .with-unit{ + float: left; + .input-group-addon{ + overflow: hidden; + max-width:250px; + } + } + .dropdown-menu > li > a:hover { + text-shadow: none; + } + .db-connection { + .spinner { + width: @spinner-small-width; + height: @spinner-small-height; + background-size: cover; + i { + font-size: 1em; + } + } + .glyphicon-ok-sign, .glyphicon-warning-sign { + font-size: 27px; + line-height: 30px; + } + .glyphicon-warning-sign { + color: @health-status-red; + } + .connection-result { + font-size: 15px; + line-height: 30px; + } + a.mute { + color: #333; + &:hover { + text-decoration: none; + color: #333; + } + } + } + .help-block { + display: inline-block; + } + .long-input { + width: 75%; + } + .config-controls { + line-height: 34px; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/widgets.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/widgets.less b/ambari-web/app/styles/widgets.less index a11c30f..3f4a707 100644 --- a/ambari-web/app/styles/widgets.less +++ b/ambari-web/app/styles/widgets.less @@ -28,6 +28,7 @@ @slider-widget-border-color: #999; @slider-widget-width: 220px; +@slider-widget-wrapper-width: 68%; @slider-widget-tooltip-background-color: @green; @slider-widget-selection-background-color: @slider-dark-grey; @slider-widget-body-height: 10px; @@ -158,7 +159,7 @@ .directory-textarea-wrapper { float: left; - width: 80%; + width: @slider-widget-wrapper-width; } .list-widget { @@ -283,9 +284,9 @@ .ui-slider-wrapper { .ui-slider-wrapper-inner { - width: 68%; + width: @slider-widget-wrapper-width; width: calc(~"100% - 30px -"@controls-min-width); - max-width: 68%; + max-width: @slider-widget-wrapper-width; padding-left: 10px; .slider.slider-horizontal { width: 100%; http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates.js b/ambari-web/app/templates.js index 80a3176..b18cc73 100644 --- a/ambari-web/app/templates.js +++ b/ambari-web/app/templates.js @@ -28,3 +28,5 @@ require("templates/main/service/widgets/create/step2_template"); require("templates/main/service/widgets/create/step2_graph"); require('templates/common/configs/widgets/controls'); require('templates/common/configs/widgets/config_label'); +require('templates/common/configs/configs_comparison_row'); +require('templates/common/configs/configs_comparison_cell'); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/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 deleted file mode 100644 index 6d84913..0000000 --- a/ambari-web/app/templates/common/configs/compare_property.hbs +++ /dev/null @@ -1,38 +0,0 @@ -{{! -* 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. -}} - -{{#each compareConfig in view.serviceConfigProperty.compareConfigs}} - <div {{bindAttr class=":form-group :overrideField"}}> - <div class="row"> - <div class="col-md-9"> - {{view compareConfig.viewClass serviceConfigBinding="compareConfig" versionBinding="compareConfig.serviceVersion.version" categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}} - <span class="label label-info config-controls">{{compareConfig.serviceVersion.versionText}}</span> - {{#if compareConfig.serviceVersion.isCurrent}} - <span class="label label-success config-controls">{{t common.current}}</span> - {{/if}} - {{#unless compareConfig.isMock}} - {{#if compareConfig.supportsFinal}} - <a disabled="disabled" {{bindAttr class=":btn-sm :btn-final compareConfig.isFinal:active compareConfig.hideFinalIcon:hidden" }}> - <i class="glyphicon glyphicon-lock"></i> - </a> - {{/if}} - {{/unless}} - </div> - </div> - </div> -{{/each}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs b/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs new file mode 100644 index 0000000..450d5f7 --- /dev/null +++ b/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs @@ -0,0 +1,26 @@ +{{! +* 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. +}} + +<span {{bindAttr class="compareConfig.isMock:undefined"}}> + {{compareConfig.value}} {{compareConfig.unit}} +</span> +{{#unless compareConfig.isMock}} + {{#if compareConfig.supportsFinal}} + <i {{bindAttr class=":glyphicon :glyphicon-lock compareConfig.isFinal::hidden" }}></i> + {{/if}} +{{/unless}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/configs_comparison_row.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/configs_comparison_row.hbs b/ambari-web/app/templates/common/configs/configs_comparison_row.hbs new file mode 100644 index 0000000..c9264ee --- /dev/null +++ b/ambari-web/app/templates/common/configs/configs_comparison_row.hbs @@ -0,0 +1,79 @@ +{{! +* 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. +}} + +<div {{bindAttr class=":row :comparison-row :bottom-border configData.isHiddenByFilter:hide configData.hasCompareDiffs:has-compare-diffs"}} {{QAAttr "property-row"}}> + <div class="col-md-3 property-name-column"> + {{#if configData.showLabel}} + <span class="control-label"> + {{formatWordBreak configData.displayName}} + {{#if configData.isSecureConfig}} + <a href="javascript:void(null);"> + <i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i> + </a> + {{/if}} + </span> + {{/if}} + </div> + <div class="col-md-4 property-value-column"> + {{#if controller.selectedConfigGroup.isDefault}} + {{! Comparing config-versions from Default config-group}} + <span {{bindAttr class="configData.isMock:undefined"}}>{{configData.value}} {{configData.unit}}</span> + {{#unless configData.isMock}} + {{#if configData.supportsFinal}} + <i {{bindAttr class=":glyphicon :glyphicon-lock configData.isFinal::hidden" }}></i> + {{/if}} + {{/unless}} + {{else}} + {{#if configData.hasCompareDiffs}} + {{! Comparing config-versions from Non-Default config-group}} + {{#each compareConfig in configData.compareConfigs}} + {{#if compareConfig.isComparison}} + {{template "templates/common/configs/configs_comparison_cell"}} + {{/if}} + {{/each}} + {{else}} + {{! If config values of non-default group haven't been changed then show their values}} + {{#each compareConfig in configData.overrides}} + {{template "templates/common/configs/configs_comparison_cell"}} + {{/each}} + {{/if}} + {{/if}} + </div> + <div class="col-md-4 col-md-offset-1 property-value-column"> + {{#if controller.selectedConfigGroup.isDefault}} + {{! Comparing config-versions from Default config-group}} + {{#each compareConfig in configData.compareConfigs}} + {{template "templates/common/configs/configs_comparison_cell"}} + {{/each}} + {{else}} + {{#if configData.hasCompareDiffs}} + {{! Comparing config-versions from Non-Default config-group}} + {{#each compareConfig in configData.compareConfigs}} + {{#if compareConfig.isOriginalSCP}} + {{template "templates/common/configs/configs_comparison_cell"}} + {{/if}} + {{/each}} + {{else}} + {{! If config values of non-default group haven't been changed then show their values}} + {{#each compareConfig in configData.overrides}} + {{template "templates/common/configs/configs_comparison_cell"}} + {{/each}} + {{/if}} + {{/if}} + </div> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/controls.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/controls.hbs b/ambari-web/app/templates/common/configs/controls.hbs index db12e3c..84e50ad 100644 --- a/ambari-web/app/templates/common/configs/controls.hbs +++ b/ambari-web/app/templates/common/configs/controls.hbs @@ -17,40 +17,40 @@ }} {{#if view.showSwitchToGroup}} - {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="this.group"}} + {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="view.serviceConfigProperty.group"}} {{else}} {{#if view.showIsFinal}} <a href="#" data-toggle="tooltip" {{bindAttr class=":btn-sm :btn-final view.serviceConfigProperty.isFinal:active view.serviceConfigProperty.hideFinalIcon:hidden" disabled="view.serviceConfigProperty.isNotEditable"}} - {{action "toggleFinalFlag" this target="view.parentView"}} + {{action "toggleFinalFlag" view.serviceConfigProperty target="view.parentView"}} {{translateAttr data-original-title="services.service.config.final"}}> <i class="glyphicon glyphicon-lock"></i> </a> {{/if}} {{#if view.showOverride}} <a href="#" data-toggle="tooltip" class="btn-sm" - {{action "createOverrideProperty" this target="view.parentView"}} + {{action "createOverrideProperty" view.serviceConfigProperty target="view.parentView"}} {{translateAttr data-original-title="common.override"}}> <i class="glyphicon glyphicon-plus-sign"></i> </a> {{/if}} {{#if view.showUndo}} <a href="#" data-toggle="tooltip" class="btn-sm" - {{action "doRestoreDefaultValue" this target="view.parentView"}} + {{action "doRestoreDefaultValue" view.serviceConfigProperty target="view.parentView"}} {{translateAttr data-original-title="common.undo"}}> <i class="icon-undo"></i> </a> {{/if}} {{#if view.showRemove}} <a href="#" data-toggle="tooltip" class="btn-sm remove-config-property-button" - {{action "removeProperty" this target="view.parentView"}} + {{action "removeProperty" view.serviceConfigProperty target="view.parentView"}} {{translateAttr data-original-title="common.remove"}}> <i class="glyphicon glyphicon-minus-sign"></i> </a> {{/if}} {{#if view.showSetRecommended}} <a href="#" data-toggle="tooltip" class="btn-sm" - {{action "setRecommendedValue" this target="view.parentView"}} + {{action "setRecommendedValue" view.serviceConfigProperty target="view.parentView"}} {{translateAttr data-original-title="services.service.config.setRecommendedValue"}}> <i class="glyphicon glyphicon-repeat"></i> </a> http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/service_config.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs index b097b16..34ac602 100644 --- a/ambari-web/app/templates/common/configs/service_config.hbs +++ b/ambari-web/app/templates/common/configs/service_config.hbs @@ -58,7 +58,7 @@ {{/if}} </div> {{#if view.supportsHostOverrides}} - <div {{bindAttr class="controller.isCompareMode:pull-bottom :pull-top :config-manage-nav :pull-right"}}> + <div {{bindAttr class="controller.isCompareMode:pull-bottom :pull-top controller.isHostsConfigsPage:pull-bottom :config-manage-nav :pull-right"}}> {{#if controller.isHostsConfigsPage}} {{#isAuthorized "SERVICE.MANAGE_CONFIG_GROUPS"}} <a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a> @@ -138,16 +138,40 @@ </ul> <div class="tab-content service-config-tab-content"> {{#each tab in view.tabs}} - <div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}> + <div {{bindAttr class=":tab-pane tab.isActive:active isCompareMode:settings-compare-layout tab.id"}}> {{#if tab.isAdvanced}} {{#if tab.isRendered}} + {{#if isCompareMode}} + <div class="row bottom-border comparison-table-header"> + <div class="col-md-3 property-name-column">{{t common.propertyName}}</div> + <div class="col-md-4 property-value-column"> + {{t common.version}} {{selectedVersionRecord.version}} + {{#if selectedVersionRecord.isCurrent}} + <span class="label label-success">{{t common.current}}</span> + {{/if}} + </div> + <div class="col-md-4 col-md-offset-1 property-value-column"> + {{t common.version}} {{compareServiceVersion.version}} + {{#if compareServiceVersion.isCurrent}} + <span class="label label-success">{{t common.current}}</span> + {{/if}} + </div> + </div> + {{/if}} {{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}} {{else}} {{view App.SpinnerView}} {{/if}} {{else}} {{! Render Enhanced Config Section }} - {{view App.ServiceConfigLayoutTabView contentBinding="tab" canEditBinding="view.canEdit" }} + {{#if isCompareMode}} + {{view App.ServiceConfigLayoutTabCompareView + contentBinding="tab" + primaryCompareVersionBinding="selectedVersionRecord" + secondaryCompareVersionBinding="compareServiceVersion"}} + {{else}} + {{view App.ServiceConfigLayoutTabView contentBinding="tab" canEditBinding="view.canEdit" }} + {{/if}} {{/if}} </div> {{/each}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/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 87a716c..930e65d 100644 --- a/ambari-web/app/templates/common/configs/service_config_category.hbs +++ b/ambari-web/app/templates/common/configs/service_config_category.hbs @@ -31,86 +31,64 @@ <div class="panel-body collapse in" {{bindAttr style="view.isCategoryBodyVisible"}} {{QAAttr "panel-body"}}> <div class="service-config-section"> <form class="form-horizontal" autocomplete="off"> - {{#each view.categoryConfigs}} - {{#unless widget}} {{! configs with widgets should be shown only on the EnhancedConfigs tabs }} - <div {{bindAttr class=":entry-row :form-group isHiddenByFilter:hide isOverridden:overridden-property hasCompareDiffs:overridden-property"}} {{QAAttr "property-row"}}> - {{#if showLabel}} - {{#unless rightSideLabel}} - <span {{bindAttr class="errorMessage:has-error: :form-group :control-label-span :col-md-3"}}> + {{#each configData in view.categoryConfigs}} + {{#unless configData.widget}} {{! configs with widgets should be shown only on the EnhancedConfigs tabs }} + {{#if configData.isComparison}} + {{template "templates/common/configs/configs_comparison_row"}} + {{else}} + {{#unless controller.isCompareMode}} + <div {{bindAttr class=":entry-row :form-group configData.isHiddenByFilter:hide configData.isOverridden:overridden-property configData.hasCompareDiffs:overridden-property"}} {{QAAttr "property-row"}}> + {{#if configData.showLabel}} + {{#unless configData.rightSideLabel}} + <span {{bindAttr class="configData.errorMessage:has-error: :form-group :control-label-span :col-md-3"}}> <label class="control-label" {{QAAttr "control-label"}}> - {{formatWordBreak displayName}} - {{#if isSecureConfig}} - <a href="javascript:void(null);"><i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" - title="security knob"></i></a> + {{formatWordBreak configData.displayName}} + {{#if configData.isSecureConfig}} + <a href="javascript:void(null);"> + <i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i> + </a> {{/if}} </label> </span> - {{else}} - <span class="control-group control-label-span col-md-3"> </span> - {{/unless}} - {{/if}} - <div class="col-md-9"> - {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }} - {{#if this.isOriginalSCP}} - <div {{bindAttr class="errorMessage:has-error: warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}> - {{view viewClass serviceConfigBinding="this" categoryConfigsAllBinding="view.categoryConfigsAll" }} - {{#if rightSideLabel}} - <span {{bindAttr class="isEditable::muted"}}>{{formatWordBreak displayName}}</span> - {{/if}} - {{#if hintMessage}} - <a class="icon-question-sign glyphicon glyphicon-blue" href="#" - data-toggle="tooltip" {{bindAttr data-original-title="hintMessage"}}></a> - {{/if}} - {{#if this.isComparison}} - {{#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> + {{else}} + <span class="control-group control-label-span col-md-3"> </span> + {{/unless}} + {{/if}} + <div class="col-md-9"> + {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }} + {{#if configData.isOriginalSCP}} + <div {{bindAttr class="configData.errorMessage:has-error: configData.warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}> + {{view configData.viewClass serviceConfigBinding="configData" categoryConfigsAllBinding="view.categoryConfigsAll" }} + {{#if configData.rightSideLabel}} + <span {{bindAttr class="configData.isEditable::muted"}}>{{formatWordBreak configData.displayName}}</span> {{/if}} - {{else}} - <span class="label label-info config-controls">{{t common.default}} - {{t services.service.config.configHistory.configGroup}}</span> - {{/if}} - {{/if}} - {{view App.ControlsView serviceConfigPropertyBinding="this"}} - {{#if errorMessage}} - <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{errorMessage}}</span> - {{/if}} - {{#if warnMessage}} - <span class="has-warning"> - <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{warnMessage}}</span> + {{#if configData.hintMessage}} + <a class="icon-question-sign glyphicon glyphicon-blue" href="#" + data-toggle="tooltip" {{bindAttr data-original-title="configData.hintMessage"}}></a> + {{/if}} + {{view App.ControlsView serviceConfigPropertyBinding="configData"}} + {{#if configData.errorMessage}} + <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.errorMessage}}</span> + {{/if}} + {{#if configData.warnMessage}} + <span class="has-warning"> + <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.warnMessage}}</span> </span> + {{/if}} + </div> {{/if}} - </div> - {{/if}} - {{#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 configData.isOverridden}} + {{view App.ServiceConfigView.SCPOverriddenRowsView + serviceConfigPropertyBinding="configData" + isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault" + }} {{/if}} - {{/unless}} - {{view App.ServiceConfigView.SCPComparisonRowsView serviceConfigPropertyBinding="this"}} - {{else}} - {{#if this.isOverridden}} - {{view App.ServiceConfigView.SCPOverriddenRowsView - serviceConfigPropertyBinding="this" - isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault" - }} - {{/if}} + </div> + </div> + {{#if configData.additionalView}} + {{view configData.additionalView}} {{/if}} - </div> - </div> - {{#if this.additionalView}} - {{view additionalView}} + {{/unless}} {{/if}} {{/unless}} {{/each}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs b/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs new file mode 100644 index 0000000..ccf47f3 --- /dev/null +++ b/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs @@ -0,0 +1,80 @@ +{{! +* 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. +}} + +{{#if view.dataIsReady}} + {{#unless tab.isHiddenByFilter}} + <div class="row bottom-border comparison-table-header"> + <div class="col-md-3 property-name-column">{{t common.propertyName}}</div> + <div class="col-md-4 property-value-column"> + {{t common.version}} {{view.primaryCompareVersion.version}} + {{#if view.primaryCompareVersion.isCurrent}} + <span class="label label-success">{{t common.current}}</span> + {{/if}} + </div> + <div class="col-md-4 col-md-offset-1 property-value-column"> + {{t common.version}} {{view.secondaryCompareVersion.version}} + {{#if view.secondaryCompareVersion.isCurrent}} + <span class="label label-success">{{t common.current}}</span> + {{/if}} + </div> + </div> + + <div class="accordion"> + {{#each row in tab.sectionRows}} + {{#each section in row}} + <div class="panel-group"> + <div class="panel panel-default"> + <div class="panel-heading" {{action "onToggleBlock" section target="view"}}> + <h3 class="panel-title"> + <i {{bindAttr class=":pull-right :panel-toggle section.isCollapsed:icon-angle-down:icon-angle-up"}}></i> + <a class="panel-toggle category-header" {{QAAttr "category-header"}}> + <span class="category-name" {{QAAttr "category-name"}}>{{section.displayName}}</span> + </a> + </h3> + </div> + <div class="panel-body collapse in" {{bindAttr class="section.isCollapsed:hide"}} {{QAAttr "panel-body"}}> + <div class="service-config-section"> + {{#each subRow in section.subsectionRows}} + {{#each subsection in subRow}} + {{#each configData in subsection.configs}} + {{#if configData.widget}} + {{#if configData.isVisible}} + {{template "templates/common/configs/configs_comparison_row"}} + {{/if}} + {{/if}} + {{/each}} + {{#if subsection.showTabs}} + {{#each subSectionTab in subsection.subSectionTabs}} + {{#each configData in subSectionTab.configs}} + {{#if configData.isVisible}} + {{template "templates/common/configs/configs_comparison_row"}} + {{/if}} + {{/each}} + {{/each}} + {{/if}} + {{/each}} + {{/each}} + </div> + </div> + </div> + </div> + {{/each}} + {{/each}} + </div> + {{/unless}} +{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs b/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs deleted file mode 100644 index b692550..0000000 --- a/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs +++ /dev/null @@ -1,37 +0,0 @@ -{{! -* 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. -}} - -{{#each compareConfig in view.serviceConfigProperty.compareConfigs}} - <div class="clearfix"></div> - <div {{bindAttr class=":form-group :overrideField :widget-config-comparison"}}> - {{view view.serviceConfigProperty.widget canEditBinding="view.canEdit" configBinding="compareConfig" - isBeingComparedBinding="view.isBeingCompared" categoryConfigsAllBinding="view.parentView.categoryConfigsAll" isPopoverEnabled="false"}} - <div class="widget-config-controls version-labels"> - <span class="label label-info">{{compareConfig.serviceVersion.versionText}}</span> - {{#if compareConfig.serviceVersion.isCurrent}} - <span class="label label-success">{{t common.current}}</span> - {{/if}} - {{#unless compareConfig.isMock}} - {{#if compareConfig.supportsFinal}} - <i {{bindAttr class=":glyphicon :glyphicon-lock compareConfig.isFinal::hidden" }}></i> - {{/if}} - {{/unless}} - </div> - </div> -{{/each}} - <div class="clearfix"></div> http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/widgets/controls.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/widgets/controls.hbs b/ambari-web/app/templates/common/configs/widgets/controls.hbs index b7aff8e..d9a3bb2 100644 --- a/ambari-web/app/templates/common/configs/widgets/controls.hbs +++ b/ambari-web/app/templates/common/configs/widgets/controls.hbs @@ -123,16 +123,6 @@ {{t services.service.config.configHistory.configGroup}}</span> {{/if}} </div> -{{else}} - {{#unless view.isBeingCompared}} {{! subview(ConfigWidgetComparisonView) will take care of config being compared}} - {{#unless view.canEdit}} - {{#if view.config.supportsFinal}} - <div class="widget-config-controls version-labels"> - <i {{bindAttr class=":glyphicon :glyphicon-lock view.config.isFinal::hidden" }}></i> - </div> - {{/if}} - {{/unless}} - {{/unless}} {{/if}} @@ -145,8 +135,3 @@ }} {{/unless}} {{/if}} - -{{#if view.isComparison}} - <div class="clearfix"></div> - {{view App.ConfigWidgetComparisonView serviceConfigPropertyBinding="view.config"}} -{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/filter_combo_cleanable.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/filter_combo_cleanable.hbs b/ambari-web/app/templates/common/filter_combo_cleanable.hbs index 18f3322..1dab482 100644 --- a/ambari-web/app/templates/common/filter_combo_cleanable.hbs +++ b/ambari-web/app/templates/common/filter_combo_cleanable.hbs @@ -30,9 +30,10 @@ </button> <ul class="dropdown-menu"> {{#each column in view.columns}} - <li> - <a href="#" {{action selectFilterColumn column target="view"}}> - <i {{bindAttr class="column.selected:glyphicon-ok-sign:glyphicon-placeholder :glyphicon :text-success"}}></i> + <li {{bindAttr class="column.isDisabled:disabled"}}> + <a href="#" {{action selectFilterColumn column target="view"}} + {{bindAttr class="column.isDisabled:disabled"}}> + <i {{bindAttr class="column.isDisabled:disabled column.selected:glyphicon-ok-sign:glyphicon-placeholder :glyphicon :text-success"}}></i> {{column.name}} </a> </li> http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js index e18182f..ec4675e 100644 --- a/ambari-web/app/views.js +++ b/ambari-web/app/views.js @@ -74,7 +74,6 @@ require('views/common/configs/service_config_tab_view'); require('views/common/configs/config_category_container_view'); require('views/common/configs/overriddenPropertyRow_view'); require('views/common/configs/overriddenProperty_view'); -require('views/common/configs/compare_property_view'); require('views/common/configs/config_versions_control_view'); require('views/common/configs/config_versions_dropdown_view'); require('views/common/configs/selectable_popup_body_view'); @@ -98,8 +97,8 @@ require('views/common/configs/widgets/toggle_config_widget_view'); require('views/common/configs/widgets/label_config_widget_view'); require('views/common/configs/widgets/test_db_connection_widget_view'); require('views/common/configs/widgets/overrides/config_widget_override_view'); -require('views/common/configs/widgets/comparison/config_widget_comparison_view'); require('views/common/configs/service_config_layout_tab_view'); +require('views/common/configs/service_config_layout_tab_compare_view'); require('views/common/filter_combobox'); require('views/common/filter_combo_cleanable'); require('views/common/pagination_view'); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/compare_property_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/compare_property_view.js b/ambari-web/app/views/common/configs/compare_property_view.js deleted file mode 100644 index b8b022d..0000000 --- a/ambari-web/app/views/common/configs/compare_property_view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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. - */ -// SCP means ServiceConfigProperty - -var App = require('app'); - -App.ServiceConfigView.SCPComparisonRowsView = Ember.View.extend({ - classNames: ['compare-value'], - templateName: require('templates/common/configs/compare_property'), - serviceConfigProperty: null -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/config_versions_control_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/config_versions_control_view.js b/ambari-web/app/views/common/configs/config_versions_control_view.js index d5f8807..0b9fb2f 100644 --- a/ambari-web/app/views/common/configs/config_versions_control_view.js +++ b/ambari-web/app/views/common/configs/config_versions_control_view.js @@ -23,14 +23,9 @@ App.ConfigVersionsControlView = Em.View.extend({ serviceName: Em.computed.alias('controller.content.serviceName'), - /** - * @type {?App.ServiceConfigVersion} - */ - compareServiceVersion: null, - displayedServiceVersion: Em.computed.findBy('serviceVersions', 'isDisplayed', true), - isCompareMode: Em.computed.notEqual('compareServiceVersion', null), + isCompareMode: Em.computed.notEqual('controller.compareServiceVersion', null), allServiceVersions: function() { return App.ServiceConfigVersion.find().filterProperty('serviceName', this.get('serviceName')); @@ -40,12 +35,8 @@ App.ConfigVersionsControlView = Em.View.extend({ const isDefaultGroupSelected = this.get('controller.selectedConfigGroup.isDefault'); const groupId = this.get('controller.selectedConfigGroup.id'); - this.get('allServiceVersions').forEach(function (version) { - version.set('isDisabled', !(version.get('groupId') === groupId || isDefaultGroupSelected && version.get('groupName') === App.ServiceConfigGroup.defaultGroupName)); - }, this); - const serviceVersions = this.get('allServiceVersions').filter(function(s) { - return s.get('groupId') === groupId || s.get('groupName') === App.ServiceConfigGroup.defaultGroupName; + return (s.get('groupId') === groupId || isDefaultGroupSelected && s.get('groupName') === App.ServiceConfigGroup.defaultGroupName); }); if (!serviceVersions.findProperty('isDisplayed')) { @@ -59,11 +50,11 @@ App.ConfigVersionsControlView = Em.View.extend({ }.property('serviceName', 'controller.selectedConfigGroup.name'), primaryServiceVersionsInCompare: function() { - return this.get('serviceVersions').filter((sv) => sv.get('version') !== this.get('compareServiceVersion.version')); - }.property('serviceVersions', 'compareServiceVersion'), + return this.get('serviceVersions').filter((sv) => sv.get('version') !== this.get('controller.compareServiceVersion.version')); + }.property('serviceVersions', 'controller.compareServiceVersion'), secondaryServiceVersionsInCompare: function() { - if (this.get('compareServiceVersion')) { + if (this.get('controller.compareServiceVersion')) { return this.get('serviceVersions') .filter((serviceVersion) => !serviceVersion.get('isDisplayed')) .map((serviceVersion) => { @@ -75,13 +66,13 @@ App.ConfigVersionsControlView = Em.View.extend({ fullNotes: serviceVersion.get('fullNotes'), isCurrent: serviceVersion.get('isCurrent'), }); - copy.set('isDisplayed', serviceVersion.get('version') === this.get('compareServiceVersion.version')); + copy.set('isDisplayed', serviceVersion.get('version') === this.get('controller.compareServiceVersion.version')); return copy; }); } else { return []; } - }.property('serviceVersions', 'compareServiceVersion'), + }.property('serviceVersions', 'controller.compareServiceVersion'), willInsertElement: function () { this.setDisplayVersion(); @@ -93,7 +84,6 @@ App.ConfigVersionsControlView = Em.View.extend({ serviceVersions.forEach(function (serviceVersion) { serviceVersion.set('isDisplayed', selectedVersion === serviceVersion.get('version')); }); - this.set('controller.displayedVersion', this.get('serviceVersions').findProperty('isDisplayed')); }, onChangeConfigGroup: function () { @@ -118,7 +108,7 @@ App.ConfigVersionsControlView = Em.View.extend({ /** * switch configs view version to chosen */ - switchVersion: function (event) { + switchVersion: function (event, stayInCompare) { const version = event.contexts[0]; if (this.get('serviceVersions').filterProperty('isDisplayed').someProperty('version', version)) { return; @@ -127,13 +117,11 @@ App.ConfigVersionsControlView = Em.View.extend({ this.get('serviceVersions').forEach(function (serviceVersion) { serviceVersion.set('isDisplayed', serviceVersion.get('version') === version); }); - this.get('controller').loadSelectedVersion(version); - this.set('controller.displayedVersion', this.get('serviceVersions').findProperty('isDisplayed')); + this.get('controller').loadSelectedVersion(version, null, true); }, switchPrimaryInCompare: function(event) { - this.switchVersion({contexts: [event.contexts[0].get('version')]}); - this.set('controller.compareServiceVersion', this.get('compareServiceVersion')); + this.switchVersion({contexts: [event.contexts[0].get('version')]}, true); }, /** @@ -143,7 +131,6 @@ App.ConfigVersionsControlView = Em.View.extend({ compare: function (event) { const serviceConfigVersion = event.contexts[0]; this.set('controller.compareServiceVersion', serviceConfigVersion); - this.set('compareServiceVersion', serviceConfigVersion); const controller = this.get('controller'); controller.get('stepConfigs').clear(); @@ -155,8 +142,6 @@ App.ConfigVersionsControlView = Em.View.extend({ removeCompareVersionBar: function () { const displayedVersion = this.get('displayedServiceVersion.version'); - this.set('compareServiceVersion', null); - this.set('controller.compareServiceVersion', null); this.get('serviceVersions').forEach(function (serviceVersion) { serviceVersion.set('isDisplayed', serviceVersion.get('version') === displayedVersion); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js b/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js index 96c1fb1..fba3277 100644 --- a/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js +++ b/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js @@ -25,37 +25,6 @@ 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 - init: function () { - this._super(); - if (this.get('controller.name') != 'mainServiceInfoConfigsController') { - this.addObserver('isDefaultGroupSelected', this, 'setSwitchText'); - } - }, - - didInsertElement: function () { - this.setSwitchText(); - }, - - willDestroyElement: function () { - if (this.get('controller.name') != 'mainServiceInfoConfigsController') { - this.removeObserver('isDefaultGroupSelected', this, 'setSwitchText'); - } - }, - - setSwitchText: function () { - if (this.get('isDefaultGroupSelected')) { - var overrides = this.get('serviceConfigProperty.overrides'); - if (!overrides) return; - overrides.forEach(function(overriddenSCP) { - overriddenSCP.get('group').set('switchGroupTextShort', - Em.I18n.t('services.service.config_groups.switchGroupTextShort').format(overriddenSCP.get('group.displayName'))); - overriddenSCP.get('group').set('switchGroupTextFull', - Em.I18n.t('services.service.config_groups.switchGroupTextFull').format(overriddenSCP.get('group.displayName'))); - }); - this.set('serviceConfigProperty.overrides', overrides); - } - }, - toggleFinalFlag: function (event) { var override = event.contexts[0]; if (override.get('isNotEditable')) { http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js new file mode 100644 index 0000000..ee4f751 --- /dev/null +++ b/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js @@ -0,0 +1,31 @@ +/** + * 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'); + +App.ServiceConfigLayoutTabCompareView = App.ServiceConfigLayoutTabView.extend({ + templateName: require('templates/common/configs/service_config_layout_tab_compare'), + + canEdit: false, + primaryCompareVersion: null, + secondaryCompareVersion: null, + + onToggleBlock: function(event) { + event.context.toggleProperty('isCollapsed'); + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_config_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js index 50f7418..5e4253f 100644 --- a/ambari-web/app/views/common/configs/service_config_view.js +++ b/ambari-web/app/views/common/configs/service_config_view.js @@ -63,8 +63,11 @@ App.ServiceConfigView = Em.View.extend({ }.property('controller.name', 'controller.selectedService'), showSavePanel: function() { - return this.get('isOnTheServicePage') && !this.get('controller.isCompareMode') && this.get('controller.displayedVersion.isCurrent'); - }.property('isOnTheServicePage', 'controller.isCompareMode', 'controller.displayedVersion.isCurrent'), + return this.get('isOnTheServicePage') && + !this.get('controller.isCompareMode') && + this.get('controller.selectedVersionRecord.isCurrent') && + !this.get('controller.isHostsConfigsPage'); + }.property('isOnTheServicePage', 'controller.isCompareMode', 'controller.selectedVersionRecord.isCurrent', 'controller.isHostsConfigsPage'), /** * Determines if user is on the service configs page http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_configs_by_category_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js index 2e7de36..4726c61 100644 --- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js +++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js @@ -188,13 +188,22 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid * @type {boolean} */ isShowBlock: function () { - var isCustomPropertiesCategory = this.get('category.customCanAddProperty'); - var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) { + const isFilterEmpty = this.get('controller.filter') === ''; + const isFilterActive = this.get('mainView.columns').someProperty('selected'); + const isCustomPropertiesCategory = this.get('category.customCanAddProperty'); + const isCompareMode = this.get('controller.isCompareMode'); + const hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) { return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget')); }, this).length > 0; - return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('mainView.columns').someProperty('selected')) || + return (isCustomPropertiesCategory && !isCompareMode && isFilterEmpty && !isFilterActive) || hasFilteredAdvancedConfigs; - }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'mainView.columns.@each.selected'), + }.property( + 'category.customCanAddProperty', + 'categoryConfigs.@each.isHiddenByFilter', + 'categoryConfigs.@each.widget', + 'controller.filter', + 'controller.isCompareMode', + 'mainView.columns.@each.selected'), /** * Re-order the configs to list content displayType properties at last in the category http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js b/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js deleted file mode 100644 index 1461b87..0000000 --- a/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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'); - -App.ConfigWidgetComparisonView = App.ServiceConfigView.SCPComparisonRowsView.extend({ - isBeingCompared: true, - templateName: require('templates/common/configs/widgets/comparison/config_widget_comparison') -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/filter_combo_cleanable.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/filter_combo_cleanable.js b/ambari-web/app/views/common/filter_combo_cleanable.js index f26fc51..27ce6c5 100644 --- a/ambari-web/app/views/common/filter_combo_cleanable.js +++ b/ambari-web/app/views/common/filter_combo_cleanable.js @@ -49,7 +49,9 @@ App.FilterComboCleanableView = Ember.View.extend({ */ selectFilterColumn: function(event){ var column = event.context; - column.set('selected', !column.get('selected')); + if (!column.get('isDisabled')) { + column.set('selected', !column.get('selected')); + } }, filterNotEmpty: Em.computed.gt('filter.length', 0), @@ -66,7 +68,7 @@ App.FilterComboCleanableView = Ember.View.extend({ * @method clearFilterColumn */ clearFilterColumn: function() { - this.get('columns').setEach('selected', false); + this.get('columns').filterProperty('isDisabled', false).setEach('selected', false); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/mixins/common/configs/configs_comparator_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mixins/common/configs/configs_comparator_test.js b/ambari-web/test/mixins/common/configs/configs_comparator_test.js index 263cd96..5d1089a 100644 --- a/ambari-web/test/mixins/common/configs/configs_comparator_test.js +++ b/ambari-web/test/mixins/common/configs/configs_comparator_test.js @@ -109,11 +109,6 @@ describe('App.ConfigsComparator', function() { expect(mixin.initCompareConfig.calledWith([config], {})).to.be.true; }); - it("compareServiceVersion should be null", function() { - mixin.loadCompareVersionConfigs([config]); - expect(mixin.get('compareServiceVersion')).to.be.null; - }); - it("isCompareMode should be true", function() { mixin.loadCompareVersionConfigs([config]); expect(mixin.get('isCompareMode')).to.be.true; http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/views/common/configs/config_versions_control_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/config_versions_control_view_test.js b/ambari-web/test/views/common/configs/config_versions_control_view_test.js index 9f72fc5..f881872 100644 --- a/ambari-web/test/views/common/configs/config_versions_control_view_test.js +++ b/ambari-web/test/views/common/configs/config_versions_control_view_test.js @@ -54,7 +54,6 @@ describe('App.ConfigVersionsControlView', function () { view.switchVersion(event); expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([false, true]); expect(view.get('controller').loadSelectedVersion.calledWith(2)).to.be.true; - expect(view.get('controller.displayedVersion')).to.be.eql(view.get('serviceVersions')[1]); }); it('Choose displayed version', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/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 index 16ab7e4..426dc81 100644 --- a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js +++ b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js @@ -26,58 +26,16 @@ describe('App.ServiceConfigView.SCPOverriddenRowsView', function () { 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 () { - - 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')); - }); - - }); - }); http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js index 5c91220..8868ec4 100644 --- a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js +++ b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js @@ -176,6 +176,15 @@ describe('App.ServiceConfigsByCategoryView', function () { category: Em.Object.create({ customCanAddProperty: false }), m: 'Category contains mixed properties. Properties are visible. Panel should be shown', e: true + }, + { + categoryConfigs: Em.A([ + Em.Object.create({ widget: {someProp: 'a'} }) + ]), + isCompareMode: true, + category: Em.Object.create({ customCanAddProperty: true }), + m: 'Should hide block in compare mode', + e: false } ]; @@ -195,10 +204,15 @@ describe('App.ServiceConfigsByCategoryView', function () { it(test.m, function() { this._view.reopen({ category: test.category, - categoryConfigs: test.categoryConfigs + categoryConfigs: test.categoryConfigs, + mainView: Em.Object.create({ + columns: [] + }), + controller: Em.Object.create({ + isCompareMode: test.isCompareMode + }) }); expect(this._view.get('isShowBlock')).to.be.eql(test.e); - }); }); });