Merge pull request #3363 from wiad/issue-3362

add config option for typeahead limit
This commit is contained in:
Neil Lathwood
2016-04-24 11:20:22 +01:00
3 changed files with 14 additions and 2 deletions

View File

@ -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));

View File

@ -204,6 +204,7 @@ function '.$unique_id.'() {
},
{
source: '.$unique_id.'_device.ttAdapter(),
limit: '.$typeahead_limit.',
async: false,
templates: {
header: "<h5><strong>&nbsp;Devices</strong></h5>",
@ -240,6 +241,7 @@ function '.$unique_id.'() {
},
{
source: '.$unique_id.'_port.ttAdapter(),
limit: '.$typeahead_limit.',
async: false,
templates: {
header: "<h5><strong>&nbsp;Ports</strong></h5>",
@ -275,6 +277,7 @@ function '.$unique_id.'() {
},
{
source: '.$unique_id.'_application.ttAdapter(),
limit: '.$typeahead_limit.',
async: false,
templates: {
header: "<h5><strong>&nbsp;Applications</strong></h5>",
@ -312,6 +315,7 @@ function '.$unique_id.'() {
},
{
source: '.$unique_id.'_munin.ttAdapter(),
limit: '.$typeahead_limit.',
async: false,
templates: {
header: "<h5><strong>&nbsp;Munin</strong></h5>",
@ -346,6 +350,7 @@ function '.$unique_id.'() {
},
{
source: '.$unique_id.'_bill.ttAdapter(),
limit: '.$typeahead_limit.',
async: false,
templates: {
header: "<h5><strong><i class=\'fa fa-money\'></i>&nbsp;Bill</strong></h5>",
@ -432,3 +437,4 @@ else {
$common_output[] = '<a href="graphs/'.$param.'/type='.$widget_settings['graph_type'].'/from='.$config['time'][$widget_settings['graph_range']].'"><img class="minigraph-image" width="'.$widget_dimensions['x'].'" height="'.$widget_dimensions['y'].'" src="graph.php?'.$param.'&from='.$config['time'][$widget_settings['graph_range']].'&to='.$config['time']['now'].'&width='.$widget_dimensions['x'].'&height='.$widget_dimensions['y'].'&type='.$widget_settings['graph_type'].'&legend='.($widget_settings['graph_legend'] == 1 ? 'yes' : 'no').'&absolute=1"/></a>';
}

View File

@ -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,6 +718,7 @@ $('#gsearch').typeahead({
},
{
source: devices.ttAdapter(),
limit: '<?php echo($typeahead_limit); ?>',
async: true,
display: 'name',
valueKey: 'name',
@ -727,6 +729,7 @@ $('#gsearch').typeahead({
},
{
source: ports.ttAdapter(),
limit: '<?php echo($typeahead_limit); ?>',
async: true,
display: 'name',
valueKey: 'name',
@ -737,6 +740,7 @@ $('#gsearch').typeahead({
},
{
source: bgp.ttAdapter(),
limit: '<?php echo($typeahead_limit); ?>',
async: true,
display: 'name',
valueKey: 'name',
@ -749,3 +753,4 @@ $('#gsearch').bind('typeahead:open', function(ev, suggestion) {
$('#gsearch').addClass('search-box');
});
</script>