Compare commits

...
Author SHA1 Message Date
Matthias de BaatandClaude Opus 5.5 25307e427d Show when backup retention is paused for a location (#56088)
Automatic backup retention no longer deletes backups from locations
that are turned off for automatic backups (home-assistant/core#192788).
Show "Retention paused" in the locations list and an info alert on the
location page for those locations.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-25 22:17:03 +01:00
Paul Bottein 207cbcc585 Show the connection error when logged out and the server is offline (#56139)
* Show the connection error when logged out and the server is offline

* Show the connection error when the server responds with a 5xx

* Time out the server check before the login redirect

* Give the server check 10 seconds
2026-11-25 19:44:23 +02:00
4 changed files with 66 additions and 19 deletions

No files matched your search

+29 -1
View File
@@ -75,11 +75,39 @@ const clearUrlParams = () => {
}
};
const SERVER_CHECK_TIMEOUT = 10_000;
const checkServer = async () => {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), SERVER_CHECK_TIMEOUT);
try {
const response = await fetch(`${hassUrl}/manifest.json`, {
mode: "no-cors",
cache: "no-store",
signal: controller.signal,
});
if (response.status >= 500) {
throw new Error(`Home Assistant responded with ${response.status}`);
}
} finally {
clearTimeout(timeout);
}
};
// The login page is never cached, so check the server is up before getAuth redirects to it.
const loadTokensOrCheckServer = async () => {
const tokens = loadTokens();
if (!tokens || tokens.hassUrl !== hassUrl) {
await checkServer();
}
return tokens;
};
const authOptions = {
hassUrl,
limitHassInstance: true,
saveTokens,
loadTokens: () => Promise.resolve(loadTokens()),
loadTokens: loadTokensOrCheckServer,
};
const getAuthDroppingStaleCallback = async () => {
@@ -89,7 +89,11 @@ class HaBackupConfigAgents extends LitElement {
const retention = this.agentsConfig?.[agentId]?.retention;
if (retention) {
if (retention && !this._value.includes(agentId)) {
texts.push(
this.hass.localize("ui.panel.config.backup.agents.retention_inactive")
);
} else if (retention) {
if (retention.copies === null && retention.days === null) {
texts.push(
this.hass.localize("ui.panel.config.backup.agents.retention_all")
@@ -120,21 +120,34 @@ class HaConfigBackupDetails extends LitElement {
</p>
</div>
`
: html`<ha-backup-config-retention
location-specific
.headline=${this.hass.localize(
`ui.panel.config.backup.location.retention_for_${isLocalAgent(this.agentId) ? "this_system" : "location"}`,
{ location: agentName }
)}
.hass=${this.hass}
.retention=${
!this.config
? undefined
: this.config.agents[this.agentId]
?.retention || null
}
@value-changed=${this._retentionChanged}
></ha-backup-config-retention>`
: html`${
this.config &&
!this.config.create_backup.agent_ids.includes(
this.agentId
)
? html`<div class="card-content">
<ha-alert alert-type="info">
${this.hass.localize(
"ui.panel.config.backup.location.retention_inactive"
)}
</ha-alert>
</div>`
: nothing
}<ha-backup-config-retention
location-specific
.headline=${this.hass.localize(
`ui.panel.config.backup.location.retention_for_${isLocalAgent(this.agentId) ? "this_system" : "location"}`,
{ location: agentName }
)}
.hass=${this.hass}
.retention=${
!this.config
? undefined
: this.config.agents[this.agentId]
?.retention || null
}
@value-changed=${this._retentionChanged}
></ha-backup-config-retention>`
}
</ha-card>
<ha-card>
+4 -2
View File
@@ -3993,7 +3993,8 @@
"location_settings": "Location settings",
"retention_all": "Keep all backups",
"retention_backups": "Keep {count} {count, plural,\n one {backup}\n other {backups}\n}",
"retention_days": "Keep {count} {count, plural,\n one {day}\n other {days}\n}"
"retention_days": "Keep {count} {count, plural,\n one {day}\n other {days}\n}",
"retention_inactive": "Retention paused"
},
"data": {
"ha_settings": "Home Assistant settings",
@@ -4049,7 +4050,7 @@
"retention": "Retention",
"custom_retention": "Custom retention",
"custom_retention_label": "Keep only",
"retention_description": "Based on the maximum number of backups or how many days they should be kept.",
"retention_description": "Based on the maximum number of backups or how many days they should be kept. Only applies to automatic backups, in the locations they are stored in.",
"retention_presets": {
"global": "Use global settings",
"copies_3": "3 backups",
@@ -4324,6 +4325,7 @@
"save_error": "Error saving configuration: {error}",
"retention_for_this_system": "Retention for this system",
"retention_for_location": "Retention for {location}",
"retention_inactive": "Automatic backups aren't stored in this location, so its retention settings are paused. Backups already in this location are kept until you delete them. Retention applies again when you turn the location back on for automatic backups.",
"not_found": "Not found",
"not_found_description": "Location matching ''{backupId}'' not found",
"error": "Could not fetch location details",