mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 04:36:36 +00:00
change
This commit is contained in:
parent
36831d26e4
commit
09f4922ad3
@ -220,10 +220,29 @@ export class HassioUpdate extends LitElement {
|
||||
}
|
||||
|
||||
private async _updateCore(): Promise<void> {
|
||||
await updateCore(this.hass);
|
||||
try {
|
||||
await updateCore(this.hass);
|
||||
} catch (err) {
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"common.failed_to_update_name",
|
||||
"name",
|
||||
"Home Assistant Core"
|
||||
),
|
||||
text: extractApiErrorMessage(err),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: "core",
|
||||
});
|
||||
fireEvent(this, "supervisor-applying-update", {
|
||||
name: "Home Assistant Core",
|
||||
version: this.supervisor.core.version_latest,
|
||||
});
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
@ -7,17 +7,12 @@ import "../../../../src/components/ha-dialog";
|
||||
import "../../../../src/components/ha-settings-row";
|
||||
import "../../../../src/components/ha-svg-icon";
|
||||
import "../../../../src/components/ha-switch";
|
||||
import {
|
||||
extractApiErrorMessage,
|
||||
ignoreSupervisorError,
|
||||
} from "../../../../src/data/hassio/common";
|
||||
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
|
||||
import { createHassioPartialSnapshot } from "../../../../src/data/hassio/snapshot";
|
||||
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
|
||||
import type { HomeAssistant } from "../../../../src/types";
|
||||
import { SupervisorDialogSupervisorUpdateParams } from "./show-dialog-update";
|
||||
|
||||
const BLOCKING_UPDATES: string[] = ["Home Assistant Core"];
|
||||
|
||||
@customElement("dialog-supervisor-update")
|
||||
class DialogSupervisorUpdate extends LitElement {
|
||||
public hass!: HomeAssistant;
|
||||
@ -38,13 +33,6 @@ class DialogSupervisorUpdate extends LitElement {
|
||||
): Promise<void> {
|
||||
this._opened = true;
|
||||
this._dialogParams = params;
|
||||
this.addEventListener("supervisor-applying-update", (ev) => {
|
||||
fireEvent(
|
||||
this._dialogParams!.element,
|
||||
"supervisor-applying-update",
|
||||
ev.detail
|
||||
);
|
||||
});
|
||||
await this.updateComplete;
|
||||
}
|
||||
|
||||
@ -162,21 +150,7 @@ class DialogSupervisorUpdate extends LitElement {
|
||||
}
|
||||
|
||||
this._action = "update";
|
||||
try {
|
||||
await this._dialogParams!.updateHandler!();
|
||||
} catch (err) {
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
this._action = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (BLOCKING_UPDATES.includes(this._dialogParams!.name)) {
|
||||
fireEvent(this, "supervisor-applying-update", {
|
||||
name: this._dialogParams!.name,
|
||||
version: this._dialogParams!.version,
|
||||
});
|
||||
}
|
||||
await this._dialogParams!.updateHandler!();
|
||||
this.closeDialog();
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||
import { HassioPartialSnapshotCreateParams } from "../../../../src/data/hassio/snapshot";
|
||||
import { Supervisor } from "../../../../src/data/supervisor/supervisor";
|
||||
|
||||
export interface SupervisorDialogSupervisorUpdateParams {
|
||||
supervisor: Supervisor;
|
||||
name: string;
|
||||
version: string;
|
||||
snapshotParams: any;
|
||||
element: HTMLElement;
|
||||
snapshotParams: HassioPartialSnapshotCreateParams;
|
||||
updateHandler: () => Promise<void>;
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ export const showDialogSupervisorUpdate = (
|
||||
element: HTMLElement,
|
||||
dialogParams: Partial<SupervisorDialogSupervisorUpdateParams>
|
||||
): void => {
|
||||
dialogParams.element = element;
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-supervisor-update",
|
||||
dialogImport: () => import("./dialog-supervisor-update"),
|
||||
|
@ -56,7 +56,7 @@ class HassioPanel extends LitElement {
|
||||
|
||||
if (this._applyingUpdate !== undefined) {
|
||||
return html`<hass-loading-screen no-toolbar>
|
||||
${this.supervisor.localize("common.applying_update", {
|
||||
${this.supervisor.localize("dialog.update.updating", {
|
||||
name: this._applyingUpdate.name,
|
||||
version: this._applyingUpdate.version,
|
||||
})}
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
extractApiErrorMessage,
|
||||
fetchHassioStats,
|
||||
HassioStats,
|
||||
ignoreSupervisorError,
|
||||
} from "../../../src/data/hassio/common";
|
||||
import { restartCore, updateCore } from "../../../src/data/supervisor/core";
|
||||
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||
@ -150,7 +151,7 @@ class HassioCoreInfo extends LitElement {
|
||||
title: this.supervisor.localize(
|
||||
"common.failed_to_restart_name",
|
||||
"name",
|
||||
"Home AssistantCore"
|
||||
"Home Assistant Core"
|
||||
),
|
||||
text: extractApiErrorMessage(err),
|
||||
});
|
||||
@ -175,10 +176,29 @@ class HassioCoreInfo extends LitElement {
|
||||
}
|
||||
|
||||
private async _updateCore(): Promise<void> {
|
||||
await updateCore(this.hass);
|
||||
try {
|
||||
await updateCore(this.hass);
|
||||
} catch (err) {
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"common.failed_to_update_name",
|
||||
"name",
|
||||
"Home Assistant Core"
|
||||
),
|
||||
text: extractApiErrorMessage(err),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: "core",
|
||||
});
|
||||
fireEvent(this, "supervisor-applying-update", {
|
||||
name: "Home Assistant Core",
|
||||
version: this.supervisor.core.version_latest,
|
||||
});
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
@ -3779,7 +3779,6 @@
|
||||
"update_available": "{count, plural,\n one {Update}\n other {{count} updates}\n} pending",
|
||||
"update": "Update",
|
||||
"version": "Version",
|
||||
"applying_update": "Applying update to {version} for {name}",
|
||||
"error": {
|
||||
"unknown": "Unknown error",
|
||||
"update_failed": "Update failed"
|
||||
|
Loading…
x
Reference in New Issue
Block a user