Commit 4a3cf8cc authored by Dietmar Maurer's avatar Dietmar Maurer

correctly display error messages in ObjectGrid

parent afdd053c
......@@ -18,6 +18,10 @@ Ext.define('PVE.RestProxy', {
reader: {
type: 'json',
root: 'data'
},
afterRequest: function(request, success) {
me.fireEvent('afterload', me, request, success);
return;
}
});
......
......@@ -107,7 +107,7 @@ Ext.define('PVE.dc.OptionView', {
});
Ext.applyIf(me, {
url: "/api2/extjs/cluster/options",
url: "/api2/json/cluster/options",
cwidth1: 130,
interval: 1000,
selModel: sm,
......
......@@ -91,19 +91,26 @@ Ext.define('PVE.grid.ObjectGrid', {
me.mon(rstore, 'beforeload', function(s, operation, eOpts) {
if (!load_count) {
me.setLoading(true);
}
}
});
me.mon(rstore, 'load', function(s, records, success) {
me.mon(rstore.proxy, 'afterload', function(proxy, request, success) {
load_count++;
me.setLoading(false);
if (!success) {
me.setLoading("Data load error");
if (success) {
return;
}
}
var msg;
var operation = request.operation;
var error = operation.getError();
if (error.statusText) {
msg = error.statusText + ' (' + error.status + ')';
} else {
msg = gettext('Connection error');
}
me.setLoading(msg);
});
Ext.applyIf(me, {
......
......@@ -107,13 +107,31 @@ Ext.define('PVE.node.ServiceView', {
me.mon(store, 'datachanged', set_button_status);
me.mon(rstore, 'load', function(s, records, success) {
if (!success) {
me.setLoading("Data load error");
var load_count = 0;
me.mon(rstore, 'beforeload', function(s, operation, eOpts) {
if (!load_count) {
me.setLoading(true);
}
});
me.mon(rstore.proxy, 'afterload', function(proxy, request, success) {
load_count++;
me.setLoading(false);
if (success) {
return;
}
var msg;
var operation = request.operation;
var error = operation.getError();
if (error.statusText) {
msg = error.statusText + ' (' + error.status + ')';
} else {
me.setLoading(false);
msg = gettext('Connection error');
}
me.setLoading(msg);
});
Ext.apply(me, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment