mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Generalize reloadableDomains (#6773)
* Generalize reloadableDomains * Add back translations
This commit is contained in:
parent
d9e8b53ffe
commit
d16e2f37d4
@ -1,25 +1,26 @@
|
|||||||
import "@material/mwc-tab-bar";
|
|
||||||
import "@material/mwc-tab";
|
|
||||||
import "@material/mwc-icon-button";
|
import "@material/mwc-icon-button";
|
||||||
|
import "@material/mwc-tab";
|
||||||
|
import "@material/mwc-tab-bar";
|
||||||
|
import { mdiClose, mdiTune } from "@mdi/js";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
customElement,
|
customElement,
|
||||||
html,
|
html,
|
||||||
|
internalProperty,
|
||||||
LitElement,
|
LitElement,
|
||||||
property,
|
property,
|
||||||
internalProperty,
|
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { cache } from "lit-html/directives/cache";
|
import { cache } from "lit-html/directives/cache";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
|
||||||
import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
|
import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
|
||||||
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import "../../../components/ha-dialog";
|
import "../../../components/ha-dialog";
|
||||||
import "../../../components/ha-header-bar";
|
import "../../../components/ha-header-bar";
|
||||||
import "../../../components/ha-svg-icon";
|
|
||||||
import "../../../components/ha-related-items";
|
import "../../../components/ha-related-items";
|
||||||
|
import "../../../components/ha-svg-icon";
|
||||||
import {
|
import {
|
||||||
EntityRegistryEntry,
|
EntityRegistryEntry,
|
||||||
ExtEntityRegistryEntry,
|
ExtEntityRegistryEntry,
|
||||||
@ -30,7 +31,6 @@ import type { HomeAssistant } from "../../../types";
|
|||||||
import { PLATFORMS_WITH_SETTINGS_TAB } from "./const";
|
import { PLATFORMS_WITH_SETTINGS_TAB } from "./const";
|
||||||
import "./entity-registry-settings";
|
import "./entity-registry-settings";
|
||||||
import type { EntityRegistryDetailDialogParams } from "./show-dialog-entity-editor";
|
import type { EntityRegistryDetailDialogParams } from "./show-dialog-entity-editor";
|
||||||
import { mdiClose, mdiTune } from "@mdi/js";
|
|
||||||
|
|
||||||
interface Tabs {
|
interface Tabs {
|
||||||
[key: string]: Tab;
|
[key: string]: Tab;
|
||||||
@ -252,7 +252,7 @@ export class DialogEntityEditor extends LitElement {
|
|||||||
|
|
||||||
@media all and (min-width: 451px) and (min-height: 501px) {
|
@media all and (min-width: 451px) and (min-height: 501px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 400px;
|
min-width: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,55 +1,27 @@
|
|||||||
|
import "@material/mwc-button";
|
||||||
import "@polymer/app-layout/app-header/app-header";
|
import "@polymer/app-layout/app-header/app-header";
|
||||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
||||||
import "../../../layouts/hass-tabs-subpage";
|
import "@polymer/paper-input/paper-input";
|
||||||
import { configSections } from "../ha-panel-config";
|
|
||||||
import {
|
import {
|
||||||
LitElement,
|
|
||||||
property,
|
|
||||||
internalProperty,
|
|
||||||
customElement,
|
|
||||||
html,
|
|
||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
internalProperty,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { HomeAssistant, Route } from "../../../types";
|
|
||||||
|
|
||||||
import "@material/mwc-button";
|
|
||||||
import "@polymer/paper-input/paper-input";
|
|
||||||
import { isServiceLoaded } from "../../../common/config/is_service_loaded";
|
import { isServiceLoaded } from "../../../common/config/is_service_loaded";
|
||||||
import "../../../components/buttons/ha-call-service-button";
|
import "../../../components/buttons/ha-call-service-button";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../ha-config-section";
|
|
||||||
import { haStyle } from "../../../resources/styles";
|
|
||||||
import { checkCoreConfig } from "../../../data/core";
|
import { checkCoreConfig } from "../../../data/core";
|
||||||
|
import { domainToName } from "../../../data/integration";
|
||||||
const reloadableDomains = [
|
import "../../../layouts/hass-tabs-subpage";
|
||||||
"group",
|
import { haStyle } from "../../../resources/styles";
|
||||||
"automation",
|
import { HomeAssistant, Route } from "../../../types";
|
||||||
"script",
|
import "../ha-config-section";
|
||||||
"scene",
|
import { configSections } from "../ha-panel-config";
|
||||||
"person",
|
|
||||||
"zone",
|
|
||||||
"input_boolean",
|
|
||||||
"input_text",
|
|
||||||
"input_number",
|
|
||||||
"input_datetime",
|
|
||||||
"input_select",
|
|
||||||
"template",
|
|
||||||
"universal",
|
|
||||||
"rest",
|
|
||||||
"command_line",
|
|
||||||
"filter",
|
|
||||||
"statistics",
|
|
||||||
"generic",
|
|
||||||
"generic_thermostat",
|
|
||||||
"homekit",
|
|
||||||
"min_max",
|
|
||||||
"history_stats",
|
|
||||||
"trend",
|
|
||||||
"ping",
|
|
||||||
"filesize",
|
|
||||||
];
|
|
||||||
|
|
||||||
@customElement("ha-config-server-control")
|
@customElement("ha-config-server-control")
|
||||||
export class HaConfigServerControl extends LitElement {
|
export class HaConfigServerControl extends LitElement {
|
||||||
@ -65,10 +37,26 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
|
|
||||||
@internalProperty() private _validating = false;
|
@internalProperty() private _validating = false;
|
||||||
|
|
||||||
|
@internalProperty() private _reloadableDomains: string[] = [];
|
||||||
|
|
||||||
private _validateLog = "";
|
private _validateLog = "";
|
||||||
|
|
||||||
private _isValid: boolean | null = null;
|
private _isValid: boolean | null = null;
|
||||||
|
|
||||||
|
protected updated(changedProperties) {
|
||||||
|
const oldHass = changedProperties.get("hass");
|
||||||
|
if (
|
||||||
|
changedProperties.has("hass") &&
|
||||||
|
(!oldHass || oldHass.config.components !== this.hass.config.components)
|
||||||
|
) {
|
||||||
|
this._reloadableDomains = this.hass.config.components.filter(
|
||||||
|
(component) =>
|
||||||
|
!component.includes(".") &&
|
||||||
|
isServiceLoaded(this.hass, component, "reload")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<hass-tabs-subpage
|
<hass-tabs-subpage
|
||||||
@ -215,7 +203,7 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
)}
|
)}
|
||||||
</ha-call-service-button>
|
</ha-call-service-button>
|
||||||
</div>
|
</div>
|
||||||
${reloadableDomains.map((domain) =>
|
${this._reloadableDomains.map((domain) =>
|
||||||
isServiceLoaded(this.hass, domain, "reload")
|
isServiceLoaded(this.hass, domain, "reload")
|
||||||
? html`<div class="card-actions">
|
? html`<div class="card-actions">
|
||||||
<ha-call-service-button
|
<ha-call-service-button
|
||||||
@ -224,6 +212,11 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
service="reload"
|
service="reload"
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(
|
||||||
`ui.panel.config.server_control.section.reloading.${domain}`
|
`ui.panel.config.server_control.section.reloading.${domain}`
|
||||||
|
) ||
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.panel.config.server_control.section.reloading.reload",
|
||||||
|
"domain",
|
||||||
|
domainToName(this.hass.localize, domain)
|
||||||
)}
|
)}
|
||||||
</ha-call-service-button>
|
</ha-call-service-button>
|
||||||
</div>`
|
</div>`
|
||||||
@ -282,6 +275,10 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ha-config-section {
|
||||||
|
padding-bottom: 24px;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -827,6 +827,7 @@
|
|||||||
"reloading": {
|
"reloading": {
|
||||||
"heading": "YAML configuration reloading",
|
"heading": "YAML configuration reloading",
|
||||||
"introduction": "Some parts of Home Assistant can reload without requiring a restart. Hitting reload will unload their current YAML configuration and load the new one.",
|
"introduction": "Some parts of Home Assistant can reload without requiring a restart. Hitting reload will unload their current YAML configuration and load the new one.",
|
||||||
|
"reload": "Reload {domain}",
|
||||||
"core": "Reload location & customizations",
|
"core": "Reload location & customizations",
|
||||||
"group": "Reload groups",
|
"group": "Reload groups",
|
||||||
"automation": "Reload automations",
|
"automation": "Reload automations",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user