1
mirror of https://github.com/home-assistant/frontend synced 2024-08-30 01:56:15 +02:00

Add reload_themes and reload_core_config to quick bar (#11072)

This commit is contained in:
Philip Allgaier 2022-01-07 17:47:57 +01:00 committed by GitHub
parent 595e13ecac
commit 48a800882e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 24 deletions

View File

@ -428,32 +428,54 @@ export class QuickBar extends LitElement {
}
private _generateReloadCommands(): CommandItem[] {
const reloadableDomains = componentsWithService(this.hass, "reload").sort();
// Get all domains that have a direct "reload" service
const reloadableDomains = componentsWithService(this.hass, "reload");
return reloadableDomains.map((domain) => {
const commandItem = {
primaryText:
this.hass.localize(
`ui.dialogs.quick-bar.commands.reload.${domain}`
) ||
this.hass.localize(
"ui.dialogs.quick-bar.commands.reload.reload",
"domain",
domainToName(this.hass.localize, domain)
),
action: () => this.hass.callService(domain, "reload"),
iconPath: mdiReload,
categoryText: this.hass.localize(
`ui.dialogs.quick-bar.commands.types.reload`
const commands = reloadableDomains.map((domain) => ({
primaryText:
this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) ||
this.hass.localize(
"ui.dialogs.quick-bar.commands.reload.reload",
"domain",
domainToName(this.hass.localize, domain)
),
};
action: () => this.hass.callService(domain, "reload"),
iconPath: mdiReload,
categoryText: this.hass.localize(
`ui.dialogs.quick-bar.commands.types.reload`
),
}));
return {
...commandItem,
categoryKey: "reload",
strings: [`${commandItem.categoryText} ${commandItem.primaryText}`],
};
// Add "frontend.reload_themes"
commands.push({
primaryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.reload.themes"
),
action: () => this.hass.callService("frontend", "reload_themes"),
iconPath: mdiReload,
categoryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.types.reload"
),
});
// Add "homeassistant.reload_core_config"
commands.push({
primaryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.reload.core"
),
action: () =>
this.hass.callService("homeassistant", "reload_core_config"),
iconPath: mdiReload,
categoryText: this.hass.localize(
"ui.dialogs.quick-bar.commands.types.reload"
),
});
return commands.map((command) => ({
...command,
categoryKey: "reload",
strings: [`${command.categoryText} ${command.primaryText}`],
}));
}
private _generateServerControlCommands(): CommandItem[] {

View File

@ -590,7 +590,8 @@
"telegram": "[%key:ui::panel::config::server_control::section::reloading::telegram%]",
"smtp": "[%key:ui::panel::config::server_control::section::reloading::smtp%]",
"mqtt": "[%key:ui::panel::config::server_control::section::reloading::mqtt%]",
"rpi_gpio": "[%key:ui::panel::config::server_control::section::reloading::rpi_gpio%]"
"rpi_gpio": "[%key:ui::panel::config::server_control::section::reloading::rpi_gpio%]",
"themes": "[%key:ui::panel::config::server_control::section::reloading::themes%]"
},
"server_control": {
"perform_action": "{action} server",
@ -1462,7 +1463,8 @@
"smtp": "SMTP notify services",
"mqtt": "Manually configured MQTT entities",
"rpi_gpio": "Raspberry Pi GPIO entities",
"timer": "Timers"
"timer": "Timers",
"themes": "Themes"
},
"server_management": {
"heading": "Server management",