mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 01:46:35 +00:00
Fix add integration discovery (#14432)
* Fix add integration discovery * Update show-dialog-config-flow.ts * Update src/panels/config/integrations/dialog-add-integration.ts Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev> Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
This commit is contained in:
parent
147b1f34ac
commit
aa1e9cedca
@ -87,9 +87,11 @@ export const showConfigFlowDialog = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderShowFormStepFieldError(hass, step, error) {
|
renderShowFormStepFieldError(hass, step, error) {
|
||||||
return hass.localize(
|
return (
|
||||||
`component.${step.handler}.config.error.${error}`,
|
hass.localize(
|
||||||
step.description_placeholders
|
`component.${step.handler}.config.error.${error}`,
|
||||||
|
step.description_placeholders
|
||||||
|
) || error
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ export interface IntegrationListItem {
|
|||||||
config_flow?: boolean;
|
config_flow?: boolean;
|
||||||
is_helper?: boolean;
|
is_helper?: boolean;
|
||||||
integrations?: string[];
|
integrations?: string[];
|
||||||
|
domains?: string[];
|
||||||
iot_standards?: string[];
|
iot_standards?: string[];
|
||||||
supported_by?: string;
|
supported_by?: string;
|
||||||
cloud?: boolean;
|
cloud?: boolean;
|
||||||
@ -188,6 +189,9 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
([dom, val]) => val.name || domainToName(localize, dom)
|
([dom, val]) => val.name || domainToName(localize, dom)
|
||||||
)
|
)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
domains: integration.integrations
|
||||||
|
? Object.keys(integration.integrations)
|
||||||
|
: undefined,
|
||||||
is_built_in: integration.is_built_in !== false,
|
is_built_in: integration.is_built_in !== false,
|
||||||
});
|
});
|
||||||
} else if (filter && "integration_type" in integration) {
|
} else if (filter && "integration_type" in integration) {
|
||||||
@ -494,7 +498,7 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (integration.integrations) {
|
if (integration.integrations) {
|
||||||
let domains = integration.integrations;
|
let domains = integration.domains || [];
|
||||||
if (integration.domain === "apple") {
|
if (integration.domain === "apple") {
|
||||||
// we show discoverd homekit devices in their own brand section, dont show them at apple
|
// we show discoverd homekit devices in their own brand section, dont show them at apple
|
||||||
domains = domains.filter((domain) => domain !== "homekit_controller");
|
domains = domains.filter((domain) => domain !== "homekit_controller");
|
||||||
|
@ -174,6 +174,15 @@ class HaDomainIntegrations extends LitElement {
|
|||||||
? html`<mwc-list-item
|
? html`<mwc-list-item
|
||||||
.domain=${this.domain}
|
.domain=${this.domain}
|
||||||
@request-selected=${this._integrationPicked}
|
@request-selected=${this._integrationPicked}
|
||||||
|
.integration=${{
|
||||||
|
...this.integration,
|
||||||
|
domain: this.domain,
|
||||||
|
name:
|
||||||
|
this.integration.name ||
|
||||||
|
domainToName(this.hass.localize, this.domain),
|
||||||
|
is_built_in: this.integration.is_built_in !== false,
|
||||||
|
cloud: this.integration.iot_class?.startsWith("cloud_"),
|
||||||
|
}}
|
||||||
hasMeta
|
hasMeta
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.panel.config.integrations.new_flow", {
|
${this.hass.localize("ui.panel.config.integrations.new_flow", {
|
||||||
@ -241,7 +250,8 @@ class HaDomainIntegrations extends LitElement {
|
|||||||
(!this.integration!.integrations ||
|
(!this.integration!.integrations ||
|
||||||
!(domain in this.integration!.integrations))))) ||
|
!(domain in this.integration!.integrations))))) ||
|
||||||
// config_flow being undefined means its false
|
// config_flow being undefined means its false
|
||||||
!(this.integration as Brand)!.integrations?.[domain]?.config_flow
|
(!("integration_type" in this.integration!) &&
|
||||||
|
!this.integration!.integrations?.[domain]?.config_flow)
|
||||||
) {
|
) {
|
||||||
const manifest = await fetchIntegrationManifest(this.hass, domain);
|
const manifest = await fetchIntegrationManifest(this.hass, domain);
|
||||||
showYamlIntegrationDialog(this, { manifest });
|
showYamlIntegrationDialog(this, { manifest });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user