Compare commits

...

7 Commits

Author SHA1 Message Date
J. Nick Koston
b3bf63f2ca
make _macAddress state 2025-04-17 08:29:21 -10:00
J. Nick Koston
9116f2c834
camel 2025-04-17 08:28:06 -10:00
J. Nick Koston
8f8d8ec93d
Update src/panels/config/integrations/integration-panels/dhcp/dhcp-config-panel.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2025-04-17 08:25:36 -10:00
J. Nick Koston
bb5fd093de
Update src/data/dhcp.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2025-04-17 08:25:29 -10:00
J. Nick Koston
57dca6f0d8
Update src/data/dhcp.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2025-04-17 08:25:22 -10:00
J. Nick Koston
329fc82fb8
Update src/data/dhcp.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2025-04-17 08:25:14 -10:00
J. Nick Koston
5b962e226f
Update src/panels/config/integrations/integration-panels/dhcp/dhcp-config-panel.ts
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2025-04-17 08:25:05 -10:00
2 changed files with 14 additions and 14 deletions

View File

@ -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);

View File

@ -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>
`; `;
} }