mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +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,
|
this.hass,
|
||||||
integration.domain
|
integration.domain
|
||||||
);
|
);
|
||||||
this.closeDialog();
|
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
title: this.hass.localize(
|
title: this.hass.localize(
|
||||||
"ui.panel.config.integrations.config_flow.yaml_only_title"
|
"ui.panel.config.integrations.config_flow.yaml_only_title"
|
||||||
|
@ -10,9 +10,11 @@ import {
|
|||||||
} from "../../../data/integration";
|
} from "../../../data/integration";
|
||||||
import { Integration } from "../../../data/integrations";
|
import { Integration } from "../../../data/integrations";
|
||||||
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
||||||
|
import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { brandsUrl } from "../../../util/brands-url";
|
import { brandsUrl } from "../../../util/brands-url";
|
||||||
|
import { documentationUrl } from "../../../util/documentation-url";
|
||||||
import "./ha-integration-list-item";
|
import "./ha-integration-list-item";
|
||||||
|
|
||||||
const standardToDomain = { zigbee: "zha", "z-wave": "zwave_js" } as const;
|
const standardToDomain = { zigbee: "zha", "z-wave": "zwave_js" } as const;
|
||||||
@ -87,21 +89,24 @@ class HaDomainIntegrations extends LitElement {
|
|||||||
})
|
})
|
||||||
: ""}
|
: ""}
|
||||||
${this.integration?.integrations
|
${this.integration?.integrations
|
||||||
? Object.entries(this.integration.integrations).map(
|
? Object.entries(this.integration.integrations)
|
||||||
([dom, val]) => html`<ha-integration-list-item
|
.filter(([_dom, val]) => val.config_flow)
|
||||||
.hass=${this.hass}
|
.map(
|
||||||
.domain=${dom}
|
([dom, val]) =>
|
||||||
.integration=${{
|
html`<ha-integration-list-item
|
||||||
...val,
|
.hass=${this.hass}
|
||||||
domain: dom,
|
.domain=${dom}
|
||||||
name: val.name || domainToName(this.hass.localize, dom),
|
.integration=${{
|
||||||
is_built_in: val.is_built_in !== false,
|
...val,
|
||||||
cloud: val.iot_class?.startsWith("cloud_"),
|
domain: dom,
|
||||||
}}
|
name: val.name || domainToName(this.hass.localize, dom),
|
||||||
@click=${this._integrationPicked}
|
is_built_in: val.is_built_in !== false,
|
||||||
>
|
cloud: val.iot_class?.startsWith("cloud_"),
|
||||||
</ha-integration-list-item>`
|
}}
|
||||||
)
|
@click=${this._integrationPicked}
|
||||||
|
>
|
||||||
|
</ha-integration-list-item>`
|
||||||
|
)
|
||||||
: ""}
|
: ""}
|
||||||
${["zha", "zwave_js"].includes(this.domain)
|
${["zha", "zwave_js"].includes(this.domain)
|
||||||
? html`<mwc-list-item
|
? html`<mwc-list-item
|
||||||
@ -162,6 +167,42 @@ class HaDomainIntegrations extends LitElement {
|
|||||||
|
|
||||||
private async _integrationPicked(ev) {
|
private async _integrationPicked(ev) {
|
||||||
const domain = ev.currentTarget.domain;
|
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();
|
const root = this.getRootNode();
|
||||||
showConfigFlowDialog(
|
showConfigFlowDialog(
|
||||||
root instanceof ShadowRoot ? (root.host as HTMLElement) : this,
|
root instanceof ShadowRoot ? (root.host as HTMLElement) : this,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user