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:
J. Nick Koston 2020-08-24 07:32:52 -05:00 committed by GitHub
parent a90203f256
commit 42d421a6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -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];

View File

@ -16,7 +16,7 @@ import { HomeAssistant, Route } from "../../../types";
import "@material/mwc-button";
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/ha-card";
import "../ha-config-section";
@ -35,6 +35,7 @@ const reloadableDomains = [
"input_number",
"input_datetime",
"input_select",
"template",
];
@customElement("ha-config-server-control")
@ -202,7 +203,7 @@ export class HaConfigServerControl extends LitElement {
</ha-call-service-button>
</div>
${reloadableDomains.map((domain) =>
isComponentLoaded(this.hass, domain)
isServiceLoaded(this.hass, domain, "reload")
? html`<div class="card-actions">
<ha-call-service-button
.hass=${this.hass}

View File

@ -812,7 +812,8 @@
"input_text": "Reload input texts",
"input_number": "Reload input numbers",
"input_datetime": "Reload input date times",
"input_select": "Reload input selects"
"input_select": "Reload input selects",
"template": "Reload template entities"
},
"server_management": {
"heading": "Server management",