Forráskód Böngészése

AMBARI-15351 Remove Service: Delete confirmation tweaks. (atkach)

Andrii Tkach 9 éve
szülő
commit
f9d317bd29

+ 10 - 6
ambari-web/app/controllers/main/service/item.js

@@ -1167,11 +1167,14 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
    * @param {string} [servicesToDeleteFmt]
    */
   confirmDeleteService: function (serviceName, dependentServiceNames, servicesToDeleteFmt) {
-    var message = dependentServiceNames && dependentServiceNames.length
-        ? Em.I18n.t('services.service.confirmDelete.popup.body.dependent').format(App.format.role(serviceName), servicesToDeleteFmt)
-        : Em.I18n.t('services.service.confirmDelete.popup.body').format(App.format.role(serviceName)),
-        confirmKey = 'yes',
-        self = this;
+    var confirmKey = 'delete',
+        self = this,
+        message = Em.I18n.t('services.service.confirmDelete.popup.body').format(App.format.role(serviceName), confirmKey);
+
+    if (dependentServiceNames.length > 0) {
+      message = Em.I18n.t('services.service.confirmDelete.popup.body.dependent')
+                .format(App.format.role(serviceName), servicesToDeleteFmt, confirmKey);
+    }
 
     App.ModalPopup.show({
 
@@ -1213,9 +1216,10 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
        */
       bodyClass: Em.View.extend({
         confirmKey: confirmKey,
+        typeMessage: Em.I18n.t('services.service.confirmDelete.popup.body.type').format(confirmKey),
         template: Em.Handlebars.compile(message +
         '<div class="form-inline align-center"></br>' +
-        '<label><b>{{t common.enter}}&nbsp;{{view.confirmKey}}</b></label>&nbsp;' +
+        '<label><b>{{view.typeMessage}}</b></label>&nbsp;' +
         '{{view Ember.TextField valueBinding="view.parentView.confirmInput" class="input-small"}}</br>' +
         '</div>')
       }),

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

@@ -1724,10 +1724,11 @@ Em.I18n.translations = {
   ' and configuration history will be lost.</b>',
   'services.service.delete.popup.warning.dependent': '<b>Note! {0} will be deleted too.</b>',
   'services.service.confirmDelete.popup.header': 'Confirm Delete',
-  'services.service.confirmDelete.popup.body': 'You must confirm delete of <b>{0}</b> by typing "yes"' +
+  'services.service.confirmDelete.popup.body': 'You must confirm delete of <b>{0}</b> by typing "{1}"' +
   ' in the confirmation box. <b>This operation is not reversible and all configuration history will be lost.</b>',
+  'services.service.confirmDelete.popup.body.type': 'Type "{0}" to confirm',
 
-  'services.service.confirmDelete.popup.body.dependent': 'You must confirm delete of <b>{0}</b> and <b>{1}</b> by typing "yes"' +
+  'services.service.confirmDelete.popup.body.dependent': 'You must confirm delete of <b>{0}</b> and <b>{1}</b> by typing "{2}"' +
   ' in the confirmation box. <b>This operation is not reversible and all configuration history will be lost.</b>',
   'services.service.summary.unknown':'unknown',
   'services.service.summary.notRunning':'Not Running',

+ 1 - 1
ambari-web/test/controllers/main/service/item_test.js

@@ -1362,7 +1362,7 @@ describe('App.MainServiceItemController', function () {
     });
 
     it("App.ModalPopup.show should be called", function() {
-      mainServiceItemController.confirmDeleteService();
+      mainServiceItemController.confirmDeleteService('S1', [], '');
       expect(App.ModalPopup.show.calledOnce).to.be.true;
     });
   });