mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
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:
parent
a90203f256
commit
42d421a6fc
9
src/common/config/is_service_loaded.ts
Normal file
9
src/common/config/is_service_loaded.ts
Normal 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];
|
@ -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}
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user