From 362bcd43539e09bd575a2d249f8256ba245b1e2f Mon Sep 17 00:00:00 2001 From: wiad Date: Tue, 12 Apr 2016 19:16:15 +0200 Subject: [PATCH 1/3] add config option for typeahead limit --- html/includes/common/generic-graph.inc.php | 5 +++++ html/includes/print-menubar.php | 3 +++ includes/defaults.inc.php | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php index 038154e5c0..c7425d5a06 100644 --- a/html/includes/common/generic-graph.inc.php +++ b/html/includes/common/generic-graph.inc.php @@ -204,6 +204,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_device.ttAdapter(), + limit: '.$config['typeahead_limit'].', async: false, templates: { header: "
 Devices
", @@ -240,6 +241,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_port.ttAdapter(), + limit: '.$config['typeahead_limit'].', async: false, templates: { header: "
 Ports
", @@ -275,6 +277,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_application.ttAdapter(), + limit: '.$config['typeahead_limit'].', async: false, templates: { header: "
 Applications
", @@ -312,6 +315,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_munin.ttAdapter(), + limit: '.$config['typeahead_limit'].', async: false, templates: { header: "
 Munin
", @@ -346,6 +350,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_bill.ttAdapter(), + limit: '.$config['typeahead_limit'].', async: false, templates: { header: "
 Bill
", diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index afc91e645f..3bccd65900 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -717,6 +717,7 @@ $('#gsearch').typeahead({ }, { source: devices.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', @@ -727,6 +728,7 @@ $('#gsearch').typeahead({ }, { source: ports.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', @@ -737,6 +739,7 @@ $('#gsearch').typeahead({ }, { source: bgp.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 3dac116ada..8d763310db 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -870,4 +870,7 @@ $config['ignore_unmapable_port'] = False; // InfluxDB default configuration $config['influxdb']['timeout'] = 0; -$config['influxdb']['verifySSL'] = false; \ No newline at end of file +$config['influxdb']['verifySSL'] = false; + +// Typeahead default configuration +$config['typeahead_limit'] = 5; From 341869eaafd17c41a337e113e92e2c9e7d926e2e Mon Sep 17 00:00:00 2001 From: Adam Winberg Date: Thu, 21 Apr 2016 12:56:45 +0200 Subject: [PATCH 2/3] use existings webui option (global_search_result_limit) to set typeahead limit instead of introducing new config option --- html/includes/common/generic-graph.inc.php | 11 ++++++----- html/includes/print-menubar.php | 12 +++++++----- includes/defaults.inc.php | 3 --- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php index c7425d5a06..022fb0585c 100644 --- a/html/includes/common/generic-graph.inc.php +++ b/html/includes/common/generic-graph.inc.php @@ -204,7 +204,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_device.ttAdapter(), - limit: '.$config['typeahead_limit'].', + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Devices
", @@ -241,7 +241,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_port.ttAdapter(), - limit: '.$config['typeahead_limit'].', + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Ports
", @@ -277,7 +277,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_application.ttAdapter(), - limit: '.$config['typeahead_limit'].', + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Applications
", @@ -315,7 +315,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_munin.ttAdapter(), - limit: '.$config['typeahead_limit'].', + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Munin
", @@ -350,7 +350,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_bill.ttAdapter(), - limit: '.$config['typeahead_limit'].', + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Bill
", @@ -437,3 +437,4 @@ else { $common_output[] = ''; } + diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 3bccd65900..1ccdb32d9c 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -3,8 +3,9 @@ require $config['install_dir'].'/includes/object-cache.inc.php'; // FIXME - this could do with some performance improvements, i think. possible rearranging some tables and setting flags at poller time (nothing changes outside of then anyways) -$service_status = get_service_status(); -$if_alerts = dbFetchCell("SELECT COUNT(port_id) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"); +$service_status = get_service_status(); +$typeahead_limit = $config['webui']['global_search_result_limit']; +$if_alerts = dbFetchCell("SELECT COUNT(port_id) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"); if ($_SESSION['userlevel'] >= 5) { $links['count'] = dbFetchCell("SELECT COUNT(*) FROM `links`"); @@ -717,7 +718,7 @@ $('#gsearch').typeahead({ }, { source: devices.ttAdapter(), - limit: '', + limit: '', async: true, display: 'name', valueKey: 'name', @@ -728,7 +729,7 @@ $('#gsearch').typeahead({ }, { source: ports.ttAdapter(), - limit: '', + limit: '', async: true, display: 'name', valueKey: 'name', @@ -739,7 +740,7 @@ $('#gsearch').typeahead({ }, { source: bgp.ttAdapter(), - limit: '', + limit: '', async: true, display: 'name', valueKey: 'name', @@ -752,3 +753,4 @@ $('#gsearch').bind('typeahead:open', function(ev, suggestion) { $('#gsearch').addClass('search-box'); }); + diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 8d763310db..c99bfd6f63 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -871,6 +871,3 @@ $config['ignore_unmapable_port'] = False; // InfluxDB default configuration $config['influxdb']['timeout'] = 0; $config['influxdb']['verifySSL'] = false; - -// Typeahead default configuration -$config['typeahead_limit'] = 5; From 8ef8c33ba3a82836f3149983d5e52a03a9fea8a8 Mon Sep 17 00:00:00 2001 From: Adam Winberg Date: Thu, 21 Apr 2016 13:03:26 +0200 Subject: [PATCH 3/3] forgot setting typeahead_limit option for dash --- html/ajax_dash.php | 1 + 1 file changed, 1 insertion(+) diff --git a/html/ajax_dash.php b/html/ajax_dash.php index 0ffc580679..6b268f889b 100644 --- a/html/ajax_dash.php +++ b/html/ajax_dash.php @@ -35,6 +35,7 @@ if ($type == 'placeholder') { elseif (is_file('includes/common/'.$type.'.inc.php')) { $results_limit = 10; + $typeahead_limit = $config['webui']['global_search_result_limit']; $no_form = true; $title = ucfirst($type); $unique_id = str_replace(array("-","."),"_",uniqid($type,true));