You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rz...@apache.org on 2017/02/17 22:57:28 UTC

[50/51] [abbrv] ambari git commit: AMBARI-19907. On certain actions, there's no feedback from the UI when API takes a long time to respond - not reassuring and the user is encouraged to keep triggering the same heavy action to make the problem worse. (vs

AMBARI-19907. On certain actions, there's no feedback from the UI when API takes a long time to respond - not reassuring and the user is encouraged to keep triggering the same heavy action to make the problem worse. (vsubramanian)

Change-Id: Ia87a2c9b5e16f487be32dcf7232728c1458eaf27


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

Branch: refs/heads/branch-feature-BUG-74026
Commit: c77ca2e55c64f8ec657230c54917112606900b45
Parents: 6e2a285
Author: Vivek Ratnavel Subramanian <vi...@gmail.com>
Authored: Tue Feb 7 18:13:21 2017 -0800
Committer: Vivek Ratnavel Subramanian <vi...@gmail.com>
Committed: Tue Feb 7 18:13:21 2017 -0800

----------------------------------------------------------------------
 .../main/host/bulk_operations_controller.js     | 33 ++++++++------------
 ambari-web/app/controllers/main/host/details.js | 24 +++++++++-----
 ambari-web/app/controllers/main/service.js      | 12 ++++---
 ambari-web/app/controllers/main/service/item.js | 30 ++++++++++++------
 ambari-web/app/utils/ajax/ajax.js               | 17 +++++++++-
 .../app/utils/batch_scheduled_requests.js       |  6 ++--
 .../test/controllers/main/service_test.js       |  6 ++--
 7 files changed, 81 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/controllers/main/host/bulk_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/bulk_operations_controller.js b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
index 0e73c0c..a43f9f1 100644
--- a/ambari-web/app/controllers/main/host/bulk_operations_controller.js
+++ b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
@@ -252,7 +252,8 @@ App.BulkOperationsController = Em.Controller.extend({
           context: operationData.message,
           noOpsMessage: Em.I18n.t('hosts.host.maintainance.reinstallFailedComponents.context')
         },
-        success: 'bulkOperationForHostComponentsSuccessCallback'
+        success: 'bulkOperationForHostComponentsSuccessCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -274,7 +275,8 @@ App.BulkOperationsController = Em.Controller.extend({
           hosts: hosts.mapProperty('hostName')
         },
         success: 'bulkOperationForHostsDeleteDryRunCallback',
-        error: 'bulkOperationForHostsDeleteDryRunCallback'
+        error: 'bulkOperationForHostsDeleteDryRunCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -371,7 +373,8 @@ App.BulkOperationsController = Em.Controller.extend({
               hosts: hosts.mapProperty('deleted.key')
             },
             success: 'bulkOperationForHostsDeleteCallback',
-            error: 'bulkOperationForHostsDeleteCallback'
+            error: 'bulkOperationForHostsDeleteCallback',
+            showLoadingPopup: true
           });
         },
         bodyClass: Em.View.extend({
@@ -623,7 +626,8 @@ App.BulkOperationsController = Em.Controller.extend({
           }),
           context: operationData.message + ' ' + operationData.componentNameFormatted,
         },
-        success: 'bulkOperationForHostComponentsAddSuccessCallback'
+        success: 'bulkOperationForHostComponentsAddSuccessCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -932,28 +936,19 @@ App.BulkOperationsController = Em.Controller.extend({
       return;
     }
 
-    var loadingPopup = App.ModalPopup.show({
-      header: Em.I18n.t('jobs.loadingTasks'),
-      primary: false,
-      secondary: false,
-      bodyClass: Em.View.extend({
-        template: Em.Handlebars.compile('{{view App.SpinnerView}}')
-      })
-    });
-
-    this.getHostsForBulkOperations(queryParams, operationData, loadingPopup);
+    this.getHostsForBulkOperations(queryParams, operationData);
   },
 
