You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/02/26 00:08:13 UTC
svn commit: r1449954 - in /incubator/ambari/trunk: CHANGES.txt
ambari-web/app/config.js
ambari-web/app/controllers/global/cluster_controller.js
ambari-web/app/controllers/main.js ambari-web/app/utils/http_client.js
Author: jaimin
Date: Mon Feb 25 23:08:12 2013
New Revision: 1449954
URL: http://svn.apache.org/r1449954
Log:
AMBARI-1494. Browser memory consumption issues. (jaimin)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/config.js
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main.js
incubator/ambari/trunk/ambari-web/app/utils/http_client.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1449954&r1=1449953&r2=1449954&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Feb 25 23:08:12 2013
@@ -374,6 +374,8 @@ Trunk (unreleased changes):
BUG FIXES
+ AMBARI-1494. Browser memory consumption issues. (jaimin)
+
AMBARI-1480. Comparison predicate should account for null values. (tbeerbower)
AMBARI-1467. UI should block on cluster metric api call before making
Modified: incubator/ambari/trunk/ambari-web/app/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/config.js?rev=1449954&r1=1449953&r2=1449954&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/config.js Mon Feb 25 23:08:12 2013
@@ -35,6 +35,7 @@ App.bgOperationsUpdateInterval = 6000;
App.componentsUpdateInterval = 6000;
App.contentUpdateInterval = 15000;
App.maxRunsForAppBrowser = 500;
+App.pageReloadTime=3600000;
// this is to make sure that IE does not cache data when making AJAX calls to the server
$.ajaxSetup({
Modified: incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js?rev=1449954&r1=1449953&r2=1449954&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js Mon Feb 25 23:08:12 2013
@@ -186,6 +186,7 @@ App.ClusterController = Em.Controller.ex
* property, which will trigger the alerts property.
*/
loadAlerts:function () {
+ var self=this;
if(App.router.get('updateController.isUpdated')){
return;
}
@@ -200,8 +201,8 @@ App.ClusterController = Em.Controller.ex
dataType:"json",
context:this,
complete:function (jqXHR, textStatus) {
- this.updateLoadStatus('alerts');
- this.updateAlerts();
+ self.updateLoadStatus('alerts');
+ self.updateAlerts();
},
error: function(jqXHR, testStatus, error) {
// this.showMessage(Em.I18n.t('nagios.alerts.unavailable'));
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main.js?rev=1449954&r1=1449953&r2=1449954&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main.js Mon Feb 25 23:08:12 2013
@@ -52,5 +52,19 @@ App.MainController = Em.Controller.exten
App.router.get('updateController').set('isWorking', false);
App.router.get('backgroundOperationsController').set('isWorking', false);
App.router.get('clusterController').set('isWorking', false);
- }
+ },
+
+ reloadTimeOut: null,
+
+ pageReload: function () {
+
+ clearTimeout(this.get("reloadTimeOut"));
+
+ this.set('reloadTimeOut',
+ setTimeout(function () {
+ location.reload()
+ }, App.pageReloadTime)
+ );
+ }.observes("App.router.location.lastSetURL")
+
})
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/utils/http_client.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/http_client.js?rev=1449954&r1=1449953&r2=1449954&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/http_client.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/http_client.js Mon Feb 25 23:08:12 2013
@@ -38,6 +38,9 @@ App.HttpClient = Em.Object.create({
}
},
+ emptyFunc: function () {
+ },
+
/**
* @param {string} url
* @param {Object} ajaxOptions
@@ -51,22 +54,41 @@ App.HttpClient = Em.Object.create({
errorHandler = this.defaultErrorHandler;
}
- var options = {dataType: 'json'}; // default ajax options;
+ var xhr = new XMLHttpRequest();
+ var curTime = new Date().getTime();
- $.extend(options, {
- url: url,
- success: function (data) {
- try {
- App.store.commit();
- } catch (err) {}
- mapper.map(data);
- },
- error: errorHandler
- });
+ xhr.open('GET', url + "?_=" + curTime, true);
+ xhr.send(null);
- $.extend(options, ajaxOptions);
+ this.onReady(xhr, "", ajaxOptions, mapper, errorHandler);
+ },
- $.ajax(options);
+ /*
+ This function checks if we get response from server
+ Not using onreadystatechange cuz of possible closure
+ */
+ onReady: function (xhr, tm, tmp_val, mapper, errorHandler) {
+ var self = this;
+ clearTimeout(tm);
+ var timeout = setTimeout(function () {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ mapper.map($.parseJSON(xhr.responseText));
+ tmp_val.complete.call(self);
+ xhr.abort();
+ } else {
+ errorHandler(xhr , "error", xhr.statusText);
+ }
+
+ tmp_val = null;
+ xhr = self.emptyFunc();
+ clearTimeout(timeout);
+ timeout = null;
+
+ } else {
+ self.onReady(xhr, timeout, tmp_val, mapper, errorHandler);
+ }
+ }, 10);
},
/**
@@ -78,9 +100,16 @@ App.HttpClient = Em.Object.create({
*/
get: function (url, mapper, data, errorHandler, interval) {
var eHandler = data.complete
+ if (!errorHandler && data.error) {
+ errorHandler = data.error;
+ }
var client = this;
var request = function () {
client.request(url, data, mapper, errorHandler);
+ url=null;
+ data=null;
+ mapper=null;
+ errorHandler=null;
}
interval = "" + interval;
@@ -113,7 +142,7 @@ App.HttpClient = Em.Object.create({
});
/*App.HttpClient.get(
- 'http://nagiosserver/hdp/nagios/nagios_alerts.php?q1=alerts&alert_type=all',
- App.alertsMapper,
- { dataType: 'jsonp', jsonp: 'jsonp' }
-);*/
+ 'http://nagiosserver/hdp/nagios/nagios_alerts.php?q1=alerts&alert_type=all',
+ App.alertsMapper,
+ { dataType: 'jsonp', jsonp: 'jsonp' }
+ );*/