mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 06:16:33 +00:00
Fix my link add integration: search for discovered items (#16315)
* fix my link add integration * add confirm back * Update dialog-add-integration.ts
This commit is contained in:
parent
10d476195d
commit
63de324224
@ -92,14 +92,24 @@ class AddIntegrationDialog extends LitElement {
|
||||
|
||||
private _height?: number;
|
||||
|
||||
public showDialog(params?: AddIntegrationDialogParams): void {
|
||||
this._load();
|
||||
public async showDialog(params?: AddIntegrationDialogParams): Promise<void> {
|
||||
const loadPromise = this._load();
|
||||
this._open = true;
|
||||
this._pickedBrand = params?.brand;
|
||||
this._initialFilter = params?.initialFilter;
|
||||
this._narrow = matchMedia(
|
||||
"all and (max-width: 450px), all and (max-height: 500px)"
|
||||
).matches;
|
||||
if (params?.domain) {
|
||||
this._createFlow(params.domain);
|
||||
}
|
||||
if (params?.brand) {
|
||||
await loadPromise;
|
||||
const brand = this._integrations?.[params.brand];
|
||||
if (brand && "integrations" in brand && brand.integrations) {
|
||||
this._fetchFlowsInProgress(Object.keys(brand.integrations));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public closeDialog() {
|
||||
@ -543,7 +553,7 @@ class AddIntegrationDialog extends LitElement {
|
||||
}
|
||||
|
||||
if (integration.config_flow) {
|
||||
this._createFlow(integration);
|
||||
this._createFlow(integration.domain);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -563,25 +573,20 @@ class AddIntegrationDialog extends LitElement {
|
||||
showYamlIntegrationDialog(this, { manifest });
|
||||
}
|
||||
|
||||
private async _createFlow(integration: IntegrationListItem) {
|
||||
const flowsInProgress = await this._fetchFlowsInProgress([
|
||||
integration.domain,
|
||||
]);
|
||||
private async _createFlow(domain: string) {
|
||||
const flowsInProgress = await this._fetchFlowsInProgress([domain]);
|
||||
|
||||
if (flowsInProgress?.length) {
|
||||
this._pickedBrand = integration.domain;
|
||||
this._pickedBrand = domain;
|
||||
return;
|
||||
}
|
||||
|
||||
const manifest = await fetchIntegrationManifest(
|
||||
this.hass,
|
||||
integration.domain
|
||||
);
|
||||
const manifest = await fetchIntegrationManifest(this.hass, domain);
|
||||
|
||||
this.closeDialog();
|
||||
|
||||
showConfigFlowDialog(this, {
|
||||
startFlowHandler: integration.domain,
|
||||
startFlowHandler: domain,
|
||||
showAdvanced: this.hass.userData?.showAdvanced,
|
||||
manifest,
|
||||
});
|
||||
|
@ -731,13 +731,8 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
}),
|
||||
})
|
||||
) {
|
||||
showConfigFlowDialog(this, {
|
||||
dialogClosedCallback: () => {
|
||||
this._handleFlowUpdated();
|
||||
},
|
||||
startFlowHandler: domain,
|
||||
manifest: await fetchIntegrationManifest(this.hass, domain),
|
||||
showAdvanced: this.hass.userData?.showAdvanced,
|
||||
showAddIntegrationDialog(this, {
|
||||
domain,
|
||||
});
|
||||
}
|
||||
return;
|
||||
|
@ -3,6 +3,7 @@ import { IntegrationManifest } from "../../../data/integration";
|
||||
|
||||
export interface AddIntegrationDialogParams {
|
||||
brand?: string;
|
||||
domain?: string;
|
||||
initialFilter?: string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user