Commit version 24.12.13800
This commit is contained in:
@ -6,40 +6,43 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
/// SEARCH SENSORS
|
||||
$results = dbFetchRows("SELECT * FROM `slas` LEFT JOIN `devices` USING (`device_id`) WHERE (`sla_target` LIKE ? OR `sla_index` LIKE ? OR `sla_tag` LIKE ?) $query_permitted_device ORDER BY `sla_target` LIMIT $query_limit", array($query_param, $query_param, $query_param));
|
||||
$where = [ '(`sla_target` LIKE ? OR `sla_index` LIKE ? OR `sla_tag` LIKE ?)' ];
|
||||
$where[] = '`slas`.`deleted` = 0';
|
||||
|
||||
$sql = "SELECT * FROM `slas` LEFT JOIN `devices` USING (`device_id`)" .
|
||||
generate_where_clause($where, $GLOBALS['cache']['where']['devices_permitted']) .
|
||||
" ORDER BY `sla_target` LIMIT $query_limit";
|
||||
$results = dbFetchRows($sql, [ $query_param, $query_param, $query_param ]);
|
||||
if (safe_empty($results)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!safe_empty($results)) {
|
||||
$max_len = 35;
|
||||
foreach ($results as $result) {
|
||||
$max_len = 35;
|
||||
foreach ($results as $result) {
|
||||
humanize_sla($result);
|
||||
|
||||
$device_name = truncate($result['hostname'], $max_len);
|
||||
if ($result['hostname'] != $result['sysName'] && $result['sysName']) {
|
||||
$device_name .= ' | ' . truncate($result['sysName'], $max_len);
|
||||
$device_name .= ' | ' . truncate($result['sysName'], $max_len);
|
||||
}
|
||||
$descr = strlen($result['location']) ? escape_html($result['location']) . ' | ' : '';
|
||||
$descr .= $result['rtt_label'];
|
||||
$descr = strlen($result['location']) ? escape_html($result['location']) . ' | ' : '';
|
||||
$descr .= $result['rtt_label'];
|
||||
$tab_colour = '#194B7F';
|
||||
|
||||
$sla_search_results[] = [
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $result['device_id'], 'tab' => 'slas', 'id' => $result['sla_id'])),
|
||||
'name' => $result['sla_descr'],
|
||||
'url' => generate_url(['page' => 'device', 'device' => $result['device_id'], 'tab' => 'slas', 'id' => $result['sla_id']]),
|
||||
'name' => $result['sla_descr'],
|
||||
'colour' => $tab_colour,
|
||||
'icon' => $config['icon']['sla'],
|
||||
'data' => [
|
||||
'| ' . escape_html($device_name),
|
||||
$descr,
|
||||
]
|
||||
'icon' => $config['icon']['sla'],
|
||||
'data' => ['| ' . escape_html($device_name), $descr]
|
||||
];
|
||||
}
|
||||
|
||||
$search_results['slas'] = [ 'descr' => 'SLAs found', 'results' => $sla_search_results ];
|
||||
}
|
||||
|
||||
$search_results['slas'] = ['descr' => 'SLAs found', 'results' => $sla_search_results];
|
||||
|
||||
// EOF
|
Reference in New Issue
Block a user