mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 10:26:35 +00:00
parent
2d902a0688
commit
40a4255045
@ -15,8 +15,8 @@ export const enum BackupScheduleState {
|
||||
}
|
||||
|
||||
export interface BackupConfig {
|
||||
last_attempted_strategy_backup: string | null;
|
||||
last_completed_strategy_backup: string | null;
|
||||
last_attempted_automatic_backup: string | null;
|
||||
last_completed_automatic_backup: string | null;
|
||||
create_backup: {
|
||||
agent_ids: string[];
|
||||
include_addons: string[] | null;
|
||||
@ -64,7 +64,7 @@ export interface BackupContent {
|
||||
size: number;
|
||||
agent_ids?: string[];
|
||||
failed_agent_ids?: string[];
|
||||
with_strategy_settings: boolean;
|
||||
with_automatic_settings: boolean;
|
||||
}
|
||||
|
||||
export interface BackupData {
|
||||
@ -164,11 +164,11 @@ export const generateBackup = (
|
||||
...params,
|
||||
});
|
||||
|
||||
export const generateBackupWithStrategySettings = (
|
||||
export const generateBackupWithAutomaticSettings = (
|
||||
hass: HomeAssistant
|
||||
): Promise<void> =>
|
||||
hass.callWS({
|
||||
type: "backup/generate_with_strategy_settings",
|
||||
type: "backup/generate_with_automatic_settings",
|
||||
});
|
||||
|
||||
export const restoreBackup = (
|
||||
|
@ -24,7 +24,7 @@ export class HaBackupSummaryProgress extends LitElement {
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
.filter((backup) => {
|
||||
// TODO : only show backups with default flag
|
||||
return backup.with_strategy_settings;
|
||||
return backup.with_automatic_settings;
|
||||
})
|
||||
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
|
||||
|
@ -70,8 +70,8 @@ const RECOMMENDED_CONFIG: BackupConfig = {
|
||||
schedule: {
|
||||
state: BackupScheduleState.DAILY,
|
||||
},
|
||||
last_attempted_strategy_backup: null,
|
||||
last_completed_strategy_backup: null,
|
||||
last_attempted_automatic_backup: null,
|
||||
last_completed_automatic_backup: null,
|
||||
};
|
||||
|
||||
@customElement("ha-dialog-backup-onboarding")
|
||||
@ -237,7 +237,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
||||
case "key":
|
||||
return "Encryption key";
|
||||
case "setup":
|
||||
return "Set up your backup strategy";
|
||||
return "Set up your automatic backups";
|
||||
case "schedule":
|
||||
return "Automatic backups";
|
||||
case "data":
|
||||
@ -279,7 +279,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
||||
src="/static/images/voice-assistant/hi.png"
|
||||
alt="Casita Home Assistant logo"
|
||||
/>
|
||||
<h1>Set up your backup strategy</h1>
|
||||
<h1>Set up your automatic backups</h1>
|
||||
<p class="secondary">
|
||||
Backups are essential to a reliable smart home. They protect your
|
||||
setup against failures and allows you to quickly have a working
|
||||
@ -326,7 +326,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
||||
<ha-md-list-item type="button" @click=${this._done}>
|
||||
<span slot="headline">Recommended settings</span>
|
||||
<span slot="supporting-text">
|
||||
Set the proven backup strategy of daily backup.
|
||||
Set the proven settings of daily backup.
|
||||
</span>
|
||||
<ha-icon-next slot="end"> </ha-icon-next>
|
||||
</ha-md-list-item>
|
||||
@ -368,7 +368,7 @@ class DialogBackupOnboarding extends LitElement implements HassDialog {
|
||||
return html`
|
||||
<p>
|
||||
Home Assistant will upload to these locations when this backup
|
||||
strategy is used. You can use all locations for custom backups.
|
||||
settings are used. You can use all locations for custom backups.
|
||||
</p>
|
||||
<ha-backup-config-agents
|
||||
.hass=${this.hass}
|
||||
|
@ -76,7 +76,7 @@ class DialogNewBackup extends LitElement implements HassDialog {
|
||||
.disabled=${!this._params.config.create_backup.password}
|
||||
>
|
||||
<ha-svg-icon slot="start" .path=${mdiCog}></ha-svg-icon>
|
||||
<span slot="headline">Use backup strategy</span>
|
||||
<span slot="headline">Use automatic backups</span>
|
||||
<span slot="supporting-text">
|
||||
Create a backup with the data and locations you have configured.
|
||||
</span>
|
||||
@ -97,12 +97,12 @@ class DialogNewBackup extends LitElement implements HassDialog {
|
||||
}
|
||||
|
||||
private async _custom() {
|
||||
this._params!.submit?.("custom");
|
||||
this._params!.submit?.("manual");
|
||||
this.closeDialog();
|
||||
}
|
||||
|
||||
private async _default() {
|
||||
this._params!.submit?.("strategy");
|
||||
this._params!.submit?.("automatic");
|
||||
this.closeDialog();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import type { BackupConfig } from "../../../../data/backup";
|
||||
|
||||
export type NewBackupType = "strategy" | "custom";
|
||||
export type NewBackupType = "automatic" | "manual";
|
||||
|
||||
export interface NewBackupDialogParams {
|
||||
config: BackupConfig;
|
||||
|
@ -43,7 +43,7 @@ import {
|
||||
fetchBackupConfig,
|
||||
fetchBackupInfo,
|
||||
generateBackup,
|
||||
generateBackupWithStrategySettings,
|
||||
generateBackupWithAutomaticSettings,
|
||||
getBackupDownloadUrl,
|
||||
getPreferredAgentForDownload,
|
||||
isLocalAgent,
|
||||
@ -80,9 +80,9 @@ interface BackupRow extends BackupContent {
|
||||
formatted_type: string;
|
||||
}
|
||||
|
||||
type BackupType = "strategy" | "custom";
|
||||
type BackupType = "automatic" | "manual";
|
||||
|
||||
const TYPE_ORDER: Array<BackupType> = ["strategy", "custom"];
|
||||
const TYPE_ORDER: Array<BackupType> = ["automatic", "manual"];
|
||||
|
||||
@customElement("ha-config-backup-dashboard")
|
||||
class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
@ -251,7 +251,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
backups.map((backup) => ({
|
||||
...backup,
|
||||
formatted_type: this._formatBackupType(
|
||||
backup.with_strategy_settings ? "strategy" : "custom"
|
||||
backup.with_automatic_settings ? "automatic" : "manual"
|
||||
),
|
||||
}))
|
||||
);
|
||||
@ -302,7 +302,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
>
|
||||
<ha-button
|
||||
slot="action"
|
||||
@click=${this._configureBackupStrategy}
|
||||
@click=${this._configureAutomaticBackups}
|
||||
>
|
||||
Configure
|
||||
</ha-button>
|
||||
@ -317,7 +317,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
>
|
||||
<ha-button
|
||||
slot="action"
|
||||
@click=${this._configureBackupStrategy}
|
||||
@click=${this._configureAutomaticBackups}
|
||||
>
|
||||
Configure
|
||||
</ha-button>
|
||||
@ -326,16 +326,16 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
: this._needsOnboarding
|
||||
? html`
|
||||
<ha-backup-summary-card
|
||||
heading="Configure backup strategy"
|
||||
heading="Configure automatic backups"
|
||||
description="Have a one-click backup automation with selected data and locations."
|
||||
has-action
|
||||
status="info"
|
||||
>
|
||||
<ha-button
|
||||
slot="action"
|
||||
@click=${this._setupBackupStrategy}
|
||||
@click=${this._setupAutomaticBackups}
|
||||
>
|
||||
Set up backup strategy
|
||||
Set up automatic backups
|
||||
</ha-button>
|
||||
</ha-backup-summary-card>
|
||||
`
|
||||
@ -347,7 +347,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
>
|
||||
<ha-button
|
||||
slot="action"
|
||||
@click=${this._configureBackupStrategy}
|
||||
@click=${this._configureAutomaticBackups}
|
||||
>
|
||||
Configure
|
||||
</ha-button>
|
||||
@ -522,7 +522,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === "custom") {
|
||||
if (type === "manual") {
|
||||
const params = await showGenerateBackupDialog(this, {});
|
||||
|
||||
if (!params) {
|
||||
@ -539,8 +539,8 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
await this._fetchBackupInfo();
|
||||
return;
|
||||
}
|
||||
if (type === "strategy") {
|
||||
await generateBackupWithStrategySettings(this.hass);
|
||||
if (type === "automatic") {
|
||||
await generateBackupWithAutomaticSettings(this.hass);
|
||||
await this._fetchBackupInfo();
|
||||
}
|
||||
}
|
||||
@ -602,11 +602,11 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
this._dataTable.clearSelection();
|
||||
}
|
||||
|
||||
private _configureBackupStrategy() {
|
||||
navigate("/config/backup/strategy");
|
||||
private _configureAutomaticBackups() {
|
||||
navigate("/config/backup/settings");
|
||||
}
|
||||
|
||||
private async _setupBackupStrategy() {
|
||||
private async _setupAutomaticBackups() {
|
||||
const success = await showBackupOnboardingDialog(this, {
|
||||
cloudStatus: this.cloudStatus,
|
||||
});
|
||||
@ -615,7 +615,7 @@ class HaConfigBackupDashboard extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
|
||||
this._fetchBackupConfig();
|
||||
await generateBackupWithStrategySettings(this.hass);
|
||||
await generateBackupWithAutomaticSettings(this.hass);
|
||||
await this._fetchBackupInfo();
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ const INITIAL_BACKUP_CONFIG: BackupConfig = {
|
||||
schedule: {
|
||||
state: BackupScheduleState.DAILY,
|
||||
},
|
||||
last_attempted_strategy_backup: null,
|
||||
last_completed_strategy_backup: null,
|
||||
last_attempted_automatic_backup: null,
|
||||
last_completed_automatic_backup: null,
|
||||
};
|
||||
|
||||
@customElement("ha-config-backup-strategy")
|
||||
class HaConfigBackupStrategy extends LitElement {
|
||||
@customElement("ha-config-backup-settings")
|
||||
class HaConfigBackupSettings extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property({ attribute: false }) public cloudStatus!: CloudStatus;
|
||||
@ -75,15 +75,15 @@ class HaConfigBackupStrategy extends LitElement {
|
||||
back-path="/config/backup"
|
||||
.hass=${this.hass}
|
||||
.narrow=${this.narrow}
|
||||
.header=${"Backup strategy"}
|
||||
.header=${"Automatic backups"}
|
||||
>
|
||||
<div class="content">
|
||||
<ha-card>
|
||||
<div class="card-header">Automatic backups</div>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
Let Home Assistant take care of your backup strategy by creating
|
||||
a scheduled backup that also removes older copies.
|
||||
Let Home Assistant take care of your backups by creating a
|
||||
scheduled backup that also removes older copies.
|
||||
</p>
|
||||
<ha-backup-config-schedule
|
||||
.hass=${this.hass}
|
||||
@ -249,6 +249,6 @@ class HaConfigBackupStrategy extends LitElement {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-config-backup-strategy": HaConfigBackupStrategy;
|
||||
"ha-config-backup-settings": HaConfigBackupSettings;
|
||||
}
|
||||
}
|
@ -30,9 +30,9 @@ class HaConfigBackup extends HassRouterPage {
|
||||
tag: "ha-config-backup-locations",
|
||||
load: () => import("./ha-config-backup-locations"),
|
||||
},
|
||||
strategy: {
|
||||
tag: "ha-config-backup-strategy",
|
||||
load: () => import("./ha-config-backup-strategy"),
|
||||
settings: {
|
||||
tag: "ha-config-backup-settings",
|
||||
load: () => import("./ha-config-backup-settings"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user