mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
Compare commits
7 Commits
07a78ae854
...
b3bf63f2ca
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b3bf63f2ca | ||
![]() |
9116f2c834 | ||
![]() |
8f8d8ec93d | ||
![]() |
bb5fd093de | ||
![]() |
57dca6f0d8 | ||
![]() |
329fc82fb8 | ||
![]() |
5b962e226f |
@ -30,31 +30,31 @@ const subscribeDHCPDiscoveryUpdates = (
|
|||||||
(event) => {
|
(event) => {
|
||||||
const data = [...(store.state || [])];
|
const data = [...(store.state || [])];
|
||||||
if (event.add) {
|
if (event.add) {
|
||||||
for (const device_data of event.add) {
|
for (const deviceData of event.add) {
|
||||||
const index = data.findIndex(
|
const index = data.findIndex(
|
||||||
(d) => d.mac_address === device_data.mac_address
|
(d) => d.mac_address === deviceData.mac_address
|
||||||
);
|
);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
data.push(device_data);
|
data.push(deviceData);
|
||||||
} else {
|
} else {
|
||||||
data[index] = device_data;
|
data[index] = deviceData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.change) {
|
if (event.change) {
|
||||||
for (const device_data of event.change) {
|
for (const deviceData of event.change) {
|
||||||
const index = data.findIndex(
|
const index = data.findIndex(
|
||||||
(d) => d.mac_address === device_data.mac_address
|
(d) => d.mac_address === deviceData.mac_address
|
||||||
);
|
);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
data[index] = device_data;
|
data[index] = deviceData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.remove) {
|
if (event.remove) {
|
||||||
for (const device_data of event.remove) {
|
for (const deviceData of event.remove) {
|
||||||
const index = data.findIndex(
|
const index = data.findIndex(
|
||||||
(d) => d.mac_address === device_data.mac_address
|
(d) => d.mac_address === deviceData.mac_address
|
||||||
);
|
);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
data.splice(index, 1);
|
data.splice(index, 1);
|
||||||
|
@ -22,7 +22,7 @@ export class DHCPConfigPanel extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
@property({ attribute: false }) public route!: Route;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@property({ attribute: false }) public mac_address?: string;
|
@state() private _macAddress?: string;
|
||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
|
|
||||||
@ -82,9 +82,9 @@ export class DHCPConfigPanel extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const searchParams = extractSearchParamsObject();
|
const searchParams = extractSearchParamsObject();
|
||||||
const mac_address = searchParams.mac_address;
|
const macAddress = searchParams.mac_address;
|
||||||
if (mac_address) {
|
if (macAddress) {
|
||||||
this.mac_address = mac_address.toUpperCase();
|
this._macAddress = macAddress.toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export class DHCPConfigPanel extends SubscribeMixin(LitElement) {
|
|||||||
.route=${this.route}
|
.route=${this.route}
|
||||||
.columns=${this._columns(this.hass.localize)}
|
.columns=${this._columns(this.hass.localize)}
|
||||||
.data=${this._dataWithIds(this._data)}
|
.data=${this._dataWithIds(this._data)}
|
||||||
filter=${this.mac_address || ""}
|
filter=${this._macAddress || ""}
|
||||||
></hass-tabs-subpage-data-table>
|
></hass-tabs-subpage-data-table>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user