mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Blazor Server: Improve wording (#5323)
This commit is contained in:
parent
163f805f3b
commit
e694568674
@ -349,7 +349,7 @@ if (window.Blazor) {
|
||||
return;
|
||||
this.setBlazorStatus(false);
|
||||
this.reconnecting = true;
|
||||
console.warn('Blazor hub connection lost');
|
||||
console.debug('Blazor hub connection lost');
|
||||
await this.reconnect();
|
||||
}
|
||||
async reconnect() {
|
||||
@ -362,20 +362,11 @@ if (window.Blazor) {
|
||||
if (await Blazor.reconnect())
|
||||
break;
|
||||
|
||||
var refresh = document.createElement('span');
|
||||
refresh.appendChild(document.createTextNode('Please '));
|
||||
var refreshLink = document.createElement('a');
|
||||
refreshLink.href = "#";
|
||||
refreshLink.textContent = "refresh";
|
||||
refreshLink.addEventListener('click', (event) => { event.preventDefault(); window.location.reload(); });
|
||||
refresh.appendChild(refreshLink);
|
||||
refresh.appendChild(document.createTextNode(' the page.'));
|
||||
|
||||
this.setBlazorStatus(false, refresh);
|
||||
this.setBlazorStatus(false);
|
||||
console.warn('Error while reconnecting to Blazor hub (Broken circuit)');
|
||||
}
|
||||
catch (err) {
|
||||
this.setBlazorStatus(false, err + '. Reconnecting...');
|
||||
this.setBlazorStatus(false);
|
||||
console.warn(`Error while reconnecting to Blazor hub (${err})`);
|
||||
}
|
||||
i++;
|
||||
@ -389,7 +380,7 @@ if (window.Blazor) {
|
||||
this.setBlazorStatus(true);
|
||||
}
|
||||
|
||||
setBlazorStatus(isConnected, text) {
|
||||
setBlazorStatus(isConnected) {
|
||||
document.querySelectorAll('.blazor-status').forEach($status => {
|
||||
const $state = $status.querySelector('.blazor-status__state');
|
||||
const $title = $status.querySelector('.blazor-status__title');
|
||||
@ -397,14 +388,9 @@ if (window.Blazor) {
|
||||
$state.classList.remove('btcpay-status--enabled');
|
||||
$state.classList.remove('btcpay-status--disabled');
|
||||
$state.classList.add('btcpay-status--' + (isConnected ? 'enabled' : 'disabled'));
|
||||
$title.textContent = `Backend ${isConnected ? 'connected' : 'disconnected'}`;
|
||||
if (text instanceof Node) {
|
||||
$body.innerHTML = '';
|
||||
$body.appendChild(text);
|
||||
} else
|
||||
$body.textContent = text || '';
|
||||
|
||||
$body.classList.toggle('d-none', !text);
|
||||
$title.textContent = isConnected ? 'Connection established' : 'Connection interrupted';
|
||||
$body.innerHTML = isConnected ? '' : 'Please <a href="">refresh the page</a>.'; // use empty link on purpose
|
||||
$body.classList.toggle('d-none', isConnected);
|
||||
if (!isConnected && !isUnloading) {
|
||||
const toast = new bootstrap.Toast($status, { autohide: false });
|
||||
if (!toast.isShown())
|
||||
|
Loading…
Reference in New Issue
Block a user