|
@@ -22,33 +22,30 @@ var App = require('app');
|
|
* popup to display requirements that are not met
|
|
* popup to display requirements that are not met
|
|
* for current action
|
|
* for current action
|
|
* @param data
|
|
* @param data
|
|
- * @param popup
|
|
|
|
|
|
+ * @param header
|
|
|
|
+ * @param failTitle
|
|
|
|
+ * @param failAlert
|
|
|
|
+ * @param warningTitle
|
|
|
|
+ * @param warningAlert
|
|
|
|
+ * @param callback
|
|
* @param configs
|
|
* @param configs
|
|
* @param upgradeVersion
|
|
* @param upgradeVersion
|
|
* @returns {*|void}
|
|
* @returns {*|void}
|
|
*/
|
|
*/
|
|
-App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion) {
|
|
|
|
|
|
+App.showClusterCheckPopup = function (data, header, failTitle, failAlert, warningTitle, warningAlert, callback, configs, upgradeVersion) {
|
|
var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
|
|
var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
|
|
warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
|
|
warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
|
|
hasConfigsMergeConflicts = !!(configs && configs.length),
|
|
hasConfigsMergeConflicts = !!(configs && configs.length),
|
|
- primary,
|
|
|
|
- secondary,
|
|
|
|
- popupBody;
|
|
|
|
- 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,
|
|
|
|
- warnings: warnings,
|
|
|
|
- hasConfigsMergeConflicts: hasConfigsMergeConflicts,
|
|
|
|
- isAllPassed: !fails.length && !warnings.length && !hasConfigsMergeConflicts
|
|
|
|
- };
|
|
|
|
|
|
+ popupBody = {
|
|
|
|
+ failTitle: failTitle,
|
|
|
|
+ failAlert: failAlert,
|
|
|
|
+ warningTitle: warningTitle,
|
|
|
|
+ warningAlert: warningAlert,
|
|
|
|
+ templateName: require('templates/common/modal_popups/cluster_check_dialog'),
|
|
|
|
+ fails: fails,
|
|
|
|
+ warnings: warnings,
|
|
|
|
+ hasConfigsMergeConflicts: hasConfigsMergeConflicts
|
|
|
|
+ };
|
|
if (hasConfigsMergeConflicts) {
|
|
if (hasConfigsMergeConflicts) {
|
|
popupBody.configsMergeTable = Em.View.extend({
|
|
popupBody.configsMergeTable = Em.View.extend({
|
|
templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'),
|
|
templateName: require('templates/main/admin/stack_upgrade/upgrade_configs_merge_table'),
|
|
@@ -61,15 +58,75 @@ App.showClusterCheckPopup = function (data, popup, configs, upgradeVersion) {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return App.ModalPopup.show({
|
|
return App.ModalPopup.show({
|
|
- primary: primary,
|
|
|
|
- secondary: secondary,
|
|
|
|
- header: popup.header,
|
|
|
|
|
|
+ primary: fails.length ? Em.I18n.t('common.dismiss') : Em.I18n.t('common.proceedAnyway'),
|
|
|
|
+ secondary: fails.length ? false : Em.I18n.t('common.cancel'),
|
|
|
|
+ header: header,
|
|
|
|
+ classNames: ['cluster-check-popup'],
|
|
|
|
+ bodyClass: Em.View.extend(popupBody),
|
|
|
|
+ onPrimary: function () {
|
|
|
|
+ if (!fails.length && callback) {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ this._super();
|
|
|
|
+ },
|
|
|
|
+ didInsertElement: function () {
|
|
|
|
+ this._super();
|
|
|
|
+ this.fitHeight();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * popup to display requirements that are not met
|
|
|
|
+ * for current action
|
|
|
|
+ * @param data
|
|
|
|
+ * @param header
|
|
|
|
+ * @param failTitle
|
|
|
|
+ * @param failAlert
|
|
|
|
+ * @param warningTitle
|
|
|
|
+ * @param warningAlert
|
|
|
|
+ * @param callback
|
|
|
|
+ * @param configs
|
|
|
|
+ * @param upgradeVersion
|
|
|
|
+ * @returns {*|void}
|
|
|
|
+ */
|
|
|
|
+App.showPreUpgradeCheckPopup = function (data, header, failTitle, failAlert, warningTitle, warningAlert, callback, configs, upgradeVersion) {
|
|
|
|
+ var fails = data.items.filterProperty('UpgradeChecks.status', 'FAIL'),
|
|
|
|
+ warnings = data.items.filterProperty('UpgradeChecks.status', 'WARNING'),
|
|
|
|
+ hasConfigsMergeConflicts = !!(configs && configs.length),
|
|
|
|
+ popupBody = {
|
|
|
|
+ failTitle: failTitle,
|
|
|
|
+ failAlert: failAlert,
|
|
|
|
+ warningTitle: warningTitle,
|
|
|
|
+ warningAlert: warningAlert,
|
|
|
|
+ templateName: require('templates/common/modal_popups/cluster_check_dialog'),
|
|
|
|
+ fails: fails,
|
|
|
|
+ warnings: warnings,
|
|
|
|
+ hasConfigsMergeConflicts: hasConfigsMergeConflicts,
|
|
|
|
+ isAllPassed: !fails.length && !warnings.length && !hasConfigsMergeConflicts.length
|
|
|
|
+ };
|
|
|
|
+ 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
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return App.ModalPopup.show({
|
|
|
|
+ primary: Em.I18n.t('admin.stackVersions.version.upgrade.upgradeOptions.preCheck.rerun'),
|
|
|
|
+ secondary: Em.I18n.t('common.cancel'),
|
|
|
|
+ header: header,
|
|
classNames: ['cluster-check-popup'],
|
|
classNames: ['cluster-check-popup'],
|
|
bodyClass: Em.View.extend(popupBody),
|
|
bodyClass: Em.View.extend(popupBody),
|
|
onPrimary: function () {
|
|
onPrimary: function () {
|
|
this._super();
|
|
this._super();
|
|
- if (!popup.noCallbackCondition && popup.callback) {
|
|
|
|
- popup.callback();
|
|
|
|
|
|
+ if (callback) {
|
|
|
|
+ callback();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
didInsertElement: function () {
|
|
didInsertElement: function () {
|