mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-28 15:27:20 +00:00
Guard setting up config flow for an unsupported domain (#11937)
This commit is contained in:
parent
a040e1d5e0
commit
7c94ced303
@ -377,13 +377,20 @@ class DataEntryFlowDialog extends LitElement {
|
|||||||
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
|
const message =
|
||||||
|
err?.status_code === 404
|
||||||
|
? this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.no_config_flow"
|
||||||
|
)
|
||||||
|
: `${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.could_not_load"
|
||||||
|
)}: ${err?.body?.message || err?.message}`;
|
||||||
|
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
title: this.hass.localize(
|
title: this.hass.localize(
|
||||||
"ui.panel.config.integrations.config_flow.error"
|
"ui.panel.config.integrations.config_flow.error"
|
||||||
),
|
),
|
||||||
text: `${this.hass.localize(
|
text: message,
|
||||||
"ui.panel.config.integrations.config_flow.could_not_load"
|
|
||||||
)}: ${err.message || err.body}`,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -30,6 +30,7 @@ import "../../../components/ha-check-list-item";
|
|||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
|
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
|
||||||
import {
|
import {
|
||||||
|
getConfigFlowHandlers,
|
||||||
getConfigFlowInProgressCollection,
|
getConfigFlowInProgressCollection,
|
||||||
localizeConfigFlowTitle,
|
localizeConfigFlowTitle,
|
||||||
subscribeConfigFlowInProgress,
|
subscribeConfigFlowInProgress,
|
||||||
@ -51,7 +52,10 @@ import {
|
|||||||
} from "../../../data/integration";
|
} from "../../../data/integration";
|
||||||
import { scanUSBDevices } from "../../../data/usb";
|
import { scanUSBDevices } from "../../../data/usb";
|
||||||
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
||||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
import {
|
||||||
|
showAlertDialog,
|
||||||
|
showConfirmationDialog,
|
||||||
|
} from "../../../dialogs/generic/show-dialog-box";
|
||||||
import "../../../layouts/hass-loading-screen";
|
import "../../../layouts/hass-loading-screen";
|
||||||
import "../../../layouts/hass-tabs-subpage";
|
import "../../../layouts/hass-tabs-subpage";
|
||||||
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
|
||||||
@ -652,6 +656,19 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
if (!domain) {
|
if (!domain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const handlers = await getConfigFlowHandlers(this.hass);
|
||||||
|
|
||||||
|
if (!handlers.includes(domain)) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.error"
|
||||||
|
),
|
||||||
|
text: this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.no_config_flow"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const localize = await localizePromise;
|
const localize = await localizePromise;
|
||||||
if (
|
if (
|
||||||
!(await showConfirmationDialog(this, {
|
!(await showConfirmationDialog(this, {
|
||||||
|
@ -2605,6 +2605,7 @@
|
|||||||
"finish": "Finish",
|
"finish": "Finish",
|
||||||
"submit": "Submit",
|
"submit": "Submit",
|
||||||
"next": "Next",
|
"next": "Next",
|
||||||
|
"no_config_flow": "This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.",
|
||||||
"not_all_required_fields": "Not all required fields are filled in.",
|
"not_all_required_fields": "Not all required fields are filled in.",
|
||||||
"error_saving_area": "Error saving area: {error}",
|
"error_saving_area": "Error saving area: {error}",
|
||||||
"created_config": "Created configuration for {name}.",
|
"created_config": "Created configuration for {name}.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user