mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added search and sorting support
This commit is contained in:
@@ -7,6 +7,10 @@ $device_id = $_POST['device_id'];
|
|||||||
$sql = 'FROM `ports` WHERE `device_id` = ?';
|
$sql = 'FROM `ports` WHERE `device_id` = ?';
|
||||||
$param = array($device_id);
|
$param = array($device_id);
|
||||||
|
|
||||||
|
if (isset($searchPhrase) && !empty($searchPhrase)) {
|
||||||
|
$sql .= " AND (`ifName` LIKE '%$searchPhrase%' OR `ifAlias` LIKE '%$searchPhrase%' OR `ifDescr` LIKE '%$searchPhrase%')";
|
||||||
|
}
|
||||||
|
|
||||||
$count_sql = "SELECT COUNT(`port_id`) $sql";
|
$count_sql = "SELECT COUNT(`port_id`) $sql";
|
||||||
$total = dbFetchCell($count_sql, $param);
|
$total = dbFetchCell($count_sql, $param);
|
||||||
if (empty($total)) {
|
if (empty($total)) {
|
||||||
@@ -53,7 +57,7 @@ foreach (dbFetchRows($sql, $param) as $port) {
|
|||||||
|
|
||||||
$response[] = array(
|
$response[] = array(
|
||||||
'ifIndex' => $port['ifIndex'],
|
'ifIndex' => $port['ifIndex'],
|
||||||
'label' => $port['label'],
|
'ifName' => $port['label'],
|
||||||
'ifAdminStatus' => $port['ifAdminStatus'],
|
'ifAdminStatus' => $port['ifAdminStatus'],
|
||||||
'ifOperStatus' => '<span name="operstatus_'.$port['port_id'].'"'.$outofsync.'>'.$port['ifOperStatus'].'</span>',
|
'ifOperStatus' => '<span name="operstatus_'.$port['port_id'].'"'.$outofsync.'>'.$port['ifOperStatus'].'</span>',
|
||||||
'disabled' => '<input type="checkbox" class="disable-check" name="disabled_'.$port['port_id'].'"'.($port['disabled'] ? 'checked' : '').'>
|
'disabled' => '<input type="checkbox" class="disable-check" name="disabled_'.$port['port_id'].'"'.($port['disabled'] ? 'checked' : '').'>
|
||||||
|
@@ -8,11 +8,11 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-column-id='ifIndex'>Index</th>
|
<th data-column-id='ifIndex'>Index</th>
|
||||||
<th data-column-id='label'>Name</th>
|
<th data-column-id='ifName'>Name</th>
|
||||||
<th data-column-id='ifAdminStatus'>Admin</th>
|
<th data-column-id='ifAdminStatus'>Admin</th>
|
||||||
<th data-column-id='ifOperStatus'>Oper</th>
|
<th data-column-id='ifOperStatus'>Oper</th>
|
||||||
<th data-column-id='disabled'>Disable</th>
|
<th data-column-id='disabled' data-sortable='false'>Disable</th>
|
||||||
<th data-column-id='ignore'>Ignore</th>
|
<th data-column-id='ignore' data-sortable='false'>Ignore</th>
|
||||||
<th data-column-id='ifAlias'>Description</th>
|
<th data-column-id='ifAlias'>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
Reference in New Issue
Block a user