mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
Squashed commit of the following:
commit a59dc4394043aa5fce060426f13d965ab3c6679f
Author: Ad Schellevis <ad@opnsense.org>
Date: Mon Nov 18 21:16:13 2024 +0100
Services: Kea DHCP [new]: Leases DHCPv4 - minor cleanups for https://github.com/opnsense/core/pull/8053
commit 9986eca14c4ee72675bedc31953cefe60a6659cd
Merge: d23170c05 8d0ab40c5
Author: cpalv <13182421+cpalv@users.noreply.github.com>
Date: Mon Nov 11 23:46:43 2024 -0600
Merge branch 'opnsense:master' into mac-db
commit d23170c05f3d511000d8302dd2403c0761d757ac
Author: eddie <13182421+cpalv@users.noreply.github.com>
Date: Mon Nov 11 23:45:16 2024 -0600
Add MAC formatter, removed unclosed table row tag
macformatter will include the hardware manufacturer info (if it exists) in the same table cell as MAC address
removed unclosed 'tr' tag. linked 'hwaddr' column to macformatter. adjusted spacing
commit 04e7cf40ee809b3afdcc203d27cd3ed9cd9ff128
Author: eddie <13182421+cpalv@users.noreply.github.com>
Date: Mon Nov 11 23:39:30 2024 -0600
add MAC manufacturer info to dhcp lease record
This commit is contained in:
parent
db8005b186
commit
a94e08ec66
@ -42,6 +42,7 @@ class Leases4Controller extends ApiControllerBase
|
||||
|
||||
$leases = json_decode($backend->configdpRun('kea list leases4'), true) ?? [];
|
||||
$ifconfig = json_decode($backend->configdRun('interface list ifconfig'), true);
|
||||
$mac_db = json_decode($backend->configdRun('interface list macdb'), true) ?? [];
|
||||
|
||||
$ifmap = [];
|
||||
foreach (Config::getInstance()->object()->interfaces->children() as $if => $if_props) {
|
||||
@ -61,6 +62,8 @@ class Leases4Controller extends ApiControllerBase
|
||||
$record['if_name'] = $ifmap[$record['if']]['key'];
|
||||
$interfaces[$ifmap[$record['if']]['key']] = $ifmap[$record['if']]['descr'];
|
||||
}
|
||||
$mac = strtoupper(substr(str_replace(':', '', $record['hwaddr']), 0, 6));
|
||||
$record['mac_info'] = isset($mac_db[$mac]) ? $mac_db[$mac] : '';
|
||||
}
|
||||
} else {
|
||||
$records = [];
|
||||
|
||||
@ -63,6 +63,13 @@
|
||||
"overflowformatter": function (column, row) {
|
||||
return '<span class="overflow">' + row[column.id] + '</span><br/>'
|
||||
},
|
||||
"macformatter": function (column, row) {
|
||||
let mac = '<span class="overflow">' + row.hwaddr + '</span>';
|
||||
if (row.mac_info != '') {
|
||||
mac = mac + '<br/>' + '<small class="overflow"><i>' + row.mac_info + '</i></small>';
|
||||
}
|
||||
return mac;
|
||||
},
|
||||
"timestamp": function (column, row) {
|
||||
return moment.unix(row[column.id]).local().format('YYYY-MM-DD HH:mm:ss');
|
||||
},
|
||||
@ -91,16 +98,15 @@
|
||||
</select>
|
||||
</div>
|
||||
<table id="grid-leases" class="table table-condensed table-hover table-striped table-responsive">
|
||||
<tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="if_descr" data-type="string">{{ lang._('Interface') }}</th>
|
||||
<th data-column-id="address" data-identifier="true" data-type="string" data-formatter="overflowformatter">{{ lang._('IP Address') }}</th>
|
||||
<th data-column-id="hwaddr" data-type="string" data-width="9em">{{ lang._('MAC Address') }}</th>
|
||||
<th data-column-id="valid_lifetime" data-type="integer">{{ lang._('Lifetime') }}</th>
|
||||
<th data-column-id="expire" data-type="string" data-formatter="timestamp">{{ lang._('Expire') }}</th>
|
||||
<th data-column-id="hostname" data-type="string" data-formatter="overflowformatter">{{ lang._('Hostname') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th data-column-id="if_descr" data-type="string">{{ lang._('Interface') }}</th>
|
||||
<th data-column-id="address" data-identifier="true" data-type="string" data-formatter="overflowformatter">{{ lang._('IP Address') }}</th>
|
||||
<th data-column-id="hwaddr" data-type="string" data-formatter="macformatter" data-width="9em">{{ lang._('MAC Address') }}</th>
|
||||
<th data-column-id="valid_lifetime" data-type="integer">{{ lang._('Lifetime') }}</th>
|
||||
<th data-column-id="expire" data-type="string" data-formatter="timestamp">{{ lang._('Expire') }}</th>
|
||||
<th data-column-id="hostname" data-type="string" data-formatter="overflowformatter">{{ lang._('Hostname') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user