Add template to the list of reloadables (#6673)
Make reloadable check to see if the service is loaded instead of the component
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
|
/** Return if a service is loaded. */
|
||||||
|
export const isServiceLoaded = (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
domain: string,
|
||||||
|
service: string
|
||||||
|
): boolean =>
|
||||||
|
hass && domain in hass.services && service in hass.services[domain];
|
||||||
@@ -16,7 +16,7 @@ import { HomeAssistant, Route } from "../../../types";
|
|||||||
|
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import "@polymer/paper-input/paper-input";
|
import "@polymer/paper-input/paper-input";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_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 "../ha-config-section";
|
||||||
@@ -35,6 +35,7 @@ const reloadableDomains = [
|
|||||||
"input_number",
|
"input_number",
|
||||||
"input_datetime",
|
"input_datetime",
|
||||||
"input_select",
|
"input_select",
|
||||||
|
"template",
|
||||||
];
|
];
|
||||||
|
|
||||||
@customElement("ha-config-server-control")
|
@customElement("ha-config-server-control")
|
||||||
@@ -202,7 +203,7 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
</ha-call-service-button>
|
</ha-call-service-button>
|
||||||
</div>
|
</div>
|
||||||
${reloadableDomains.map((domain) =>
|
${reloadableDomains.map((domain) =>
|
||||||
isComponentLoaded(this.hass, domain)
|
isServiceLoaded(this.hass, domain, "reload")
|
||||||
? html`<div class="card-actions">
|
? html`<div class="card-actions">
|
||||||
<ha-call-service-button
|
<ha-call-service-button
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
|||||||
@@ -812,7 +812,8 @@
|
|||||||
"input_text": "Reload input texts",
|
"input_text": "Reload input texts",
|
||||||
"input_number": "Reload input numbers",
|
"input_number": "Reload input numbers",
|
||||||
"input_datetime": "Reload input date times",
|
"input_datetime": "Reload input date times",
|
||||||
"input_select": "Reload input selects"
|
"input_select": "Reload input selects",
|
||||||
|
"template": "Reload template entities"
|
||||||
},
|
},
|
||||||
"server_management": {
|
"server_management": {
|
||||||
"heading": "Server management",
|
"heading": "Server management",
|
||||||
|
|||||||
Reference in New Issue
Block a user