Browse Source

AMBARI-1078. Improve graph message when data is not available. (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431612 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
b2f7f5fad6
3 changed files with 17 additions and 3 deletions
  1. 3 0
      CHANGES.txt
  2. 5 0
      ambari-web/app/messages.js
  3. 9 3
      ambari-web/app/views/common/chart/linear_time.js

+ 3 - 0
CHANGES.txt

@@ -457,6 +457,9 @@ AMBARI-666 branch (unreleased changes)
   AMBARI-676. Seperate directory for ambari-server. (jitendra)
 
   IMPROVEMENTS
+
+  AMBARI-1078. Improve graph message when data is not available.
+  (Srimanth Gunturi via yusaku)
  
   AMBARI-1146. Exclude hosts and include hosts config parameters need 
   clarification. (yusaku)

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

@@ -28,6 +28,11 @@ Em.I18n.translations = {
   'login.password':'Password',
   'login.loginButton':'Sign in',
   'login.error':'Invalid username/password combination.',
+  
+  'graphs.noData.title': 'No Data',
+  'graphs.noData.message': 'There was no data available. Possible reasons include inaccessible Ganglia service.',
+  'graphs.error.title': 'Error',
+  'graphs.error.message': 'There was a problem getting data for the chart ({0}: {1})',
 
   'services.nagios.description':'Nagios Monitoring and Alerting system',
   'services.ganglia.description':'Ganglia Metrics Collection system',

+ 9 - 3
ambari-web/app/views/common/chart/linear_time.js

@@ -139,8 +139,14 @@ App.ChartLinearTimeView = Ember.View.extend({
           hash.contentType = 'application/json; charset=utf-8';
           hash.context = this;
           hash.success = this._refreshGraph,
-          hash.error = function (xhr, textStatus, errorThrown) {
-            this._showMessage('warn', 'Error', 'There was a problem getting data for the chart (' + textStatus + ': ' + errorThrown + ')');
+           hash.error = function(xhr, textStatus, errorThrown){
+            this.set('isReady', true);
+            if (xhr.readyState == 4 && xhr.status) {
+              textStatus = xhr.status + " " + textStatus;
+            }
+            this._showMessage('warn', this.t('graphs.error.title'), this.t('graphs.error.message').format(textStatus, errorThrown));
+            this.set('isPopup', false);
+            this.set('hasData', false);
           }
           jQuery.ajax(hash);
         }
@@ -291,7 +297,7 @@ App.ChartLinearTimeView = Ember.View.extend({
         }
         else {
           this.set('isReady', true);
-          this._showMessage('info', 'No Data', 'There was no data available.');
+          this._showMessage('info', this.t('graphs.noData.title'), this.t('graphs.noData.message'));
           this.set('isPopup', false);
           this.set('hasData', false);
         }