mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-14 03:39:26 +00:00
Compare commits
17 Commits
move-defau
...
20250528.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
46e05f10d1 | ||
![]() |
a1819d6189 | ||
![]() |
48a3e1fd63 | ||
![]() |
139c8b3702 | ||
![]() |
9458946dcc | ||
![]() |
b907dbefad | ||
![]() |
5371fd649c | ||
![]() |
61d9b0d2a3 | ||
![]() |
06270c771f | ||
![]() |
ae49de8e71 | ||
![]() |
6abdeeae20 | ||
![]() |
116716c51d | ||
![]() |
77ee69b64d | ||
![]() |
1a57eeddde | ||
![]() |
9131bf6dfd | ||
![]() |
1611423ca5 | ||
![]() |
de56c3376e |
@@ -1 +1 @@
|
||||
yarn run lint-staged --relative
|
||||
yarn run lint-staged --relative --shell "/bin/bash"
|
||||
|
32
package.json
32
package.json
@@ -26,7 +26,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.27.4",
|
||||
"@babel/runtime": "7.27.1",
|
||||
"@braintree/sanitize-url": "7.1.1",
|
||||
"@codemirror/autocomplete": "6.18.6",
|
||||
"@codemirror/commands": "6.8.1",
|
||||
@@ -34,7 +34,7 @@
|
||||
"@codemirror/legacy-modes": "6.5.1",
|
||||
"@codemirror/search": "6.5.11",
|
||||
"@codemirror/state": "6.5.2",
|
||||
"@codemirror/view": "6.37.1",
|
||||
"@codemirror/view": "6.36.8",
|
||||
"@egjs/hammerjs": "2.0.17",
|
||||
"@formatjs/intl-datetimeformat": "6.18.0",
|
||||
"@formatjs/intl-displaynames": "6.8.11",
|
||||
@@ -111,7 +111,7 @@
|
||||
"fuse.js": "7.1.0",
|
||||
"google-timezones-json": "1.2.0",
|
||||
"gulp-zopfli-green": "6.0.2",
|
||||
"hls.js": "1.6.4",
|
||||
"hls.js": "1.6.2",
|
||||
"home-assistant-js-websocket": "9.5.0",
|
||||
"idb-keyval": "6.2.2",
|
||||
"intl-messageformat": "10.7.16",
|
||||
@@ -149,20 +149,20 @@
|
||||
"xss": "1.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.27.4",
|
||||
"@babel/core": "7.27.1",
|
||||
"@babel/helper-define-polyfill-provider": "0.6.4",
|
||||
"@babel/plugin-transform-runtime": "7.27.4",
|
||||
"@babel/plugin-transform-runtime": "7.27.1",
|
||||
"@babel/preset-env": "7.27.2",
|
||||
"@bundle-stats/plugin-webpack-filter": "4.20.2",
|
||||
"@lokalise/node-api": "14.8.0",
|
||||
"@bundle-stats/plugin-webpack-filter": "4.20.1",
|
||||
"@lokalise/node-api": "14.7.0",
|
||||
"@octokit/auth-oauth-device": "8.0.1",
|
||||
"@octokit/plugin-retry": "8.0.1",
|
||||
"@octokit/rest": "22.0.0",
|
||||
"@octokit/rest": "21.1.1",
|
||||
"@rsdoctor/rspack-plugin": "1.1.2",
|
||||
"@rspack/cli": "1.3.12",
|
||||
"@rspack/core": "1.3.12",
|
||||
"@rspack/cli": "1.3.11",
|
||||
"@rspack/core": "1.3.11",
|
||||
"@types/babel__plugin-transform-runtime": "7.9.5",
|
||||
"@types/chromecast-caf-receiver": "6.0.22",
|
||||
"@types/chromecast-caf-receiver": "6.0.21",
|
||||
"@types/chromecast-caf-sender": "1.0.11",
|
||||
"@types/color-name": "2.0.0",
|
||||
"@types/glob": "8.1.0",
|
||||
@@ -184,7 +184,7 @@
|
||||
"babel-plugin-template-html-minifier": "4.1.0",
|
||||
"browserslist-useragent-regexp": "4.1.3",
|
||||
"del": "8.0.0",
|
||||
"eslint": "9.28.0",
|
||||
"eslint": "9.27.0",
|
||||
"eslint-config-airbnb-base": "15.0.0",
|
||||
"eslint-config-prettier": "10.1.5",
|
||||
"eslint-import-resolver-webpack": "0.13.10",
|
||||
@@ -196,7 +196,7 @@
|
||||
"fancy-log": "2.0.0",
|
||||
"fs-extra": "11.3.0",
|
||||
"glob": "11.0.2",
|
||||
"gulp": "5.0.1",
|
||||
"gulp": "5.0.0",
|
||||
"gulp-brotli": "3.0.0",
|
||||
"gulp-json-transform": "0.5.0",
|
||||
"gulp-rename": "2.0.0",
|
||||
@@ -204,7 +204,7 @@
|
||||
"husky": "9.1.7",
|
||||
"jsdom": "26.1.0",
|
||||
"jszip": "3.10.1",
|
||||
"lint-staged": "16.1.0",
|
||||
"lint-staged": "15.5.2",
|
||||
"lit-analyzer": "2.0.3",
|
||||
"lodash.merge": "4.6.2",
|
||||
"lodash.template": "4.5.0",
|
||||
@@ -218,7 +218,7 @@
|
||||
"terser-webpack-plugin": "5.3.14",
|
||||
"ts-lit-plugin": "2.0.2",
|
||||
"typescript": "5.8.3",
|
||||
"typescript-eslint": "8.33.0",
|
||||
"typescript-eslint": "8.32.1",
|
||||
"vite-tsconfig-paths": "5.1.4",
|
||||
"vitest": "3.1.4",
|
||||
"webpack-stats-plugin": "1.1.3",
|
||||
@@ -232,7 +232,7 @@
|
||||
"clean-css": "5.3.3",
|
||||
"@lit/reactive-element": "2.1.0",
|
||||
"@fullcalendar/daygrid": "6.1.17",
|
||||
"globals": "16.2.0",
|
||||
"globals": "16.1.0",
|
||||
"tslib": "2.8.1",
|
||||
"@material/mwc-list@^0.27.0": "patch:@material/mwc-list@npm%3A0.27.0#~/.yarn/patches/@material-mwc-list-npm-0.27.0-5344fc9de4.patch"
|
||||
},
|
||||
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20250430.0"
|
||||
version = "20250528.0"
|
||||
license = "Apache-2.0"
|
||||
license-files = ["LICENSE*"]
|
||||
description = "The Home Assistant frontend"
|
||||
|
@@ -1,19 +1,9 @@
|
||||
// https://gist.github.com/hagemann/382adfc57adbd5af078dc93feef01fe1
|
||||
export const slugify = (value: string, delimiter = "_") => {
|
||||
const a =
|
||||
"àáâäæãåāăąабçćčđďдèéêëēėęěеёэфğǵгḧхîïíīįìıİийкłлḿмñńǹňнôöòóœøōõőоṕпŕřрßśšşșсťțтûüùúūǘůűųувẃẍÿýыžźżз·";
|
||||
const b = `aaaaaaaaaaabcccdddeeeeeeeeeeefggghhiiiiiiiiijkllmmnnnnnoooooooooopprrrsssssstttuuuuuuuuuuvwxyyyzzzz${delimiter}`;
|
||||
"àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·";
|
||||
const b = `aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz${delimiter}`;
|
||||
const p = new RegExp(a.split("").join("|"), "g");
|
||||
const complex_cyrillic = {
|
||||
ж: "zh",
|
||||
х: "kh",
|
||||
ц: "ts",
|
||||
ч: "ch",
|
||||
ш: "sh",
|
||||
щ: "shch",
|
||||
ю: "iu",
|
||||
я: "ia",
|
||||
};
|
||||
|
||||
let slugified;
|
||||
|
||||
@@ -24,7 +14,6 @@ export const slugify = (value: string, delimiter = "_") => {
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
|
||||
.replace(/[а-я]/g, (c) => complex_cyrillic[c] || "") // Replace some cyrillic characters
|
||||
.replace(/(\d),(?=\d)/g, "$1") // Remove Commas between numbers
|
||||
.replace(/[^a-z0-9]+/g, delimiter) // Replace all non-word characters
|
||||
.replace(new RegExp(`(${delimiter})\\1+`, "g"), "$1") // Replace multiple delimiters with single delimiter
|
||||
|
@@ -494,13 +494,6 @@ export class HaChartBase extends LitElement {
|
||||
smooth: false,
|
||||
},
|
||||
bar: { itemStyle: { barBorderWidth: 1.5 } },
|
||||
graph: {
|
||||
label: {
|
||||
color: style.getPropertyValue("--primary-text-color"),
|
||||
textBorderColor: style.getPropertyValue("--primary-background-color"),
|
||||
textBorderWidth: 2,
|
||||
},
|
||||
},
|
||||
categoryAxis: {
|
||||
axisLine: { show: false },
|
||||
axisTick: { show: false },
|
||||
|
@@ -740,7 +740,6 @@ export class HaDataTable extends LitElement {
|
||||
}, {});
|
||||
const groupedItems: DataTableRowData[] = [];
|
||||
Object.entries(sorted).forEach(([groupName, rows]) => {
|
||||
const collapsed = collapsedGroups.includes(groupName);
|
||||
groupedItems.push({
|
||||
append: true,
|
||||
selectable: false,
|
||||
@@ -752,10 +751,9 @@ export class HaDataTable extends LitElement {
|
||||
>
|
||||
<ha-icon-button
|
||||
.path=${mdiChevronUp}
|
||||
.label=${this.hass.localize(
|
||||
`ui.components.data-table.${collapsed ? "expand" : "collapse"}`
|
||||
)}
|
||||
class=${collapsed ? "collapsed" : ""}
|
||||
class=${collapsedGroups.includes(groupName)
|
||||
? "collapsed"
|
||||
: ""}
|
||||
>
|
||||
</ha-icon-button>
|
||||
${groupName === UNDEFINED_GROUP_KEY
|
||||
|
@@ -72,9 +72,7 @@ export class HaGenericPicker extends LitElement {
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
${this.label
|
||||
? html`<label ?disabled=${this.disabled}>${this.label}</label>`
|
||||
: nothing}
|
||||
${this.label ? html`<label>${this.label}</label>` : nothing}
|
||||
<div class="container">
|
||||
${!this._opened
|
||||
? html`
|
||||
@@ -118,9 +116,7 @@ export class HaGenericPicker extends LitElement {
|
||||
|
||||
private _renderHelper() {
|
||||
return this.helper
|
||||
? html`<ha-input-helper-text .disabled=${this.disabled}
|
||||
>${this.helper}</ha-input-helper-text
|
||||
>`
|
||||
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
|
||||
: nothing;
|
||||
}
|
||||
|
||||
@@ -169,9 +165,6 @@ export class HaGenericPicker extends LitElement {
|
||||
position: relative;
|
||||
display: block;
|
||||
}
|
||||
label[disabled] {
|
||||
color: var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.6));
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
margin: 0 0 8px;
|
||||
|
@@ -1,11 +1,9 @@
|
||||
import type { TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { customElement } from "lit/decorators";
|
||||
|
||||
@customElement("ha-input-helper-text")
|
||||
class InputHelperText extends LitElement {
|
||||
@property({ type: Boolean, reflect: true }) disabled = false;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`<slot></slot>`;
|
||||
}
|
||||
@@ -20,9 +18,6 @@ class InputHelperText extends LitElement {
|
||||
padding-inline-start: 16px;
|
||||
padding-inline-end: 16px;
|
||||
}
|
||||
:host([disabled]) {
|
||||
color: var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.6));
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
|
@@ -85,9 +85,7 @@ class HaMultiTextField extends LitElement {
|
||||
</ha-button>
|
||||
</div>
|
||||
${this.helper
|
||||
? html`<ha-input-helper-text .disabled=${this.disabled}
|
||||
>${this.helper}</ha-input-helper-text
|
||||
>`
|
||||
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
|
||||
: nothing}
|
||||
`;
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ const createPanelNavigationItem = (hass: HomeAssistant, panel: PanelInfo) => ({
|
||||
path: `/${panel.url_path}`,
|
||||
icon: panel.icon ?? "mdi:view-dashboard",
|
||||
title:
|
||||
panel.url_path === hass.sidebar.defaultPanel
|
||||
panel.url_path === hass.defaultPanel
|
||||
? hass.localize("panel.states")
|
||||
: hass.localize(`panel.${panel.title}`) ||
|
||||
panel.title ||
|
||||
|
@@ -88,12 +88,6 @@ export class HaPickerField extends LitElement {
|
||||
static get styles(): CSSResultGroup {
|
||||
return [
|
||||
css`
|
||||
ha-combo-box-item[disabled] {
|
||||
background-color: var(
|
||||
--mdc-text-field-disabled-fill-color,
|
||||
whitesmoke
|
||||
);
|
||||
}
|
||||
ha-combo-box-item {
|
||||
background-color: var(--mdc-text-field-fill-color, whitesmoke);
|
||||
border-radius: 4px;
|
||||
@@ -112,12 +106,6 @@ export class HaPickerField extends LitElement {
|
||||
}
|
||||
|
||||
/* Add Similar focus style as the text field */
|
||||
ha-combo-box-item[disabled]:after {
|
||||
background-color: var(
|
||||
--mdc-text-field-disabled-line-color,
|
||||
rgba(0, 0, 0, 0.42)
|
||||
);
|
||||
}
|
||||
ha-combo-box-item:after {
|
||||
display: block;
|
||||
content: "";
|
||||
|
@@ -50,7 +50,6 @@ import type { HaMdListItem } from "./ha-md-list-item";
|
||||
import "./ha-spinner";
|
||||
import "./ha-svg-icon";
|
||||
import "./user/ha-user-badge";
|
||||
import { DEFAULT_PANEL } from "../data/panel";
|
||||
|
||||
const SHOW_AFTER_SPACER = ["config", "developer-tools"];
|
||||
|
||||
@@ -141,9 +140,9 @@ const defaultPanelSorter = (
|
||||
export const computePanels = memoizeOne(
|
||||
(
|
||||
panels: HomeAssistant["panels"],
|
||||
defaultPanel: HomeAssistant["sidebar"]["defaultPanel"],
|
||||
panelsOrder: HomeAssistant["sidebar"]["panelOrder"],
|
||||
hiddenPanels: HomeAssistant["sidebar"]["hiddenPanels"],
|
||||
defaultPanel: HomeAssistant["defaultPanel"],
|
||||
panelsOrder: string[],
|
||||
hiddenPanels: string[],
|
||||
locale: HomeAssistant["locale"]
|
||||
): [PanelInfo[], PanelInfo[]] => {
|
||||
if (!panels) {
|
||||
@@ -196,6 +195,10 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
|
||||
@state() private _issuesCount = 0;
|
||||
|
||||
@state() private _panelOrder?: string[];
|
||||
|
||||
@state() private _hiddenPanels?: string[];
|
||||
|
||||
private _mouseLeaveTimeout?: number;
|
||||
|
||||
private _tooltipHideTimeout?: number;
|
||||
@@ -210,32 +213,18 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
this.hass.connection,
|
||||
"sidebar",
|
||||
({ value }) => {
|
||||
let panelOrder = value?.panelOrder;
|
||||
let hiddenPanels = value?.hiddenPanels;
|
||||
let defaultPanel = value?.defaultPanel;
|
||||
this._panelOrder = value?.panelOrder;
|
||||
this._hiddenPanels = value?.hiddenPanels;
|
||||
|
||||
// fallback to old localStorage values
|
||||
if (!panelOrder) {
|
||||
if (!this._panelOrder) {
|
||||
const storedOrder = localStorage.getItem("sidebarPanelOrder");
|
||||
panelOrder = storedOrder ? JSON.parse(storedOrder) : [];
|
||||
this._panelOrder = storedOrder ? JSON.parse(storedOrder) : [];
|
||||
}
|
||||
if (!hiddenPanels) {
|
||||
if (!this._hiddenPanels) {
|
||||
const storedHidden = localStorage.getItem("sidebarHiddenPanels");
|
||||
hiddenPanels = storedHidden ? JSON.parse(storedHidden) : [];
|
||||
this._hiddenPanels = storedHidden ? JSON.parse(storedHidden) : [];
|
||||
}
|
||||
if (!defaultPanel) {
|
||||
const storedDefault = localStorage.getItem("defaultPanel");
|
||||
defaultPanel = storedDefault
|
||||
? JSON.parse(storedDefault)
|
||||
: DEFAULT_PANEL;
|
||||
}
|
||||
|
||||
fireEvent(this, "hass-set-sidebar-data", {
|
||||
...value,
|
||||
defaultPanel: defaultPanel as string,
|
||||
panelOrder: panelOrder as string[],
|
||||
hiddenPanels: hiddenPanels as string[],
|
||||
});
|
||||
}
|
||||
),
|
||||
subscribeNotifications(this.hass.connection, (notifications) => {
|
||||
@@ -286,8 +275,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
changedProps.has("_updatesCount") ||
|
||||
changedProps.has("_issuesCount") ||
|
||||
changedProps.has("_notifications") ||
|
||||
(changedProps.has("hass") &&
|
||||
changedProps.get("hass")?.sidebar !== this.hass.sidebar)
|
||||
changedProps.has("_hiddenPanels") ||
|
||||
changedProps.has("_panelOrder")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -306,7 +295,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
hass.localize !== oldHass.localize ||
|
||||
hass.locale !== oldHass.locale ||
|
||||
hass.states !== oldHass.states ||
|
||||
hass.sidebar !== oldHass.sidebar ||
|
||||
hass.defaultPanel !== oldHass.defaultPanel ||
|
||||
hass.connected !== oldHass.connected
|
||||
);
|
||||
}
|
||||
@@ -376,7 +365,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
|
||||
private _renderAllPanels(selectedPanel: string) {
|
||||
if (!this.hass.sidebar.panelOrder || !this.hass.sidebar.hiddenPanels) {
|
||||
if (!this._panelOrder || !this._hiddenPanels) {
|
||||
return html`
|
||||
<ha-fade-in .delay=${500}
|
||||
><ha-spinner size="small"></ha-spinner
|
||||
@@ -386,9 +375,9 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
|
||||
const [beforeSpacer, afterSpacer] = computePanels(
|
||||
this.hass.panels,
|
||||
this.hass.sidebar.defaultPanel,
|
||||
this.hass.sidebar.panelOrder,
|
||||
this.hass.sidebar.hiddenPanels,
|
||||
this.hass.defaultPanel,
|
||||
this._panelOrder,
|
||||
this._hiddenPanels,
|
||||
this.hass.locale
|
||||
);
|
||||
|
||||
@@ -413,11 +402,11 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
return panels.map((panel) =>
|
||||
this._renderPanel(
|
||||
panel.url_path,
|
||||
panel.url_path === this.hass.sidebar.defaultPanel
|
||||
panel.url_path === this.hass.defaultPanel
|
||||
? panel.title || this.hass.localize("panel.states")
|
||||
: this.hass.localize(`panel.${panel.title}`) || panel.title,
|
||||
panel.icon,
|
||||
panel.url_path === this.hass.sidebar.defaultPanel && !panel.icon
|
||||
panel.url_path === this.hass.defaultPanel && !panel.icon
|
||||
? PANEL_ICONS.lovelace
|
||||
: panel.url_path in PANEL_ICONS
|
||||
? PANEL_ICONS[panel.url_path]
|
||||
@@ -637,15 +626,12 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
this._tooltipHideTimeout = undefined;
|
||||
}
|
||||
const tooltip = this._tooltip;
|
||||
const allListbox = this.shadowRoot!.querySelectorAll("ha-md-list")!;
|
||||
const listbox = [...allListbox].find((lb) => lb.contains(item));
|
||||
|
||||
const top =
|
||||
item.offsetTop +
|
||||
11 +
|
||||
(listbox?.offsetTop ?? 0) -
|
||||
(listbox?.scrollTop ?? 0);
|
||||
|
||||
const listbox = this.shadowRoot!.querySelector("ha-md-list")!;
|
||||
let top = item.offsetTop + 11;
|
||||
if (listbox.contains(item)) {
|
||||
top += listbox.offsetTop;
|
||||
top -= listbox.scrollTop;
|
||||
}
|
||||
tooltip.innerText = (
|
||||
item.querySelector(".item-text") as HTMLElement
|
||||
).innerText;
|
||||
|
@@ -12,8 +12,6 @@ class HaEntityMarker extends LitElement {
|
||||
|
||||
@property({ attribute: "entity-name" }) public entityName?: string;
|
||||
|
||||
@property({ attribute: "entity-unit" }) public entityUnit?: string;
|
||||
|
||||
@property({ attribute: "entity-picture" }) public entityPicture?: string;
|
||||
|
||||
@property({ attribute: "entity-color" }) public entityColor?: string;
|
||||
@@ -39,16 +37,7 @@ class HaEntityMarker extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.stateObj=${this.hass?.states[this.entityId]}
|
||||
></ha-state-icon>`
|
||||
: !this.entityUnit
|
||||
? this.entityName
|
||||
: html`
|
||||
${this.entityName}
|
||||
<span
|
||||
class="unit"
|
||||
style="display: ${this.entityUnit ? "initial" : "none"}"
|
||||
>${this.entityUnit}</span
|
||||
>
|
||||
`}
|
||||
: this.entityName}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -83,9 +72,6 @@ class HaEntityMarker extends LitElement {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.unit {
|
||||
margin-left: 2px;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,6 @@ export interface HaMapEntity {
|
||||
color: string;
|
||||
label_mode?: "name" | "state" | "attribute" | "icon";
|
||||
attribute?: string;
|
||||
unit?: string;
|
||||
name?: string;
|
||||
focus?: boolean;
|
||||
}
|
||||
@@ -550,12 +549,6 @@ export class HaMap extends ReactiveElement {
|
||||
typeof entity !== "string" && entity.label_mode === "icon";
|
||||
entityMarker.entityId = getEntityId(entity);
|
||||
entityMarker.entityName = entityName;
|
||||
entityMarker.entityUnit =
|
||||
typeof entity !== "string" &&
|
||||
entity.unit &&
|
||||
entity.label_mode === "attribute"
|
||||
? entity.unit
|
||||
: "";
|
||||
entityMarker.entityPicture =
|
||||
entityPicture && (typeof entity === "string" || !entity.label_mode)
|
||||
? this.hass.hassUrl(entityPicture)
|
||||
|
@@ -8,7 +8,6 @@ export interface CoreFrontendUserData {
|
||||
export interface SidebarFrontendUserData {
|
||||
panelOrder: string[];
|
||||
hiddenPanels: string[];
|
||||
defaultPanel?: string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import type { HomeAssistant, PanelInfo } from "../types";
|
||||
|
||||
/** Panel to show when no panel is picked. */
|
||||
@@ -9,9 +10,16 @@ export const getStorageDefaultPanelUrlPath = (): string => {
|
||||
return defaultPanel ? JSON.parse(defaultPanel) : DEFAULT_PANEL;
|
||||
};
|
||||
|
||||
export const setDefaultPanel = (
|
||||
element: HTMLElement,
|
||||
urlPath: string
|
||||
): void => {
|
||||
fireEvent(element, "hass-default-panel", { defaultPanel: urlPath });
|
||||
};
|
||||
|
||||
export const getDefaultPanel = (hass: HomeAssistant): PanelInfo =>
|
||||
hass.panels[hass.sidebar.defaultPanel]
|
||||
? hass.panels[hass.sidebar.defaultPanel]
|
||||
hass.panels[hass.defaultPanel]
|
||||
? hass.panels[hass.defaultPanel]
|
||||
: hass.panels[DEFAULT_PANEL];
|
||||
|
||||
export const getPanelNameTranslationKey = (panel: PanelInfo) => {
|
||||
|
@@ -6,7 +6,6 @@ const HAS_CUSTOM_PREVIEW = ["generic_camera", "template"];
|
||||
export interface GenericPreview {
|
||||
state: string;
|
||||
attributes: Record<string, any>;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const subscribePreviewGeneric = (
|
||||
|
@@ -58,11 +58,6 @@ export class FlowPreviewGeneric extends LitElement {
|
||||
}
|
||||
|
||||
private _setPreview = (preview: GenericPreview) => {
|
||||
if (preview.error) {
|
||||
this._error = preview.error;
|
||||
this._preview = undefined;
|
||||
return;
|
||||
}
|
||||
const now = new Date().toISOString();
|
||||
this._preview = {
|
||||
entity_id: `${this.stepId}.___flow_preview___`,
|
||||
@@ -85,7 +80,6 @@ export class FlowPreviewGeneric extends LitElement {
|
||||
if (this.flowType !== "config_flow" && this.flowType !== "options_flow") {
|
||||
return;
|
||||
}
|
||||
this._error = undefined;
|
||||
try {
|
||||
this._unsub = subscribePreviewGeneric(
|
||||
this.hass,
|
||||
@@ -95,7 +89,6 @@ export class FlowPreviewGeneric extends LitElement {
|
||||
this.stepData,
|
||||
this._setPreview
|
||||
);
|
||||
await this._unsub;
|
||||
fireEvent(this, "set-flow-errors", { errors: {} });
|
||||
} catch (err: any) {
|
||||
if (typeof err.message === "string") {
|
||||
|
@@ -235,13 +235,9 @@ class StepFlowCreateEntry extends LitElement {
|
||||
|
||||
fireEvent(this, "flow-update", { step: undefined });
|
||||
if (this.step.result && this.navigateToResult) {
|
||||
if (this.devices.length === 1) {
|
||||
navigate(`/config/devices/device/${this.devices[0].id}`);
|
||||
} else {
|
||||
navigate(
|
||||
`/config/integrations/integration/${this.step.result.domain}#config_entry=${this.step.result.entry_id}`
|
||||
);
|
||||
}
|
||||
navigate(
|
||||
`/config/integrations/integration/${this.step.result.domain}#config_entry=${this.step.result.entry_id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,8 @@ class MoreInfoCamera extends LitElement {
|
||||
<ha-progress-button
|
||||
@click=${this._downloadSnapshot}
|
||||
.progress=${this._waiting}
|
||||
.disabled=${this.stateObj.state === UNAVAILABLE}
|
||||
.disabled=${this.stateObj.state === UNAVAILABLE ||
|
||||
this.stateObj.state === "idle"}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.dialogs.more_info_control.camera.download_snapshot"
|
||||
|
@@ -96,7 +96,7 @@ class DialogEditSidebar extends LitElement {
|
||||
|
||||
const [beforeSpacer, afterSpacer] = computePanels(
|
||||
this.hass.panels,
|
||||
this.hass.sidebar.defaultPanel,
|
||||
this.hass.defaultPanel,
|
||||
this._order,
|
||||
this._hidden,
|
||||
this.hass.locale
|
||||
@@ -109,12 +109,12 @@ class DialogEditSidebar extends LitElement {
|
||||
].map((panel) => ({
|
||||
value: panel.url_path,
|
||||
label:
|
||||
panel.url_path === this.hass.sidebar.defaultPanel
|
||||
panel.url_path === this.hass.defaultPanel
|
||||
? panel.title || this.hass.localize("panel.states")
|
||||
: this.hass.localize(`panel.${panel.title}`) || panel.title || "?",
|
||||
icon: panel.icon || undefined,
|
||||
iconPath:
|
||||
panel.url_path === this.hass.sidebar.defaultPanel && !panel.icon
|
||||
panel.url_path === this.hass.defaultPanel && !panel.icon
|
||||
? PANEL_ICONS.lovelace
|
||||
: panel.url_path in PANEL_ICONS
|
||||
? PANEL_ICONS[panel.url_path]
|
||||
@@ -195,7 +195,6 @@ class DialogEditSidebar extends LitElement {
|
||||
await saveFrontendUserData(this.hass.connection, "sidebar", {
|
||||
panelOrder: this._order!,
|
||||
hiddenPanels: this._hidden!,
|
||||
defaultPanel: this.hass.sidebar.defaultPanel,
|
||||
});
|
||||
} catch (err: any) {
|
||||
this._error = err.message || err;
|
||||
|
@@ -497,9 +497,9 @@ export class HAFullCalendar extends LitElement {
|
||||
|
||||
ha-fab {
|
||||
position: absolute;
|
||||
bottom: 16px;
|
||||
right: 16px;
|
||||
inset-inline-end: 16px;
|
||||
bottom: 32px;
|
||||
right: 32px;
|
||||
inset-inline-end: 32px;
|
||||
inset-inline-start: initial;
|
||||
z-index: 1;
|
||||
}
|
||||
|
@@ -233,8 +233,6 @@ export class CloudLogin extends LitElement {
|
||||
text: this.hass.localize(
|
||||
"ui.panel.config.cloud.login.cloud_pipeline_text"
|
||||
),
|
||||
confirmText: this.hass.localize("ui.common.yes"),
|
||||
dismissText: this.hass.localize("ui.common.no"),
|
||||
})
|
||||
) {
|
||||
setAssistPipelinePreferred(this.hass, result.cloud_pipeline);
|
||||
|
@@ -4,7 +4,6 @@ import {
|
||||
mdiDeleteForever,
|
||||
mdiHospitalBox,
|
||||
mdiInformation,
|
||||
mdiPlus,
|
||||
mdiUpload,
|
||||
mdiWrench,
|
||||
} from "@mdi/js";
|
||||
@@ -14,7 +13,6 @@ import {
|
||||
fetchZwaveIntegrationSettings,
|
||||
fetchZwaveIsAnyOTAFirmwareUpdateInProgress,
|
||||
fetchZwaveIsNodeFirmwareUpdateInProgress,
|
||||
fetchZwaveNetworkStatus,
|
||||
fetchZwaveNodeStatus,
|
||||
} from "../../../../../../data/zwave_js";
|
||||
import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box";
|
||||
@@ -26,7 +24,6 @@ import { showZWaveJSRemoveFailedNodeDialog } from "../../../../integrations/inte
|
||||
import { showZWaveJSUpdateFirmwareNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node";
|
||||
import type { DeviceAction } from "../../../ha-config-device-page";
|
||||
import { showZWaveJSHardResetControllerDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-hard-reset-controller";
|
||||
import { showZWaveJSAddNodeDialog } from "../../../../integrations/integration-panels/zwave_js/add-node/show-dialog-zwave_js-add-node";
|
||||
|
||||
export const getZwaveDeviceActions = async (
|
||||
el: HTMLElement,
|
||||
@@ -163,19 +160,6 @@ export const getZwaveDeviceActions = async (
|
||||
}
|
||||
|
||||
if (nodeStatus.is_controller_node) {
|
||||
const networkStatus = await fetchZwaveNetworkStatus(hass, {
|
||||
entry_id: entryId,
|
||||
});
|
||||
actions.unshift({
|
||||
label: hass.localize("ui.panel.config.zwave_js.common.add_node"),
|
||||
icon: mdiPlus,
|
||||
action: async () => {
|
||||
showZWaveJSAddNodeDialog(el, {
|
||||
entry_id: entryId,
|
||||
longRangeSupported: networkStatus.controller?.supports_long_range,
|
||||
});
|
||||
},
|
||||
});
|
||||
actions.push({
|
||||
label: hass.localize(
|
||||
"ui.panel.config.zwave_js.device_info.hard_reset_controller"
|
||||
|
@@ -163,7 +163,6 @@ export class HaIntegrationCard extends LitElement {
|
||||
: "custom"}"
|
||||
>
|
||||
<ha-tooltip
|
||||
hoist
|
||||
.placement=${computeRTL(this.hass) ? "right" : "left"}
|
||||
.content=${this.hass.localize(
|
||||
this.manifest.overwrites_built_in
|
||||
@@ -178,7 +177,6 @@ export class HaIntegrationCard extends LitElement {
|
||||
${this.manifest && this.manifest.iot_class?.startsWith("cloud_")
|
||||
? html`<div class="icon cloud">
|
||||
<ha-tooltip
|
||||
hoist
|
||||
.placement=${computeRTL(this.hass) ? "right" : "left"}
|
||||
.content=${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_entry.depends_on_cloud"
|
||||
@@ -193,7 +191,6 @@ export class HaIntegrationCard extends LitElement {
|
||||
!this.items.every((itm) => itm.source === "system")
|
||||
? html`<div class="icon yaml">
|
||||
<ha-tooltip
|
||||
hoist
|
||||
.placement=${computeRTL(this.hass) ? "right" : "left"}
|
||||
.content=${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_entry.no_config_flow"
|
||||
|
@@ -133,11 +133,8 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
|
||||
if (ERROR_STATES.includes(this._configEntry.state)) {
|
||||
return this._renderErrorScreen();
|
||||
}
|
||||
const provisioningDevices =
|
||||
this._provisioningEntries?.filter((entry) => !entry.nodeId).length ?? 0;
|
||||
const notReadyDevices =
|
||||
(this._network?.controller.nodes.filter((node) => !node.ready).length ??
|
||||
0) + provisioningDevices;
|
||||
this._network?.controller.nodes.filter((node) => !node.ready).length ?? 0;
|
||||
|
||||
return html`
|
||||
<hass-tabs-subpage
|
||||
@@ -185,9 +182,7 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
|
||||
${this.hass.localize(
|
||||
`ui.panel.config.zwave_js.dashboard.devices`,
|
||||
{
|
||||
count:
|
||||
this._network.controller.nodes.length +
|
||||
provisioningDevices,
|
||||
count: this._network.controller.nodes.length,
|
||||
}
|
||||
)}
|
||||
${notReadyDevices > 0
|
||||
|
@@ -13,11 +13,10 @@ import type {
|
||||
LovelaceDashboardCreateParams,
|
||||
LovelaceDashboardMutableParams,
|
||||
} from "../../../../data/lovelace/dashboard";
|
||||
import { DEFAULT_PANEL } from "../../../../data/panel";
|
||||
import { DEFAULT_PANEL, setDefaultPanel } from "../../../../data/panel";
|
||||
import { haStyleDialog } from "../../../../resources/styles";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
import type { LovelaceDashboardDetailsDialogParams } from "./show-dialog-lovelace-dashboard-detail";
|
||||
import { saveFrontendUserData } from "../../../../data/frontend";
|
||||
|
||||
@customElement("dialog-lovelace-dashboard-detail")
|
||||
export class DialogLovelaceDashboardDetail extends LitElement {
|
||||
@@ -60,7 +59,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
||||
if (!this._params || !this._data) {
|
||||
return nothing;
|
||||
}
|
||||
const defaultPanelUrlPath = this.hass.sidebar.defaultPanel;
|
||||
const defaultPanelUrlPath = this.hass.defaultPanel;
|
||||
const titleInvalid = !this._data.title || !this._data.title.trim();
|
||||
|
||||
return html`
|
||||
@@ -250,17 +249,15 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
private async _toggleDefault() {
|
||||
private _toggleDefault() {
|
||||
const urlPath = this._params?.urlPath;
|
||||
if (!urlPath) {
|
||||
return;
|
||||
}
|
||||
await saveFrontendUserData(this.hass!.connection, "sidebar", {
|
||||
panelOrder: this.hass!.sidebar.panelOrder,
|
||||
hiddenPanels: this.hass!.sidebar.hiddenPanels,
|
||||
defaultPanel:
|
||||
urlPath === this.hass.sidebar.defaultPanel ? DEFAULT_PANEL : urlPath,
|
||||
});
|
||||
setDefaultPanel(
|
||||
this,
|
||||
urlPath === this.hass.defaultPanel ? DEFAULT_PANEL : urlPath
|
||||
);
|
||||
}
|
||||
|
||||
private async _updateDashboard() {
|
||||
|
@@ -255,7 +255,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
const defaultMode = (
|
||||
this.hass.panels?.lovelace?.config as LovelacePanelConfig
|
||||
).mode;
|
||||
const defaultUrlPath = this.hass.sidebar.defaultPanel;
|
||||
const defaultUrlPath = this.hass.defaultPanel;
|
||||
const isDefault = defaultUrlPath === "lovelace";
|
||||
const result: DataTableItem[] = [
|
||||
{
|
||||
|
@@ -384,22 +384,15 @@ export class HuiAreaCard
|
||||
areaSensorEntityId = area.humidity_entity_id;
|
||||
break;
|
||||
}
|
||||
const areaEntity =
|
||||
areaSensorEntityId &&
|
||||
this.hass.states[areaSensorEntityId] &&
|
||||
!isUnavailableState(this.hass.states[areaSensorEntityId].state)
|
||||
? this.hass.states[areaSensorEntityId]
|
||||
: undefined;
|
||||
const areaEntity = areaSensorEntityId
|
||||
? this.hass.states[areaSensorEntityId]
|
||||
: undefined;
|
||||
if (
|
||||
areaEntity ||
|
||||
entitiesByDomain[domain].some(
|
||||
(entity) => entity.attributes.device_class === deviceClass
|
||||
)
|
||||
) {
|
||||
let value = areaEntity
|
||||
? this.hass.formatEntityState(areaEntity)
|
||||
: this._average(domain, deviceClass);
|
||||
if (!value) value = "—";
|
||||
sensors.push(html`
|
||||
<div class="sensor">
|
||||
<ha-domain-icon
|
||||
@@ -407,7 +400,9 @@ export class HuiAreaCard
|
||||
.domain=${domain}
|
||||
.deviceClass=${deviceClass}
|
||||
></ha-domain-icon>
|
||||
${value}
|
||||
${areaEntity
|
||||
? this.hass.formatEntityState(areaEntity)
|
||||
: this._average(domain, deviceClass)}
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
|
@@ -301,7 +301,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
line-height: var(--ha-line-height-expanded);
|
||||
}
|
||||
|
||||
.value {
|
||||
|
@@ -45,7 +45,6 @@ export const DEFAULT_ZOOM = 14;
|
||||
interface MapEntityConfig extends EntityConfig {
|
||||
label_mode?: "state" | "attribute" | "name";
|
||||
attribute?: string;
|
||||
unit?: string;
|
||||
focus?: boolean;
|
||||
}
|
||||
|
||||
@@ -53,7 +52,6 @@ interface GeoEntity {
|
||||
entity_id: string;
|
||||
label_mode?: "state" | "attribute" | "name" | "icon";
|
||||
attribute?: string;
|
||||
unit?: string;
|
||||
focus: boolean;
|
||||
}
|
||||
|
||||
@@ -432,7 +430,6 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
||||
entity_id: stateObj.entity_id,
|
||||
label_mode: sourceObj?.label_mode ?? allSource?.label_mode,
|
||||
attribute: sourceObj?.attribute ?? allSource?.attribute,
|
||||
unit: sourceObj?.unit ?? allSource?.unit,
|
||||
focus: sourceObj
|
||||
? (sourceObj.focus ?? true)
|
||||
: (allSource?.focus ?? true),
|
||||
@@ -449,7 +446,6 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
||||
color: this._getColor(entityConf.entity),
|
||||
label_mode: entityConf.label_mode,
|
||||
attribute: entityConf.attribute,
|
||||
unit: entityConf.unit,
|
||||
focus: entityConf.focus,
|
||||
name: entityConf.name,
|
||||
})),
|
||||
|
@@ -323,7 +323,6 @@ interface GeoLocationSourceConfig {
|
||||
source: string;
|
||||
label_mode?: "name" | "state" | "attribute" | "icon";
|
||||
attribute?: string;
|
||||
unit?: string;
|
||||
focus?: boolean;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,6 @@ export const mapEntitiesConfigStruct = union([
|
||||
entity: string(),
|
||||
label_mode: optional(string()),
|
||||
attribute: optional(string()),
|
||||
unit: optional(string()),
|
||||
focus: optional(boolean()),
|
||||
name: optional(string()),
|
||||
}),
|
||||
@@ -52,7 +51,6 @@ const geoSourcesConfigStruct = union([
|
||||
source: string(),
|
||||
label_mode: optional(string()),
|
||||
attribute: optional(string()),
|
||||
unit: optional(string()),
|
||||
focus: optional(boolean()),
|
||||
}),
|
||||
string(),
|
||||
|
@@ -139,7 +139,7 @@ export class HuiDialogSelectDashboard extends LitElement {
|
||||
...(this._params!.dashboards || (await fetchDashboards(this.hass))),
|
||||
];
|
||||
|
||||
const currentPath = this._fromUrlPath || this.hass.sidebar.defaultPanel;
|
||||
const currentPath = this._fromUrlPath || this.hass.defaultPanel;
|
||||
for (const dashboard of this._dashboards!) {
|
||||
if (dashboard.url_path !== currentPath) {
|
||||
this._toUrlPath = dashboard.url_path;
|
||||
|
@@ -77,7 +77,7 @@ export class HuiDialogSelectView extends LitElement {
|
||||
"ui.panel.lovelace.editor.select_view.dashboard_label"
|
||||
)}
|
||||
.disabled=${!this._dashboards.length}
|
||||
.value=${this._urlPath || this.hass.sidebar.defaultPanel}
|
||||
.value=${this._urlPath || this.hass.defaultPanel}
|
||||
@selected=${this._dashboardChanged}
|
||||
@closed=${stopPropagation}
|
||||
fixedMenuPosition
|
||||
|
@@ -1109,16 +1109,6 @@ class HUIRoot extends LitElement {
|
||||
sl-tab[aria-selected="true"] .edit-icon {
|
||||
display: inline-flex;
|
||||
}
|
||||
sl-tab::part(base) {
|
||||
padding-inline-start: var(
|
||||
--ha-tab-padding-start,
|
||||
var(--sl-spacing-large)
|
||||
);
|
||||
padding-inline-end: var(
|
||||
--ha-tab-padding-end,
|
||||
var(--sl-spacing-large)
|
||||
);
|
||||
}
|
||||
sl-tab::part(base) {
|
||||
padding-top: calc((var(--header-height) - 20px) / 2);
|
||||
padding-bottom: calc((var(--header-height) - 20px) / 2 - 2px);
|
||||
|
@@ -6,8 +6,8 @@ import "../../components/ha-select";
|
||||
import "../../components/ha-settings-row";
|
||||
import type { LovelaceDashboard } from "../../data/lovelace/dashboard";
|
||||
import { fetchDashboards } from "../../data/lovelace/dashboard";
|
||||
import { setDefaultPanel } from "../../data/panel";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import { saveFrontendUserData } from "../../data/frontend";
|
||||
|
||||
@customElement("ha-pick-dashboard-row")
|
||||
class HaPickDashboardRow extends LitElement {
|
||||
@@ -37,7 +37,7 @@ class HaPickDashboardRow extends LitElement {
|
||||
"ui.panel.profile.dashboard.dropdown_label"
|
||||
)}
|
||||
.disabled=${!this._dashboards?.length}
|
||||
.value=${this.hass.sidebar.defaultPanel}
|
||||
.value=${this.hass.defaultPanel}
|
||||
@selected=${this._dashboardChanged}
|
||||
naturalMenuWidth
|
||||
>
|
||||
@@ -71,16 +71,12 @@ class HaPickDashboardRow extends LitElement {
|
||||
this._dashboards = await fetchDashboards(this.hass);
|
||||
}
|
||||
|
||||
private async _dashboardChanged(ev) {
|
||||
private _dashboardChanged(ev) {
|
||||
const urlPath = ev.target.value;
|
||||
if (!urlPath || urlPath === this.hass.sidebar.defaultPanel) {
|
||||
if (!urlPath || urlPath === this.hass.defaultPanel) {
|
||||
return;
|
||||
}
|
||||
await saveFrontendUserData(this.hass!.connection, "sidebar", {
|
||||
panelOrder: this.hass!.sidebar.panelOrder,
|
||||
hiddenPanels: this.hass!.sidebar.hiddenPanels,
|
||||
defaultPanel: urlPath,
|
||||
});
|
||||
setDefaultPanel(this, urlPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -167,10 +167,6 @@ class HaProfileSectionGeneral extends LitElement {
|
||||
)}
|
||||
</mwc-button>
|
||||
</ha-settings-row>
|
||||
<ha-pick-dashboard-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-pick-dashboard-row>
|
||||
${this.hass.user!.is_admin
|
||||
? html`
|
||||
<ha-advanced-mode-row
|
||||
@@ -204,6 +200,10 @@ class HaProfileSectionGeneral extends LitElement {
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-pick-theme-row>
|
||||
<ha-pick-dashboard-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-pick-dashboard-row>
|
||||
${this.hass.dockedSidebar !== "auto" || !this.narrow
|
||||
? html`
|
||||
<ha-force-narrow-row
|
||||
|
@@ -59,11 +59,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
||||
services: null as any,
|
||||
user: null as any,
|
||||
panelUrl: (this as any)._panelUrl,
|
||||
sidebar: {
|
||||
defaultPanel: DEFAULT_PANEL,
|
||||
hiddenPanels: [],
|
||||
panelOrder: [],
|
||||
},
|
||||
defaultPanel: DEFAULT_PANEL,
|
||||
language,
|
||||
selectedLanguage: null,
|
||||
locale: {
|
||||
|
@@ -7,16 +7,20 @@ interface DockSidebarParams {
|
||||
dock: HomeAssistant["dockedSidebar"];
|
||||
}
|
||||
|
||||
interface DefaultPanelParams {
|
||||
defaultPanel: HomeAssistant["defaultPanel"];
|
||||
}
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
interface HASSDomEvents {
|
||||
"hass-dock-sidebar": DockSidebarParams;
|
||||
"hass-set-sidebar-data": HomeAssistant["sidebar"];
|
||||
"hass-default-panel": DefaultPanelParams;
|
||||
}
|
||||
// for add event listener
|
||||
interface HTMLElementEventMap {
|
||||
"hass-dock-sidebar": HASSDomEvent<DockSidebarParams>;
|
||||
"hass-set-sidebar-data": HASSDomEvent<HomeAssistant["sidebar"]>;
|
||||
"hass-default-panel": HASSDomEvent<DefaultPanelParams>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +32,8 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
||||
this._updateHass({ dockedSidebar: ev.detail.dock });
|
||||
storeState(this.hass!);
|
||||
});
|
||||
this.addEventListener("hass-set-sidebar-data", async (ev) => {
|
||||
this._updateHass({
|
||||
sidebar: ev.detail,
|
||||
});
|
||||
this.addEventListener("hass-default-panel", (ev) => {
|
||||
this._updateHass({ defaultPanel: ev.detail.defaultPanel });
|
||||
storeState(this.hass!);
|
||||
});
|
||||
}
|
||||
|
@@ -902,8 +902,6 @@
|
||||
"hidden": "{number} hidden",
|
||||
"clear": "Clear",
|
||||
"ungrouped": "Ungrouped",
|
||||
"collapse": "Collapse",
|
||||
"expand": "Expand",
|
||||
"settings": {
|
||||
"header": "Customize",
|
||||
"hide": "Hide column {title}",
|
||||
@@ -1581,7 +1579,7 @@
|
||||
"upload_in_progress": "A backup upload is currently in progress. The action will automatically proceed once the upload process is complete.",
|
||||
"restore_in_progress": "A backup restore is currently in progress. The action will automatically proceed once the restore process is complete.",
|
||||
"wait_for_backup": "Wait for the backup creation to finish",
|
||||
"error_backup_state": "An error occurred while getting the current backup state. Error: {error}",
|
||||
"error_backup_state": "An error occured while getting the current backup state. Error: {error}",
|
||||
"wait_for_upload": "Wait for backup upload to finish",
|
||||
"wait_for_restore": "Wait for backup restore to finish",
|
||||
"reload": {
|
||||
@@ -1784,7 +1782,7 @@
|
||||
"buttons": {
|
||||
"add": "Add devices via this device",
|
||||
"remove": "Remove",
|
||||
"manage": "Manage Zigbee device",
|
||||
"manage": "Manage zigbee device",
|
||||
"reconfigure": "Reconfigure",
|
||||
"view_network": "View network"
|
||||
},
|
||||
@@ -2380,7 +2378,7 @@
|
||||
},
|
||||
"generate": {
|
||||
"sync": {
|
||||
"title": "Synchronization",
|
||||
"title": "Synchonization",
|
||||
"name": "Backup name",
|
||||
"locations": "Locations",
|
||||
"locations_description": "What locations you want to automatically backup to.",
|
||||
|
@@ -243,11 +243,7 @@ export interface HomeAssistant {
|
||||
vibrate: boolean;
|
||||
debugConnection: boolean;
|
||||
dockedSidebar: "docked" | "always_hidden" | "auto";
|
||||
sidebar: {
|
||||
defaultPanel: string;
|
||||
panelOrder: string[];
|
||||
hiddenPanels: string[];
|
||||
};
|
||||
defaultPanel: string;
|
||||
moreInfoEntityId: string | null;
|
||||
user?: CurrentUser;
|
||||
userData?: CoreFrontendUserData | null;
|
||||
|
@@ -8,7 +8,7 @@ const STORED_STATE = [
|
||||
"debugConnection",
|
||||
"suspendWhenHidden",
|
||||
"enableShortcuts",
|
||||
"sidebar",
|
||||
"defaultPanel",
|
||||
];
|
||||
|
||||
export function storeState(hass: HomeAssistant) {
|
||||
|
Reference in New Issue
Block a user