ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [14/50] [abbrv] ambari git commit: AMBARI-14509. Handle the case when UI call to 'Install Packages' action times out (alexantonenko)
Date Mon, 04 Jan 2016 21:38:07 GMT
AMBARI-14509. Handle the case when UI call to 'Install Packages' action times out
 (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/23653924
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/23653924
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/23653924

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 23653924d6016ce6b3b52d5ea84d53298721ad6f
Parents: f2b1a89
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Dec 28 20:42:33 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Mon Dec 28 21:17:57 2015 +0200

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js        | 14 ++++++++++++++
 ambari-web/app/messages.js                            |  1 +
 .../main/admin/stack_upgrade/upgrade_version_box.hbs  |  3 +++
 .../admin/stack_upgrade/upgrade_version_box_view.js   |  8 +++++++-
 4 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 748cbc8..06ddf24 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -140,6 +140,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    */
   requestInProgress: false,
   /**
+   * @type {number} repo id, request for which is currently in progress
+   */
+  requestInProgressRepoId: null,
+  /**
    * @type {boolean} true while no updated upgrade info is loaded after retry
    */
   isRetryPending: false,
@@ -1140,6 +1144,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    */
   installRepoVersion: function (repo) {
     this.set('requestInProgress', true);
+    this.set('requestInProgressRepoId', repo.get('id'));
+
     var data = {
       ClusterStackVersions: {
         stack: repo.get('stackVersionType'),
@@ -1156,6 +1162,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       error: 'installRepoVersionError',
       callback: function() {
         this.sender.set('requestInProgress', false);
+        this.sender.set('requestInProgressRepoId', null);
       }
     });
   },
@@ -1293,6 +1300,10 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @method installStackVersionSuccess
    */
   installRepoVersionSuccess: function (data, opt, params) {
+    if(data && data.statusText == "timeout") {
+      App.showAlertPopup(Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.title'),
Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout'));
+      return false;
+    }
     var version = App.RepositoryVersion.find(params.id);
     App.db.set('repoVersionInstall', 'id', [data.Requests.id]);
     App.clusterStatus.setClusterStatus({
@@ -1320,6 +1331,9 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
         body = json.message;
       } catch (err) {}
     }
+    if(data && data.statusText == "timeout") {
+      body = Em.I18n.t('admin.stackVersions.upgrade.installPackage.fail.timeout');
+    }
     App.showAlertPopup(header, body);
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index c0e1e16..2203b17 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1451,6 +1451,7 @@ Em.I18n.translations = {
   'admin.stackVersions.filter.upgraded': "Ready to Finalize ({0})",
   'admin.stackVersions.upgrade.start.fail.title':'Upgrade could not be started',
   'admin.stackVersions.upgrade.installPackage.fail.title':'Packages could not be installed',
+  'admin.stackVersions.upgrade.installPackage.fail.timeout':'Request timed out.',
 
   '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',

http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
index 96d4544..1bc81c5 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
@@ -71,6 +71,9 @@
       }}
     {{/if}}
   {{/if}}
+  {{#if view.stateElement.isSpinner}}
+    <div {{bindAttr class="view.stateElement.class"}}></div>
+  {{/if}}
 </div>
 
 <div class="hosts-section">

http://git-wip-us.apache.org/repos/asf/ambari/blob/23653924/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index b6c5ad9..df588fd 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -114,6 +114,10 @@ App.UpgradeVersionBoxView = Em.View.extend({
       text: Em.I18n.t('admin.stackVersions.version.installNow'),
       action: 'installRepoVersionConfirmation'
     },
+    'LOADING': {
+      isSpinner: true,
+      class: 'spinner'
+    },
     'INSTALLING': {
       iconClass: 'icon-cog',
       isLink: true,
@@ -141,6 +145,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
   stateElement: function () {
     var currentVersion = this.get('controller.currentVersion');
     var statePropertiesMap = this.get('statePropertiesMap');
+    var requestInProgressRepoId = this.get('controller.requestInProgressRepoId');
     var status = this.get('content.status');
     var element = Em.Object.create({
       status: status,
@@ -157,7 +162,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
       element.setProperties(statePropertiesMap[status]);
     }
     else if (status === 'INIT') {
-      element.setProperties(statePropertiesMap[status]);
+      requestInProgressRepoId && requestInProgressRepoId == this.get('content.id')
? element.setProperties(statePropertiesMap['LOADING']) : element.setProperties(statePropertiesMap[status]);
       element.set('isDisabled', this.get('controller.requestInProgress') || isInstalling);
     }
     else if ((status === 'INSTALLED' && !this.get('isUpgrading')) ||
@@ -221,6 +226,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
     'controller.isDowngrade',
     'isUpgrading',
     'controller.requestInProgress',
+    'controller.requestInProgressRepoId',
     'parentView.repoVersions.@each.status'
   ),
 


Mime
View raw message