mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +00:00
Filter adapters with information from the Supervisor (#9322)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
1795fd56b7
commit
bc5bd35448
@ -9,13 +9,14 @@ import {
|
|||||||
} from "lit";
|
} from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import "../../../components/ha-network";
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-checkbox";
|
import "../../../components/ha-checkbox";
|
||||||
|
import "../../../components/ha-network";
|
||||||
import "../../../components/ha-settings-row";
|
import "../../../components/ha-settings-row";
|
||||||
|
import { fetchNetworkInfo } from "../../../data/hassio/network";
|
||||||
import {
|
import {
|
||||||
NetworkConfig,
|
|
||||||
getNetworkConfig,
|
getNetworkConfig,
|
||||||
|
NetworkConfig,
|
||||||
setNetworkConfig,
|
setNetworkConfig,
|
||||||
} from "../../../data/network";
|
} from "../../../data/network";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
@ -73,7 +74,19 @@ class ConfigNetwork extends LitElement {
|
|||||||
private async _load() {
|
private async _load() {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
try {
|
try {
|
||||||
this._networkConfig = await getNetworkConfig(this.hass);
|
const coreNetwork = await getNetworkConfig(this.hass);
|
||||||
|
if (isComponentLoaded(this.hass, "hassio")) {
|
||||||
|
const supervisorNetwork = await fetchNetworkInfo(this.hass);
|
||||||
|
const interfaces = new Set(
|
||||||
|
supervisorNetwork.interfaces.map((int) => int.interface)
|
||||||
|
);
|
||||||
|
if (interfaces.size) {
|
||||||
|
coreNetwork.adapters = coreNetwork.adapters.filter((adapter) =>
|
||||||
|
interfaces.has(adapter.name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._networkConfig = coreNetwork;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err.message || err;
|
this._error = err.message || err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user