-  getHostsForBulkOperations: function (queryParams, operationData, loadingPopup) {
+  getHostsForBulkOperations: function (queryParams, operationData) {
     return App.ajax.send({
       name: 'hosts.bulk.operations',
       sender: this,
       data: {
         parameters: App.router.get('updateController').computeParameters(queryParams),
-        operationData: operationData,
-        loadingPopup: loadingPopup
+        operationData: operationData
       },
-      success: 'getHostsForBulkOperationSuccessCallback'
+      success: 'getHostsForBulkOperationSuccessCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -979,8 +974,6 @@ App.BulkOperationsController = Em.Controller.extend({
       return;
     }
 
-    Em.tryInvoke(param.loadingPopup, 'hide');
-
     if ('SET_RACK_INFO' === operationData.action) {
       return self.bulkOperation(operationData, hosts);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index f040db5..d9bf401 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -192,7 +192,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       sender: this,
       data: data,
       success: 'sendComponentCommandSuccessCallback',
-      error: 'ajaxErrorCallback'
+      error: 'ajaxErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -435,7 +436,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         hostName: this.get('content.hostName')
       },
       success: '_doDeleteHostComponentSuccessCallback',
-      error: '_doDeleteHostComponentErrorCallback'
+      error: '_doDeleteHostComponentErrorCallback',
+      showLoadingPopup: true
     }).then(callback, callback);
   },
 
@@ -1294,7 +1296,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         resource_filters: resource_filters,
         context: context
       },
-      success: 'refreshComponentConfigsSuccessCallback'
+      success: 'refreshComponentConfigsSuccessCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -1484,7 +1487,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
                 }
               },
               success: 'installComponentSuccessCallback',
-              error: 'ajaxErrorCallback'
+              error: 'ajaxErrorCallback',
+              showLoadingPopup: true
             });
           })
         });
@@ -1590,7 +1594,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         slaveType: slaveType
       },
       success: 'decommissionSuccessCallback',
-      error: 'decommissionErrorCallback'
+      error: 'decommissionErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -1773,7 +1778,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         batches: batches
       },
       success: 'decommissionSuccessCallback',
-      error: 'decommissionErrorCallback'
+      error: 'decommissionErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -1880,7 +1886,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         batches: batches
       },
       success: 'decommissionSuccessCallback',
-      error: 'decommissionErrorCallback'
+      error: 'decommissionErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -2279,7 +2286,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
           },
           callback: completeCallback,
           success: 'deleteHostSuccessCallback',
-          error: 'deleteHostErrorCallback'
+          error: 'deleteHostErrorCallback',
+          showLoadingPopup: true
         });
       }
       else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/controllers/main/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js
index e434d41..5dfc176 100644
--- a/ambari-web/app/controllers/main/service.js
+++ b/ambari-web/app/controllers/main/service.js
@@ -171,7 +171,8 @@ App.MainServiceController = Em.ArrayController.extend(App.SupportClientConfigsDo
         query: query
       },
       success: 'allServicesCallSuccessCallback',
-      error: 'allServicesCallErrorCallback'
+      error: 'allServicesCallErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -196,7 +197,8 @@ App.MainServiceController = Em.ArrayController.extend(App.SupportClientConfigsDo
           state: 'INSTALLED'
         }
       },
-      success: 'silentStopSuccess'
+      success: 'silentStopSuccess',
+      showLoadingPopup: true
     });
   },
 
@@ -246,7 +248,8 @@ App.MainServiceController = Em.ArrayController.extend(App.SupportClientConfigsDo
             state: 'STARTED'
           }
         },
-        success: 'silentCallSuccessCallback'
+        success: 'silentCallSuccessCallback',
+        showLoadingPopup: true
       });
     }
   }.observes('shouldStart', 'controllers.backgroundOperationsController.allOperationsCount'),
@@ -333,7 +336,8 @@ App.MainServiceController = Em.ArrayController.extend(App.SupportClientConfigsDo
     App.ajax.send({
       name: 'restart.staleConfigs',
       sender: this,
-      success: 'restartAllRequiredSuccessCallback'
+      success: 'restartAllRequiredSuccessCallback',
+      showLoadingPopup: true
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 6f1efd8..e8942a4 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -482,7 +482,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       'sender': this,
       'success': 'startStopPopupSuccessCallback',
       'error': 'startStopPopupErrorCallback',
-      'data': data
+      'data': data,
+      'showLoadingPopup': true
     });
   },
 
@@ -538,7 +539,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
         forceRefreshConfigTags : "capacity-scheduler"
       },
       success : 'refreshYarnQueuesSuccessCallback',
-      error : 'refreshYarnQueuesErrorCallback'
+      error : 'refreshYarnQueuesErrorCallback',
+      showLoadingPopup: true
     });
     });
   },
@@ -583,7 +585,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
           componentName: "KNOX_GATEWAY"
         },
         success: 'startStopLdapKnoxSuccessCallback',
-        error: 'startStopLdapKnoxErrorCallback'
+        error: 'startStopLdapKnoxErrorCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -630,7 +633,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
         componentName: "HIVE_SERVER_INTERACTIVE"
       },
       success: 'requestSuccessCallback',
