better checkup page error messages

pull/1/head
ansuz 4 years ago
parent b24de7984f
commit 359de1dc94

@ -175,17 +175,19 @@ define([
// Test Websocket // Test Websocket
var evWSError = Util.mkEvent(true); var evWSError = Util.mkEvent(true);
assert(function (_cb, msg) { assert(function (_cb, msg) {
var cb = Util.once(Util.both(_cb, function (err) { var timeoutErr = 'Could not connect to the websocket server within 5 seconds.';
if (typeof(err) === 'string') { var cb = Util.once(Util.both(_cb, function (status) {
msg.innerText = err; if (status === true) { return; }
} msg.appendChild(h('span#websocket', [
status || 'Unknown websocket error',
]));
})); }));
var ws = new WebSocket(NetConfig.getWebsocketURL()); var ws = new WebSocket(NetConfig.getWebsocketURL());
var to = setTimeout(function () { var to = setTimeout(function () {
console.error('Websocket TIMEOUT'); console.error('Websocket TIMEOUT');
evWSError.fire(); evWSError.fire();
cb('Could not connect to the websocket server within 5 seconds.'); cb(timeoutErr);
}, 5000); }, 5000);
ws.onopen = function () { ws.onopen = function () {
clearTimeout(to); clearTimeout(to);
@ -200,17 +202,32 @@ define([
}); });
// Test login block // Test login block
assert(function (cb, msg) { assert(function (_cb, msg) {
msg.appendChild(h('span', [ var websocketErr = "No WebSocket available";
"Unable to create, retrieve, or remove encrypted credentials from the server. ", var cb = Util.once(Util.both(_cb, function (status) {
"This is most commonly caused by a mismatch between the value of the ", if (status === true) { return; }
h('code', 'blockPath'), if (status === websocketErr) {
' value configured in ', msg.appendChild(h('span', [
CONFIG_PATH(), websocketErr,
" and the corresponding settings in your reverse proxy's configuration file,", ' See ',
" but it can also be explained by a websocket error. ", h('a', {
RESTART_WARNING(), href: '#websocket',
])); }, 'the related websocket error'),
]));
return;
}
// else
msg.appendChild(h('span', [
"Unable to create, retrieve, or remove encrypted credentials from the server. ",
"This is most commonly caused by a mismatch between the value of the ",
h('code', 'blockPath'),
' value configured in ',
CONFIG_PATH(),
" and the corresponding settings in your reverse proxy's configuration file,",
" but it can also be explained by a websocket error. ",
RESTART_WARNING(),
]));
}));
var bytes = new Uint8Array(Login.requiredBytes); var bytes = new Uint8Array(Login.requiredBytes);
@ -237,7 +254,7 @@ define([
// If WebSockets aren't working, don't wait forever here // If WebSockets aren't working, don't wait forever here
evWSError.reg(function () { evWSError.reg(function () {
waitFor.abort(); waitFor.abort();
cb("No WebSocket available"); cb(websocketErr);
}); });
// Create proxy // Create proxy
Login.loadUserObject(opt, waitFor(function (err, rt) { Login.loadUserObject(opt, waitFor(function (err, rt) {
@ -416,12 +433,16 @@ define([
var statusClass = failed? 'failure': 'success'; var statusClass = failed? 'failure': 'success';
var failedDetails = "Details found below";
var successDetails = "This checkup only tests the most common configuration issues. You may still experience errors.";
var details = h('p', failed? failedDetails: successDetails);
var summary = h('div.summary.' + statusClass, [ var summary = h('div.summary.' + statusClass, [
h('p', Messages._getKey('assert_numberOfTestsPassed', [ h('p', Messages._getKey('assert_numberOfTestsPassed', [
state.passed, state.passed,
state.total state.total
])), ])),
h('p', "Details found below"), details,
]); ]);
var report = h('div.report', [ var report = h('div.report', [

Loading…
Cancel
Save