mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 11:56:34 +00:00
Handle no cloud subscription better in backups (#23523)
This commit is contained in:
parent
a5de6ff3af
commit
a7ef498d75
@ -51,6 +51,9 @@ class HaBackupConfigAgents extends LitElement {
|
||||
|
||||
private _description(agentId: string) {
|
||||
if (agentId === CLOUD_AGENT) {
|
||||
if (this.cloudStatus.logged_in && !this.cloudStatus.active_subscription) {
|
||||
return "You currently do not have an active Home Assistant Cloud subscription.";
|
||||
}
|
||||
return "Note: It stores only one backup with a maximum size of 5 GB, regardless of your settings.";
|
||||
}
|
||||
if (isNetworkMountAgent(agentId)) {
|
||||
@ -72,6 +75,10 @@ class HaBackupConfigAgents extends LitElement {
|
||||
this._agentIds
|
||||
);
|
||||
const description = this._description(agentId);
|
||||
const noCloudSubscription =
|
||||
agentId === CLOUD_AGENT &&
|
||||
this.cloudStatus.logged_in &&
|
||||
!this.cloudStatus.active_subscription;
|
||||
return html`
|
||||
<ha-md-list-item>
|
||||
${isLocalAgent(agentId)
|
||||
@ -107,7 +114,9 @@ class HaBackupConfigAgents extends LitElement {
|
||||
<ha-switch
|
||||
slot="end"
|
||||
id=${agentId}
|
||||
.checked=${this._value.includes(agentId)}
|
||||
.checked=${!noCloudSubscription &&
|
||||
this._value.includes(agentId)}
|
||||
.disabled=${noCloudSubscription}
|
||||
@change=${this._agentToggled}
|
||||
></ha-switch>
|
||||
</ha-md-list-item>
|
||||
@ -133,7 +142,11 @@ class HaBackupConfigAgents extends LitElement {
|
||||
// Ensure we don't have duplicates, agents exist in the list and cloud is logged in
|
||||
this.value = [...new Set(this.value)]
|
||||
.filter((agent) => this._agentIds.some((id) => id === agent))
|
||||
.filter((id) => id !== CLOUD_AGENT || this.cloudStatus.logged_in);
|
||||
.filter(
|
||||
(id) =>
|
||||
id !== CLOUD_AGENT ||
|
||||
(this.cloudStatus.logged_in && this.cloudStatus.active_subscription)
|
||||
);
|
||||
|
||||
fireEvent(this, "value-changed", { value: this.value });
|
||||
}
|
||||
|
@ -100,7 +100,10 @@ class DialogGenerateBackup extends LitElement implements HassDialog {
|
||||
this._agentIds = agents
|
||||
.map((agent) => agent.agent_id)
|
||||
.filter(
|
||||
(id) => id !== CLOUD_AGENT || this._params?.cloudStatus?.logged_in
|
||||
(id) =>
|
||||
id !== CLOUD_AGENT ||
|
||||
(this._params?.cloudStatus?.logged_in &&
|
||||
this._params?.cloudStatus?.active_subscription)
|
||||
)
|
||||
.sort(compareAgents);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import type { HassDialog } from "../../../../dialogs/make-dialog-manager";
|
||||
import { haStyle, haStyleDialog } from "../../../../resources/styles";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
import { showAlertDialog } from "../../../lovelace/custom-card-helpers";
|
||||
import "../components/ha-backup-agents-picker";
|
||||
import type { UploadBackupDialogParams } from "./show-dialog-upload-backup";
|
||||
|
||||
const SUPPORTED_FORMAT = "application/x-tar";
|
||||
|
Loading…
x
Reference in New Issue
Block a user