mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 06:17:20 +00:00
Merge pull request #9334 from home-assistant/dev
This commit is contained in:
commit
2db9f33c41
@ -31,10 +31,8 @@ const createConfigEntry = (
|
|||||||
supports_options: false,
|
supports_options: false,
|
||||||
supports_unload: true,
|
supports_unload: true,
|
||||||
disabled_by: null,
|
disabled_by: null,
|
||||||
system_options: {
|
pref_disable_new_entities: false,
|
||||||
disable_new_entities: false,
|
pref_disable_polling: false,
|
||||||
disable_polling: false,
|
|
||||||
},
|
|
||||||
reason: null,
|
reason: null,
|
||||||
...override,
|
...override,
|
||||||
});
|
});
|
||||||
@ -68,10 +66,7 @@ const optionsFlowEntry = createConfigEntry("Options Flow", {
|
|||||||
supports_options: true,
|
supports_options: true,
|
||||||
});
|
});
|
||||||
const disabledPollingEntry = createConfigEntry("Disabled Polling", {
|
const disabledPollingEntry = createConfigEntry("Disabled Polling", {
|
||||||
system_options: {
|
pref_disable_polling: true,
|
||||||
disable_new_entities: false,
|
|
||||||
disable_polling: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const setupErrorEntry = createConfigEntry("Setup Error", {
|
const setupErrorEntry = createConfigEntry("Setup Error", {
|
||||||
state: "setup_error",
|
state: "setup_error",
|
||||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="home-assistant-frontend",
|
name="home-assistant-frontend",
|
||||||
version="20210601.0",
|
version="20210601.1",
|
||||||
description="The Home Assistant frontend",
|
description="The Home Assistant frontend",
|
||||||
url="https://github.com/home-assistant/home-assistant-polymer",
|
url="https://github.com/home-assistant/home-assistant-polymer",
|
||||||
author="The Home Assistant Authors",
|
author="The Home Assistant Authors",
|
||||||
|
@ -89,8 +89,6 @@ export const domainIcon = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.warn(
|
console.warn(`Unable to find icon for domain ${domain}`);
|
||||||
"Unable to find icon for domain " + domain + " (" + stateObj + ")"
|
|
||||||
);
|
|
||||||
return DEFAULT_DOMAIN_ICON;
|
return DEFAULT_DOMAIN_ICON;
|
||||||
};
|
};
|
||||||
|
@ -4,29 +4,25 @@
|
|||||||
// be triggered. The function will be called after it stops being called for
|
// be triggered. The function will be called after it stops being called for
|
||||||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||||||
// leading edge, instead of the trailing.
|
// leading edge, instead of the trailing.
|
||||||
// eslint-disable-next-line: ban-types
|
|
||||||
export const debounce = <T extends (...args) => unknown>(
|
export const debounce = <T extends any[]>(
|
||||||
func: T,
|
func: (...args: T) => void,
|
||||||
wait,
|
wait: number,
|
||||||
immediate = false
|
immediate = false
|
||||||
): T => {
|
) => {
|
||||||
let timeout;
|
let timeout: number | undefined;
|
||||||
// @ts-ignore
|
return (...args: T): void => {
|
||||||
return function (...args) {
|
|
||||||
// @ts-ignore
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
||||||
const context = this;
|
|
||||||
const later = () => {
|
const later = () => {
|
||||||
timeout = null;
|
timeout = undefined;
|
||||||
if (!immediate) {
|
if (!immediate) {
|
||||||
func.apply(context, args);
|
func(...args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const callNow = immediate && !timeout;
|
const callNow = immediate && !timeout;
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(later, wait);
|
timeout = window.setTimeout(later, wait);
|
||||||
if (callNow) {
|
if (callNow) {
|
||||||
func.apply(context, args);
|
func(...args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -246,7 +246,7 @@ export class HaDataTable extends LitElement {
|
|||||||
aria-rowcount=${this._filteredData.length + 1}
|
aria-rowcount=${this._filteredData.length + 1}
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
height: this.autoHeight
|
height: this.autoHeight
|
||||||
? `${(this._filteredData.length || 1) * 53 + 57}px`
|
? `${(this._filteredData.length || 1) * 53 + 53}px`
|
||||||
: `calc(100% - ${this._headerHeight}px)`,
|
: `calc(100% - ${this._headerHeight}px)`,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
@ -919,13 +919,11 @@ export class HaDataTable extends LitElement {
|
|||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
.scroller {
|
.scroller {
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
contain: strict;
|
|
||||||
height: calc(100% - 57px);
|
height: calc(100% - 57px);
|
||||||
}
|
}
|
||||||
.mdc-data-table__table:not(.auto-height) .scroller {
|
|
||||||
overflow: auto;
|
.mdc-data-table__table.auto-height .scroller {
|
||||||
|
overflow-y: hidden !important;
|
||||||
}
|
}
|
||||||
.grows {
|
.grows {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -377,7 +377,10 @@ class StateHistoryChartLine extends LocalizeMixin(PolymerElement) {
|
|||||||
major: {
|
major: {
|
||||||
fontStyle: "bold",
|
fontStyle: "bold",
|
||||||
},
|
},
|
||||||
|
source: "auto",
|
||||||
|
sampleSize: 5,
|
||||||
autoSkipPadding: 20,
|
autoSkipPadding: 20,
|
||||||
|
maxRotation: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -236,7 +236,9 @@ class StateHistoryChartTimeline extends LocalizeMixin(PolymerElement) {
|
|||||||
major: {
|
major: {
|
||||||
fontStyle: "bold",
|
fontStyle: "bold",
|
||||||
},
|
},
|
||||||
|
sampleSize: 5,
|
||||||
autoSkipPadding: 50,
|
autoSkipPadding: 50,
|
||||||
|
maxRotation: 0,
|
||||||
},
|
},
|
||||||
categoryPercentage: undefined,
|
categoryPercentage: undefined,
|
||||||
barPercentage: undefined,
|
barPercentage: undefined,
|
||||||
|
@ -14,19 +14,18 @@ export interface ConfigEntry {
|
|||||||
| "failed_unload";
|
| "failed_unload";
|
||||||
supports_options: boolean;
|
supports_options: boolean;
|
||||||
supports_unload: boolean;
|
supports_unload: boolean;
|
||||||
system_options: ConfigEntrySystemOptions;
|
pref_disable_new_entities: boolean;
|
||||||
|
pref_disable_polling: boolean;
|
||||||
disabled_by: "user" | null;
|
disabled_by: "user" | null;
|
||||||
reason: string | null;
|
reason: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConfigEntryMutableParams {
|
export type ConfigEntryMutableParams = Partial<
|
||||||
title: string;
|
Pick<
|
||||||
}
|
ConfigEntry,
|
||||||
|
"title" | "pref_disable_new_entities" | "pref_disable_polling"
|
||||||
export interface ConfigEntrySystemOptions {
|
>
|
||||||
disable_new_entities: boolean;
|
>;
|
||||||
disable_polling: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getConfigEntries = (hass: HomeAssistant) =>
|
export const getConfigEntries = (hass: HomeAssistant) =>
|
||||||
hass.callApi<ConfigEntry[]>("GET", "config/config_entries/entry");
|
hass.callApi<ConfigEntry[]>("GET", "config/config_entries/entry");
|
||||||
@ -34,9 +33,9 @@ export const getConfigEntries = (hass: HomeAssistant) =>
|
|||||||
export const updateConfigEntry = (
|
export const updateConfigEntry = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
configEntryId: string,
|
configEntryId: string,
|
||||||
updatedValues: Partial<ConfigEntryMutableParams>
|
updatedValues: ConfigEntryMutableParams
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<ConfigEntry>({
|
hass.callWS<{ require_restart: boolean; config_entry: ConfigEntry }>({
|
||||||
type: "config_entries/update",
|
type: "config_entries/update",
|
||||||
entry_id: configEntryId,
|
entry_id: configEntryId,
|
||||||
...updatedValues,
|
...updatedValues,
|
||||||
@ -52,13 +51,15 @@ export const reloadConfigEntry = (hass: HomeAssistant, configEntryId: string) =>
|
|||||||
require_restart: boolean;
|
require_restart: boolean;
|
||||||
}>("POST", `config/config_entries/entry/${configEntryId}/reload`);
|
}>("POST", `config/config_entries/entry/${configEntryId}/reload`);
|
||||||
|
|
||||||
|
export interface DisableConfigEntryResult {
|
||||||
|
require_restart: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export const disableConfigEntry = (
|
export const disableConfigEntry = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
configEntryId: string
|
configEntryId: string
|
||||||
) =>
|
) =>
|
||||||
hass.callWS<{
|
hass.callWS<DisableConfigEntryResult>({
|
||||||
require_restart: boolean;
|
|
||||||
}>({
|
|
||||||
type: "config_entries/disable",
|
type: "config_entries/disable",
|
||||||
entry_id: configEntryId,
|
entry_id: configEntryId,
|
||||||
disabled_by: "user",
|
disabled_by: "user",
|
||||||
@ -72,17 +73,3 @@ export const enableConfigEntry = (hass: HomeAssistant, configEntryId: string) =>
|
|||||||
entry_id: configEntryId,
|
entry_id: configEntryId,
|
||||||
disabled_by: null,
|
disabled_by: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateConfigEntrySystemOptions = (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
configEntryId: string,
|
|
||||||
params: Partial<ConfigEntrySystemOptions>
|
|
||||||
) =>
|
|
||||||
hass.callWS<{
|
|
||||||
require_restart: boolean;
|
|
||||||
system_options: ConfigEntrySystemOptions;
|
|
||||||
}>({
|
|
||||||
type: "config_entries/system_options/update",
|
|
||||||
entry_id: configEntryId,
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
@ -7,7 +7,10 @@ import "../../components/ha-dialog";
|
|||||||
import "../../components/ha-formfield";
|
import "../../components/ha-formfield";
|
||||||
import "../../components/ha-switch";
|
import "../../components/ha-switch";
|
||||||
import type { HaSwitch } from "../../components/ha-switch";
|
import type { HaSwitch } from "../../components/ha-switch";
|
||||||
import { updateConfigEntrySystemOptions } from "../../data/config_entries";
|
import {
|
||||||
|
ConfigEntryMutableParams,
|
||||||
|
updateConfigEntry,
|
||||||
|
} from "../../data/config_entries";
|
||||||
import { haStyleDialog } from "../../resources/styles";
|
import { haStyleDialog } from "../../resources/styles";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
import { showAlertDialog } from "../generic/show-dialog-box";
|
import { showAlertDialog } from "../generic/show-dialog-box";
|
||||||
@ -32,8 +35,8 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._disableNewEntities = params.entry.system_options.disable_new_entities;
|
this._disableNewEntities = params.entry.pref_disable_new_entities;
|
||||||
this._disablePolling = params.entry.system_options.disable_polling;
|
this._disablePolling = params.entry.pref_disable_polling;
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog(): void {
|
||||||
@ -147,14 +150,14 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||||||
|
|
||||||
private async _updateEntry(): Promise<void> {
|
private async _updateEntry(): Promise<void> {
|
||||||
this._submitting = true;
|
this._submitting = true;
|
||||||
const data: Parameters<typeof updateConfigEntrySystemOptions>[2] = {
|
const data: ConfigEntryMutableParams = {
|
||||||
disable_new_entities: this._disableNewEntities,
|
pref_disable_new_entities: this._disableNewEntities,
|
||||||
};
|
};
|
||||||
if (this._allowUpdatePolling()) {
|
if (this._allowUpdatePolling()) {
|
||||||
data.disable_polling = this._disablePolling;
|
data.pref_disable_polling = this._disablePolling;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const result = await updateConfigEntrySystemOptions(
|
const result = await updateConfigEntry(
|
||||||
this.hass,
|
this.hass,
|
||||||
this._params!.entry.entry_id,
|
this._params!.entry.entry_id,
|
||||||
data
|
data
|
||||||
@ -166,15 +169,8 @@ class DialogConfigEntrySystemOptions extends LitElement {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const curEntry = this._params!.entry;
|
this._params!.entryUpdated(result.config_entry);
|
||||||
this._params!.entryUpdated({
|
this.closeDialog();
|
||||||
...curEntry,
|
|
||||||
system_options: {
|
|
||||||
...curEntry.system_options,
|
|
||||||
...data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
this._params = undefined;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err.message || "Unknown error";
|
this._error = err.message || "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -638,18 +638,6 @@ export class QuickBar extends LitElement {
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-virtualizer-host {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
contain: strict;
|
|
||||||
overflow: auto;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-virtualizer-host > * {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
mwc-list-item {
|
mwc-list-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ class HassTabsSubpage extends LitElement {
|
|||||||
color: var(--sidebar-text-color);
|
color: var(--sidebar-text-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
:host([narrow]) .toolbar a {
|
.bottom-bar a {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,13 +9,14 @@ import {
|
|||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import "../../../components/ha-network";
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-checkbox";
|
import "../../../components/ha-checkbox";
|
||||||
|
import "../../../components/ha-network";
|
||||||
import "../../../components/ha-settings-row";
|
import "../../../components/ha-settings-row";
|
||||||
|
import { fetchNetworkInfo } from "../../../data/hassio/network";
|
||||||
import {
|
import {
|
||||||
NetworkConfig,
|
|
||||||
getNetworkConfig,
|
getNetworkConfig,
|
||||||
|
NetworkConfig,
|
||||||
setNetworkConfig,
|
setNetworkConfig,
|
||||||
} from "../../../data/network";
|
} from "../../../data/network";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
@ -73,7 +74,19 @@ class ConfigNetwork extends LitElement {
|
|||||||
private async _load() {
|
private async _load() {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
try {
|
try {
|
||||||
this._networkConfig = await getNetworkConfig(this.hass);
|
const coreNetwork = await getNetworkConfig(this.hass);
|
||||||
|
if (isComponentLoaded(this.hass, "hassio")) {
|
||||||
|
const supervisorNetwork = await fetchNetworkInfo(this.hass);
|
||||||
|
const interfaces = new Set(
|
||||||
|
supervisorNetwork.interfaces.map((int) => int.interface)
|
||||||
|
);
|
||||||
|
if (interfaces.size) {
|
||||||
|
coreNetwork.adapters = coreNetwork.adapters.filter((adapter) =>
|
||||||
|
interfaces.has(adapter.name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._networkConfig = coreNetwork;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err.message || err;
|
this._error = err.message || err;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,11 @@ import { slugify } from "../../../common/string/slugify";
|
|||||||
import "../../../components/entity/ha-battery-icon";
|
import "../../../components/entity/ha-battery-icon";
|
||||||
import "../../../components/ha-icon-next";
|
import "../../../components/ha-icon-next";
|
||||||
import { AreaRegistryEntry } from "../../../data/area_registry";
|
import { AreaRegistryEntry } from "../../../data/area_registry";
|
||||||
import { ConfigEntry, disableConfigEntry } from "../../../data/config_entries";
|
import {
|
||||||
|
ConfigEntry,
|
||||||
|
disableConfigEntry,
|
||||||
|
DisableConfigEntryResult,
|
||||||
|
} from "../../../data/config_entries";
|
||||||
import {
|
import {
|
||||||
computeDeviceName,
|
computeDeviceName,
|
||||||
DeviceRegistryEntry,
|
DeviceRegistryEntry,
|
||||||
@ -25,7 +29,10 @@ import {
|
|||||||
} from "../../../data/entity_registry";
|
} from "../../../data/entity_registry";
|
||||||
import { SceneEntities, showSceneEditor } from "../../../data/scene";
|
import { SceneEntities, showSceneEditor } from "../../../data/scene";
|
||||||
import { findRelated, RelatedResult } from "../../../data/search";
|
import { findRelated, RelatedResult } from "../../../data/search";
|
||||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
import {
|
||||||
|
showAlertDialog,
|
||||||
|
showConfirmationDialog,
|
||||||
|
} from "../../../dialogs/generic/show-dialog-box";
|
||||||
import "../../../layouts/hass-error-screen";
|
import "../../../layouts/hass-error-screen";
|
||||||
import "../../../layouts/hass-tabs-subpage";
|
import "../../../layouts/hass-tabs-subpage";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
@ -671,13 +678,41 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
dismissText: this.hass.localize("ui.common.no"),
|
dismissText: this.hass.localize("ui.common.no"),
|
||||||
}))
|
}))
|
||||||
) {
|
) {
|
||||||
disableConfigEntry(this.hass, cnfg_entry);
|
let result: DisableConfigEntryResult;
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
result = await disableConfigEntry(this.hass, cnfg_entry);
|
||||||
|
} catch (err) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable_error"
|
||||||
|
),
|
||||||
|
text: err.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result.require_restart) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
text: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable_restart_confirm"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
delete updates.disabled_by;
|
delete updates.disabled_by;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
|
await updateDeviceRegistryEntry(this.hass, this.deviceId, updates);
|
||||||
|
} catch (err) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.devices.update_device_error"
|
||||||
|
),
|
||||||
|
text: err.message,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!oldDeviceName ||
|
!oldDeviceName ||
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
deleteConfigEntry,
|
deleteConfigEntry,
|
||||||
disableConfigEntry,
|
disableConfigEntry,
|
||||||
|
DisableConfigEntryResult,
|
||||||
enableConfigEntry,
|
enableConfigEntry,
|
||||||
reloadConfigEntry,
|
reloadConfigEntry,
|
||||||
updateConfigEntry,
|
updateConfigEntry,
|
||||||
@ -487,7 +488,18 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = await disableConfigEntry(this.hass, entryId);
|
let result: DisableConfigEntryResult;
|
||||||
|
try {
|
||||||
|
result = await disableConfigEntry(this.hass, entryId);
|
||||||
|
} catch (err) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable_error"
|
||||||
|
),
|
||||||
|
text: err.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (result.require_restart) {
|
if (result.require_restart) {
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
text: this.hass.localize(
|
text: this.hass.localize(
|
||||||
@ -503,7 +515,18 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
private async _enableIntegration(configEntry: ConfigEntry) {
|
private async _enableIntegration(configEntry: ConfigEntry) {
|
||||||
const entryId = configEntry.entry_id;
|
const entryId = configEntry.entry_id;
|
||||||
|
|
||||||
const result = await enableConfigEntry(this.hass, entryId);
|
let result: DisableConfigEntryResult;
|
||||||
|
try {
|
||||||
|
result = await enableConfigEntry(this.hass, entryId);
|
||||||
|
} catch (err) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.disable_error"
|
||||||
|
),
|
||||||
|
text: err.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (result.require_restart) {
|
if (result.require_restart) {
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
@ -567,10 +590,10 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
if (newName === null) {
|
if (newName === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newEntry = await updateConfigEntry(this.hass, configEntry.entry_id, {
|
const result = await updateConfigEntry(this.hass, configEntry.entry_id, {
|
||||||
title: newName,
|
title: newName,
|
||||||
});
|
});
|
||||||
fireEvent(this, "entry-updated", { entry: newEntry });
|
fireEvent(this, "entry-updated", { entry: result.config_entry });
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -63,7 +63,7 @@ export class HaIntegrationHeader extends LitElement {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.configEntry?.system_options.disable_polling) {
|
if (this.configEntry?.pref_disable_polling) {
|
||||||
icons.push([
|
icons.push([
|
||||||
mdiSyncOff,
|
mdiSyncOff,
|
||||||
this.hass.localize(
|
this.hass.localize(
|
||||||
|
@ -353,15 +353,7 @@ class HaLogbook extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:host([virtualize]) .container {
|
:host([virtualize]) .container {
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
contain: strict;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container > * {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.narrow .entry {
|
.narrow .entry {
|
||||||
|
@ -1975,6 +1975,7 @@
|
|||||||
"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!",
|
||||||
"confirm_disable_config_entry": "There are no more devices for the config entry {entry_name}, do you want to instead disable the config entry?",
|
"confirm_disable_config_entry": "There are no more devices for the config entry {entry_name}, do you want to instead disable the config entry?",
|
||||||
|
"update_device_error": "Updating the device failed",
|
||||||
"disabled": "Disabled",
|
"disabled": "Disabled",
|
||||||
"data_table": {
|
"data_table": {
|
||||||
"device": "Device",
|
"device": "Device",
|
||||||
@ -2163,6 +2164,7 @@
|
|||||||
"reload_restart_confirm": "Restart Home Assistant to finish reloading this integration",
|
"reload_restart_confirm": "Restart Home Assistant to finish reloading this integration",
|
||||||
"disable_restart_confirm": "Restart Home Assistant to finish disabling this integration",
|
"disable_restart_confirm": "Restart Home Assistant to finish disabling this integration",
|
||||||
"enable_restart_confirm": "Restart Home Assistant to finish enabling this integration",
|
"enable_restart_confirm": "Restart Home Assistant to finish enabling this integration",
|
||||||
|
"disable_error": "Enabling or disabling of the integration failed",
|
||||||
"manuf": "by {manufacturer}",
|
"manuf": "by {manufacturer}",
|
||||||
"hub": "Connected via",
|
"hub": "Connected via",
|
||||||
"firmware": "Firmware: {version}",
|
"firmware": "Firmware: {version}",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user