mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +00:00
Display services as services and not devices (#6798)
* Display services as services and not devices * remove seperator * Add comma * Update src/panels/config/integrations/ha-integration-card.ts Co-authored-by: Bram Kragten <mail@bramkragten.nl> * Fix spacing * Remove check Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
8f8a2cea56
commit
3fd7899b93
@ -137,6 +137,7 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
|
|
||||||
private _renderSingleEntry(item: ConfigEntryExtended): TemplateResult {
|
private _renderSingleEntry(item: ConfigEntryExtended): TemplateResult {
|
||||||
const devices = this._getDevices(item);
|
const devices = this._getDevices(item);
|
||||||
|
const services = this._getServices(item);
|
||||||
const entities = this._getEntities(item);
|
const entities = this._getEntities(item);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
@ -168,7 +169,7 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
<h3>
|
<h3>
|
||||||
${item.localized_domain_name === item.title ? "" : item.title}
|
${item.localized_domain_name === item.title ? "" : item.title}
|
||||||
</h3>
|
</h3>
|
||||||
${devices.length || entities.length
|
${devices.length || services.length || entities.length
|
||||||
? html`
|
? html`
|
||||||
<div>
|
<div>
|
||||||
${devices.length
|
${devices.length
|
||||||
@ -180,10 +181,22 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
"count",
|
"count",
|
||||||
devices.length
|
devices.length
|
||||||
)}</a
|
)}</a
|
||||||
|
>${services.length ? "," : ""}
|
||||||
|
`
|
||||||
|
: ""}
|
||||||
|
${services.length
|
||||||
|
? html`
|
||||||
|
<a
|
||||||
|
href=${`/config/devices/dashboard?historyBack=1&config_entry=${item.entry_id}`}
|
||||||
|
>${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.services",
|
||||||
|
"count",
|
||||||
|
services.length
|
||||||
|
)}</a
|
||||||
>
|
>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${devices.length && entities.length
|
${(devices.length || services.length) && entities.length
|
||||||
? this.hass.localize("ui.common.and")
|
? this.hass.localize("ui.common.and")
|
||||||
: ""}
|
: ""}
|
||||||
${entities.length
|
${entities.length
|
||||||
@ -304,8 +317,21 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
if (!this.deviceRegistryEntries) {
|
if (!this.deviceRegistryEntries) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return this.deviceRegistryEntries.filter((device) =>
|
return this.deviceRegistryEntries.filter(
|
||||||
device.config_entries.includes(configEntry.entry_id)
|
(device) =>
|
||||||
|
device.config_entries.includes(configEntry.entry_id) &&
|
||||||
|
device.entry_type !== "service"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getServices(configEntry: ConfigEntry): DeviceRegistryEntry[] {
|
||||||
|
if (!this.deviceRegistryEntries) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return this.deviceRegistryEntries.filter(
|
||||||
|
(device) =>
|
||||||
|
device.config_entries.includes(configEntry.entry_id) &&
|
||||||
|
device.entry_type === "service"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,6 +1638,7 @@
|
|||||||
"config_entry": {
|
"config_entry": {
|
||||||
"devices": "{count} {count, plural,\n one {device}\n other {devices}\n}",
|
"devices": "{count} {count, plural,\n one {device}\n other {devices}\n}",
|
||||||
"entities": "{count} {count, plural,\n one {entity}\n other {entities}\n}",
|
"entities": "{count} {count, plural,\n one {entity}\n other {entities}\n}",
|
||||||
|
"services": "{count} {count, plural,\n one {service}\n other {services}\n}",
|
||||||
"rename": "Rename",
|
"rename": "Rename",
|
||||||
"options": "Options",
|
"options": "Options",
|
||||||
"system_options": "System options",
|
"system_options": "System options",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user