Skip to content

Commit

Permalink
Show agent name if only one off site location is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Dec 23, 2024
1 parent bf5b776 commit 211e48f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import "../../../../../components/ha-md-list";
import "../../../../../components/ha-md-list-item";
import "../../../../../components/ha-svg-icon";
import type { BackupConfig } from "../../../../../data/backup";
import { BackupScheduleState, isLocalAgent } from "../../../../../data/backup";
import {
BackupScheduleState,
computeBackupAgentName,
isLocalAgent,
} from "../../../../../data/backup";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant } from "../../../../../types";

Expand Down Expand Up @@ -88,6 +92,14 @@ class HaBackupBackupsSummary extends LitElement {
);

if (offsiteLocations.length) {
if (offsiteLocations.length === 1) {
const name = computeBackupAgentName(
this.hass.localize,
offsiteLocations[0],
offsiteLocations
);
return `Upload to ${name}`;
}
return `Upload to ${offsiteLocations.length} off-site locations`;
}
if (hasLocal) {
Expand Down

0 comments on commit 211e48f

Please sign in to comment.