You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/07/30 23:57:13 UTC
git commit: AMBARI-2769. FE should show the error-details when it
encounters error while persisting web client state. (Andrii Babiichuk via
yusaku)
Updated Branches:
refs/heads/trunk 354d2568d -> 26229f0e9
AMBARI-2769. FE should show the error-details when it encounters error while persisting web client state. (Andrii Babiichuk via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/26229f0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/26229f0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/26229f0e
Branch: refs/heads/trunk
Commit: 26229f0e97d8c2a99a5192243088236d66d8bfd3
Parents: 354d256
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Jul 30 14:56:48 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Jul 30 14:56:48 2013 -0700
----------------------------------------------------------------------
ambari-web/app/messages.js | 2 +-
ambari-web/app/models/cluster_states.js | 44 ++++++++++++++--------------
ambari-web/app/utils/ajax.js | 11 +++++++
3 files changed, 34 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/26229f0e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index d1e8401..181d06b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -142,7 +142,7 @@ Em.I18n.translations = {
'common.process': 'Process',
'common.property': 'Property',
'common.installed': 'Installed',
- 'common.persist.error' : 'Error in persisting web client state at ambari server',
+ 'common.persist.error' : 'Error in persisting web client state at ambari server:',
'common.update.error' : 'Error in retrieving web client state from ambari server',
'common.tags': 'Tags',
'requestInfo.installComponents':'Install Components',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/26229f0e/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index fdb476b..ea6a851 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -104,7 +104,6 @@ App.clusterStatus = Ember.Object.create({
this.set('localdb', newValue.localdb);
}
- var url = App.apiPrefix + '/persist/';
var keyValuePair = {};
var val = {
clusterName: this.get('clusterName'),
@@ -114,39 +113,40 @@ App.clusterStatus = Ember.Object.create({
};
keyValuePair[this.get('key')] = JSON.stringify(val);
-
- jQuery.ajax({
- async: false,
- context: this,
- type: "POST",
- url: url,
- data: JSON.stringify(keyValuePair),
- beforeSend: function () {
- console.log('BeforeSend: persistKeyValues', keyValuePair);
- },
- error: function () {
- console.log("ERROR");
- if(newValue.errorCallBack) {
- newValue.errorCallBack();
- } else {
- this.clusterStatusErrorCallBack();
- }
+ App.ajax.send({
+ name: 'cluster.state',
+ sender: this,
+ data: {
+ key: keyValuePair,
+ newVal: newValue
},
- statusCode: require('data/statusCodes')
+ beforeSend: 'clusterStatusBeforeSend',
+ error: 'clusterStatusErrorCallBack'
});
return newValue;
}
},
-
- clusterStatusErrorCallBack: function() {
+ clusterStatusBeforeSend: function (keyValuePair) {
+ console.log('BeforeSend: persistKeyValues', keyValuePair);
+ },
+ clusterStatusErrorCallBack: function(request, ajaxOptions, error, opt) {
+ console.log("ERROR");
+ if(opt.newValue.errorCallBack) {
+ opt.newValue.errorCallBack();
+ } else {
+ var doc = $.parseXML(request.responseText);
+ var msg = 'Error ' + (request.status) + ' ';
+ msg += $(doc).find("body p").text();
+ }
App.ModalPopup.show({
header: Em.I18n.t('common.error'),
secondary: false,
+ response: msg,
onPrimary: function () {
this.hide();
},
bodyClass: Ember.View.extend({
- template: Ember.Handlebars.compile('<p>{{t common.persist.error}}</p>')
+ template: Ember.Handlebars.compile('<p>{{t common.persist.error}} {{response}}</p>')
})
});
},
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/26229f0e/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index d84ff0e..d52acc9 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -512,6 +512,17 @@ var urls = {
};
}
},
+ 'cluster.state': {
+ 'type': 'POST',
+ 'real': '/persist/',
+ 'format': function (data, opt) {
+ return {
+ async: false,
+ data: JSON.stringify(data.key),
+ newValue: data.newVal
+ };
+ }
+ },
'cluster.update_upgrade_version': {
'real': '/stacks2/HDP/versions?fields=stackServices/StackServices,Versions',
'mock': '/data/wizard/stack/stacks.json',