Add reload_themes and reload_core_config to quick bar ()

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
src
dialogs/quick-bar
translations

@ -428,14 +428,12 @@ export class QuickBar extends LitElement {
} }
private _generateReloadCommands(): CommandItem[] { 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 commands = reloadableDomains.map((domain) => ({
const commandItem = {
primaryText: primaryText:
this.hass.localize( this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) ||
`ui.dialogs.quick-bar.commands.reload.${domain}`
) ||
this.hass.localize( this.hass.localize(
"ui.dialogs.quick-bar.commands.reload.reload", "ui.dialogs.quick-bar.commands.reload.reload",
"domain", "domain",
@ -446,14 +444,38 @@ export class QuickBar extends LitElement {
categoryText: this.hass.localize( categoryText: this.hass.localize(
`ui.dialogs.quick-bar.commands.types.reload` `ui.dialogs.quick-bar.commands.types.reload`
), ),
}; }));
return { // Add "frontend.reload_themes"
...commandItem, commands.push({
categoryKey: "reload", primaryText: this.hass.localize(
strings: [`${commandItem.categoryText} ${commandItem.primaryText}`], "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[] { private _generateServerControlCommands(): CommandItem[] {

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