mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
hide none config flow integrations from brand (#13907)
* hide none config flow integrations from brand * filter * Add support for not config flow domain integrations
This commit is contained in:
parent
d9f1540115
commit
c17e8ba65a
@ -495,7 +495,6 @@ class AddIntegrationDialog extends LitElement {
|
||||
this.hass,
|
||||
integration.domain
|
||||
);
|
||||
this.closeDialog();
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.yaml_only_title"
|
||||
|
@ -10,9 +10,11 @@ import {
|
||||
} from "../../../data/integration";
|
||||
import { Integration } from "../../../data/integrations";
|
||||
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
||||
import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||
import { haStyle } from "../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { brandsUrl } from "../../../util/brands-url";
|
||||
import { documentationUrl } from "../../../util/documentation-url";
|
||||
import "./ha-integration-list-item";
|
||||
|
||||
const standardToDomain = { zigbee: "zha", "z-wave": "zwave_js" } as const;
|
||||
@ -87,21 +89,24 @@ class HaDomainIntegrations extends LitElement {
|
||||
})
|
||||
: ""}
|
||||
${this.integration?.integrations
|
||||
? Object.entries(this.integration.integrations).map(
|
||||
([dom, val]) => html`<ha-integration-list-item
|
||||
.hass=${this.hass}
|
||||
.domain=${dom}
|
||||
.integration=${{
|
||||
...val,
|
||||
domain: dom,
|
||||
name: val.name || domainToName(this.hass.localize, dom),
|
||||
is_built_in: val.is_built_in !== false,
|
||||
cloud: val.iot_class?.startsWith("cloud_"),
|
||||
}}
|
||||
@click=${this._integrationPicked}
|
||||
>
|
||||
</ha-integration-list-item>`
|
||||
)
|
||||
? Object.entries(this.integration.integrations)
|
||||
.filter(([_dom, val]) => val.config_flow)
|
||||
.map(
|
||||
([dom, val]) =>
|
||||
html`<ha-integration-list-item
|
||||
.hass=${this.hass}
|
||||
.domain=${dom}
|
||||
.integration=${{
|
||||
...val,
|
||||
domain: dom,
|
||||
name: val.name || domainToName(this.hass.localize, dom),
|
||||
is_built_in: val.is_built_in !== false,
|
||||
cloud: val.iot_class?.startsWith("cloud_"),
|
||||
}}
|
||||
@click=${this._integrationPicked}
|
||||
>
|
||||
</ha-integration-list-item>`
|
||||
)
|
||||
: ""}
|
||||
${["zha", "zwave_js"].includes(this.domain)
|
||||
? html`<mwc-list-item
|
||||
@ -162,6 +167,42 @@ class HaDomainIntegrations extends LitElement {
|
||||
|
||||
private async _integrationPicked(ev) {
|
||||
const domain = ev.currentTarget.domain;
|
||||
if (
|
||||
(domain === this.domain && !this.integration.config_flow) ||
|
||||
!this.integration.integrations?.[domain]?.config_flow
|
||||
) {
|
||||
const manifest = await fetchIntegrationManifest(this.hass, domain);
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.yaml_only_title"
|
||||
),
|
||||
text: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.yaml_only_text",
|
||||
{
|
||||
link:
|
||||
manifest?.is_built_in || manifest?.documentation
|
||||
? html`<a
|
||||
href=${manifest.is_built_in
|
||||
? documentationUrl(
|
||||
this.hass,
|
||||
`/integrations/${manifest.domain}`
|
||||
)
|
||||
: manifest.documentation}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.documentation"
|
||||
)}
|
||||
</a>`
|
||||
: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.documentation"
|
||||
),
|
||||
}
|
||||
),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const root = this.getRootNode();
|
||||
showConfigFlowDialog(
|
||||
root instanceof ShadowRoot ? (root.host as HTMLElement) : this,
|
||||
|
Loading…
x
Reference in New Issue
Block a user