Only restore config and database for core install (#23935)

This commit is contained in:
Paul Bottein 2025-01-29 12:46:30 +01:00 committed by GitHub
parent dd64d88afe
commit 4b5c7fc2de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,33 +1,35 @@
import { mdiClose } from "@mdi/js";
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
import { fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/ha-button";
import "../../../../components/ha-circular-progress";
import "../../../../components/ha-dialog-header";
import "../../../../components/ha-password-field";
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
import "../../../../components/ha-alert";
import "../../../../components/ha-icon-button";
import "../../../../components/ha-md-dialog";
import type { HaMdDialog } from "../../../../components/ha-md-dialog";
import "../../../../components/ha-svg-icon";
import type { RestoreBackupParams } from "../../../../data/backup";
import {
fetchBackupConfig,
getPreferredAgentForDownload,
restoreBackup,
} from "../../../../data/backup";
import type { HassDialog } from "../../../../dialogs/make-dialog-manager";
import { haStyle, haStyleDialog } from "../../../../resources/styles";
import type { HomeAssistant } from "../../../../types";
import type { RestoreBackupDialogParams } from "./show-dialog-restore-backup";
import type {
RestoreBackupStage,
RestoreBackupState,
} from "../../../../data/backup_manager";
import { subscribeBackupEvents } from "../../../../data/backup_manager";
import type { HassDialog } from "../../../../dialogs/make-dialog-manager";
import { haStyle, haStyleDialog } from "../../../../resources/styles";
import type { HomeAssistant } from "../../../../types";
import type { RestoreBackupDialogParams } from "./show-dialog-restore-backup";
interface FormData {
encryption_key_type: "config" | "custom";
@ -327,15 +329,20 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
const { addons, database_included, homeassistant_included, folders } =
this._params.selectedData;
await restoreBackup(this.hass, {
const restoreParams: RestoreBackupParams = {
backup_id: this._params.backup.backup_id,
agent_id: preferedAgent,
password,
restore_addons: addons.map((addon) => addon.slug),
restore_database: database_included,
restore_folders: folders,
restore_homeassistant: homeassistant_included,
});
};
if (isComponentLoaded(this.hass, "hassio")) {
restoreParams.restore_addons = addons.map((addon) => addon.slug);
restoreParams.restore_folders = folders;
}
await restoreBackup(this.hass, restoreParams);
}
static get styles(): CSSResultGroup {