mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Merge pull request #12193 from home-assistant/dev
This commit is contained in:
commit
1f65193a97
@ -31,7 +31,7 @@ export const mockHassioSupervisor = (hass: MockHomeAssistant) => {
|
|||||||
version_latest: "3.6.2",
|
version_latest: "3.6.2",
|
||||||
update_available: false,
|
update_available: false,
|
||||||
repository: "a0d7b954",
|
repository: "a0d7b954",
|
||||||
icon: true,
|
icon: false,
|
||||||
logo: true,
|
logo: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
BIN
gallery/public/api/hassio/addons/core_zwave_js/icon
Normal file
BIN
gallery/public/api/hassio/addons/core_zwave_js/icon
Normal file
Binary file not shown.
@ -128,6 +128,11 @@ const ENTITIES = [
|
|||||||
supported_features:
|
supported_features:
|
||||||
base_attributes.supported_features + UPDATE_SUPPORT_RELEASE_NOTES,
|
base_attributes.supported_features + UPDATE_SUPPORT_RELEASE_NOTES,
|
||||||
}),
|
}),
|
||||||
|
getEntity("update", "update19", "on", {
|
||||||
|
...base_attributes,
|
||||||
|
friendly_name: "Update with auto update",
|
||||||
|
auto_update: true,
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
@customElement("demo-more-info-update")
|
@customElement("demo-more-info-update")
|
||||||
|
@ -32,13 +32,6 @@ interface AddonCheckboxItem extends CheckboxItem {
|
|||||||
|
|
||||||
const _computeFolders = (folders): CheckboxItem[] => {
|
const _computeFolders = (folders): CheckboxItem[] => {
|
||||||
const list: CheckboxItem[] = [];
|
const list: CheckboxItem[] = [];
|
||||||
if (folders.includes("homeassistant")) {
|
|
||||||
list.push({
|
|
||||||
slug: "homeassistant",
|
|
||||||
name: "Home Assistant configuration",
|
|
||||||
checked: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (folders.includes("ssl")) {
|
if (folders.includes("ssl")) {
|
||||||
list.push({ slug: "ssl", name: "SSL", checked: false });
|
list.push({ slug: "ssl", name: "SSL", checked: false });
|
||||||
}
|
}
|
||||||
@ -100,7 +93,7 @@ export class SupervisorBackupContent extends LitElement {
|
|||||||
this.folders = _computeFolders(
|
this.folders = _computeFolders(
|
||||||
this.backup
|
this.backup
|
||||||
? this.backup.folders
|
? this.backup.folders
|
||||||
: ["homeassistant", "ssl", "share", "media", "addons/local"]
|
: ["ssl", "share", "media", "addons/local"]
|
||||||
);
|
);
|
||||||
this.addons = _computeAddons(
|
this.addons = _computeAddons(
|
||||||
this.backup ? this.backup.addons : this.supervisor?.supervisor.addons
|
this.backup ? this.backup.addons : this.supervisor?.supervisor.addons
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = home-assistant-frontend
|
name = home-assistant-frontend
|
||||||
version = 20220330.0
|
version = 20220401.0
|
||||||
author = The Home Assistant Authors
|
author = The Home Assistant Authors
|
||||||
author_email = hello@home-assistant.io
|
author_email = hello@home-assistant.io
|
||||||
license = Apache-2.0
|
license = Apache-2.0
|
||||||
|
@ -68,7 +68,7 @@ class HaDevicesPicker extends LitElement {
|
|||||||
.excludeDomains=${this.excludeDomains}
|
.excludeDomains=${this.excludeDomains}
|
||||||
.includeDeviceClasses=${this.includeDeviceClasses}
|
.includeDeviceClasses=${this.includeDeviceClasses}
|
||||||
.label=${this.pickDeviceLabel}
|
.label=${this.pickDeviceLabel}
|
||||||
.required=${this.required}
|
.required=${this.required && !currentDevices.length}
|
||||||
@value-changed=${this._addDevice}
|
@value-changed=${this._addDevice}
|
||||||
></ha-device-picker>
|
></ha-device-picker>
|
||||||
</div>
|
</div>
|
||||||
|
@ -110,7 +110,7 @@ class HaEntitiesPickerLight extends LitElement {
|
|||||||
.includeUnitOfMeasurement=${this.includeUnitOfMeasurement}
|
.includeUnitOfMeasurement=${this.includeUnitOfMeasurement}
|
||||||
.entityFilter=${this._entityFilter}
|
.entityFilter=${this._entityFilter}
|
||||||
.label=${this.pickEntityLabel}
|
.label=${this.pickEntityLabel}
|
||||||
.required=${this.required}
|
.required=${this.required && !currentEntities.length}
|
||||||
@value-changed=${this._addEntity}
|
@value-changed=${this._addEntity}
|
||||||
></ha-entity-picker>
|
></ha-entity-picker>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,9 +13,12 @@ import { HaComboBox } from "./ha-combo-box";
|
|||||||
|
|
||||||
const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
|
const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
|
||||||
item
|
item
|
||||||
) => html`<mwc-list-item twoline>
|
) => html`<mwc-list-item twoline graphic="icon">
|
||||||
<span>${item.name}</span>
|
<span>${item.name}</span>
|
||||||
<span slot="secondary">${item.slug}</span>
|
<span slot="secondary">${item.slug}</span>
|
||||||
|
${item.icon
|
||||||
|
? html`<img slot="graphic" .src="/api/hassio/addons/${item.slug}/icon" />`
|
||||||
|
: ""}
|
||||||
</mwc-list-item>`;
|
</mwc-list-item>`;
|
||||||
|
|
||||||
@customElement("ha-addon-picker")
|
@customElement("ha-addon-picker")
|
||||||
|
@ -97,7 +97,7 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) {
|
|||||||
.entityFilter=${this.entityFilter}
|
.entityFilter=${this.entityFilter}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.placeholder=${this.placeholder}
|
.placeholder=${this.placeholder}
|
||||||
.required=${this.required}
|
.required=${this.required && !currentAreas.length}
|
||||||
@value-changed=${this._addArea}
|
@value-changed=${this._addArea}
|
||||||
></ha-area-picker>
|
></ha-area-picker>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,7 +108,7 @@ export class HaSelectSelector extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.label=${this.label}
|
.label=${this.label}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.required=${this.required}
|
.required=${this.required && !value.length}
|
||||||
.value=${this._filter}
|
.value=${this._filter}
|
||||||
.items=${options.filter((item) => !this.value?.includes(item.value))}
|
.items=${options.filter((item) => !this.value?.includes(item.value))}
|
||||||
@filter-changed=${this._filterChanged}
|
@filter-changed=${this._filterChanged}
|
||||||
|
@ -2,6 +2,7 @@ import type {
|
|||||||
HassEntityAttributeBase,
|
HassEntityAttributeBase,
|
||||||
HassEntityBase,
|
HassEntityBase,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
|
import { BINARY_STATE_ON } from "../common/const";
|
||||||
import { supportsFeature } from "../common/entity/supports-feature";
|
import { supportsFeature } from "../common/entity/supports-feature";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ export const UPDATE_SUPPORT_BACKUP = 8;
|
|||||||
export const UPDATE_SUPPORT_RELEASE_NOTES = 16;
|
export const UPDATE_SUPPORT_RELEASE_NOTES = 16;
|
||||||
|
|
||||||
interface UpdateEntityAttributes extends HassEntityAttributeBase {
|
interface UpdateEntityAttributes extends HassEntityAttributeBase {
|
||||||
|
auto_update: boolean | null;
|
||||||
current_version: string | null;
|
current_version: string | null;
|
||||||
in_progress: boolean | number;
|
in_progress: boolean | number;
|
||||||
latest_version: string | null;
|
latest_version: string | null;
|
||||||
@ -30,9 +32,8 @@ export const updateUsesProgress = (entity: UpdateEntity): boolean =>
|
|||||||
typeof entity.attributes.in_progress === "number";
|
typeof entity.attributes.in_progress === "number";
|
||||||
|
|
||||||
export const updateCanInstall = (entity: UpdateEntity): boolean =>
|
export const updateCanInstall = (entity: UpdateEntity): boolean =>
|
||||||
supportsFeature(entity, UPDATE_SUPPORT_INSTALL) &&
|
entity.state === BINARY_STATE_ON &&
|
||||||
entity.attributes.latest_version !== entity.attributes.current_version &&
|
supportsFeature(entity, UPDATE_SUPPORT_INSTALL);
|
||||||
entity.attributes.latest_version !== entity.attributes.skipped_version;
|
|
||||||
|
|
||||||
export const updateIsInstalling = (entity: UpdateEntity): boolean =>
|
export const updateIsInstalling = (entity: UpdateEntity): boolean =>
|
||||||
updateUsesProgress(entity) || !!entity.attributes.in_progress;
|
updateUsesProgress(entity) || !!entity.attributes.in_progress;
|
||||||
|
@ -167,12 +167,18 @@ export interface ZwaveJSNodeMetadata {
|
|||||||
wakeup: string;
|
wakeup: string;
|
||||||
reset: string;
|
reset: string;
|
||||||
device_database_url: string;
|
device_database_url: string;
|
||||||
|
comments: ZWaveJSNodeComment[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNodeConfigParams {
|
export interface ZWaveJSNodeConfigParams {
|
||||||
[key: string]: ZWaveJSNodeConfigParam;
|
[key: string]: ZWaveJSNodeConfigParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ZWaveJSNodeComment {
|
||||||
|
level: "info" | "warning" | "error";
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNodeConfigParam {
|
export interface ZWaveJSNodeConfigParam {
|
||||||
property: number;
|
property: number;
|
||||||
value: any;
|
value: any;
|
||||||
|
@ -96,6 +96,13 @@ class MoreInfoMediaPlayer extends LitElement {
|
|||||||
.path=${stateObj.attributes.is_volume_muted
|
.path=${stateObj.attributes.is_volume_muted
|
||||||
? mdiVolumeOff
|
? mdiVolumeOff
|
||||||
: mdiVolumeHigh}
|
: mdiVolumeHigh}
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
`ui.card.media_player.${
|
||||||
|
stateObj.attributes.is_volume_muted
|
||||||
|
? "media_volume_unmute"
|
||||||
|
: "media_volume_mute"
|
||||||
|
}`
|
||||||
|
)}
|
||||||
@click=${this._toggleMute}
|
@click=${this._toggleMute}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
`
|
`
|
||||||
@ -105,11 +112,17 @@ class MoreInfoMediaPlayer extends LitElement {
|
|||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
action="volume_down"
|
action="volume_down"
|
||||||
.path=${mdiVolumeMinus}
|
.path=${mdiVolumeMinus}
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.card.media_player.media_volume_down"
|
||||||
|
)}
|
||||||
@click=${this._handleClick}
|
@click=${this._handleClick}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
action="volume_up"
|
action="volume_up"
|
||||||
.path=${mdiVolumePlus}
|
.path=${mdiVolumePlus}
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.card.media_player.media_volume_up"
|
||||||
|
)}
|
||||||
@click=${this._handleClick}
|
@click=${this._handleClick}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
`
|
`
|
||||||
|
@ -130,14 +130,20 @@ class MoreInfoUpdate extends LitElement {
|
|||||||
: ""}
|
: ""}
|
||||||
<hr />
|
<hr />
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
${this.stateObj.attributes.auto_update
|
||||||
|
? ""
|
||||||
|
: html`
|
||||||
<mwc-button
|
<mwc-button
|
||||||
@click=${this._handleSkip}
|
@click=${this._handleSkip}
|
||||||
.disabled=${skippedVersion ||
|
.disabled=${skippedVersion ||
|
||||||
this.stateObj.state === "off" ||
|
this.stateObj.state === "off" ||
|
||||||
updateIsInstalling(this.stateObj)}
|
updateIsInstalling(this.stateObj)}
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.dialogs.more_info_control.update.skip")}
|
${this.hass.localize(
|
||||||
|
"ui.dialogs.more_info_control.update.skip"
|
||||||
|
)}
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
|
`}
|
||||||
${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL)
|
${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL)
|
||||||
? html`
|
? html`
|
||||||
<mwc-button
|
<mwc-button
|
||||||
|
@ -246,8 +246,8 @@ class ConfigUrlForm extends LitElement {
|
|||||||
|
|
||||||
if (isComponentLoaded(this.hass, "cloud")) {
|
if (isComponentLoaded(this.hass, "cloud")) {
|
||||||
fetchCloudStatus(this.hass).then((cloudStatus) => {
|
fetchCloudStatus(this.hass).then((cloudStatus) => {
|
||||||
if (cloudStatus.logged_in) {
|
|
||||||
this._cloudStatus = cloudStatus;
|
this._cloudStatus = cloudStatus;
|
||||||
|
if (cloudStatus.logged_in) {
|
||||||
this._showCustomExternalUrl = this._externalUrlValue !== null;
|
this._showCustomExternalUrl = this._externalUrlValue !== null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -75,7 +75,7 @@ export class HaDeviceEntitiesCard extends LitElement {
|
|||||||
this._entityRows = [];
|
this._entityRows = [];
|
||||||
|
|
||||||
this.entities.forEach((entry) => {
|
this.entities.forEach((entry) => {
|
||||||
if (entry.disabled_by || entry.hidden_by) {
|
if (entry.disabled_by) {
|
||||||
if (this._extDisabledEntityEntries) {
|
if (this._extDisabledEntityEntries) {
|
||||||
hiddenEntities.push(
|
hiddenEntities.push(
|
||||||
this._extDisabledEntityEntries[entry.entity_id] || entry
|
this._extDisabledEntityEntries[entry.entity_id] || entry
|
||||||
@ -167,7 +167,11 @@ export class HaDeviceEntitiesCard extends LitElement {
|
|||||||
computeStateName(stateObj),
|
computeStateName(stateObj),
|
||||||
this.deviceName.toLowerCase()
|
this.deviceName.toLowerCase()
|
||||||
);
|
);
|
||||||
if (name) {
|
if (entry.hidden_by) {
|
||||||
|
config.name = `${
|
||||||
|
name || computeStateName(stateObj)
|
||||||
|
} (${this.hass.localize("ui.panel.config.devices.entities.hidden")})`;
|
||||||
|
} else if (name) {
|
||||||
config.name = name;
|
config.name = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import { customElement, property, state } from "lit/decorators";
|
|||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { debounce } from "../../../../../common/util/debounce";
|
import { debounce } from "../../../../../common/util/debounce";
|
||||||
|
import "../../../../../components/ha-alert";
|
||||||
import "../../../../../components/ha-card";
|
import "../../../../../components/ha-card";
|
||||||
import "../../../../../components/ha-icon-next";
|
import "../../../../../components/ha-icon-next";
|
||||||
import "../../../../../components/ha-select";
|
import "../../../../../components/ha-select";
|
||||||
@ -130,7 +131,7 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
></hass-error-screen>`;
|
></hass-error-screen>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._config) {
|
if (!this._config || !this._nodeMetadata) {
|
||||||
return html`<hass-loading-screen></hass-loading-screen>`;
|
return html`<hass-loading-screen></hass-loading-screen>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,9 +179,18 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
</em>
|
</em>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ha-card>
|
${this._nodeMetadata.comments.length > 0
|
||||||
${this._config
|
|
||||||
? html`
|
? html`
|
||||||
|
<div>
|
||||||
|
${this._nodeMetadata.comments.map(
|
||||||
|
(comment) => html`<ha-alert .alertType=${comment.level}>
|
||||||
|
${comment.text}
|
||||||
|
</ha-alert>`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: ``}
|
||||||
|
<ha-card>
|
||||||
${Object.entries(this._config).map(
|
${Object.entries(this._config).map(
|
||||||
([id, item]) => html` <ha-settings-row
|
([id, item]) => html` <ha-settings-row
|
||||||
class="config-item"
|
class="config-item"
|
||||||
@ -190,8 +200,6 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
${this._generateConfigBox(id, item)}
|
${this._generateConfigBox(id, item)}
|
||||||
</ha-settings-row>`
|
</ha-settings-row>`
|
||||||
)}
|
)}
|
||||||
`
|
|
||||||
: ``}
|
|
||||||
</ha-card>
|
</ha-card>
|
||||||
</ha-config-section>
|
</ha-config-section>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
|
@ -13,6 +13,7 @@ import { computeStateName } from "../../../common/entity/compute_state_name";
|
|||||||
import "../../../components/ha-select";
|
import "../../../components/ha-select";
|
||||||
import { UNAVAILABLE } from "../../../data/entity";
|
import { UNAVAILABLE } from "../../../data/entity";
|
||||||
import { forwardHaptic } from "../../../data/haptics";
|
import { forwardHaptic } from "../../../data/haptics";
|
||||||
|
import type { InputSelectEntity } from "../../../data/input_select";
|
||||||
import { SelectEntity, setSelectOption } from "../../../data/select";
|
import { SelectEntity, setSelectOption } from "../../../data/select";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { EntitiesCardEntityConfig } from "../cards/types";
|
import { EntitiesCardEntityConfig } from "../cards/types";
|
||||||
@ -106,9 +107,14 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _selectedChanged(ev): void {
|
private _selectedChanged(ev): void {
|
||||||
const stateObj = this.hass!.states[this._config!.entity];
|
const stateObj = this.hass!.states[
|
||||||
|
this._config!.entity
|
||||||
|
] as InputSelectEntity;
|
||||||
const option = ev.target.value;
|
const option = ev.target.value;
|
||||||
if (option === stateObj.state) {
|
if (
|
||||||
|
option === stateObj.state ||
|
||||||
|
!stateObj.attributes.options.includes(option)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,12 @@ import "../../layouts/hass-error-screen";
|
|||||||
import { HomeAssistant, Route } from "../../types";
|
import { HomeAssistant, Route } from "../../types";
|
||||||
import { documentationUrl } from "../../util/documentation-url";
|
import { documentationUrl } from "../../util/documentation-url";
|
||||||
|
|
||||||
const REDIRECTS: Redirects = {
|
const getRedirect = (
|
||||||
|
path: string,
|
||||||
|
hasSupervisor: boolean
|
||||||
|
): Redirect | undefined =>
|
||||||
|
((
|
||||||
|
{
|
||||||
developer_states: {
|
developer_states: {
|
||||||
redirect: "/developer-tools/state",
|
redirect: "/developer-tools/state",
|
||||||
},
|
},
|
||||||
@ -159,7 +164,20 @@ const REDIRECTS: Redirects = {
|
|||||||
component: "media_source",
|
component: "media_source",
|
||||||
redirect: "/media-browser",
|
redirect: "/media-browser",
|
||||||
},
|
},
|
||||||
};
|
backup: {
|
||||||
|
component: hasSupervisor ? "hassio" : "backup",
|
||||||
|
redirect: hasSupervisor ? "/hassio/backups" : "/config/backup",
|
||||||
|
},
|
||||||
|
supervisor_snapshots: {
|
||||||
|
component: hasSupervisor ? "hassio" : "backup",
|
||||||
|
redirect: hasSupervisor ? "/hassio/backups" : "/config/backup",
|
||||||
|
},
|
||||||
|
supervisor_backups: {
|
||||||
|
component: hasSupervisor ? "hassio" : "backup",
|
||||||
|
redirect: hasSupervisor ? "/hassio/backups" : "/config/backup",
|
||||||
|
},
|
||||||
|
} as Redirects
|
||||||
|
)[path]);
|
||||||
|
|
||||||
export type ParamType = "url" | "string";
|
export type ParamType = "url" | "string";
|
||||||
|
|
||||||
@ -180,12 +198,17 @@ class HaPanelMy extends LitElement {
|
|||||||
|
|
||||||
@state() public _error?: string;
|
@state() public _error?: string;
|
||||||
|
|
||||||
|
private _redirect?: Redirect;
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
const path = this.route.path.substring(1);
|
const path = this.route.path.substring(1);
|
||||||
|
const hasSupervisor = isComponentLoaded(this.hass, "hassio");
|
||||||
|
|
||||||
if (path.startsWith("supervisor")) {
|
this._redirect = getRedirect(path, hasSupervisor);
|
||||||
if (!isComponentLoaded(this.hass, "hassio")) {
|
|
||||||
|
if (path.startsWith("supervisor") && this._redirect === undefined) {
|
||||||
|
if (!hasSupervisor) {
|
||||||
this._error = "no_supervisor";
|
this._error = "no_supervisor";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -195,16 +218,14 @@ class HaPanelMy extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const redirect = REDIRECTS[path];
|
if (!this._redirect) {
|
||||||
|
|
||||||
if (!redirect) {
|
|
||||||
this._error = "not_supported";
|
this._error = "not_supported";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
redirect.component &&
|
this._redirect.component &&
|
||||||
!isComponentLoaded(this.hass, redirect.component)
|
!isComponentLoaded(this.hass, this._redirect.component)
|
||||||
) {
|
) {
|
||||||
this._error = "no_component";
|
this._error = "no_component";
|
||||||
return;
|
return;
|
||||||
@ -212,7 +233,7 @@ class HaPanelMy extends LitElement {
|
|||||||
|
|
||||||
let url: string;
|
let url: string;
|
||||||
try {
|
try {
|
||||||
url = this._createRedirectUrl(redirect);
|
url = this._createRedirectUrl();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = "url_error";
|
this._error = "url_error";
|
||||||
return;
|
return;
|
||||||
@ -243,10 +264,16 @@ class HaPanelMy extends LitElement {
|
|||||||
this.hass.localize(
|
this.hass.localize(
|
||||||
"ui.panel.my.component_not_loaded",
|
"ui.panel.my.component_not_loaded",
|
||||||
"integration",
|
"integration",
|
||||||
domainToName(
|
html`<a
|
||||||
this.hass.localize,
|
target="_blank"
|
||||||
REDIRECTS[this.route.path.substr(1)].component!
|
rel="noreferrer noopener"
|
||||||
)
|
href=${documentationUrl(
|
||||||
|
this.hass,
|
||||||
|
`/integrations/${this._redirect!.component!}`
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
${domainToName(this.hass.localize, this._redirect!.component!)}
|
||||||
|
</a>`
|
||||||
) || "This redirect is not supported.";
|
) || "This redirect is not supported.";
|
||||||
break;
|
break;
|
||||||
case "no_supervisor":
|
case "no_supervisor":
|
||||||
@ -269,18 +296,18 @@ class HaPanelMy extends LitElement {
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createRedirectUrl(redirect: Redirect): string {
|
private _createRedirectUrl(): string {
|
||||||
const params = this._createRedirectParams(redirect);
|
const params = this._createRedirectParams();
|
||||||
return `${redirect.redirect}${params}`;
|
return `${this._redirect!.redirect}${params}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createRedirectParams(redirect: Redirect): string {
|
private _createRedirectParams(): string {
|
||||||
const params = extractSearchParamsObject();
|
const params = extractSearchParamsObject();
|
||||||
if (!redirect.params && !Object.keys(params).length) {
|
if (!this._redirect!.params && !Object.keys(params).length) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
const resultParams = {};
|
const resultParams = {};
|
||||||
Object.entries(redirect.params || {}).forEach(([key, type]) => {
|
Object.entries(this._redirect!.params || {}).forEach(([key, type]) => {
|
||||||
if (!params[key] || !this._checkParamType(type, params[key])) {
|
if (!params[key] || !this._checkParamType(type, params[key])) {
|
||||||
throw Error();
|
throw Error();
|
||||||
}
|
}
|
||||||
|
@ -2463,7 +2463,8 @@
|
|||||||
"add_entities_lovelace": "Add to dashboard",
|
"add_entities_lovelace": "Add to dashboard",
|
||||||
"none": "This device has no entities",
|
"none": "This device has no entities",
|
||||||
"show_less": "Show less",
|
"show_less": "Show less",
|
||||||
"hidden_entities": "+{count} {count, plural,\n one {entity}\n other {entities}\n} not shown"
|
"hidden_entities": "+{count} {count, plural,\n one {entity}\n other {entities}\n} not shown",
|
||||||
|
"hidden": "Hidden"
|
||||||
},
|
},
|
||||||
"confirm_rename_entity_ids": "Do you also want to rename the entity IDs of your entities?",
|
"confirm_rename_entity_ids": "Do you also want to rename the entity IDs of your entities?",
|
||||||
"confirm_rename_entity_ids_warning": "This will not change any configuration (like automations, scripts, scenes, dashboards) that is currently using these entities! You will have to update them yourself to use the new entity IDs!",
|
"confirm_rename_entity_ids_warning": "This will not change any configuration (like automations, scripts, scenes, dashboards) that is currently using these entities! You will have to update them yourself to use the new entity IDs!",
|
||||||
@ -4049,7 +4050,8 @@
|
|||||||
"update": "Update the historic statistic values from ''{metadata_unit}'' to ''{state_unit}''",
|
"update": "Update the historic statistic values from ''{metadata_unit}'' to ''{state_unit}''",
|
||||||
"clear": "Delete all old statistic data for this entity"
|
"clear": "Delete all old statistic data for this entity"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"adjust_sum": "Adjust sum"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5915,9 +5915,9 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"caniuse-lite@npm:^1.0.30001259":
|
"caniuse-lite@npm:^1.0.30001259":
|
||||||
version: 1.0.30001261
|
version: 1.0.30001322
|
||||||
resolution: "caniuse-lite@npm:1.0.30001261"
|
resolution: "caniuse-lite@npm:1.0.30001322"
|
||||||
checksum: d894662312ecbdd772f0a258c4a45cac93605247b127b25649052353e0b981abfd0b445f469650943b612adc236fd510ae61c1293f3e77c68af7411d1b66574a
|
checksum: 48609d1808c69034a74ab6df9db8cffd847e12da6979e150f364cc8e2a4310fce1f2811382ca57b3b4111c0182f7c67edfde3cd4159c29537fc232596aecf48b
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user