Fix translation loading and manifest fetching for integration page (#21501)

This commit is contained in:
Bram Kragten 2024-07-30 12:48:28 +02:00 committed by GitHub
parent 4ade39543d
commit a5786b4761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 4 deletions

View File

@ -266,7 +266,8 @@ export class HaTabsSubpageDataTable extends LitElement {
<ha-assist-chip
.label=${localize("ui.components.subpage-data-table.sort_by", {
sortColumn: this._sortColumn
? ` ${this.columns[this._sortColumn].title || this.columns[this._sortColumn].label}`
? ` ${this.columns[this._sortColumn]?.title || this.columns[this._sortColumn]?.label}` ||
""
: "",
})}
id="sort-by-anchor"

View File

@ -538,7 +538,9 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
</h1>
${normalEntries.length === 0
? html`<div class="card-content no-entries">
${this.hass.config.components.find(
${this._manifest &&
!this._manifest.config_flow &&
this.hass.config.components.find(
(comp) => comp.split(".")[0] === this.domain
)
? this.hass.localize(

View File

@ -172,6 +172,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
if (
!entryDomains.has(componentDomain) &&
manifests[componentDomain] &&
!manifests[componentDomain].config_flow &&
(!manifests[componentDomain].integration_type ||
["device", "hub", "service", "integration"].includes(
manifests[componentDomain].integration_type!
@ -314,6 +315,11 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
this.configEntriesInProgress.map((flow) => flow.handler)
);
}
if (changed.has("configEntries") && this.configEntries) {
this._fetchIntegrationManifests(
this.configEntries.map((entry) => entry.domain)
);
}
}
protected render() {

View File

@ -151,7 +151,10 @@ class HaConfigIntegrations extends SubscribeMixin(HassRouterPage) {
if (this.hasUpdated) {
return;
}
this._loadTranslationsPromise = this.hass.loadBackendTranslation("title");
this._loadTranslationsPromise = this.hass.loadBackendTranslation(
"title",
this.hass.config.components.map((comp) => comp.split(".")[0])
);
}
protected updatePageEl(pageEl) {

View File

@ -182,7 +182,7 @@ export class HaIntegrationCard extends LitElement {
>
</div>`
: nothing}
${!this.manifest?.config_flow
${this.manifest && !this.manifest?.config_flow
? html`<div class="icon yaml">
<ha-svg-icon .path=${mdiCodeBraces}></ha-svg-icon>
<simple-tooltip