소스 검색

AMBARI-11188. Widgets: Warning should be explicit exiting of create widget wizard (onechiporenko)

Oleg Nechiporenko 10 년 전
부모
커밋
8cd295c10e
2개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. 6 7
      ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js
  2. 2 0
      ambari-web/app/messages.js

+ 6 - 7
ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js

@@ -322,17 +322,16 @@ App.WidgetWizardController = App.WizardController.extend({
   cancel: function () {
     var self = this;
     var step3Controller = App.router.get('widgetWizardStep3Controller');
+    var isLastStep = parseInt(self.get('currentStep')) === self.get('totalSteps');
     return App.ModalPopup.show({
       header: Em.I18n.t('common.warning'),
-      bodyClass: Em.View.extend({
-        template: Ember.Handlebars.compile('{{t alerts.saveChanges}}')
-      }),
-      primary: Em.I18n.t('common.save'),
-      secondary: Em.I18n.t('common.discard'),
+      body: Em.I18n.t('dashboard.widgets.wizard.onClose.popup.body'),
+      primary: isLastStep ? Em.I18n.t('common.save') : null,
+      secondary: Em.I18n.t('dashboard.widgets.wizard.onClose.popup.discardAndExit'),
       third: Em.I18n.t('common.cancel'),
       disablePrimary: function () {
-        return !(parseInt(self.get('currentStep')) === self.get('totalSteps') && !step3Controller.get('isSubmitDisabled'));
-      }.property(''),
+        return !(isLastStep && !step3Controller.get('isSubmitDisabled'));
+      }.property(),
       onPrimary: function () {
         App.router.send('complete', step3Controller.collectWidgetData());
         this.onSecondary();

+ 2 - 0
ambari-web/app/messages.js

@@ -2590,6 +2590,8 @@ Em.I18n.translations = {
   'dashboard.widgets.wizard.step2.aggregateTooltip': 'This mathematical function will be applied to compute single value for selected metric across all host components',
   'dashboard.widgets.wizard.step2.threshold.ok.tooltip': 'This is the threshold value at which the widget color changes from green (OK) to orange (Warning)',
   'dashboard.widgets.wizard.step2.threshold.warning.tooltip': 'This is the threshold value at which the widget color changes from orange (Warning) to red (Critical)',
+  'dashboard.widgets.wizard.onClose.popup.body': 'You have unsaved changes. Your changes will not be saved if you exit the wizard at this step.',
+  'dashboard.widgets.wizard.onClose.popup.discardAndExit': 'Discard and Exit',
 
   'restart.service.all': 'Restart All',
   'restart.service.all.affected': 'Restart All Affected',