Clarify online backup key creation and status messages
The menu entry opens the key creation section instead of creating a key immediately, the create button shows its progress, and success or error messages appear as toasts. Key entries list creation time, source IP and validity on separate lines, and the backup submenu separates local and online actions.
This commit is contained in:
1 parent
a26b00c425
commit
400c90f7fb
3 files changed
+41
-8
No files matched your search
+30
-6
@@ -1792,7 +1792,7 @@ async function _handleMenuAction(action) {
|
|||||||
case 'add-folder': document.getElementById('addFolderBtn')?.click(); break;
|
case 'add-folder': document.getElementById('addFolderBtn')?.click(); break;
|
||||||
case 'backup-export': doBackupExport(); break;
|
case 'backup-export': doBackupExport(); break;
|
||||||
case 'backup-import': doBackupImport(); break;
|
case 'backup-import': doBackupImport(); break;
|
||||||
case 'online-backup-create': doOnlineBackupCreate(); break;
|
case 'online-backup-create': openOnlineBackupCreate(); break;
|
||||||
case 'online-backup-restore': openOnlineBackupRestore(); break;
|
case 'online-backup-restore': openOnlineBackupRestore(); break;
|
||||||
case 'restart': if (await showAppConfirm({ title: 'Anwendung neu starten?', message: 'Nicht gespeicherte laufende Aktionen werden beendet.', confirmText: 'Neustart', danger: true })) window.api.restartApp(); break;
|
case 'restart': if (await showAppConfirm({ title: 'Anwendung neu starten?', message: 'Nicht gespeicherte laufende Aktionen werden beendet.', confirmText: 'Neustart', danger: true })) window.api.restartApp(); break;
|
||||||
case 'quit': window.api.quitApp(); break;
|
case 'quit': window.api.quitApp(); break;
|
||||||
@@ -3780,8 +3780,17 @@ function setOnlineBackupStatus(message, state = '', statusContext = null) {
|
|||||||
const context = statusContext === null ? beginOnlineBackupStatusContext() : statusContext;
|
const context = statusContext === null ? beginOnlineBackupStatusContext() : statusContext;
|
||||||
if (context !== onlineBackupStatusContextGeneration) return false;
|
if (context !== onlineBackupStatusContextGeneration) return false;
|
||||||
const status = document.getElementById('onlineBackupStatus');
|
const status = document.getElementById('onlineBackupStatus');
|
||||||
|
const text = String(message || '').replace(/MHU2-[A-Za-z0-9_-]{70}/gu, localizeUiText('Geschützter Schlüssel'));
|
||||||
|
if (state === 'success' || state === 'error' || state === 'warning') {
|
||||||
|
if (status) {
|
||||||
|
status.textContent = '';
|
||||||
|
status.dataset.state = '';
|
||||||
|
}
|
||||||
|
showCopyToast(text, 5000, state);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!status) return false;
|
if (!status) return false;
|
||||||
status.textContent = String(message || '').replace(/MHU2-[A-Za-z0-9_-]{70}/gu, localizeUiText('Geschützter Schlüssel'));
|
status.textContent = text;
|
||||||
status.dataset.state = state;
|
status.dataset.state = state;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3904,12 +3913,14 @@ function renderManagedOnlineBackups(focusTarget = undefined) {
|
|||||||
const created = document.createElement('span');
|
const created = document.createElement('span');
|
||||||
created.className = 'online-backup-managed-created';
|
created.className = 'online-backup-managed-created';
|
||||||
const createdLabel = document.createElement('span');
|
const createdLabel = document.createElement('span');
|
||||||
createdLabel.textContent = `${localizeUiText('Erstellt')}: ${formatDateTime(entry.createdAt).text} | ${entry.sourceIp ? `IP: ${entry.sourceIp}` : localizeUiText('IP unbekannt')}`;
|
createdLabel.textContent = `${localizeUiText('Erstellt')}: ${formatDateTime(entry.createdAt).text}`;
|
||||||
|
const sourceLabel = document.createElement('span');
|
||||||
|
sourceLabel.textContent = entry.sourceIp ? `IP: ${entry.sourceIp}` : localizeUiText('IP unbekannt');
|
||||||
const expirationLabel = document.createElement('span');
|
const expirationLabel = document.createElement('span');
|
||||||
expirationLabel.textContent = entry.expiresAt
|
expirationLabel.textContent = entry.expiresAt
|
||||||
? `${localizeUiText('Gültig bis')}: ${formatDateTime(entry.expiresAt).text}`
|
? `${localizeUiText('Gültig bis')}: ${formatDateTime(entry.expiresAt).text}`
|
||||||
: localizeUiText('Unbegrenzt gültig');
|
: localizeUiText('Unbegrenzt gültig');
|
||||||
created.append(createdLabel, expirationLabel);
|
created.append(createdLabel, sourceLabel, expirationLabel);
|
||||||
const actions = document.createElement('div');
|
const actions = document.createElement('div');
|
||||||
actions.className = 'online-backup-managed-actions';
|
actions.className = 'online-backup-managed-actions';
|
||||||
const copyButton = document.createElement('button');
|
const copyButton = document.createElement('button');
|
||||||
@@ -4109,7 +4120,10 @@ async function doOnlineBackupCreate() {
|
|||||||
const createButton = document.getElementById('createOnlineBackupBtn');
|
const createButton = document.getElementById('createOnlineBackupBtn');
|
||||||
const retentionSelect = document.getElementById('onlineBackupRetentionSelect');
|
const retentionSelect = document.getElementById('onlineBackupRetentionSelect');
|
||||||
const retention = retentionSelect?.value || 'forever';
|
const retention = retentionSelect?.value || 'forever';
|
||||||
if (createButton) createButton.disabled = true;
|
if (createButton) {
|
||||||
|
createButton.disabled = true;
|
||||||
|
createButton.textContent = localizeUiText('Wird erstellt…');
|
||||||
|
}
|
||||||
if (retentionSelect) retentionSelect.disabled = true;
|
if (retentionSelect) retentionSelect.disabled = true;
|
||||||
setOnlineBackupStatus('Verschlüssele und speichere Einstellungen…', 'busy', authority.statusContext);
|
setOnlineBackupStatus('Verschlüssele und speichere Einstellungen…', 'busy', authority.statusContext);
|
||||||
try {
|
try {
|
||||||
@@ -4125,12 +4139,22 @@ async function doOnlineBackupCreate() {
|
|||||||
setOnlineBackupStatus('Online-Sicherung konnte nicht erstellt werden', 'error', authority.statusContext);
|
setOnlineBackupStatus('Online-Sicherung konnte nicht erstellt werden', 'error', authority.statusContext);
|
||||||
} finally {
|
} finally {
|
||||||
endManagedOnlineBackupMutation();
|
endManagedOnlineBackupMutation();
|
||||||
if (createButton?.isConnected) createButton.disabled = false;
|
if (createButton?.isConnected) {
|
||||||
|
createButton.disabled = false;
|
||||||
|
createButton.textContent = localizeUiText('Neuen Schlüssel erzeugen');
|
||||||
|
}
|
||||||
if (retentionSelect?.isConnected) retentionSelect.disabled = false;
|
if (retentionSelect?.isConnected) retentionSelect.disabled = false;
|
||||||
doOnlineBackupCreate.busy = false;
|
doOnlineBackupCreate.busy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openOnlineBackupCreate() {
|
||||||
|
openOnlineBackupView();
|
||||||
|
const createModule = document.getElementById('onlineBackupCreateHeading')?.closest('.online-backup-module');
|
||||||
|
createModule?.scrollIntoView({ block: 'nearest' });
|
||||||
|
document.getElementById('createOnlineBackupBtn')?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
function openOnlineBackupView(focusRestore = false) {
|
function openOnlineBackupView(focusRestore = false) {
|
||||||
document.querySelector('.tab[data-view="settings"]')?.click();
|
document.querySelector('.tab[data-view="settings"]')?.click();
|
||||||
const searchInput = document.getElementById('settingsSearchInput');
|
const searchInput = document.getElementById('settingsSearchInput');
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
<div class="menu-submenu-dropdown" role="menu" style="display:none">
|
<div class="menu-submenu-dropdown" role="menu" style="display:none">
|
||||||
<button class="menu-dropdown-item" data-menu-action="backup-export"><span>Exportieren</span></button>
|
<button class="menu-dropdown-item" data-menu-action="backup-export"><span>Exportieren</span></button>
|
||||||
<button class="menu-dropdown-item" data-menu-action="backup-import"><span>Importieren</span></button>
|
<button class="menu-dropdown-item" data-menu-action="backup-import"><span>Importieren</span></button>
|
||||||
|
<div class="menu-separator" role="separator"></div>
|
||||||
<button class="menu-dropdown-item" data-menu-action="online-backup-create"><span>Online-Schlüssel erstellen</span></button>
|
<button class="menu-dropdown-item" data-menu-action="online-backup-create"><span>Online-Schlüssel erstellen</span></button>
|
||||||
<button class="menu-dropdown-item" data-menu-action="online-backup-restore"><span>Online-Schlüssel importieren</span></button>
|
<button class="menu-dropdown-item" data-menu-action="online-backup-restore"><span>Online-Schlüssel importieren</span></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-2
@@ -2180,8 +2180,9 @@ select.hs-input { max-width: none; width: auto; min-width: 140px; }
|
|||||||
|
|
||||||
.online-backup-managed-row {
|
.online-backup-managed-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 168px 238px minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
gap: 10px;
|
grid-template-areas: "key actions" "created actions";
|
||||||
|
gap: 6px 16px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
@@ -2191,6 +2192,7 @@ select.hs-input { max-width: none; width: auto; min-width: 140px; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
.online-backup-managed-key {
|
.online-backup-managed-key {
|
||||||
|
grid-area: key;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
@@ -2199,6 +2201,7 @@ select.hs-input { max-width: none; width: auto; min-width: 140px; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
.online-backup-managed-created {
|
.online-backup-managed-created {
|
||||||
|
grid-area: created;
|
||||||
display: grid;
|
display: grid;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
@@ -2209,6 +2212,7 @@ select.hs-input { max-width: none; width: auto; min-width: 140px; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
.online-backup-managed-actions {
|
.online-backup-managed-actions {
|
||||||
|
grid-area: actions;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@@ -4044,6 +4048,10 @@ input[type="checkbox"] {
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.online-backup-managed-row {
|
||||||
|
grid-template-areas: "key" "created" "actions";
|
||||||
|
}
|
||||||
|
|
||||||
.online-backup-managed-actions {
|
.online-backup-managed-actions {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user