mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix translations onboarding integration (#17980)
This commit is contained in:
parent
f3513e3e52
commit
1c79fcc244
@ -45,13 +45,12 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
public hassSubscribe(): Array<UnsubscribeFunc | Promise<UnsubscribeFunc>> {
|
public hassSubscribe(): Array<UnsubscribeFunc | Promise<UnsubscribeFunc>> {
|
||||||
return [
|
return [
|
||||||
subscribeConfigFlowInProgress(this.hass, (flows) => {
|
subscribeConfigFlowInProgress(this.hass, (flows) => {
|
||||||
this._discovered = flows;
|
this._discovered = flows.filter(
|
||||||
|
(flow) => !HIDDEN_DOMAINS.has(flow.handler)
|
||||||
|
);
|
||||||
const integrations: Set<string> = new Set();
|
const integrations: Set<string> = new Set();
|
||||||
for (const flow of flows) {
|
for (const flow of this._discovered) {
|
||||||
// To render title placeholders
|
integrations.add(flow.handler);
|
||||||
if (flow.context.title_placeholders) {
|
|
||||||
integrations.add(flow.handler);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.hass.loadBackendTranslation("title", Array.from(integrations));
|
this.hass.loadBackendTranslation("title", Array.from(integrations));
|
||||||
}),
|
}),
|
||||||
@ -60,12 +59,14 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
(messages) => {
|
(messages) => {
|
||||||
let fullUpdate = false;
|
let fullUpdate = false;
|
||||||
const newEntries: ConfigEntry[] = [];
|
const newEntries: ConfigEntry[] = [];
|
||||||
|
const integrations: Set<string> = new Set();
|
||||||
messages.forEach((message) => {
|
messages.forEach((message) => {
|
||||||
if (message.type === null || message.type === "added") {
|
if (message.type === null || message.type === "added") {
|
||||||
if (HIDDEN_DOMAINS.has(message.entry.domain)) {
|
if (HIDDEN_DOMAINS.has(message.entry.domain)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newEntries.push(message.entry);
|
newEntries.push(message.entry);
|
||||||
|
integrations.add(message.entry.domain);
|
||||||
if (message.type === null) {
|
if (message.type === null) {
|
||||||
fullUpdate = true;
|
fullUpdate = true;
|
||||||
}
|
}
|
||||||
@ -86,6 +87,7 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
if (!newEntries.length && !fullUpdate) {
|
if (!newEntries.length && !fullUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.hass.loadBackendTranslation("title", Array.from(integrations));
|
||||||
const existingEntries = fullUpdate ? [] : this._entries;
|
const existingEntries = fullUpdate ? [] : this._entries;
|
||||||
this._entries = [...existingEntries!, ...newEntries];
|
this._entries = [...existingEntries!, ...newEntries];
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user