Bump typescript, lint, prettier (#10108)
This commit is contained in:
parent
ff2bf1f3c1
commit
2936865c55
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"airbnb-typescript/base",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:wc/recommended",
|
||||
"plugin:lit/recommended",
|
||||
"plugin:lit/all",
|
||||
"prettier"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
|
@ -109,7 +110,9 @@
|
|||
}
|
||||
],
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"lit/attribute-value-entities": "off"
|
||||
"lit/attribute-value-entities": "off",
|
||||
"lit/no-template-map": "off",
|
||||
"lit/no-template-arrow": "warn"
|
||||
},
|
||||
"plugins": ["disable", "unused-imports"],
|
||||
"processor": "disable/disable"
|
||||
|
|
|
@ -191,7 +191,7 @@ class HcCast extends LitElement {
|
|||
}
|
||||
this.connection.close();
|
||||
location.reload();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert("Unable to log out!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ export class HcConnect extends LitElement {
|
|||
let url: URL;
|
||||
try {
|
||||
url = new URL(value);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this.error = "Invalid URL";
|
||||
return;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ export class HcConnect extends LitElement {
|
|||
try {
|
||||
this.loading = true;
|
||||
auth = await getAuth(options);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (init === "saved-tokens" && err === ERR_CANNOT_CONNECT) {
|
||||
this.cannotConnect = true;
|
||||
return;
|
||||
|
@ -259,7 +259,7 @@ export class HcConnect extends LitElement {
|
|||
|
||||
try {
|
||||
conn = await createConnection({ auth });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// In case of saved tokens, silently solve problems.
|
||||
if (init === "saved-tokens") {
|
||||
if (err === ERR_CANNOT_CONNECT) {
|
||||
|
@ -285,7 +285,7 @@ export class HcConnect extends LitElement {
|
|||
try {
|
||||
saveTokens(null);
|
||||
location.reload();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert("Unable to log out!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,14 +148,14 @@ export class HcMain extends HassElement {
|
|||
expires_in: 0,
|
||||
}),
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this._getErrorMessage(err);
|
||||
return;
|
||||
}
|
||||
let connection;
|
||||
try {
|
||||
connection = await createConnection({ auth });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this._getErrorMessage(err);
|
||||
return;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ export class HcMain extends HassElement {
|
|||
this._unsubLovelace = llColl.subscribe((lovelaceConfig) =>
|
||||
this._handleNewLovelaceConfig(lovelaceConfig)
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line
|
||||
console.log("Error fetching Lovelace configuration", err, msg);
|
||||
// Generate a Lovelace config.
|
||||
|
|
|
@ -44,7 +44,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
|||
(conf) => html`
|
||||
${conf.name}
|
||||
<small>
|
||||
<a target="_blank" href="${conf.authorUrl}">
|
||||
<a target="_blank" href=${conf.authorUrl}>
|
||||
${this.hass.localize(
|
||||
"ui.panel.page-demo.cards.demo.demo_by",
|
||||
"name",
|
||||
|
@ -94,7 +94,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
|||
this._switching = true;
|
||||
try {
|
||||
await setDemoConfig(this.hass, this.lovelace!, index);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert("Failed to switch config :-(");
|
||||
} finally {
|
||||
this._switching = false;
|
||||
|
|
|
@ -23,9 +23,9 @@ customElements.whenDefined("hui-view").then(() => {
|
|||
// eslint-disable-next-line
|
||||
const HUIView = customElements.get("hui-view");
|
||||
// Patch HUI-VIEW to make the lovelace object available to the demo card
|
||||
const oldCreateCard = HUIView.prototype.createCardElement;
|
||||
const oldCreateCard = HUIView!.prototype.createCardElement;
|
||||
|
||||
HUIView.prototype.createCardElement = function (config) {
|
||||
HUIView!.prototype.createCardElement = function (config) {
|
||||
const el = oldCreateCard.call(this, config);
|
||||
if (el.tagName === "HA-DEMO-CARD") {
|
||||
(el as HADemoCard).lovelace = this.lovelace;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import "@material/mwc-button";
|
||||
import { html, LitElement, TemplateResult } from "lit";
|
||||
import { css, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement } from "lit/decorators";
|
||||
import "../../../src/components/ha-card";
|
||||
import { ActionHandlerEvent } from "../../../src/data/lovelace";
|
||||
|
@ -9,7 +9,6 @@ import { actionHandler } from "../../../src/panels/lovelace/common/directives/ac
|
|||
export class DemoUtilLongPress extends LitElement {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
${this.renderStyle()}
|
||||
${[1, 2, 3].map(
|
||||
() => html`
|
||||
<ha-card>
|
||||
|
@ -41,26 +40,22 @@ export class DemoUtilLongPress extends LitElement {
|
|||
area.scrollTop = area.scrollHeight;
|
||||
}
|
||||
|
||||
private renderStyle() {
|
||||
return html`
|
||||
<style>
|
||||
ha-card {
|
||||
width: 200px;
|
||||
margin: calc(42vh - 140px) auto;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
ha-card:first-of-type {
|
||||
margin-top: 16px;
|
||||
}
|
||||
ha-card:last-of-type {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
static styles = css`
|
||||
ha-card {
|
||||
width: 200px;
|
||||
margin: calc(42vh - 140px) auto;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
ha-card:first-of-type {
|
||||
margin-top: 16px;
|
||||
}
|
||||
ha-card:last-of-type {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
}
|
||||
textarea {
|
||||
height: 50px;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ class HassioAddonConfig extends LitElement {
|
|||
path: "options",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.common.update_available",
|
||||
"error",
|
||||
|
@ -300,7 +300,7 @@ class HassioAddonConfig extends LitElement {
|
|||
if (this.addon?.state === "started") {
|
||||
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
|
|
@ -89,9 +89,9 @@ class HassioAddonNetwork extends LitElement {
|
|||
<td>
|
||||
<paper-input
|
||||
@value-changed=${this._configChanged}
|
||||
placeholder="${this.supervisor.localize(
|
||||
placeholder=${this.supervisor.localize(
|
||||
"addon.configuration.network.disabled"
|
||||
)}"
|
||||
)}
|
||||
.value=${item.host ? String(item.host) : ""}
|
||||
.container=${item.container}
|
||||
no-label-float
|
||||
|
@ -171,7 +171,7 @@ class HassioAddonNetwork extends LitElement {
|
|||
if (this.addon?.state === "started") {
|
||||
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_reset",
|
||||
"error",
|
||||
|
@ -207,7 +207,7 @@ class HassioAddonNetwork extends LitElement {
|
|||
if (this.addon?.state === "started") {
|
||||
await suggestAddonRestart(this, this.hass, this.supervisor, this.addon);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
|
|
@ -79,7 +79,7 @@ class HassioAddonDocumentationDashboard extends LitElement {
|
|||
this.hass,
|
||||
this.addon!.slug
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.documentation.get_logs",
|
||||
"error",
|
||||
|
|
|
@ -222,7 +222,7 @@ class HassioAddonDashboard extends LitElement {
|
|||
try {
|
||||
const addoninfo = await fetchHassioAddonInfo(this.hass, addon);
|
||||
this.addon = addoninfo;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = `Error fetching addon info: ${extractApiErrorMessage(err)}`;
|
||||
this.addon = undefined;
|
||||
}
|
||||
|
|
|
@ -123,18 +123,18 @@ class HassioAddonInfo extends LitElement {
|
|||
<div class="card-content">
|
||||
<hassio-card-content
|
||||
.hass=${this.hass}
|
||||
.title="${this.supervisor.localize(
|
||||
.title=${this.supervisor.localize(
|
||||
"addon.dashboard.new_update_available",
|
||||
"name",
|
||||
this.addon.name,
|
||||
"version",
|
||||
this.addon.version_latest
|
||||
)}"
|
||||
.description="${this.supervisor.localize(
|
||||
)}
|
||||
.description=${this.supervisor.localize(
|
||||
"common.running_version",
|
||||
"version",
|
||||
this.addon.version
|
||||
)}"
|
||||
)}
|
||||
icon=${mdiArrowUpBoldCircle}
|
||||
iconClass="update"
|
||||
></hassio-card-content>
|
||||
|
@ -254,7 +254,7 @@ class HassioAddonInfo extends LitElement {
|
|||
${this.supervisor.localize(
|
||||
"addon.dashboard.visit_addon_page",
|
||||
"name",
|
||||
html`<a href="${this.addon.url!}" target="_blank" rel="noreferrer"
|
||||
html`<a href=${this.addon.url!} target="_blank" rel="noreferrer"
|
||||
>${this.addon.name}</a
|
||||
>`
|
||||
)}
|
||||
|
@ -437,10 +437,10 @@ class HassioAddonInfo extends LitElement {
|
|||
${this.addon.version
|
||||
? html`
|
||||
<div
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
"addon-options": true,
|
||||
started: this.addon.state === "started",
|
||||
})}"
|
||||
})}
|
||||
>
|
||||
<ha-settings-row ?three-line=${this.narrow}>
|
||||
<span slot="heading">
|
||||
|
@ -796,7 +796,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "option",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
@ -818,7 +818,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "option",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
@ -840,7 +840,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "option",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
@ -862,7 +862,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "security",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
@ -884,7 +884,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "option",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.failed_to_save",
|
||||
"error",
|
||||
|
@ -912,7 +912,7 @@ class HassioAddonInfo extends LitElement {
|
|||
title: this.supervisor.localize("addon.dashboard.changelog"),
|
||||
content,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"addon.dashboard.action_error.get_changelog"
|
||||
|
@ -934,7 +934,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "install",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("addon.dashboard.action_error.install"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -955,7 +955,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "stop",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("addon.dashboard.action_error.stop"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -976,7 +976,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "stop",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("addon.dashboard.action_error.restart"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -1035,7 +1035,7 @@ class HassioAddonInfo extends LitElement {
|
|||
button.progress = false;
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: "Failed to validate addon configuration",
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -1053,7 +1053,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "start",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("addon.dashboard.action_error.start"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -1091,7 +1091,7 @@ class HassioAddonInfo extends LitElement {
|
|||
path: "uninstall",
|
||||
};
|
||||
fireEvent(this, "hass-api-called", eventdata);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"addon.dashboard.action_error.uninstall"
|
||||
|
|
|
@ -71,7 +71,7 @@ class HassioAddonLogs extends LitElement {
|
|||
this._error = undefined;
|
||||
try {
|
||||
this._content = await fetchHassioAddonLogs(this.hass, this.addon.slug);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"addon.logs.get_logs",
|
||||
"error",
|
||||
|
|
|
@ -294,7 +294,7 @@ export class HassioBackups extends LitElement {
|
|||
await Promise.all(
|
||||
this._selectedBackups.map((slug) => removeBackup(this.hass, slug))
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("backup.failed_to_delete"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
|
|
@ -37,7 +37,7 @@ class HassioCardContent extends LitElement {
|
|||
${this.iconImage
|
||||
? html`
|
||||
<div class="icon_image ${this.iconClass}">
|
||||
<img src="${this.iconImage}" .title=${this.iconTitle} />
|
||||
<img src=${this.iconImage} .title=${this.iconTitle} />
|
||||
<div></div>
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -70,7 +70,7 @@ export class HassioUploadBackup extends LitElement {
|
|||
try {
|
||||
const backup = await uploadBackup(this.hass, file);
|
||||
fireEvent(this, "backup-uploaded", { backup: backup.data });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: "Upload failed",
|
||||
text: extractApiErrorMessage(err),
|
||||
|
|
|
@ -20,10 +20,10 @@ class SupervisorMetric extends LitElement {
|
|||
<div slot="description" .title=${this.tooltip ?? ""}>
|
||||
<span class="value"> ${roundedValue} % </span>
|
||||
<ha-bar
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
"target-warning": roundedValue > 50,
|
||||
"target-critical": roundedValue > 85,
|
||||
})}"
|
||||
})}
|
||||
.value=${this.value}
|
||||
></ha-bar>
|
||||
</div>
|
||||
|
|
|
@ -136,7 +136,7 @@ export class HassioUpdate extends LitElement {
|
|||
</ha-settings-row>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<a href="${releaseNotesUrl}" target="_blank" rel="noreferrer">
|
||||
<a href=${releaseNotesUrl} target="_blank" rel="noreferrer">
|
||||
<mwc-button>
|
||||
${this.supervisor.localize("common.release_notes")}
|
||||
</mwc-button>
|
||||
|
@ -206,7 +206,7 @@ export class HassioUpdate extends LitElement {
|
|||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: item.key,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Only show an error if the status code was not expected (user behind proxy)
|
||||
// or no status at all(connection terminated)
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
|
|
|
@ -311,7 +311,7 @@ class HassioBackupDialog
|
|||
: "snapshots"
|
||||
}/${this._backup!.slug}/download`
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
await showAlertDialog(this, {
|
||||
text: extractApiErrorMessage(err),
|
||||
});
|
||||
|
|
|
@ -127,7 +127,7 @@ class HassioCreateBackupDialog extends LitElement {
|
|||
|
||||
this._dialogParams!.onCreate();
|
||||
this.closeDialog();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
}
|
||||
this._creatingBackup = false;
|
||||
|
|
|
@ -149,7 +149,7 @@ class HassioDatadiskDialog extends LitElement {
|
|||
this.moving = true;
|
||||
try {
|
||||
await moveDatadisk(this.hass, this.selectedDevice!);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
showAlertDialog(this, {
|
||||
title: this.dialogParams!.supervisor.localize(
|
||||
|
|
|
@ -287,7 +287,7 @@ export class DialogHassioNetwork
|
|||
this.hass,
|
||||
this._interface.interface
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: "Failed to scan for accesspoints",
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -448,7 +448,7 @@ export class DialogHassioNetwork
|
|||
this._interface!.interface,
|
||||
interfaceOptions
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("dialog.network.failed_to_change"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
|
|
@ -190,7 +190,7 @@ class HassioRegistriesDialog extends LitElement {
|
|||
await addHassioDockerRegistry(this.hass, data);
|
||||
await this._loadRegistries();
|
||||
this._addingRegistry = false;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("dialog.registries.failed_to_add"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -204,7 +204,7 @@ class HassioRegistriesDialog extends LitElement {
|
|||
try {
|
||||
await removeHassioDockerRegistry(this.hass, entry.registry);
|
||||
await this._loadRegistries();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("dialog.registries.failed_to_remove"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
|
|
@ -185,7 +185,7 @@ class HassioRepositoriesDialog extends LitElement {
|
|||
this._repositories = addonsinfo.repositories;
|
||||
|
||||
fireEvent(this, "supervisor-collection-refresh", { collection: "addon" });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class HassioRepositoriesDialog extends LitElement {
|
|||
await this._loadData();
|
||||
|
||||
input.value = "";
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
}
|
||||
this._processing = false;
|
||||
|
@ -229,7 +229,7 @@ class HassioRepositoriesDialog extends LitElement {
|
|||
addons_repositories: newRepositories,
|
||||
});
|
||||
await this._loadData();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export const suggestAddonRestart = async (
|
|||
if (confirmed) {
|
||||
try {
|
||||
await restartHassioAddon(hass, addon.slug);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(element, {
|
||||
title: supervisor.localize(
|
||||
"common.failed_to_restart_name",
|
||||
|
|
|
@ -148,7 +148,7 @@ class DialogSupervisorUpdate extends LitElement {
|
|||
this.hass,
|
||||
this._dialogParams!.backupParams
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
this._action = null;
|
||||
return;
|
||||
|
@ -158,7 +158,7 @@ class DialogSupervisorUpdate extends LitElement {
|
|||
this._action = "update";
|
||||
try {
|
||||
await this._dialogParams!.updateHandler!();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
this._error = extractApiErrorMessage(err);
|
||||
this._action = null;
|
||||
|
|
|
@ -87,7 +87,7 @@ class HassioMyRedirect extends LitElement {
|
|||
let url: string;
|
||||
try {
|
||||
url = this._createRedirectUrl(redirect);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize("my.error");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class HassioIngressView extends LitElement {
|
|||
if (requestedAddon) {
|
||||
try {
|
||||
addonInfo = await fetchHassioAddonInfo(this.hass, requestedAddon);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
await showAlertDialog(this, {
|
||||
text: extractApiErrorMessage(err),
|
||||
title: requestedAddon,
|
||||
|
@ -145,7 +145,7 @@ class HassioIngressView extends LitElement {
|
|||
|
||||
try {
|
||||
addon = await fetchHassioAddonInfo(this.hass, addonSlug);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
await showAlertDialog(this, {
|
||||
text: "Unable to fetch add-on info to start Ingress",
|
||||
title: "Supervisor",
|
||||
|
@ -179,7 +179,7 @@ class HassioIngressView extends LitElement {
|
|||
|
||||
try {
|
||||
session = await createSessionPromise;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
await showAlertDialog(this, {
|
||||
text: "Unable to create an Ingress session",
|
||||
title: addon.name,
|
||||
|
@ -195,7 +195,7 @@ class HassioIngressView extends LitElement {
|
|||
this._sessionKeepAlive = window.setInterval(async () => {
|
||||
try {
|
||||
await validateHassioSession(this.hass, session);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
session = await createHassioSession(this.hass);
|
||||
}
|
||||
}, 60000);
|
||||
|
|
|
@ -144,7 +144,7 @@ class HassioCoreInfo extends LitElement {
|
|||
|
||||
try {
|
||||
await restartCore(this.hass);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (this.hass.connection.connected) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
|
|
|
@ -247,7 +247,7 @@ class HassioHostInfo extends LitElement {
|
|||
let hardware;
|
||||
try {
|
||||
hardware = await fetchHassioHardwareInfo(this.hass);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
await showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"system.host.failed_to_get_hardware_list"
|
||||
|
@ -277,7 +277,7 @@ class HassioHostInfo extends LitElement {
|
|||
|
||||
try {
|
||||
await rebootHost(this.hass);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Ignore connection errors, these are all expected
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
showAlertDialog(this, {
|
||||
|
@ -307,7 +307,7 @@ class HassioHostInfo extends LitElement {
|
|||
|
||||
try {
|
||||
await shutdownHost(this.hass);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Ignore connection errors, these are all expected
|
||||
if (this.hass.connection.connected && !ignoreSupervisorError(err)) {
|
||||
showAlertDialog(this, {
|
||||
|
@ -348,7 +348,7 @@ class HassioHostInfo extends LitElement {
|
|||
try {
|
||||
await updateOS(this.hass);
|
||||
fireEvent(this, "supervisor-collection-refresh", { collection: "os" });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (this.hass.connection.connected) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
|
@ -386,7 +386,7 @@ class HassioHostInfo extends LitElement {
|
|||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: "host",
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("system.host.failed_to_set_hostname"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -401,7 +401,7 @@ class HassioHostInfo extends LitElement {
|
|||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: "host",
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"system.host.failed_to_import_from_usb"
|
||||
|
|
|
@ -282,7 +282,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||
};
|
||||
await setSupervisorOption(this.hass, data);
|
||||
await this._reloadSupervisor();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"system.supervisor.failed_to_set_option"
|
||||
|
@ -300,7 +300,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||
|
||||
try {
|
||||
await this._reloadSupervisor();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize("system.supervisor.failed_to_reload"),
|
||||
text: extractApiErrorMessage(err),
|
||||
|
@ -343,7 +343,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||
|
||||
try {
|
||||
await restartSupervisor(this.hass);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"common.failed_to_restart_name",
|
||||
|
@ -388,7 +388,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||
fireEvent(this, "supervisor-collection-refresh", {
|
||||
collection: "supervisor",
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"common.failed_to_update_name",
|
||||
|
@ -427,10 +427,10 @@ class HassioSupervisorInfo extends LitElement {
|
|||
<li>
|
||||
${UNSUPPORTED_REASON_URL[reason]
|
||||
? html`<a
|
||||
href="${documentationUrl(
|
||||
href=${documentationUrl(
|
||||
this.hass,
|
||||
UNSUPPORTED_REASON_URL[reason]
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
@ -458,10 +458,10 @@ class HassioSupervisorInfo extends LitElement {
|
|||
<li>
|
||||
${UNHEALTHY_REASON_URL[reason]
|
||||
? html`<a
|
||||
href="${documentationUrl(
|
||||
href=${documentationUrl(
|
||||
this.hass,
|
||||
UNHEALTHY_REASON_URL[reason]
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
@ -483,7 +483,7 @@ class HassioSupervisorInfo extends LitElement {
|
|||
diagnostics: !this.supervisor.supervisor?.diagnostics,
|
||||
};
|
||||
await setSupervisorOption(this.hass, data);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.supervisor.localize(
|
||||
"system.supervisor.failed_to_set_option"
|
||||
|
|
|
@ -130,7 +130,7 @@ class HassioSupervisorLog extends LitElement {
|
|||
this.hass,
|
||||
this._selectedLogProvider
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = this.supervisor.localize(
|
||||
"system.log.get_logs",
|
||||
"provider",
|
||||
|
|
33
package.json
33
package.json
|
@ -145,18 +145,18 @@
|
|||
"xss": "^1.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/core": "^7.15.5",
|
||||
"@babel/plugin-external-helpers": "^7.14.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||
"@babel/plugin-proposal-decorators": "^7.14.5",
|
||||
"@babel/plugin-proposal-decorators": "^7.15.4",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
||||
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
||||
"@babel/preset-env": "^7.14.7",
|
||||
"@babel/preset-typescript": "^7.14.5",
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@koa/cors": "^3.1.0",
|
||||
"@open-wc/dev-server-hmr": "^0.0.2",
|
||||
"@rollup/plugin-babel": "^5.2.1",
|
||||
|
@ -173,23 +173,24 @@
|
|||
"@types/mocha": "^8",
|
||||
"@types/sortablejs": "^1",
|
||||
"@types/webspeechapi": "^0.0.29",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.3",
|
||||
"@typescript-eslint/parser": "^4.28.3",
|
||||
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
||||
"@typescript-eslint/parser": "^4.32.0",
|
||||
"@web/dev-server": "^0.0.24",
|
||||
"@web/dev-server-rollup": "^0.2.11",
|
||||
"babel-loader": "^8.2.2",
|
||||
"chai": "^4.3.4",
|
||||
"del": "^4.0.0",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-config-airbnb-typescript": "^12.3.1",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-airbnb-typescript": "^14.0.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-import-resolver-webpack": "^0.13.1",
|
||||
"eslint-plugin-disable": "^2.0.1",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-lit": "^1.5.1",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-unused-imports": "^1.1.2",
|
||||
"eslint-plugin-wc": "^1.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-unused-imports": "^1.1.5",
|
||||
"eslint-plugin-wc": "^1.3.2",
|
||||
"fancy-log": "^1.3.3",
|
||||
"fs-extra": "^7.0.1",
|
||||
"gulp": "^4.0.2",
|
||||
|
@ -201,7 +202,7 @@
|
|||
"html-minifier": "^4.0.0",
|
||||
"husky": "^1.3.1",
|
||||
"instant-mocha": "^1.3.1",
|
||||
"lint-staged": "^11.0.1",
|
||||
"lint-staged": "^11.1.2",
|
||||
"lit-analyzer": "^1.2.1",
|
||||
"lodash.template": "^4.5.0",
|
||||
"magic-string": "^0.25.7",
|
||||
|
@ -210,7 +211,7 @@
|
|||
"mocha": "^8.4.0",
|
||||
"object-hash": "^2.0.3",
|
||||
"open": "^7.0.4",
|
||||
"prettier": "^2.3.2",
|
||||
"prettier": "^2.4.1",
|
||||
"require-dir": "^1.2.0",
|
||||
"rollup": "^2.8.2",
|
||||
"rollup-plugin-string": "^3.0.0",
|
||||
|
@ -222,7 +223,7 @@
|
|||
"systemjs": "^6.3.2",
|
||||
"terser-webpack-plugin": "^5.2.4",
|
||||
"ts-lit-plugin": "^1.2.1",
|
||||
"typescript": "^4.3.5",
|
||||
"typescript": "^4.4.3",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"webpack": "^5.55.1",
|
||||
|
|
|
@ -194,7 +194,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||
this._state = "error";
|
||||
this._errorMessage = data.message;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Error starting auth flow", err);
|
||||
this._state = "error";
|
||||
|
@ -317,7 +317,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||
return;
|
||||
}
|
||||
await this._updateStep(newStep);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("Error submitting step", err);
|
||||
this._state = "error";
|
||||
|
|
|
@ -76,20 +76,20 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
|||
${loggingInWith}
|
||||
|
||||
<ha-auth-flow
|
||||
.resources="${this.resources}"
|
||||
.clientId="${this.clientId}"
|
||||
.redirectUri="${this.redirectUri}"
|
||||
.oauth2State="${this.oauth2State}"
|
||||
.authProvider="${this._authProvider}"
|
||||
.resources=${this.resources}
|
||||
.clientId=${this.clientId}
|
||||
.redirectUri=${this.redirectUri}
|
||||
.oauth2State=${this.oauth2State}
|
||||
.authProvider=${this._authProvider}
|
||||
></ha-auth-flow>
|
||||
|
||||
${inactiveProviders.length > 0
|
||||
? html`
|
||||
<ha-pick-auth-provider
|
||||
.resources="${this.resources}"
|
||||
.clientId="${this.clientId}"
|
||||
.authProviders="${inactiveProviders}"
|
||||
@pick-auth-provider="${this._handleAuthProviderPick}"
|
||||
.resources=${this.resources}
|
||||
.clientId=${this.clientId}
|
||||
.authProviders=${inactiveProviders}
|
||||
@pick-auth-provider=${this._handleAuthProviderPick}
|
||||
></ha-pick-auth-provider>
|
||||
`
|
||||
: ""}
|
||||
|
@ -158,7 +158,7 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
|
|||
|
||||
this._authProviders = authProviders;
|
||||
this._authProvider = authProviders[0];
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line
|
||||
console.error("Error loading auth providers", err);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable lit/prefer-static-styles */
|
||||
import { html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import "@polymer/paper-item/paper-item";
|
||||
import "@polymer/paper-item/paper-item-body";
|
||||
import { html, LitElement } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { property } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import "../components/ha-icon-next";
|
||||
|
@ -18,14 +18,6 @@ class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
|
|||
|
||||
protected render() {
|
||||
return html`
|
||||
<style>
|
||||
paper-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
<p>${this.localize("ui.panel.page-authorize.pick_auth_provider")}:</p>
|
||||
${this.authProviders.map(
|
||||
(provider) => html`
|
||||
|
@ -41,5 +33,14 @@ class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
|
|||
private _handlePick(ev) {
|
||||
fireEvent(this, "pick-auth-provider", ev.currentTarget.auth_provider);
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
paper-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
customElements.define("ha-pick-auth-provider", HaPickAuthProvider);
|
||||
|
|
|
@ -33,7 +33,7 @@ export function saveTokens(tokens: AuthData | null) {
|
|||
if (tokenCache.writeEnabled) {
|
||||
try {
|
||||
storage.hassTokens = JSON.stringify(tokens);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// write failed, ignore it. Happens if storage is full or private mode.
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export function loadTokens() {
|
|||
} else {
|
||||
tokenCache.tokens = null;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
tokenCache.tokens = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class Storage {
|
|||
this._storage[storageKey] = value;
|
||||
try {
|
||||
window.localStorage.setItem(storageKey, JSON.stringify(value));
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Safari in private mode doesn't allow localstorage
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ const processTheme = (
|
|||
const prefixedRgbKey = `--${rgbKey}`;
|
||||
styles[prefixedRgbKey] = rgbValue;
|
||||
keys[prefixedRgbKey] = "";
|
||||
} catch (e) {
|
||||
} catch (err: any) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ export const mainWindow =
|
|||
? window
|
||||
: parent.name === MAIN_WINDOW_NAME
|
||||
? parent
|
||||
: top;
|
||||
: top!;
|
||||
|
|
|
@ -51,10 +51,10 @@ export const formatNumber = (
|
|||
locale,
|
||||
getDefaultFormatOptions(num, options)
|
||||
).format(Number(num));
|
||||
} catch (error) {
|
||||
} catch (err: any) {
|
||||
// Don't fail when using "TEST" language
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
console.error(err);
|
||||
return new Intl.NumberFormat(
|
||||
undefined,
|
||||
getDefaultFormatOptions(num, options)
|
||||
|
|
|
@ -108,7 +108,7 @@ export const computeLocalize = async (
|
|||
language,
|
||||
formats
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return "Translation error: " + err.message;
|
||||
}
|
||||
cache._localizationCache[messageKey] = translatedMessage;
|
||||
|
@ -125,7 +125,7 @@ export const computeLocalize = async (
|
|||
|
||||
try {
|
||||
return translatedMessage.format<string>(argObject) as string;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return "Translation " + err;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function parseAspectRatio(input: string) {
|
|||
return arr.length === 1
|
||||
? { w: parseOrThrow(arr[0]), h: 1 }
|
||||
: { w: parseOrThrow(arr[0]), h: parseOrThrow(arr[1]) };
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Ignore the error
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -50,7 +50,7 @@ class HaCallApiButton extends LitElement {
|
|||
this._progressButton.actionSuccess();
|
||||
eventData.success = true;
|
||||
eventData.response = resp;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this.progress = false;
|
||||
this._progressButton.actionError();
|
||||
eventData.success = false;
|
||||
|
|
|
@ -50,6 +50,7 @@ interface AreaDevices {
|
|||
devices: string[];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<AreaDevices> = (item) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
|
|
@ -46,6 +46,7 @@ export type HaDevicePickerDeviceFilterFunc = (
|
|||
device: DeviceRegistryEntry
|
||||
) => boolean;
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<Device> = (item) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
|
|
@ -23,6 +23,7 @@ import "./state-badge";
|
|||
|
||||
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
|
|
@ -26,6 +26,7 @@ import "./state-badge";
|
|||
|
||||
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<HassEntity> = (item) => html`<style>
|
||||
paper-icon-item {
|
||||
padding: 0;
|
||||
|
|
|
@ -57,11 +57,11 @@ export class HaStateLabelBadge extends LitElement {
|
|||
return html`
|
||||
<ha-label-badge
|
||||
class="warning"
|
||||
label="${this.hass!.localize("state_badge.default.error")}"
|
||||
label=${this.hass!.localize("state_badge.default.error")}
|
||||
icon="hass:alert"
|
||||
description="${this.hass!.localize(
|
||||
description=${this.hass!.localize(
|
||||
"state_badge.default.entity_not_found"
|
||||
)}"
|
||||
)}
|
||||
></ha-label-badge>
|
||||
`;
|
||||
}
|
||||
|
@ -70,27 +70,25 @@ export class HaStateLabelBadge extends LitElement {
|
|||
|
||||
return html`
|
||||
<ha-label-badge
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
[domain]: true,
|
||||
"has-unit_of_measurement":
|
||||
"unit_of_measurement" in entityState.attributes,
|
||||
})}"
|
||||
.value="${this._computeValue(domain, entityState)}"
|
||||
.icon="${this.icon
|
||||
? this.icon
|
||||
: this._computeIcon(domain, entityState)}"
|
||||
.image="${this.icon
|
||||
})}
|
||||
.value=${this._computeValue(domain, entityState)}
|
||||
.icon=${this.icon ? this.icon : this._computeIcon(domain, entityState)}
|
||||
.image=${this.icon
|
||||
? ""
|
||||
: this.image
|
||||
? this.image
|
||||
: entityState.attributes.entity_picture_local ||
|
||||
entityState.attributes.entity_picture}"
|
||||
.label="${this._computeLabel(
|
||||
entityState.attributes.entity_picture}
|
||||
.label=${this._computeLabel(
|
||||
domain,
|
||||
entityState,
|
||||
this._timerTimeRemaining
|
||||
)}"
|
||||
.description="${this.name ? this.name : computeStateName(entityState)}"
|
||||
)}
|
||||
.description=${this.name ? this.name : computeStateName(entityState)}
|
||||
></ha-label-badge>
|
||||
`;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ export class HaStatisticPicker extends LitElement {
|
|||
id: string;
|
||||
name: string;
|
||||
state?: HassEntity;
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
}> = (item) => html`<style>
|
||||
paper-icon-item {
|
||||
padding: 0;
|
||||
|
@ -110,7 +111,7 @@ export class HaStatisticPicker extends LitElement {
|
|||
? html`<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href="${documentationUrl(this.hass, "/more-info/statistics/")}"
|
||||
href=${documentationUrl(this.hass, "/more-info/statistics/")}
|
||||
>${this.hass.localize(
|
||||
"ui.components.statistic-picker.learn_more"
|
||||
)}</a
|
||||
|
|
|
@ -12,6 +12,7 @@ import { PolymerChangedEvent } from "../polymer-types";
|
|||
import { HomeAssistant } from "../types";
|
||||
import { HaComboBox } from "./ha-combo-box";
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (item) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
@ -109,7 +110,7 @@ class HaAddonPicker extends LitElement {
|
|||
),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.componencts.addon-picker.error.fetch_addons.title"
|
||||
|
|
|
@ -46,6 +46,7 @@ import "./ha-svg-icon";
|
|||
|
||||
const rowRenderer: ComboBoxLitRenderer<AreaRegistryEntry> = (
|
||||
item
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
@ -435,7 +436,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
|
|||
});
|
||||
this._areas = [...this._areas!, area];
|
||||
this._setValue(area.area_id);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
text: this.hass.localize(
|
||||
"ui.components.area-picker.add_dialog.failed_create_area"
|
||||
|
|
|
@ -117,7 +117,7 @@ class HaCameraStream extends LitElement {
|
|||
);
|
||||
|
||||
this._url = url;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Fails if we were unable to get a stream
|
||||
// eslint-disable-next-line
|
||||
console.error(err);
|
||||
|
|
|
@ -13,6 +13,7 @@ import { PolymerChangedEvent } from "../polymer-types";
|
|||
import { HomeAssistant } from "../types";
|
||||
import "./ha-svg-icon";
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const defaultRowRenderer: ComboBoxLitRenderer<string> = (item) => html`<style>
|
||||
paper-item {
|
||||
margin: -5px -10px;
|
||||
|
|
|
@ -26,10 +26,10 @@ class HaLabelBadge extends LitElement {
|
|||
<div class="badge-container">
|
||||
<div class="label-badge" id="badge">
|
||||
<div
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
value: true,
|
||||
big: Boolean(this.value && this.value.length > 4),
|
||||
})}"
|
||||
})}
|
||||
>
|
||||
<slot>
|
||||
${this.icon && !this.value && !this.image
|
||||
|
@ -43,10 +43,10 @@ class HaLabelBadge extends LitElement {
|
|||
${this.label
|
||||
? html`
|
||||
<div
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
label: true,
|
||||
big: this.label.length > 5,
|
||||
})}"
|
||||
})}
|
||||
>
|
||||
<span>${this.label}</span>
|
||||
</div>
|
||||
|
|
|
@ -38,9 +38,8 @@ class HaMarkdownElement extends ReactiveElement {
|
|||
|
||||
const walker = document.createTreeWalker(
|
||||
this,
|
||||
1 /* SHOW_ELEMENT */,
|
||||
null,
|
||||
false
|
||||
NodeFilter.SHOW_ELEMENT,
|
||||
null
|
||||
);
|
||||
|
||||
while (walker.nextNode()) {
|
||||
|
|
|
@ -89,7 +89,7 @@ export class HaPictureUpload extends LitElement {
|
|||
const media = await createImage(this.hass, file);
|
||||
this.value = generateImageThumbnailUrl(media.id, this.size);
|
||||
fireEvent(this, "change");
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
text: err.toString(),
|
||||
});
|
||||
|
|
|
@ -162,7 +162,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
<li>
|
||||
<button
|
||||
@click=${this._openMoreInfo}
|
||||
.entityId="${entityId}"
|
||||
.entityId=${entityId}
|
||||
class="link"
|
||||
>
|
||||
${entity.attributes.friendly_name || entityId}
|
||||
|
@ -187,7 +187,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
<button
|
||||
class="link"
|
||||
@click=${this._openMoreInfo}
|
||||
.entityId="${groupId}"
|
||||
.entityId=${groupId}
|
||||
>
|
||||
${group.attributes.friendly_name || group.entity_id}
|
||||
</button>
|
||||
|
@ -212,7 +212,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
<button
|
||||
class="link"
|
||||
@click=${this._openMoreInfo}
|
||||
.entityId="${sceneId}"
|
||||
.entityId=${sceneId}
|
||||
>
|
||||
${scene.attributes.friendly_name || scene.entity_id}
|
||||
</button>
|
||||
|
@ -239,7 +239,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
<button
|
||||
class="link"
|
||||
@click=${this._openMoreInfo}
|
||||
.entityId="${automationId}"
|
||||
.entityId=${automationId}
|
||||
>
|
||||
${automation.attributes.friendly_name ||
|
||||
automation.entity_id}
|
||||
|
@ -267,7 +267,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
|
|||
<button
|
||||
class="link"
|
||||
@click=${this._openMoreInfo}
|
||||
.entityId="${scriptId}"
|
||||
.entityId=${scriptId}
|
||||
>
|
||||
${script.attributes.friendly_name || script.entity_id}
|
||||
</button>
|
||||
|
|
|
@ -197,10 +197,10 @@ export class HaServiceControl extends LitElement {
|
|||
<p>${serviceData?.description}</p>
|
||||
${this._manifest
|
||||
? html` <a
|
||||
href="${this._manifest.documentation}"
|
||||
title="${this.hass.localize(
|
||||
href=${this._manifest.documentation}
|
||||
title=${this.hass.localize(
|
||||
"ui.components.service-control.integration_doc"
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
@ -406,7 +406,7 @@ export class HaServiceControl extends LitElement {
|
|||
this._manifest = undefined;
|
||||
try {
|
||||
this._manifest = await fetchIntegrationManifest(this.hass, integration);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Ignore if loading manifest fails. Probably bad JSON in manifest
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import "./ha-combo-box";
|
|||
|
||||
const rowRenderer: ComboBoxLitRenderer<{ service: string; name: string }> = (
|
||||
item
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
) => html`<style>
|
||||
paper-item {
|
||||
padding: 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ export class HaYamlEditor extends LitElement {
|
|||
value && !isEmpty(value)
|
||||
? dump(value, { schema: this.yamlSchema })
|
||||
: "";
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err, value);
|
||||
alert(`There was an error converting to YAML: ${err}`);
|
||||
|
@ -73,7 +73,7 @@ export class HaYamlEditor extends LitElement {
|
|||
if (this._yaml) {
|
||||
try {
|
||||
parsed = load(this._yaml, { schema: this.yamlSchema });
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Invalid YAML
|
||||
isValid = false;
|
||||
}
|
||||
|
|
|
@ -375,10 +375,10 @@ export class HaMediaPlayerBrowse extends LitElement {
|
|||
"ui.components.media-browser.learn_adding_local_media",
|
||||
"documentation",
|
||||
html`<a
|
||||
href="${documentationUrl(
|
||||
href=${documentationUrl(
|
||||
this.hass,
|
||||
"/more-info/local-media/add-media"
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>${this.hass.localize(
|
||||
|
@ -510,7 +510,7 @@ export class HaMediaPlayerBrowse extends LitElement {
|
|||
item.media_content_id,
|
||||
item.media_content_type
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.components.media-browser.media_browsing_error"
|
||||
|
@ -591,10 +591,10 @@ export class HaMediaPlayerBrowse extends LitElement {
|
|||
"ui.components.media-browser.setup_local_help",
|
||||
"documentation",
|
||||
html`<a
|
||||
href="${documentationUrl(
|
||||
href=${documentationUrl(
|
||||
this.hass,
|
||||
"/more-info/local-media/setup-media"
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>${this.hass.localize(
|
||||
|
|
|
@ -88,7 +88,7 @@ export class HatGraphBranch extends LitElement {
|
|||
`
|
||||
: ""}
|
||||
<div id="branches">
|
||||
<svg id="lines" width="${this._totalWidth}" height="${this._maxHeight}">
|
||||
<svg id="lines" width=${this._totalWidth} height=${this._maxHeight}>
|
||||
${this._branches.map((branch) => {
|
||||
if (branch.end) return "";
|
||||
return svg`
|
||||
|
|
|
@ -453,7 +453,7 @@ export class HatScriptGraph extends LitElement {
|
|||
</mwc-icon-button>
|
||||
</div>
|
||||
`;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (__DEV__) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Error creating script graph:", err);
|
||||
|
|
|
@ -239,7 +239,7 @@ class ActionRenderer {
|
|||
let data;
|
||||
try {
|
||||
data = getDataFromPath(this.trace.config, path);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._renderEntry(
|
||||
path,
|
||||
`Unable to extract path ${path}. Download trace and report as bug`
|
||||
|
|
|
@ -136,7 +136,7 @@ export const getRecentWithCache = (
|
|||
),
|
||||
]);
|
||||
fetchedHistory = results[1];
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
delete stateHistoryCache[cacheKey];
|
||||
throw err;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ export const getOptimisticCollection = <StateType>(
|
|||
|
||||
try {
|
||||
return await saveCollection(conn, data);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (store) {
|
||||
store.setState(current as any, true);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ export const getLogbookDataCache = async (
|
|||
DATA_CACHE[cacheKey] = {};
|
||||
}
|
||||
|
||||
if (DATA_CACHE[cacheKey][entityId]) {
|
||||
if (entityId in DATA_CACHE[cacheKey]) {
|
||||
return DATA_CACHE[cacheKey][entityId];
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||
</mwc-button>
|
||||
<mwc-button
|
||||
slot="primaryAction"
|
||||
@click="${this._updateEntry}"
|
||||
@click=${this._updateEntry}
|
||||
.disabled=${this._submitting}
|
||||
>
|
||||
${this.hass.localize("ui.dialogs.config_entry_system_options.update")}
|
||||
|
@ -171,7 +171,7 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||
}
|
||||
this._params!.entryUpdated(result.config_entry);
|
||||
this.closeDialog();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = err.message || "Unknown error";
|
||||
} finally {
|
||||
this._submitting = false;
|
||||
|
|
|
@ -115,7 +115,7 @@ class DataEntryFlowDialog extends LitElement {
|
|||
this.hass,
|
||||
params.continueFlowId
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
showAlertDialog(this, {
|
||||
|
@ -370,7 +370,7 @@ class DataEntryFlowDialog extends LitElement {
|
|||
let step: DataEntryFlowStep;
|
||||
try {
|
||||
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
showAlertDialog(this, {
|
||||
|
|
|
@ -26,7 +26,7 @@ class StepFlowAbort extends LitElement {
|
|||
${this.flowConfig.renderAbortDescription(this.hass, this.step)}
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<mwc-button @click="${this._flowDone}"
|
||||
<mwc-button @click=${this._flowDone}
|
||||
>${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.close"
|
||||
)}</mwc-button
|
||||
|
|
|
@ -65,7 +65,7 @@ class StepFlowCreateEntry extends LitElement {
|
|||
`}
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<mwc-button @click="${this._flowDone}"
|
||||
<mwc-button @click=${this._flowDone}
|
||||
>${localize(
|
||||
"ui.panel.config.integrations.config_flow.finish"
|
||||
)}</mwc-button
|
||||
|
@ -87,7 +87,7 @@ class StepFlowCreateEntry extends LitElement {
|
|||
await updateDeviceRegistryEntry(this.hass, device, {
|
||||
area_id: area,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
text: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.error_saving_area",
|
||||
|
|
|
@ -159,7 +159,7 @@ class StepFlowForm extends LitElement {
|
|||
fireEvent(this, "flow-update", {
|
||||
step,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._errorMsg =
|
||||
(err && err.body && err.body.message) || "Unknown error occurred";
|
||||
} finally {
|
||||
|
|
|
@ -118,12 +118,12 @@ class StepFlowPickHandler extends LitElement {
|
|||
${this.hass.localize(
|
||||
"ui.panel.config.integrations.note_about_website_reference"
|
||||
)}<a
|
||||
href="${documentationUrl(
|
||||
href=${documentationUrl(
|
||||
this.hass,
|
||||
`/integrations/${
|
||||
this._filter ? `#search/${this._filter}` : ""
|
||||
}`
|
||||
)}"
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>${this.hass.localize(
|
||||
|
|
|
@ -84,7 +84,7 @@ export const showDialog = async (
|
|||
{ dialog: dialogTag, dialogParams: dialogParams, open: true },
|
||||
""
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// dialogParams could not be cloned, probably contains callback
|
||||
mainWindow.history.pushState(
|
||||
{ dialog: dialogTag, dialogParams: null, open: true },
|
||||
|
|
|
@ -106,7 +106,7 @@ class MoreInfoCamera extends LitElement {
|
|||
preload_stream: checkbox.checked!,
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert(err.message);
|
||||
checkbox.checked = !checkbox.checked;
|
||||
}
|
||||
|
|
|
@ -21,21 +21,21 @@ class MoreInfoCounter extends LitElement {
|
|||
return html`
|
||||
<div class="actions">
|
||||
<mwc-button
|
||||
.action="${"increment"}"
|
||||
.action=${"increment"}
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
${this.hass!.localize("ui.card.counter.actions.increment")}
|
||||
</mwc-button>
|
||||
<mwc-button
|
||||
.action="${"decrement"}"
|
||||
.action=${"decrement"}
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
${this.hass!.localize("ui.card.counter.actions.decrement")}
|
||||
</mwc-button>
|
||||
<mwc-button
|
||||
.action="${"reset"}"
|
||||
.action=${"reset"}
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
|
|
|
@ -27,26 +27,17 @@ class MoreInfoTimer extends LitElement {
|
|||
: ""}
|
||||
${this.stateObj.state === "active"
|
||||
? html`
|
||||
<mwc-button
|
||||
.action=${"pause"}
|
||||
@click="${this._handleActionClick}"
|
||||
>
|
||||
<mwc-button .action=${"pause"} @click=${this._handleActionClick}>
|
||||
${this.hass!.localize("ui.card.timer.actions.pause")}
|
||||
</mwc-button>
|
||||
`
|
||||
: ""}
|
||||
${this.stateObj.state === "active" || this.stateObj.state === "paused"
|
||||
? html`
|
||||
<mwc-button
|
||||
.action=${"cancel"}
|
||||
@click="${this._handleActionClick}"
|
||||
>
|
||||
<mwc-button .action=${"cancel"} @click=${this._handleActionClick}>
|
||||
${this.hass!.localize("ui.card.timer.actions.cancel")}
|
||||
</mwc-button>
|
||||
<mwc-button
|
||||
.action=${"finish"}
|
||||
@click="${this._handleActionClick}"
|
||||
>
|
||||
<mwc-button .action=${"finish"} @click=${this._handleActionClick}>
|
||||
${this.hass!.localize("ui.card.timer.actions.finish")}
|
||||
</mwc-button>
|
||||
`
|
||||
|
|
|
@ -175,7 +175,7 @@ class MoreInfoWeather extends LitElement {
|
|||
${item.condition
|
||||
? html`
|
||||
<ha-svg-icon
|
||||
.path="${weatherIcons[item.condition]}"
|
||||
.path=${weatherIcons[item.condition]}
|
||||
></ha-svg-icon>
|
||||
`
|
||||
: ""}
|
||||
|
|
|
@ -141,7 +141,7 @@ export class MoreInfoLogbook extends LitElement {
|
|||
this.hass.user?.is_admin ? loadTraceContexts(this.hass) : {},
|
||||
this._fetchUserPromise,
|
||||
]);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = err.message;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export class HuiConfiguratorNotificationItem extends LitElement {
|
|||
)}
|
||||
</div>
|
||||
|
||||
<mwc-button slot="actions" @click="${this._handleClick}"
|
||||
<mwc-button slot="actions" @click=${this._handleClick}
|
||||
>${computeStateDisplay(
|
||||
this.hass.localize,
|
||||
this.notification,
|
||||
|
|
|
@ -29,13 +29,13 @@ export class HuiNotificationItem extends LitElement {
|
|||
? html`
|
||||
<configurator-notification-item
|
||||
.hass=${this.hass}
|
||||
.notification="${this.notification}"
|
||||
.notification=${this.notification}
|
||||
></configurator-notification-item>
|
||||
`
|
||||
: html`
|
||||
<persistent-notification-item
|
||||
.hass=${this.hass}
|
||||
.notification="${this.notification}"
|
||||
.notification=${this.notification}
|
||||
></persistent-notification-item>
|
||||
`;
|
||||
}
|
||||
|
|
|
@ -24,16 +24,13 @@ export class HuiPersistentNotificationItem extends LitElement {
|
|||
<notification-item-template>
|
||||
<span slot="header"> ${this.notification.title} </span>
|
||||
|
||||
<ha-markdown
|
||||
breaks
|
||||
content="${this.notification.message}"
|
||||
></ha-markdown>
|
||||
<ha-markdown breaks content=${this.notification.message}></ha-markdown>
|
||||
|
||||
<div class="time">
|
||||
<span>
|
||||
<ha-relative-time
|
||||
.hass=${this.hass}
|
||||
.datetime="${this.notification.created_at}"
|
||||
.datetime=${this.notification.created_at}
|
||||
></ha-relative-time>
|
||||
<paper-tooltip animation-delay="0">
|
||||
${this._computeTooltip(this.hass, this.notification)}
|
||||
|
@ -41,7 +38,7 @@ export class HuiPersistentNotificationItem extends LitElement {
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<mwc-button slot="actions" @click="${this._handleDismiss}"
|
||||
<mwc-button slot="actions" @click=${this._handleDismiss}
|
||||
>${this.hass.localize(
|
||||
"ui.card.persistent_notification.dismiss"
|
||||
)}</mwc-button
|
||||
|
|
|
@ -271,7 +271,7 @@ export class QuickBar extends LitElement {
|
|||
>
|
||||
<span>
|
||||
<ha-chip
|
||||
.label="${item.categoryText}"
|
||||
.label=${item.categoryText}
|
||||
hasIcon
|
||||
class="command-category ${item.categoryKey}"
|
||||
>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable lit/prefer-static-styles */
|
||||
import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
|
||||
import type { PaperDialogScrollableElement } from "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
|
||||
import "@polymer/paper-input/paper-input";
|
||||
|
@ -114,7 +115,7 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||
<div class="side-by-side" @click=${this._completeOnboarding}>
|
||||
<a
|
||||
class="button"
|
||||
href="${this._agentInfo.onboarding.url}"
|
||||
href=${this._agentInfo.onboarding.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
><mwc-button unelevated
|
||||
|
@ -138,7 +139,7 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||
>
|
||||
${this._conversation.map(
|
||||
(message) => html`
|
||||
<div class="${this._computeMessageClasses(message)}">
|
||||
<div class=${this._computeMessageClasses(message)}>
|
||||
${message.text}
|
||||
</div>
|
||||
`
|
||||
|
@ -159,11 +160,11 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||
<div class="input">
|
||||
<paper-input
|
||||
@keyup=${this._handleKeyUp}
|
||||
.label="${this.hass.localize(
|
||||
.label=${this.hass.localize(
|
||||
`ui.dialogs.voice_command.${
|
||||
SpeechRecognition ? "label_voice" : "label"
|
||||
}`
|
||||
)}"
|
||||
)}
|
||||
autofocus
|
||||
>
|
||||
${SpeechRecognition
|
||||
|
|
|
@ -68,7 +68,7 @@ const connProm = async (auth) => {
|
|||
}
|
||||
|
||||
return { auth, conn };
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (err !== ERR_INVALID_AUTH) {
|
||||
throw err;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ export class ExternalAuth extends Auth {
|
|||
try {
|
||||
await this._tokenCallbackPromise;
|
||||
return;
|
||||
} catch (e) {
|
||||
} catch (err: any) {
|
||||
// _tokenCallbackPromise is in a rejected state
|
||||
// Clear the _tokenCallbackPromise and go on refreshing access token
|
||||
this._tokenCallbackPromise = undefined;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-plugin-disable lit */
|
||||
/**
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
|
|
|
@ -169,7 +169,7 @@ export class HaTabsSubpageDataTable extends LitElement {
|
|||
? html`<div class="active-filters">
|
||||
${this.narrow
|
||||
? html`<div>
|
||||
<ha-svg-icon .path="${mdiFilterVariant}"></ha-svg-icon>
|
||||
<ha-svg-icon .path=${mdiFilterVariant}></ha-svg-icon>
|
||||
<paper-tooltip animation-delay="0" position="left">
|
||||
${filterInfo}
|
||||
</paper-tooltip>
|
||||
|
|
|
@ -178,7 +178,7 @@ class HassTabsSubpage extends LitElement {
|
|||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div id="fab" class="${classMap({ tabs: showTabs })}">
|
||||
<div id="fab" class=${classMap({ tabs: showTabs })}>
|
||||
<slot name="fab"></slot>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable lit/prefer-static-styles */
|
||||
import "@polymer/app-layout/app-drawer-layout/app-drawer-layout";
|
||||
import type { AppDrawerLayoutElement } from "@polymer/app-layout/app-drawer-layout/app-drawer-layout";
|
||||
import "@polymer/app-layout/app-drawer/app-drawer";
|
||||
|
|
|
@ -145,10 +145,12 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||
if (registration) {
|
||||
registration.update();
|
||||
} else {
|
||||
// @ts-ignore Firefox supports forceGet
|
||||
location.reload(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// @ts-ignore Firefox supports forceGet
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||
const { auth, conn } = result;
|
||||
this._haVersion = conn.haVersion;
|
||||
this.initializeHass(auth, conn);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||
// Only load if we have supervisor
|
||||
import("./onboarding-restore-backup");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
"Something went wrong loading onboarding-restore-backup",
|
||||
|
@ -220,7 +220,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||
}
|
||||
|
||||
this._steps = steps;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert("Something went wrong loading onboarding, try refreshing");
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||
authCode: result.auth_code,
|
||||
});
|
||||
await this._connectHass(auth);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert("Ah snap, something went wrong!");
|
||||
location.reload();
|
||||
} finally {
|
||||
|
@ -275,7 +275,7 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
|||
client_id: authParams.client_id!,
|
||||
redirect_uri: authParams.redirect_uri!,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this.hass!.connection.close();
|
||||
await this.hass!.auth.revoke();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class OnboardingAnalytics extends LitElement {
|
|||
fireEvent(this, "onboarding-step", {
|
||||
type: "analytics",
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert(`Failed to save: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ class OnboardingCoreConfig extends LitElement {
|
|||
if (values.currency) {
|
||||
this._currency = values.currency;
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
alert(`Failed to detect location information: ${err.message}`);
|
||||
} finally {
|
||||
this._working = false;
|
||||
|
@ -333,7 +333,7 @@ class OnboardingCoreConfig extends LitElement {
|
|||
type: "core_config",
|
||||
result,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._working = false;
|
||||
alert(`Failed to save: ${err.message}`);
|
||||
}
|
||||
|
|
|
@ -58,49 +58,49 @@ class OnboardingCreateUser extends LitElement {
|
|||
<form>
|
||||
<paper-input
|
||||
name="name"
|
||||
label="${this.localize("ui.panel.page-onboarding.user.data.name")}"
|
||||
label=${this.localize("ui.panel.page-onboarding.user.data.name")}
|
||||
.value=${this._name}
|
||||
@value-changed=${this._handleValueChanged}
|
||||
required
|
||||
auto-validate
|
||||
autocapitalize='on'
|
||||
.errorMessage="${this.localize(
|
||||
.errorMessage=${this.localize(
|
||||
"ui.panel.page-onboarding.user.required_field"
|
||||
)}"
|
||||
)}
|
||||
@blur=${this._maybePopulateUsername}
|
||||
></paper-input>
|
||||
|
||||
<paper-input
|
||||
name="username"
|
||||
label="${this.localize("ui.panel.page-onboarding.user.data.username")}"
|
||||
label=${this.localize("ui.panel.page-onboarding.user.data.username")}
|
||||
value=${this._username}
|
||||
@value-changed=${this._handleValueChanged}
|
||||
required
|
||||
auto-validate
|
||||
autocapitalize='none'
|
||||
.errorMessage="${this.localize(
|
||||
.errorMessage=${this.localize(
|
||||
"ui.panel.page-onboarding.user.required_field"
|
||||
)}"
|
||||
)}
|
||||
></paper-input>
|
||||
|
||||
<paper-input
|
||||
name="password"
|
||||
label="${this.localize("ui.panel.page-onboarding.user.data.password")}"
|
||||
label=${this.localize("ui.panel.page-onboarding.user.data.password")}
|
||||
value=${this._password}
|
||||
@value-changed=${this._handleValueChanged}
|
||||
required
|
||||
type='password'
|
||||
auto-validate
|
||||
.errorMessage="${this.localize(
|
||||
.errorMessage=${this.localize(
|
||||
"ui.panel.page-onboarding.user.required_field"
|
||||
)}"
|
||||
)}
|
||||
></paper-input>
|
||||
|
||||
<paper-input
|
||||
name="passwordConfirm"
|
||||
label="${this.localize(
|
||||
label=${this.localize(
|
||||
"ui.panel.page-onboarding.user.data.password_confirm"
|
||||
)}"
|
||||
)}
|
||||
value=${this._passwordConfirm}
|
||||
@value-changed=${this._handleValueChanged}
|
||||
required
|
||||
|
@ -110,9 +110,9 @@ class OnboardingCreateUser extends LitElement {
|
|||
this._passwordConfirm !== "" &&
|
||||
this._passwordConfirm !== this._password
|
||||
}
|
||||
.errorMessage="${this.localize(
|
||||
.errorMessage=${this.localize(
|
||||
"ui.panel.page-onboarding.user.error.password_not_match"
|
||||
)}"
|
||||
)}
|
||||
></paper-input>
|
||||
|
||||
<p class="action">
|
||||
|
@ -189,7 +189,7 @@ class OnboardingCreateUser extends LitElement {
|
|||
type: "user",
|
||||
result,
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// eslint-disable-next-line
|
||||
console.error(err);
|
||||
this._loading = false;
|
||||
|
|
|
@ -62,7 +62,7 @@ class OnboardingRestoreBackup extends ProvideHassLitMixin(LitElement) {
|
|||
if (this.restoring) {
|
||||
try {
|
||||
await fetchInstallationType();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if ((err as Error).message === "unauthorized") {
|
||||
window.location.replace("/");
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class DialogAreaDetail extends LitElement {
|
|||
<mwc-button
|
||||
slot="secondaryAction"
|
||||
class="warning"
|
||||
@click="${this._deleteEntry}"
|
||||
@click=${this._deleteEntry}
|
||||
.disabled=${this._submitting}
|
||||
>
|
||||
${this.hass.localize("ui.panel.config.areas.editor.delete")}
|
||||
|
@ -92,7 +92,7 @@ class DialogAreaDetail extends LitElement {
|
|||
: html``}
|
||||
<mwc-button
|
||||
slot="primaryAction"
|
||||
@click="${this._updateEntry}"
|
||||
@click=${this._updateEntry}
|
||||
.disabled=${nameInvalid || this._submitting}
|
||||
>
|
||||
${entry
|
||||
|
@ -130,7 +130,7 @@ class DialogAreaDetail extends LitElement {
|
|||
await this._params!.createEntry!(values);
|
||||
}
|
||||
this._params = undefined;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
this._error =
|
||||
err.message ||
|
||||
this.hass.localize("ui.panel.config.areas.editor.unknown_error");
|
||||
|
|
|
@ -388,7 +388,7 @@ class HaConfigAreaPage extends LitElement {
|
|||
try {
|
||||
await deleteAreaRegistryEntry(this.hass!, entry!.area_id);
|
||||
return true;
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue