mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 00:06:35 +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;
|
private _height?: number;
|
||||||
|
|
||||||
public showDialog(params?: AddIntegrationDialogParams): void {
|
public async showDialog(params?: AddIntegrationDialogParams): Promise<void> {
|
||||||
this._load();
|
const loadPromise = this._load();
|
||||||
this._open = true;
|
this._open = true;
|
||||||
this._pickedBrand = params?.brand;
|
this._pickedBrand = params?.brand;
|
||||||
this._initialFilter = params?.initialFilter;
|
this._initialFilter = params?.initialFilter;
|
||||||
this._narrow = matchMedia(
|
this._narrow = matchMedia(
|
||||||
"all and (max-width: 450px), all and (max-height: 500px)"
|
"all and (max-width: 450px), all and (max-height: 500px)"
|
||||||
).matches;
|
).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() {
|
public closeDialog() {
|
||||||
@ -543,7 +553,7 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (integration.config_flow) {
|
if (integration.config_flow) {
|
||||||
this._createFlow(integration);
|
this._createFlow(integration.domain);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,25 +573,20 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
showYamlIntegrationDialog(this, { manifest });
|
showYamlIntegrationDialog(this, { manifest });
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _createFlow(integration: IntegrationListItem) {
|
private async _createFlow(domain: string) {
|
||||||
const flowsInProgress = await this._fetchFlowsInProgress([
|
const flowsInProgress = await this._fetchFlowsInProgress([domain]);
|
||||||
integration.domain,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (flowsInProgress?.length) {
|
if (flowsInProgress?.length) {
|
||||||
this._pickedBrand = integration.domain;
|
this._pickedBrand = domain;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const manifest = await fetchIntegrationManifest(
|
const manifest = await fetchIntegrationManifest(this.hass, domain);
|
||||||
this.hass,
|
|
||||||
integration.domain
|
|
||||||
);
|
|
||||||
|
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
|
|
||||||
showConfigFlowDialog(this, {
|
showConfigFlowDialog(this, {
|
||||||
startFlowHandler: integration.domain,
|
startFlowHandler: domain,
|
||||||
showAdvanced: this.hass.userData?.showAdvanced,
|
showAdvanced: this.hass.userData?.showAdvanced,
|
||||||
manifest,
|
manifest,
|
||||||
});
|
});
|
||||||
|
@ -731,13 +731,8 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
showConfigFlowDialog(this, {
|
showAddIntegrationDialog(this, {
|
||||||
dialogClosedCallback: () => {
|
domain,
|
||||||
this._handleFlowUpdated();
|
|
||||||
},
|
|
||||||
startFlowHandler: domain,
|
|
||||||
manifest: await fetchIntegrationManifest(this.hass, domain),
|
|
||||||
showAdvanced: this.hass.userData?.showAdvanced,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -3,6 +3,7 @@ import { IntegrationManifest } from "../../../data/integration";
|
|||||||
|
|
||||||
export interface AddIntegrationDialogParams {
|
export interface AddIntegrationDialogParams {
|
||||||
brand?: string;
|
brand?: string;
|
||||||
|
domain?: string;
|
||||||
initialFilter?: string;
|
initialFilter?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user