Browse Source

AMBARI-14426. If repos for the current os are not defined install_packages doesn't show error.(xiwang)

Xi Wang 9 years ago
parent
commit
fd6e9cc00e

+ 19 - 0
ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js

@@ -1160,6 +1160,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       sender: this,
       sender: this,
       data: data,
       data: data,
       success: 'installRepoVersionSuccess',
       success: 'installRepoVersionSuccess',
+      error: 'installRepoVersionError',
       callback: function() {
       callback: function() {
         this.sender.set('requestInProgress', false);
         this.sender.set('requestInProgress', false);
       }
       }
@@ -1311,6 +1312,24 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     }
     }
   },
   },
 
 
+  /**
+   * error callback for <code>installRepoVersion()<code>
+   * show the error message
+   * @param data
+   * @method installStackVersionSuccess
+   */
+  installRepoVersionError: function (data) {
+    var header = Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title');
+    var body = "";
+    if(data && data.responseText){
+      try {
+        var json = $.parseJSON(data.responseText);
+        body = json.message;
+      } catch (err) {}
+    }
+    App.showAlertPopup(header, body);
+  },
+
   /**
   /**
    * opens a popup with installations state per host
    * opens a popup with installations state per host
    * @param {Em.Object} version
    * @param {Em.Object} version

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

@@ -1450,6 +1450,7 @@ Em.I18n.translations = {
   'admin.stackVersions.filter.upgrading': "Upgrade/Downgrade In Process ({0})",
   'admin.stackVersions.filter.upgrading': "Upgrade/Downgrade In Process ({0})",
   'admin.stackVersions.filter.upgraded': "Ready to Finalize ({0})",
   'admin.stackVersions.filter.upgraded': "Ready to Finalize ({0})",
   'admin.stackVersions.upgrade.start.fail.title':'Upgrade could not be started',
   'admin.stackVersions.upgrade.start.fail.title':'Upgrade could not be started',
+  'admin.stackVersions.upgrade.installPackage.fail.title':'Packages could not be installed',
 
 
   'admin.stackVersions.editRepositories.info': 'Provide Base URLs for the Operating Systems you are configuring. Uncheck all other Operating Systems.',
   'admin.stackVersions.editRepositories.info': 'Provide Base URLs for the Operating Systems you are configuring. Uncheck all other Operating Systems.',
   'admin.stackVersions.editRepositories.validation.warning': 'Some of the repositories failed validation. Make changes to the base url or skip validation if you are sure that urls are correct',
   'admin.stackVersions.editRepositories.validation.warning': 'Some of the repositories failed validation. Make changes to the base url or skip validation if you are sure that urls are correct',