diff --git a/html/ajax_search.php b/html/ajax_search.php index ac16fba5be..047137a61d 100755 --- a/html/ajax_search.php +++ b/html/ajax_search.php @@ -41,7 +41,6 @@ if (isset($_REQUEST['search'])) foreach ($results as $result) { $name = $result['hostname']; - if (strlen($name) > 36) { $name = substr($name, 0, 36) . "..."; } if($result['disabled'] == 1) { $highlight_colour = '#808080'; @@ -85,15 +84,7 @@ if (isset($_REQUEST['search'])) foreach ($results as $result) { $name = $result['ifDescr']; - if (strlen($name) > 36) - { - $name = substr($name, 0, 36) . "..."; - } $description = $result['ifAlias']; - if (strlen($description) > 50) - { - $description = substr($description, 0, 50) . "..."; - } if($result['deleted'] == 0 && ($result['ignore'] == 0 || $result['ignore'] == 0) && ($result['ifInErrors_delta'] > 0 || $result['ifOutErrors_delta'] > 0)) { @@ -135,6 +126,54 @@ if (isset($_REQUEST['search'])) print_r($json); exit; + } elseif($_REQUEST['type'] == 'bgp') { + // Search bgp peers + $results = dbFetchRows("SELECT `bgpPeers`.* AS B,`devices`.* AS D FROM `bgpPeers` LEFT JOIN `devices` ON `bgpPeers`.`device_id` = `devices`.`device_id` WHERE `astext` LIKE '%" . $search . "%' OR `bgpPeerIdentifier` LIKE '%" . $search . "%' OR `bgpPeerRemoteAs` LIKE '%" . $search . "%' ORDER BY `astext` LIMIT 8"); + if (count($results)) + { + $found = 1; + + foreach ($results as $result) + { + $name = $result['bgpPeerIdentifier']; + $description = $result['astext']; + $remoteas = $result['bgpPeerRemoteAs']; + $localas = $result['bgpLocalAs']; + + if($result['bgpPeerAdminStatus'] == 'start' && $result['bgpPeerState'] != 'established') + { + // Session active but errored + $port_colour = '#ffa500'; + } + elseif($result['bgpPeerAdminStatus'] != 'start') + { + // Session inactive + $port_colour = '#000000'; + + } + elseif($result['bgpPeerAdminStatus'] == 'start' && $result['bgpPeerState'] == 'established') + { + // Session Up + $port_colour = '#008000'; + } + + if ($result['bgpPeerRemoteAs'] == $result['bgpLocalAs']) { $bgp_image = "images/16/brick_link.png"; } else { $bgp_image = "images/16/world_link.png"; } + + $bgp[]=array('count'=>count($results), + 'url'=>generate_peer_url($result), + 'name'=>$name, + 'description'=>$description, + 'localas'=>$localas, + 'bgp_image'=>$bgp_image, + 'remoteas'=>$remoteas, + 'colours'=>$port_colour, + 'hostname'=>$result['hostname']); + + } + } + $json = json_encode($bgp); + print_r($json); + exit; } } } diff --git a/html/css/styles.css b/html/css/styles.css index f3bbab8d42..7641dbe0f9 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -1608,3 +1608,8 @@ tr.search:nth-child(odd) { max-height: 200px; overflow-x: hidden; } + +.tt-dropdown-menu +{ + min-width: 500px; +} diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 8af13b5532..45b1aec84b 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -450,6 +450,11 @@ function generate_port_url($port, $vars=array()) return generate_url(array('page' => 'device', 'device' => $port['device_id'], 'tab' => 'port', 'port' => $port['port_id']), $vars); } +function generate_peer_url($peer, $vars=array()) +{ + return generate_url(array('page' => 'device', 'device' => $peer['device_id'], 'tab' => 'routing', 'proto' => 'bgp'), $vars); +} + function generate_port_image($args) { if (!$args['bg']) { $args['bg'] = "FFFFFF"; } diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 460625eb89..d17f4082b7 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -472,14 +472,9 @@ if(is_file("includes/print-menubar-custom.inc.php"))