-      error: 'requestErrorCallback'
+      error: 'requestErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -675,7 +679,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
         batches: batches
       },
       success: 'requestSuccessCallback',
-      error: 'requestErrorCallback'
+      error: 'requestErrorCallback',
+      showLoadingPopup: true
     });
   },
 
@@ -727,7 +732,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
             threshold: this.get('inputValue')
           },
           success : 'rebalanceHdfsNodesSuccessCallback',
-          error : 'rebalanceHdfsNodesErrorCallback'
+          error : 'rebalanceHdfsNodesErrorCallback',
+          showLoadingPopup: true
         });
         this.hide();
       },
@@ -852,7 +858,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       'sender': this,
       'success':'runSmokeTestSuccessCallBack',
       'error':'runSmokeTestErrorCallBack',
-      'data': requestData
+      'data': requestData,
+      showLoadingPopup: true
     });
   },
 
@@ -1129,7 +1136,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
           componentName : context.component
         },
         success : 'executeCustomCommandSuccessCallback',
-        error : 'executeCustomCommandErrorCallback'
+        error : 'executeCustomCommandErrorCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -1153,7 +1161,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
           forceRefreshConfigTags : "capacity-scheduler"
         },
         success : 'executeCustomCommandSuccessCallback',
-        error : 'executeCustomCommandErrorCallback'
+        error : 'executeCustomCommandErrorCallback',
+        showLoadingPopup: true
       });
     });
   },
@@ -1577,7 +1586,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
         servicesToDeleteNext: servicesToDeleteNext
       },
       success : 'deleteServiceCallSuccessCallback',
-      error: 'deleteServiceCallErrorCallback'
+      error: 'deleteServiceCallErrorCallback',
+      showLoadingPopup: true
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 2ea6113..82fa34f 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -3103,13 +3103,25 @@ var ajax = Em.Object.extend({
       return null;
     }
 
+    var loadingPopup = null;
+    if(config.hasOwnProperty("showLoadingPopup") && config.showLoadingPopup === true) {
+      loadingPopup = App.ModalPopup.show({
+        header: Em.I18n.t('jobs.loadingTasks'),
+        primary: false,
+        secondary: false,
+        bodyClass: Em.View.extend({
+          template: Em.Handlebars.compile('{{view App.SpinnerView}}')
+        })
+      });
+    }
+
     // default parameters
     var params = {
       clusterName: (App.get('clusterName') || App.clusterStatus.get('clusterName'))
     };
 
     // extend default parameters with provided
-    if (config.data) {
+    if (config.hasOwnProperty("data") && config.data) {
       jQuery.extend(params, config.data);
     }
 
@@ -3152,6 +3164,9 @@ var ajax = Em.Object.extend({
       }
     };
     opt.complete = function () {
+      if(loadingPopup) {
+        Em.tryInvoke(loadingPopup, 'hide');
+      }
       App.logger.logTimerIfMoreThan(consoleMsg, 1000);
       if (config.callback) {
         config.callback();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/app/utils/batch_scheduled_requests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/batch_scheduled_requests.js b/ambari-web/app/utils/batch_scheduled_requests.js
index b8ae955..6d1e721 100644
--- a/ambari-web/app/utils/batch_scheduled_requests.js
+++ b/ambari-web/app/utils/batch_scheduled_requests.js
@@ -244,7 +244,8 @@ module.exports = {
           operation_level: operation_level
         },
         success: 'successCallback',
-        error: 'errorCallback'
+        error: 'errorCallback',
+        showLoadingPopup: true
       });
     }
   },
@@ -318,7 +319,8 @@ module.exports = {
         batches: this.getBatchesForRollingRestartRequest(restartHostComponents, batchSize)
       },
       success: 'successCallback',
-      error: 'errorCallback'
+      error: 'errorCallback',
+      showLoadingPopup: true
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c77ca2e5/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index d8c3365..7ed7641 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -462,7 +462,8 @@ describe('App.MainServiceController', function () {
             state: 'INSTALLED'
           }
         },
-        success: 'silentStopSuccess'
+        success: 'silentStopSuccess',
+        showLoadingPopup: true
       });
     });
   });
@@ -598,7 +599,8 @@ describe('App.MainServiceController', function () {
             state: 'STARTED'
           }
         },
-        success: 'silentCallSuccessCallback'
+        success: 'silentCallSuccessCallback',
+        showLoadingPopup: true
       });
       expect(mainServiceController.get('shouldStart')).to.be.false;
     });