handle admin decree errors on the admin panel

addresses #642
pull/1/head
ansuz 4 years ago
parent 2f1dad7e35
commit 5d4332b1fe

@ -267,8 +267,11 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['RESTRICT_REGISTRATION', [val]] data: ['RESTRICT_REGISTRATION', [val]]
}, function (e) { }, function (e, response) {
if (e) { UI.warn(Messages.error); console.error(e); } if (e || response.error) {
UI.warn(Messages.error);
console.error(e, response);
}
APP.updateStatus(function () { APP.updateStatus(function () {
spinner.done(); spinner.done();
state = APP.instanceStatus.restrictRegistration; state = APP.instanceStatus.restrictRegistration;
@ -316,8 +319,11 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['UPDATE_DEFAULT_STORAGE', data] data: ['UPDATE_DEFAULT_STORAGE', data]
}, function (e) { }, function (e, response) {
if (e) { UI.warn(Messages.error); return void console.error(e); } if (e || response.error) {
UI.warn(Messages.error);
return void console.error(e, response);
}
var limit = getPrettySize(l); var limit = getPrettySize(l);
$div.find('.cp-admin-defaultlimit-value').text(Messages._getKey('admin_limit', [limit])); $div.find('.cp-admin-defaultlimit-value').text(Messages._getKey('admin_limit', [limit]));
}); });
@ -448,8 +454,12 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['RM_QUOTA', data] data: ['RM_QUOTA', data]
}, function (e) { }, function (e, response) {
if (e) { UI.warn(Messages.error); console.error(e); } if (e || response.error) {
UI.warn(Messages.error);
console.error(e, response);
return;
}
APP.refreshLimits(); APP.refreshLimits();
$key.val(''); $key.val('');
}); });
@ -462,8 +472,12 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_QUOTA', data] data: ['SET_QUOTA', data]
}, function (e) { }, function (e, response) {
if (e) { UI.warn(Messages.error); console.error(e); } if (e || response.error) {
UI.warn(Messages.error);
console.error(e, response);
return;
}
APP.refreshLimits(); APP.refreshLimits();
$key.val(''); $key.val('');
}); });
@ -1030,9 +1044,10 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_LAST_BROADCAST_HASH', [lastHash]] data: ['SET_LAST_BROADCAST_HASH', [lastHash]]
}, function (e) { }, function (e, response) {
if (e) { if (e || response.error) {
console.error(e); UI.warn(Messages.error);
console.error(e, response);
return; return;
} }
console.log('lastBroadcastHash updated'); console.log('lastBroadcastHash updated');
@ -1336,9 +1351,10 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_MAINTENANCE', [data]] data: ['SET_MAINTENANCE', [data]]
}, function (e) { }, function (e, response) {
if (e) { if (e || response.error) {
UI.warn(Messages.error); console.error(e); UI.warn(Messages.error);
console.error(e, response);
$button.prop('disabled', ''); $button.prop('disabled', '');
return; return;
} }
@ -1430,10 +1446,11 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE', cmd: 'ADMIN_DECREE',
data: ['SET_SURVEY_URL', [data]] data: ['SET_SURVEY_URL', [data]]
}, function (e) { }, function (e, response) {
if (e) { if (e || response.error) {
$button.prop('disabled', ''); $button.prop('disabled', '');
UI.warn(Messages.error); console.error(e); UI.warn(Messages.error);
console.error(e, response);
return; return;
} }
// Maintenance applied, send notification // Maintenance applied, send notification
@ -1529,11 +1546,12 @@ define([
sFrameChan.query('Q_ADMIN_RPC', { sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'GET_WORKER_PROFILES', cmd: 'GET_WORKER_PROFILES',
}, function (e, data) { }, function (e, data) {
if (e) { return void console.error(e); } if (e || data.error) {
UI.warn(Messages.error);
return void console.error(e, data);
}
//console.info(data); //console.info(data);
$div.find("table").remove(); $div.find("table").remove();
process(data); process(data);
$div.append(table); $div.append(table);
}); });

Loading…
Cancel
Save