mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 02:46:38 +00:00
Add my
support for brands (#13909)
This commit is contained in:
parent
c17e8ba65a
commit
8ccd0426dd
@ -38,6 +38,7 @@ import type { HomeAssistant } from "../../../types";
|
||||
import { documentationUrl } from "../../../util/documentation-url";
|
||||
import "./ha-domain-integrations";
|
||||
import "./ha-integration-list-item";
|
||||
import { AddIntegrationDialogParams } from "./show-add-integration-dialog";
|
||||
|
||||
export interface IntegrationListItem {
|
||||
name: string;
|
||||
@ -78,8 +79,9 @@ class AddIntegrationDialog extends LitElement {
|
||||
|
||||
private _height?: number;
|
||||
|
||||
public showDialog(params): void {
|
||||
public showDialog(params: AddIntegrationDialogParams): void {
|
||||
this._open = true;
|
||||
this._pickedBrand = params.brand;
|
||||
this._initialFilter = params.initialFilter;
|
||||
this._narrow = matchMedia(
|
||||
"all and (max-width: 450px), all and (max-height: 500px)"
|
||||
|
@ -678,8 +678,16 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
|
||||
private async _handleAdd(localizePromise: Promise<LocalizeFunc>) {
|
||||
const brand = extractSearchParam("brand");
|
||||
const domain = extractSearchParam("domain");
|
||||
navigate("/config/integrations", { replace: true });
|
||||
|
||||
if (brand) {
|
||||
showAddIntegrationDialog(this, {
|
||||
brand,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!domain) {
|
||||
return;
|
||||
}
|
||||
@ -714,14 +722,14 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
||||
|
||||
// Supported brand exists, so we can just create a flow
|
||||
if (Object.keys(supportedBrandsIntegrations).includes(domain)) {
|
||||
const brand = supportedBrandsIntegrations[domain];
|
||||
const slug = brand.supported_flows![0];
|
||||
const supBrand = supportedBrandsIntegrations[domain];
|
||||
const slug = supBrand.supported_flows![0];
|
||||
|
||||
showConfirmationDialog(this, {
|
||||
text: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.supported_brand_flow",
|
||||
{
|
||||
supported_brand: brand.name,
|
||||
supported_brand: supBrand.name,
|
||||
flow_domain_name: domainToName(this.hass.localize, slug),
|
||||
}
|
||||
),
|
||||
|
@ -1,8 +1,13 @@
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
|
||||
export interface AddIntegrationDialogParams {
|
||||
brand?: string;
|
||||
initialFilter?: string;
|
||||
}
|
||||
|
||||
export const showAddIntegrationDialog = (
|
||||
element: HTMLElement,
|
||||
dialogParams?: any
|
||||
dialogParams?: AddIntegrationDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-add-integration",
|
||||
|
@ -53,6 +53,12 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
|
||||
domain: "string",
|
||||
},
|
||||
},
|
||||
brand: {
|
||||
redirect: "/config/integrations/add",
|
||||
params: {
|
||||
brand: "string",
|
||||
},
|
||||
},
|
||||
integrations: {
|
||||
redirect: "/config/integrations",
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user