Fix backup UX and proxy config dedupe

This commit is contained in:
rcourtman 2025-11-15 23:26:44 +00:00
parent 3223a3a432
commit e375a21d4b
2 changed files with 15 additions and 17 deletions

View file

@ -167,13 +167,16 @@ const UnifiedBackups: Component = () => {
const pve = pveBackupsState(); const pve = pveBackupsState();
const pbs = pbsBackupsState(); const pbs = pbsBackupsState();
const pmg = pmgBackupsState(); const pmg = pmgBackupsState();
return ( const hasData =
!(pve?.guestSnapshots?.length ?? 0) && (pve?.guestSnapshots?.length ?? 0) > 0 ||
!(pve?.storageBackups?.length ?? 0) && (pve?.storageBackups?.length ?? 0) > 0 ||
!(pbs?.length ?? 0) && (pbs?.length ?? 0) > 0 ||
!(pmg?.length ?? 0) && (pmg?.length ?? 0) > 0;
!state.pbs?.length if (hasData) {
); return false;
}
const pollingCycles = state.stats?.pollingCycles ?? 0;
return pollingCycles === 0;
}); });
// Normalize all backup data into unified format // Normalize all backup data into unified format

View file

@ -118,19 +118,14 @@ from pathlib import Path
path = Path(sys.argv[1]) path = Path(sys.argv[1])
lines = path.read_text().splitlines() lines = path.read_text().splitlines()
if not lines:
path.write_text('')
exit()
out = [] out = []
pending = [] pending = []
skip = False skip = False
def flush_pending(): def flush_pending():
global pending
if pending: if pending:
out.extend(pending) out.extend(pending)
pending = [] pending.clear()
i = 0 i = 0
while i < len(lines): while i < len(lines):
@ -138,14 +133,14 @@ while i < len(lines):
stripped = line.lstrip() stripped = line.lstrip()
if skip: if skip:
indent = len(line) - len(stripped) # Keep skipping until a non-indented, non-comment line appears
if indent > 0 or stripped.startswith('#'): if stripped == '' or stripped.startswith('#') or stripped.startswith('-') or line.startswith((' ', '\t')):
i += 1 i += 1
continue continue
skip = False skip = False
if stripped.startswith('allowed_nodes:'): if stripped.startswith('allowed_nodes:'):
pending = [] pending.clear()
skip = True skip = True
i += 1 i += 1
continue continue
@ -160,7 +155,7 @@ while i < len(lines):
i += 1 i += 1
flush_pending() flush_pending()
path.write_text('\n'.join(out) + '\n') path.write_text('\n'.join(out) + ('\n' if out else ''))
PY PY
else else
# Fallback: truncate the file to remove duplicates if python3 is unavailable # Fallback: truncate the file to remove duplicates if python3 is unavailable