mirror of
https://github.com/mjl-/mox.git
synced 2024-12-28 01:13:47 +03:00
webmail: in status line about (re|dis)connecting, make error message more readable
with space after line, so a next line doesn't get concatenated. and with capital.
This commit is contained in:
parent
9534e464f9
commit
cde54442d2
2 changed files with 9 additions and 6 deletions
|
@ -5520,6 +5520,7 @@ const init = async () => {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
const capitalizeFirst = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
||||||
const connect = async (isreconnect) => {
|
const connect = async (isreconnect) => {
|
||||||
connectionElem.classList.toggle('loading', true);
|
connectionElem.classList.toggle('loading', true);
|
||||||
dom._kids(connectionElem);
|
dom._kids(connectionElem);
|
||||||
|
@ -5534,7 +5535,7 @@ const init = async () => {
|
||||||
catch (err) {
|
catch (err) {
|
||||||
connecting = false;
|
connecting = false;
|
||||||
noreconnect = true;
|
noreconnect = true;
|
||||||
dom._kids(statusElem, (err.message || 'error fetching connection token') + ', not automatically retrying');
|
dom._kids(statusElem, (capitalizeFirst(err.message || 'Error fetching connection token')) + ', not automatically retrying. ');
|
||||||
showNotConnected();
|
showNotConnected();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5582,7 +5583,7 @@ const init = async () => {
|
||||||
}
|
}
|
||||||
catch (err) { }
|
catch (err) { }
|
||||||
eventSource = new window.EventSource('events?token=' + encodeURIComponent(token) + '&request=' + encodeURIComponent(JSON.stringify(request)) + slow);
|
eventSource = new window.EventSource('events?token=' + encodeURIComponent(token) + '&request=' + encodeURIComponent(JSON.stringify(request)) + slow);
|
||||||
let eventID = window.setTimeout(() => dom._kids(statusElem, 'Connecting...'), 1000);
|
let eventID = window.setTimeout(() => dom._kids(statusElem, 'Connecting... '), 1000);
|
||||||
eventSource.addEventListener('open', (e) => {
|
eventSource.addEventListener('open', (e) => {
|
||||||
log('eventsource open', { e });
|
log('eventsource open', { e });
|
||||||
if (eventID) {
|
if (eventID) {
|
||||||
|
@ -5611,7 +5612,7 @@ const init = async () => {
|
||||||
document.title = ['(not connected)', loginAddress ? (loginAddress.User + '@' + (loginAddress.Domain.Unicode || loginAddress.Domain.ASCII)) : '', 'Mox Webmail'].filter(s => s).join(' - ');
|
document.title = ['(not connected)', loginAddress ? (loginAddress.User + '@' + (loginAddress.Domain.Unicode || loginAddress.Domain.ASCII)) : '', 'Mox Webmail'].filter(s => s).join(' - ');
|
||||||
dom._kids(connectionElem);
|
dom._kids(connectionElem);
|
||||||
if (noreconnect) {
|
if (noreconnect) {
|
||||||
dom._kids(statusElem, errmsg + ', not automatically retrying');
|
dom._kids(statusElem, capitalizeFirst(errmsg) + ', not automatically retrying. ');
|
||||||
showNotConnected();
|
showNotConnected();
|
||||||
listloadingElem.remove();
|
listloadingElem.remove();
|
||||||
listendElem.remove();
|
listendElem.remove();
|
||||||
|
|
|
@ -5907,6 +5907,8 @@ const init = async () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const capitalizeFirst = (s: string) => s.charAt(0).toUpperCase() + s.slice(1)
|
||||||
|
|
||||||
const connect = async (isreconnect: boolean) => {
|
const connect = async (isreconnect: boolean) => {
|
||||||
connectionElem.classList.toggle('loading', true)
|
connectionElem.classList.toggle('loading', true)
|
||||||
dom._kids(connectionElem)
|
dom._kids(connectionElem)
|
||||||
|
@ -5922,7 +5924,7 @@ const init = async () => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
connecting = false
|
connecting = false
|
||||||
noreconnect = true
|
noreconnect = true
|
||||||
dom._kids(statusElem, ((err as any).message || 'error fetching connection token')+', not automatically retrying')
|
dom._kids(statusElem, (capitalizeFirst((err as any).message || 'Error fetching connection token'))+', not automatically retrying. ')
|
||||||
showNotConnected()
|
showNotConnected()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5975,7 +5977,7 @@ const init = async () => {
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
|
||||||
eventSource = new window.EventSource('events?token=' + encodeURIComponent(token)+'&request='+encodeURIComponent(JSON.stringify(request))+slow)
|
eventSource = new window.EventSource('events?token=' + encodeURIComponent(token)+'&request='+encodeURIComponent(JSON.stringify(request))+slow)
|
||||||
let eventID = window.setTimeout(() => dom._kids(statusElem, 'Connecting...'), 1000)
|
let eventID = window.setTimeout(() => dom._kids(statusElem, 'Connecting... '), 1000)
|
||||||
eventSource.addEventListener('open', (e: Event) => {
|
eventSource.addEventListener('open', (e: Event) => {
|
||||||
log('eventsource open', {e})
|
log('eventsource open', {e})
|
||||||
if (eventID) {
|
if (eventID) {
|
||||||
|
@ -6005,7 +6007,7 @@ const init = async () => {
|
||||||
document.title = ['(not connected)', loginAddress ? (loginAddress.User+'@'+(loginAddress.Domain.Unicode || loginAddress.Domain.ASCII)) : '', 'Mox Webmail'].filter(s => s).join(' - ')
|
document.title = ['(not connected)', loginAddress ? (loginAddress.User+'@'+(loginAddress.Domain.Unicode || loginAddress.Domain.ASCII)) : '', 'Mox Webmail'].filter(s => s).join(' - ')
|
||||||
dom._kids(connectionElem)
|
dom._kids(connectionElem)
|
||||||
if (noreconnect) {
|
if (noreconnect) {
|
||||||
dom._kids(statusElem, errmsg+', not automatically retrying')
|
dom._kids(statusElem, capitalizeFirst(errmsg)+', not automatically retrying. ')
|
||||||
showNotConnected()
|
showNotConnected()
|
||||||
listloadingElem.remove()
|
listloadingElem.remove()
|
||||||
listendElem.remove()
|
listendElem.remove()
|
||||||
|
|
Loading…
Reference in a new issue