Repository: ambari Updated Branches: refs/heads/trunk 8fd6395b3 -> 742225ab9
AMBARI-19888. A lot of warning messages after opening "Upgrade to ..."-popup (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/742225ab Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/742225ab Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/742225ab Branch: refs/heads/trunk Commit: 742225ab9b400b80dba6f878bedcfad1cd3534e6 Parents: 8fd6395 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Tue Feb 7 13:14:30 2017 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed Feb 8 13:59:38 2017 +0200 ---------------------------------------------------------------------- .../modal_popups/cluster_check_dialog.hbs | 12 ++-- .../common/modal_popups/cluster_check_popup.js | 68 ++++++++++++-------- ambari-web/test/models/service_test.js | 39 ----------- .../modal_popups/cluster_check_popup_test.js | 48 ++++++++------ 4 files changed, 74 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/742225ab/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs index 88d8eaf..79e1de5 100644 --- a/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs +++ b/ambari-web/app/templates/common/modal_popups/cluster_check_dialog.hbs @@ -30,8 +30,8 @@ {{/if}} <div class="limited-height-2"> {{#each item in view.fails}} - <i class="glyphicon glyphicon-remove"></i> <span>{{item.UpgradeChecks.check}}</span> - <pre>{{t popup.clusterCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre> + <i class="glyphicon glyphicon-remove"></i> <span>{{item.check}}</span> + <pre>{{t popup.clusterCheck.reason}}{{item.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.failed_on}}</pre> {{/each}} </div> {{/if}} @@ -48,8 +48,8 @@ {{/if}} <div class="limited-height-2"> {{#each item in view.bypass}} - <i class="glyphicon glyphicon-remove"></i> <span>{{item.UpgradeChecks.check}}</span> - <pre>{{t popup.clusterCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre> + <i class="glyphicon glyphicon-remove"></i> <span>{{item.check}}</span> + <pre>{{t popup.clusterCheck.reason}}{{item.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.failed_on}}</pre> {{/each}} </div> {{/if}} @@ -65,8 +65,8 @@ {{/if}} <div class="limited-height-2"> {{#each item in view.warnings}} - <i class="glyphicon glyphicon-warning-sign"></i> <span>{{item.UpgradeChecks.check}}</span> - <pre>{{t popup.clusterCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre> + <i class="glyphicon glyphicon-warning-sign"></i> <span>{{item.check}}</span> + <pre>{{t popup.clusterCheck.reason}}{{item.reason}}<br/>{{t popup.clusterCheck.failedOn}}{{item.failed_on}}</pre> {{/each}} </div> {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/742225ab/ambari-web/app/views/common/modal_popups/cluster_check_popup.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js index a2f6f83..a613f4b 100644 --- a/ambari-web/app/views/common/modal_popups/cluster_check_popup.js +++ b/ambari-web/app/views/common/modal_popups/cluster_check_popup.js @@ -18,6 +18,10 @@ var App = require('app'); +function mapUpgradeChecks(items) { + return items.map(item => Em.getProperties(item.UpgradeChecks, ['failed_on', 'reason', 'check'])); +} + /** * popup to display requirements that are not met * for current action @@ -33,41 +37,49 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion) { bypass = data.items.filterProperty('UpgradeChecks.status', 'BYPASS'), hasConfigsMergeConflicts = !!(configs && configs.length), primary, - secondary, - popupBody; + secondary; popup = popup || {}; - primary = Em.isNone(popup.primary) ? - (fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway')) : popup.primary; - secondary = Em.isNone(popup.secondary) ? (fails.length ? false : Em.I18n.t('common.cancel')) : popup.secondary; - popupBody = { - failTitle: popup.failTitle, - failAlert: popup.failAlert, - warningTitle: popup.warningTitle, - warningAlert: popup.warningAlert, - templateName: require('templates/common/modal_popups/cluster_check_dialog'), - fails: fails, - bypass: bypass, // errors that can be bypassed - warnings: warnings, - hasConfigsMergeConflicts: hasConfigsMergeConflicts, - isAllPassed: !fails.length && !warnings.length && !bypass.length && !hasConfigsMergeConflicts - }; - if (hasConfigsMergeConflicts) { - popupBody.configsMergeTable = Em.View.extend({ - templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'), - configs: configs, - didInsertElement: function () { - App.tooltip($('.recommended-value'), { - title: upgradeVersion - }); - } - }); + + if (Em.isNone(popup.primary)) { + primary = fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway'); + } + else { + primary = popup.primary; } + + if (Em.isNone(popup.secondary)) { + secondary = fails.length ? false : Em.I18n.t('common.cancel'); + } + else { + secondary = popup.secondary; + } + return App.ModalPopup.show({ primary: primary, secondary: secondary, header: popup.header, classNames: ['cluster-check-popup'], - bodyClass: Em.View.extend(popupBody), + bodyClass: Em.View.extend({ + failTitle: popup.failTitle, + failAlert: popup.failAlert, + warningTitle: popup.warningTitle, + warningAlert: popup.warningAlert, + templateName: require('templates/common/modal_popups/cluster_check_dialog'), + warnings: mapUpgradeChecks(warnings), + fails: mapUpgradeChecks(fails), + bypass: mapUpgradeChecks(bypass), // errors that can be bypassed + hasConfigsMergeConflicts: hasConfigsMergeConflicts, + isAllPassed: !fails.length && !warnings.length && !bypass.length && !hasConfigsMergeConflicts, + configsMergeTable: Em.View.extend({ + templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'), + configs: configs, + didInsertElement: function () { + App.tooltip($('.recommended-value'), { + title: upgradeVersion + }); + } + }) + }), onPrimary: function () { this._super(); if (!popup.noCallbackCondition && popup.callback) { http://git-wip-us.apache.org/repos/asf/ambari/blob/742225ab/ambari-web/test/models/service_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/service_test.js b/ambari-web/test/models/service_test.js index 5bd0cf8..887aa28 100644 --- a/ambari-web/test/models/service_test.js +++ b/ambari-web/test/models/service_test.js @@ -35,45 +35,6 @@ var service, property: 'isStarted' } ], - hostComponentsDataFalse = [ - [], - [ - { - staleConfigs: false - } - ], - [ - { - service: { - serviceName: 'HIVE' - }, - staleConfigs: false - } - ] - ], - hostComponentsDataTrue = [ - [ - Em.Object.create({ - service: { - serviceName: 'HDFS' - }, - staleConfigs: true, - displayName: 'service0' - }) - ], - [ - Em.Object.create({ - host: { - publicHostName: 'host0' - }, - service: { - serviceName: 'HDFS' - }, - staleConfigs: true, - displayName: 'service1' - }) - ] - ], restartData = { host0: ['service0', 'service1'] }; http://git-wip-us.apache.org/repos/asf/ambari/blob/742225ab/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js b/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js index 71e602a..d70379b 100644 --- a/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js +++ b/ambari-web/test/views/common/modal_popups/cluster_check_popup_test.js @@ -70,13 +70,19 @@ describe('App.showClusterCheckPopup', function () { { UpgradeChecks: { id: 'w0', - status: 'WARNING' + status: 'WARNING', + check: 'w0 check', + failed_on: 'w0 failed', + reason: 'w0 reason' } }, { UpgradeChecks: { id: 'w1', - status: 'WARNING' + status: 'WARNING', + check: 'w1 check', + failed_on: 'w1 failed', + reason: 'w1 reason' } } ] @@ -103,16 +109,14 @@ describe('App.showClusterCheckPopup', function () { fails: [], warnings: [ { - UpgradeChecks: { - id: 'w0', - status: 'WARNING' - } + check: 'w0 check', + failed_on: 'w0 failed', + reason: 'w0 reason' }, { - UpgradeChecks: { - id: 'w1', - status: 'WARNING' - } + check: 'w1 check', + failed_on: 'w1 failed', + reason: 'w1 reason' } ], hasConfigsMergeConflicts: false, @@ -128,13 +132,19 @@ describe('App.showClusterCheckPopup', function () { { UpgradeChecks: { id: 'f0', - status: 'FAIL' + status: 'FAIL', + check: 'f0 check', + failed_on: 'f0 failed', + reason: 'f0 reason' } }, { UpgradeChecks: { id: 'f1', - status: 'FAIL' + status: 'FAIL', + check: 'f1 check', + failed_on: 'f1 failed', + reason: 'f1 reason' } } ] @@ -156,16 +166,14 @@ describe('App.showClusterCheckPopup', function () { warningAlert: undefined, fails: [ { - UpgradeChecks: { - id: 'f0', - status: 'FAIL' - } + check: 'f0 check', + failed_on: 'f0 failed', + reason: 'f0 reason' }, { - UpgradeChecks: { - id: 'f1', - status: 'FAIL' - } + check: 'f1 check', + failed_on: 'f1 failed', + reason: 'f1 reason' } ], warnings: [],