Fixed errors and added more information about the module alerts into the module nodes

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-30 20:06:49 +01:00
parent 35997cd727
commit 28c422d039
2 changed files with 47 additions and 15 deletions

View File

@ -894,9 +894,9 @@ class Tree {
break; break;
default: default:
$sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID, $sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID,
$serverID, $agent_search_filter, $agent_status_filter, $agent_search_filter, $agent_status_filter, $agents_join,
$agents_join, $module_search_filter, $module_status_filter, $module_search_filter, $module_status_filter, $modules_join,
$modules_join, $module_status_join); $module_status_join);
} }
return $sql; return $sql;
@ -904,9 +904,9 @@ class Tree {
// Override this method // Override this method
protected function getSqlExtended ($item_for_count, $type, $rootType, $parent, $rootID, protected function getSqlExtended ($item_for_count, $type, $rootType, $parent, $rootID,
$serverID, $agent_search_filter, $agent_status_filter, $agent_search_filter, $agent_status_filter, $agents_join,
$agents_join, $module_search_filter, $module_status_filter, $module_search_filter, $module_status_filter, $modules_join,
$modules_join, $module_status_join) { $module_status_join) {
return false; return false;
} }
@ -1079,11 +1079,8 @@ class Tree {
// Match with the name and type // Match with the name and type
if ($item['name'] == $item2['name'] && $item['type'] == $item2['type']) { if ($item['name'] == $item2['name'] && $item['type'] == $item2['type']) {
// Add the matched ids // Add the matched ids
$resultItem['id'] = array();
$resultItem['id'][$item2['serverID']] = $item2['id']; $resultItem['id'][$item2['serverID']] = $item2['id'];
$resultItem['rootID'] = array();
$resultItem['rootID'][$item2['serverID']] = $item2['rootID']; $resultItem['rootID'][$item2['serverID']] = $item2['rootID'];
$resultItem['serverID'] = array();
$resultItem['serverID'][$item2['serverID']] = $item2['rootID']; $resultItem['serverID'][$item2['serverID']] = $item2['rootID'];
// Add the matched counters // Add the matched counters
@ -1226,6 +1223,13 @@ class Tree {
'handle' => $winHandle 'handle' => $winHandle
); );
} }
// Alerts fired image
$has_alerts = (bool) db_get_value('COUNT(DISTINCT(id_agent_module))', 'talert_template_modules', 'id_agent_module', $module['id']);
if ($has_alerts) {
$module['alertsImageHTML'] = html_print_image("images/bell.png", true, array("title" => __('Module alerts')));
}
} }
protected function processModules (&$modules, $server = false) { protected function processModules (&$modules, $server = false) {

View File

@ -372,6 +372,8 @@ TreeController = {
// console.log(error); // console.log(error);
} }
}); });
$content.append($graphImage);
} }
// Data pop-up // Data pop-up
@ -393,12 +395,38 @@ TreeController = {
// console.log(error); // console.log(error);
} }
}); });
$content.append($dataImage);
} }
$content // Alerts
.append($graphImage) if (typeof element.alertsImageHTML != 'undefined'
.append($dataImage) && element.alertsImageHTML.length > 0) {
.append(element.name);
var $alertsImage = $(element.alertsImageHTML);
$alertsImage
.addClass("module-alerts")
.click(function (e) {
TreeNodeDetailController.getController().init({
recipient: controller.detailRecipient,
type: 'alert',
id: element.id,
serverID: element.serverID,
baseURL: controller.baseURL,
ajaxURL: controller.ajaxURL,
ajaxPage: controller.ajaxPage
});
// Avoid the execution of the module detail event
e.stopPropagation();
})
.css('cursor', 'pointer');
$content.append($alertsImage);
}
$content.append(element.name);
break; break;
case 'os': case 'os':
if (typeof element.icon != 'undefined' && element.icon.length > 0) { if (typeof element.icon != 'undefined' && element.icon.length > 0) {