Skip to content

Commit 551847e

Browse files
committed
Improvements in the display and search of data
See: librenms-plugins#87
1 parent 3831b20 commit 551847e

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

data-pick.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function update_source_step2(graphid)
118118

119119
function filterlist(previous)
120120
{
121-
var filterstring = $('input#filterstring').val();
121+
var filterstring = $('input#filterstring').val().toUpperCase();
122122

123123
if(filterstring=='')
124124
{
@@ -160,16 +160,16 @@ function filterignore()
160160

161161
$(document).ready( function() {
162162
$('span.filter').keyup(function() {
163-
var previous = $('input#filterstring').val();
163+
var previous = $('input#filterstring').val().toUpperCase();
164164
setTimeout(function () {filterlist(previous)}, 500);
165165
}).show();
166166
$('span.ignore').click(function() {
167-
var previous = $('input#filterstring').val();
167+
var previous = $('input#filterstring').val().toUpperCase();
168168
setTimeout(function () {filterlist(previous)}, 500);
169169
});
170170
});
171171

172-
function update_source_step2(graphid,name,portid,ifAlias,ifDesc,ifIndex)
172+
function update_source_step2(graphid,name,portid,ifAlias,ifDesc,ifIndex,ifSpeed)
173173
{
174174
var graph_url, hover_url;
175175

@@ -184,11 +184,12 @@ function update_source_step2(graphid,name,portid,ifAlias,ifDesc,ifIndex)
184184
opener.document.forms["frmMain"].node_label.value ='testing';
185185
opener.document.forms["frmMain"].link_infourl.value = info_url;
186186
opener.document.forms["frmMain"].link_hover.value = graph_url;
187+
opener.document.forms["frmMain"].link_bandwith_in.value = ipSpeed;
187188
}
188189
self.close();
189190
}
190191

191-
function update_source_step1(dataid,name,portid,ifAlias,ifDesc,ifIndex)
192+
function update_source_step1(dataid,name,portid,ifAlias,ifDesc,ifIndex,ifSpeed)
192193
{
193194
// This must be the section that looks after link properties
194195
var newlocation;
@@ -213,7 +214,7 @@ function update_source_step1(dataid,name,portid,ifAlias,ifDesc,ifIndex)
213214
if(document.forms['mini'].overlib.checked)
214215
{
215216

216-
window.onload = update_source_step2(dataid,name,portid,ifAlias,ifDesc,ifIndex);
217+
window.onload = update_source_step2(dataid,name,portid,ifAlias,ifDesc,ifIndex,ifSpeed);
217218

218219
}
219220
else
@@ -285,7 +286,7 @@ function applyDSFilterChange(objForm) {
285286
}
286287

287288
// Link query
288-
$hosts = \App\Models\Device::orderBy('hostname')->get(['device_id', 'hostname']);
289+
$hosts = \App\Models\Device::orderBy('hostname')->get(['device_id', 'hostname', 'sysname']);
289290
?>
290291

291292
<h3>Pick a data source:</h3>
@@ -301,7 +302,7 @@ function applyDSFilterChange(objForm) {
301302
{
302303
print '<option ';
303304
if($host_id==$host['device_id']) print " SELECTED ";
304-
print 'value="'.$host['device_id'].'">'.$host['hostname'].'</option>';
305+
print 'value="'.$host['device_id'].'">'.$host['hostname'].'('.strtoupper($host['sysname']).')</option>';
305306
}
306307
print '</select><br />';
307308
}
@@ -334,9 +335,9 @@ function applyDSFilterChange(objForm) {
334335
if (!is_null($device->ports)) {
335336
foreach ($device->ports as $port) {
336337
echo "<li class=\"row" . ($i % 2) . "\">";
337-
$key = $device->device_id . "','" . $device->hostname . "','" . $port->port_id . "','" . addslashes($port->ifAlias) . "','" . addslashes($port->ifDescr) . "','" . (int)$port->ifIndex;
338+
$key = $device->device_id . "','" . $device->hostname . "','" . $port->port_id . "','" . addslashes($port->ifAlias) . "','" . addslashes($port->ifDescr) . "','" . (int)$port->ifIndex. "','" . $port->ifSpeed;
338339

339-
echo "<a href=\"#\" onclick=\"update_source_step1('$key')\">" . $device->displayName() . "/$port->ifDescr Desc: $port->ifAlias</a>";
340+
echo "<a href=\"#\" onclick=\"update_source_step1('$key')\">" . $device->displayName() . "<br/>".strtoupper($port->ifDescr)." <br/>Desc: ".strtoupper($port->ifAlias)." <br/> Speed: $port->ifSpeed</a>";
340341
echo "</li>\n";
341342
}
342343
$i++;
@@ -372,7 +373,7 @@ function applyDSFilterChange(objForm) {
372373
$host_id = intval($_REQUEST['host_id']);
373374
}
374375

375-
$hosts = \App\Models\Device::orderBy('hostname')->get(['device_id AS id', 'hostname AS name']);
376+
$hosts = \App\Models\Device::orderBy('hostname')->get(['device_id AS id', 'hostname AS name', 'sysname AS sysname']);
376377

377378
?>
378379
<html>
@@ -382,7 +383,7 @@ function applyDSFilterChange(objForm) {
382383

383384
function filterlist(previous)
384385
{
385-
var filterstring = $('input#filterstring').val();
386+
var filterstring = $('input#filterstring').val().toUpperCase();
386387

387388
if(filterstring=='')
388389
{
@@ -400,7 +401,7 @@ function filterlist(previous)
400401

401402
$(document).ready( function() {
402403
$('span.filter').keyup(function() {
403-
var previous = $('input#filterstring').val();
404+
var previous = $('input#filterstring').val().toUpperCase();
404405
setTimeout(function () {filterlist(previous)}, 500);
405406
}).show();
406407
});
@@ -481,7 +482,7 @@ function update_source_step1(graphid,name)
481482
{
482483
print '<option ';
483484
if($host_id==$host['id']) print " SELECTED ";
484-
print 'value="'.$host['id'].'">'.$host['name'].'</option>';
485+
print 'value="'.$host['id'].'">'.$host['name'].'('.strtoupper($host['sysname']).')</option>';
485486
}
486487
print '</select><br />';
487488
}

0 commit comments

Comments
 (0)