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-tab";
|
||||
import "@material/mwc-tab-bar";
|
||||
import { mdiClose, mdiTune } from "@mdi/js";
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import {
|
||||
css,
|
||||
CSSResult,
|
||||
customElement,
|
||||
html,
|
||||
internalProperty,
|
||||
LitElement,
|
||||
property,
|
||||
internalProperty,
|
||||
TemplateResult,
|
||||
} from "lit-element";
|
||||
import { cache } from "lit-html/directives/cache";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||
import "../../../components/ha-dialog";
|
||||
import "../../../components/ha-header-bar";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import "../../../components/ha-related-items";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import {
|
||||
EntityRegistryEntry,
|
||||
ExtEntityRegistryEntry,
|
||||
@ -30,7 +31,6 @@ import type { HomeAssistant } from "../../../types";
|
||||
import { PLATFORMS_WITH_SETTINGS_TAB } from "./const";
|
||||
import "./entity-registry-settings";
|
||||
import type { EntityRegistryDetailDialogParams } from "./show-dialog-entity-editor";
|
||||
import { mdiClose, mdiTune } from "@mdi/js";
|
||||
|
||||
interface Tabs {
|
||||
[key: string]: Tab;
|
||||
@ -252,7 +252,7 @@ export class DialogEntityEditor extends LitElement {
|
||||
|
||||
@media all and (min-width: 451px) and (min-height: 501px) {
|
||||
.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-toolbar/app-toolbar";
|
||||
import "../../../layouts/hass-tabs-subpage";
|
||||
import { configSections } from "../ha-panel-config";
|
||||
import "@polymer/paper-input/paper-input";
|
||||
import {
|
||||
LitElement,
|
||||
property,
|
||||
internalProperty,
|
||||
customElement,
|
||||
html,
|
||||
css,
|
||||
CSSResult,
|
||||
customElement,
|
||||
html,
|
||||
internalProperty,
|
||||
LitElement,
|
||||
property,
|
||||
TemplateResult,
|
||||
} 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 "../../../components/buttons/ha-call-service-button";
|
||||
import "../../../components/ha-card";
|
||||
import "../ha-config-section";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import { checkCoreConfig } from "../../../data/core";
|
||||
|
||||
const reloadableDomains = [
|
||||
"group",
|
||||
"automation",
|
||||
"script",
|
||||
"scene",
|
||||
"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",
|
||||
];
|
||||
import { domainToName } from "../../../data/integration";
|
||||
import "../../../layouts/hass-tabs-subpage";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import { HomeAssistant, Route } from "../../../types";
|
||||
import "../ha-config-section";
|
||||
import { configSections } from "../ha-panel-config";
|
||||
|
||||
@customElement("ha-config-server-control")
|
||||
export class HaConfigServerControl extends LitElement {
|
||||
@ -65,10 +37,26 @@ export class HaConfigServerControl extends LitElement {
|
||||
|
||||
@internalProperty() private _validating = false;
|
||||
|
||||
@internalProperty() private _reloadableDomains: string[] = [];
|
||||
|
||||
private _validateLog = "";
|
||||
|
||||
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 {
|
||||
return html`
|
||||
<hass-tabs-subpage
|
||||
@ -215,7 +203,7 @@ export class HaConfigServerControl extends LitElement {
|
||||
)}
|
||||
</ha-call-service-button>
|
||||
</div>
|
||||
${reloadableDomains.map((domain) =>
|
||||
${this._reloadableDomains.map((domain) =>
|
||||
isServiceLoaded(this.hass, domain, "reload")
|
||||
? html`<div class="card-actions">
|
||||
<ha-call-service-button
|
||||
@ -224,6 +212,11 @@ export class HaConfigServerControl extends LitElement {
|
||||
service="reload"
|
||||
>${this.hass.localize(
|
||||
`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>
|
||||
</div>`
|
||||
@ -282,6 +275,10 @@ export class HaConfigServerControl extends LitElement {
|
||||
white-space: pre-wrap;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
ha-config-section {
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@ -827,6 +827,7 @@
|
||||
"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.",
|
||||
"reload": "Reload {domain}",
|
||||
"core": "Reload location & customizations",
|
||||
"group": "Reload groups",
|
||||
"automation": "Reload automations",
|
||||
|
Loading…
x
Reference in New Issue
Block a user