Services: Kea DHCP: Kea DHCPv4 - add export as csv on reservations using a8d1a84fba

This commit is contained in:
Ad Schellevis 2024-02-20 18:10:01 +01:00
parent a8d1a84fba
commit 31bf0b0e6d
2 changed files with 17 additions and 3 deletions

View File

@ -105,6 +105,14 @@ class Dhcpv4Controller extends ApiMutableModelControllerBase
return $this->delBase("reservations.reservation", $uuid);
}
public function downloadReservationsAction()
{
if ($this->request->isGet()) {
$this->sessionClose();
$this->exportCsv($this->getModel()->reservations->reservation->asRecordSet(false, ['subnet']));
}
}
public function searchPeerAction()
{
return $this->searchBase("ha_peers.peer", ['name', 'role'], "name");

View File

@ -80,6 +80,11 @@
}
});
$("#download_reservations").click(function(e){
e.preventDefault();
window.open("/api/kea/dhcpv4/download_reservations");
});
/**
*
*/
@ -121,7 +126,7 @@
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-primary pull-right"><span class="fa fa-fw fa-plus"></span></button>
<button data-action="add" type="button" class="btn btn-xs btn-primary"><span class="fa fa-fw fa-plus"></span></button>
</td>
</tr>
</tfoot>
@ -147,7 +152,8 @@
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-primary pull-right"><span class="fa fa-fw fa-plus"></span></button>
<button data-action="add" type="button" class="btn btn-xs btn-primary"><span class="fa fa-fw fa-plus"></span></button>
<button id="download_reservations" type="button" title="{{ lang._('Export as csv') }}" data-toggle="tooltip" class="btn btn-xs"><span class="fa fa-fw fa-table"></span></button>
</td>
</tr>
</tfoot>
@ -170,7 +176,7 @@
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-primary pull-right"><span class="fa fa-fw fa-plus"></span></button>
<button data-action="add" type="button" class="btn btn-xs btn-primary"><span class="fa fa-fw fa-plus"></span></button>
</td>
</tr>
</tfoot>