mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
WIP new report alert fired actions
This commit is contained in:
parent
bfa8dc4473
commit
e70ecd461e
@ -748,6 +748,38 @@ switch ($action) {
|
|||||||
$idAgentModule = $module;
|
$idAgentModule = $module;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
hd('1');
|
||||||
|
$description = $item['description'];
|
||||||
|
$es = json_decode($item['external_source'], true);
|
||||||
|
$id_agents = $es['id_agents'];
|
||||||
|
|
||||||
|
$selection_a_m = get_parameter('selection');
|
||||||
|
$recursion = $item['recursion'];
|
||||||
|
|
||||||
|
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
|
||||||
|
$module = '';
|
||||||
|
} else {
|
||||||
|
$module = $es['module'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$group = $item['id_group'];
|
||||||
|
$modulegroup = $item['id_module_group'];
|
||||||
|
$idAgentModule = $module;
|
||||||
|
|
||||||
|
$alert_templates_selected = $es['templates'];
|
||||||
|
$alert_actions_selected = $es['actions'];
|
||||||
|
|
||||||
|
$show_summary = $es['show_summary'];
|
||||||
|
|
||||||
|
$group_by = $es['group_by'];
|
||||||
|
|
||||||
|
$period = $item['period'];
|
||||||
|
|
||||||
|
$lapse = $item['lapse'];
|
||||||
|
$lapse_calc = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'agents_inventory':
|
case 'agents_inventory':
|
||||||
$description = $item['description'];
|
$description = $item['description'];
|
||||||
$es = json_decode($item['external_source'], true);
|
$es = json_decode($item['external_source'], true);
|
||||||
@ -1648,7 +1680,7 @@ $class = 'databox filters';
|
|||||||
<td class="bolder"><?php echo __('Agents'); ?></td>
|
<td class="bolder"><?php echo __('Agents'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$all_agent_log = agents_get_agents(false, ['id_agente', 'alias']);
|
$all_agent_log = agents_get_agents(['id_grupo' => $group], ['id_agente', 'alias']);
|
||||||
foreach ($all_agent_log as $key => $value) {
|
foreach ($all_agent_log as $key => $value) {
|
||||||
$agents2[$value['id_agente']] = $value['alias'];
|
$agents2[$value['id_agente']] = $value['alias'];
|
||||||
}
|
}
|
||||||
@ -1680,7 +1712,18 @@ $class = 'databox filters';
|
|||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'min-width: 180px'
|
'min-width: 500px; max-height: 100px',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -1721,7 +1764,7 @@ $class = 'databox filters';
|
|||||||
$all_modules = '';
|
$all_modules = '';
|
||||||
} else {
|
} else {
|
||||||
$all_modules = db_get_all_rows_sql(
|
$all_modules = db_get_all_rows_sql(
|
||||||
'SELECT DISTINCT nombre FROM
|
'SELECT DISTINCT nombre, id_agente_modulo FROM
|
||||||
tagente_modulo WHERE id_agente IN ('.implode(',', array_values($id_agents)).')'
|
tagente_modulo WHERE id_agente IN ('.implode(',', array_values($id_agents)).')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1733,9 +1776,9 @@ $class = 'databox filters';
|
|||||||
$modules_select = [];
|
$modules_select = [];
|
||||||
$all_modules_structured = [];
|
$all_modules_structured = [];
|
||||||
if (is_array($idAgentModule) || is_object($idAgentModule)) {
|
if (is_array($idAgentModule) || is_object($idAgentModule)) {
|
||||||
foreach ($idAgentModule as $id) {
|
|
||||||
foreach ($all_modules as $key => $a) {
|
foreach ($all_modules as $key => $a) {
|
||||||
if ($a['id_agente_modulo'] == (int) $id) {
|
foreach ($idAgentModule as $id) {
|
||||||
|
if ((int) $a['id_agente_modulo'] === (int) $id) {
|
||||||
$modules_select[$a['id_agente_modulo']] = $a['id_agente_modulo'];
|
$modules_select[$a['id_agente_modulo']] = $a['id_agente_modulo'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1751,14 +1794,115 @@ $class = 'databox filters';
|
|||||||
'module[]',
|
'module[]',
|
||||||
$modules_select,
|
$modules_select,
|
||||||
$script = '',
|
$script = '',
|
||||||
__('None'),
|
'',
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'min-width: 180px'
|
'min-width: 500px; max-height: 100px',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_alert_templates" class="datos">
|
||||||
|
<td class="bolder"><?php echo __('Templates'); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$alert_templates = [];
|
||||||
|
$own_info = get_user_info($config['id_user']);
|
||||||
|
if ($own_info['is_admin']) {
|
||||||
|
$alert_templates = alerts_get_alert_templates(
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
||||||
|
$filter_groups = '';
|
||||||
|
$filter_groups = implode(',', array_keys($usr_groups));
|
||||||
|
$alert_templates = alerts_get_alert_templates(
|
||||||
|
['id_group IN ('.$filter_groups.')'],
|
||||||
|
[
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_select(
|
||||||
|
$alert_templates,
|
||||||
|
'alert_templates[]',
|
||||||
|
$alert_templates_selected,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'min-width: 500px; max-height: 100px',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_alert_actions" class="datos">
|
||||||
|
<td class="bolder"><?php echo __('Actions'); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$alert_actions = alerts_get_alert_actions(true);
|
||||||
|
html_print_select(
|
||||||
|
$alert_actions,
|
||||||
|
'alert_actions[]',
|
||||||
|
$alert_actions_selected,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'min-width: 500px; max-height: 100px',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -3109,6 +3253,59 @@ $class = 'databox filters';
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_show_summary" class="datos">
|
||||||
|
<td class="bolder">
|
||||||
|
<?php
|
||||||
|
echo __('Show Summary');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
html_print_checkbox_switch(
|
||||||
|
'show_summary',
|
||||||
|
true,
|
||||||
|
$show_summary
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_group_by" class="datos">
|
||||||
|
<td class="bolder">
|
||||||
|
<?php
|
||||||
|
echo __('Group by');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$valuesGroupBy = [
|
||||||
|
'agent' => 'Agent',
|
||||||
|
'module' => 'Module',
|
||||||
|
'action' => 'Action',
|
||||||
|
'template' => 'Template',
|
||||||
|
];
|
||||||
|
html_print_select(
|
||||||
|
$valuesGroupBy,
|
||||||
|
'group_by',
|
||||||
|
$group_by,
|
||||||
|
'',
|
||||||
|
__('None'),
|
||||||
|
'0',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="row_landscape" class="datos">
|
<tr id="row_landscape" class="datos">
|
||||||
<td class="bolder">
|
<td class="bolder">
|
||||||
<?php
|
<?php
|
||||||
@ -4257,7 +4454,7 @@ $(document).ready (function () {
|
|||||||
$("#id_agents2").html('');
|
$("#id_agents2").html('');
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
$("#inventory_modules").html('');
|
$("#inventory_modules").html('');
|
||||||
})
|
});
|
||||||
|
|
||||||
$("#text-url").keyup (
|
$("#text-url").keyup (
|
||||||
function () {
|
function () {
|
||||||
@ -4273,7 +4470,6 @@ $(document).ready (function () {
|
|||||||
|
|
||||||
$("#combo_group").change (
|
$("#combo_group").change (
|
||||||
function () {
|
function () {
|
||||||
|
|
||||||
// Alert report group must show all matches when selecting All group
|
// Alert report group must show all matches when selecting All group
|
||||||
// ignoring 'recursion' option. #6497.
|
// ignoring 'recursion' option. #6497.
|
||||||
if ($("#combo_group").val() == 0) {
|
if ($("#combo_group").val() == 0) {
|
||||||
@ -4284,7 +4480,12 @@ $(document).ready (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$("#id_agents2").html('');
|
$("#id_agents2").html('');
|
||||||
|
// Check agent all.
|
||||||
|
$("#checkbox-id_agents2-check-all").prop('checked', false);
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
|
// Check module all.
|
||||||
|
$("#checkbox-module-check-all").prop('checked', false);
|
||||||
|
|
||||||
$("#inventory_modules").html('');
|
$("#inventory_modules").html('');
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
{"page" : "operation/agentes/ver_agente",
|
{"page" : "operation/agentes/ver_agente",
|
||||||
@ -4310,7 +4511,6 @@ $(document).ready (function () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("#combo_group").change();
|
|
||||||
|
|
||||||
$("#checkbox-recursion").change (
|
$("#checkbox-recursion").change (
|
||||||
function () {
|
function () {
|
||||||
@ -4324,6 +4524,11 @@ $(document).ready (function () {
|
|||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#id_agents2").html('');
|
$("#id_agents2").html('');
|
||||||
|
// Check agent all.
|
||||||
|
$("#checkbox-id_agents2-check-all").prop('checked', false);
|
||||||
|
$("#module").html('');
|
||||||
|
// Check module all.
|
||||||
|
$("#checkbox-module-check-all").prop('checked', false);
|
||||||
jQuery.each (data, function (id, value) {
|
jQuery.each (data, function (id, value) {
|
||||||
// Remove keys_prefix from the index
|
// Remove keys_prefix from the index
|
||||||
id = id.substring(1);
|
id = id.substring(1);
|
||||||
@ -4351,6 +4556,8 @@ $(document).ready (function () {
|
|||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
|
// Check module all.
|
||||||
|
$("#checkbox-module-check-all").prop('checked', false);
|
||||||
jQuery.each (data, function (id, value) {
|
jQuery.each (data, function (id, value) {
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
.attr ("value", value["id_agente_modulo"])
|
.attr ("value", value["id_agente_modulo"])
|
||||||
@ -4374,6 +4581,8 @@ $(document).ready (function () {
|
|||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
|
// Check module all.
|
||||||
|
$("#checkbox-module-check-all").prop('checked', false);
|
||||||
if(data){
|
if(data){
|
||||||
jQuery.each (data, function (id, value) {
|
jQuery.each (data, function (id, value) {
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
@ -4399,6 +4608,8 @@ $(document).ready (function () {
|
|||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#module").html('');
|
$("#module").html('');
|
||||||
|
// Check module all.
|
||||||
|
$("#checkbox-module-check-all").prop('checked', false);
|
||||||
if(data){
|
if(data){
|
||||||
jQuery.each (data, function (id, value) {
|
jQuery.each (data, function (id, value) {
|
||||||
option = $("<option></option>")
|
option = $("<option></option>")
|
||||||
@ -5538,6 +5749,8 @@ function chooseType() {
|
|||||||
$('#row_hide_notinit_agents').hide();
|
$('#row_hide_notinit_agents').hide();
|
||||||
$('#row_priority_mode').hide();
|
$('#row_priority_mode').hide();
|
||||||
$("#row_module_group").hide();
|
$("#row_module_group").hide();
|
||||||
|
$("#row_alert_templates").hide();
|
||||||
|
$("#row_alert_actions").hide();
|
||||||
$("#row_servers").hide();
|
$("#row_servers").hide();
|
||||||
$("#row_sort").hide();
|
$("#row_sort").hide();
|
||||||
$("#row_date").hide();
|
$("#row_date").hide();
|
||||||
@ -5896,6 +6109,18 @@ function chooseType() {
|
|||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
$("#row_description").show();
|
||||||
|
$("#row_group").show();
|
||||||
|
$("#select_agent_modules").show();
|
||||||
|
$("#agents_modules_row").show();
|
||||||
|
$("#modules_row").show();
|
||||||
|
$("#row_alert_templates").show();
|
||||||
|
$("#row_alert_actions").show();
|
||||||
|
$("#row_period").show();
|
||||||
|
$("#row_lapse").show();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'event_report_group':
|
case 'event_report_group':
|
||||||
$("#row_description").show();
|
$("#row_description").show();
|
||||||
$("#row_period").show();
|
$("#row_period").show();
|
||||||
|
@ -1692,6 +1692,36 @@ switch ($action) {
|
|||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
hd('3');
|
||||||
|
$agents_to_report = get_parameter('id_agents2');
|
||||||
|
$modules_to_report = get_parameter('module', '');
|
||||||
|
$alert_templates_to_report = get_parameter('alert_templates');
|
||||||
|
$alert_actions_to_report = get_parameter('alert_actions');
|
||||||
|
$show_summary = get_parameter('show_summary', 0);
|
||||||
|
$group_by = get_parameter('group_by', 0);
|
||||||
|
|
||||||
|
$es['module'] = get_same_modules(
|
||||||
|
$agents_to_report,
|
||||||
|
$modules_to_report
|
||||||
|
);
|
||||||
|
$es['id_agents'] = $agents_to_report;
|
||||||
|
$es['templates'] = $alert_templates_to_report;
|
||||||
|
$es['actions'] = $alert_actions_to_report;
|
||||||
|
$es['show_summary'] = $show_summary;
|
||||||
|
$es['group_by'] = $group_by;
|
||||||
|
|
||||||
|
$values['external_source'] = json_encode($es);
|
||||||
|
|
||||||
|
$values['period'] = get_parameter('period');
|
||||||
|
$values['lapse_calc'] = get_parameter(
|
||||||
|
'lapse_calc'
|
||||||
|
);
|
||||||
|
$values['lapse'] = get_parameter('lapse');
|
||||||
|
|
||||||
|
$good_format = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'inventory':
|
case 'inventory':
|
||||||
$values['period'] = 0;
|
$values['period'] = 0;
|
||||||
$es['date'] = get_parameter('date');
|
$es['date'] = get_parameter('date');
|
||||||
@ -2436,6 +2466,36 @@ switch ($action) {
|
|||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
hd('2');
|
||||||
|
$agents_to_report = get_parameter('id_agents2');
|
||||||
|
$modules_to_report = get_parameter('module', '');
|
||||||
|
$alert_templates_to_report = get_parameter('alert_templates');
|
||||||
|
$alert_actions_to_report = get_parameter('alert_actions');
|
||||||
|
$show_summary = get_parameter('show_summary', 0);
|
||||||
|
$group_by = get_parameter('group_by', 0);
|
||||||
|
|
||||||
|
$es['module'] = get_same_modules(
|
||||||
|
$agents_to_report,
|
||||||
|
$modules_to_report
|
||||||
|
);
|
||||||
|
$es['id_agents'] = $agents_to_report;
|
||||||
|
$es['templates'] = $alert_templates_to_report;
|
||||||
|
$es['actions'] = $alert_actions_to_report;
|
||||||
|
$es['show_summary'] = $show_summary;
|
||||||
|
$es['group_by'] = $group_by;
|
||||||
|
|
||||||
|
$values['external_source'] = json_encode($es);
|
||||||
|
|
||||||
|
$values['period'] = get_parameter('period');
|
||||||
|
$values['lapse_calc'] = get_parameter(
|
||||||
|
'lapse_calc'
|
||||||
|
);
|
||||||
|
$values['lapse'] = get_parameter('lapse');
|
||||||
|
|
||||||
|
$good_format = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'inventory_changes':
|
case 'inventory_changes':
|
||||||
$values['period'] = get_parameter('period');
|
$values['period'] = get_parameter('period');
|
||||||
$es['id_agents'] = get_parameter('id_agents');
|
$es['id_agents'] = get_parameter('id_agents');
|
||||||
|
@ -2949,3 +2949,100 @@ function alerts_get_agent_modules(
|
|||||||
return $agent_modules;
|
return $agent_modules;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function alerts_get_alert_fired($filters=[], $groupsBy=[])
|
||||||
|
{
|
||||||
|
$filter_group = '';
|
||||||
|
if (isset($filters['group']) === true) {
|
||||||
|
$filter_group = sprintf('AND id_grupo = %d', $filters['group']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_agents = '';
|
||||||
|
if (isset($filters['agents']) === true) {
|
||||||
|
$filter_agents = sprintf(
|
||||||
|
'AND id_agente IN ("%s")',
|
||||||
|
implode(',', $filters['agents'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_modules = '';
|
||||||
|
if (isset($filters['modules']) === true) {
|
||||||
|
$filter_modules = sprintf(
|
||||||
|
'AND id_agentmodule IN ("%s")',
|
||||||
|
implode(',', $filters['modules'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_actions = '';
|
||||||
|
if (isset($filters['actions']) === true) {
|
||||||
|
$filter_actions = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_templates = '';
|
||||||
|
if (isset($filters['templates']) === true) {
|
||||||
|
$filter_templates = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter_period = '';
|
||||||
|
if (isset($filters['period']) === true) {
|
||||||
|
$filter_period = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$group_by = '';
|
||||||
|
if (isset($groupsBy['group_by']) === true) {
|
||||||
|
switch ($groupsBy['group_by']) {
|
||||||
|
case 'module':
|
||||||
|
$group_by = sprintf('GROUP BY id_agentmodule');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'action':
|
||||||
|
$group_by = sprintf('GROUP BY 1');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'template':
|
||||||
|
$group_by = sprintf('GROUP BY id_alert_am');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'agent':
|
||||||
|
$group_by = sprintf('GROUP BY id_agente');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Nothing.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: group by periods $groupsBy['lapse'].
|
||||||
|
$query = sprintf(
|
||||||
|
'SELECT id_agente, id_grupo, id_agentmodule, count(*) as fired
|
||||||
|
FROM tevento
|
||||||
|
WHERE custom_data != ""
|
||||||
|
AND event_type="alert_fired"
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
AND (
|
||||||
|
JSON_CONTAINS(custom_data, "Mail to Admin", "$.actions") = 1
|
||||||
|
OR JSON_CONTAINS(custom_data, "Restart agent", "$.actions") = 1
|
||||||
|
)
|
||||||
|
%s',
|
||||||
|
$filter_group,
|
||||||
|
$filter_agents,
|
||||||
|
$filter_modules,
|
||||||
|
$filter_actions,
|
||||||
|
$filter_templates,
|
||||||
|
$filter_period,
|
||||||
|
$group_by
|
||||||
|
);
|
||||||
|
|
||||||
|
hd($query, '', true);
|
||||||
|
|
||||||
|
$alert_fired = db_get_all_rows_sql($query);
|
||||||
|
|
||||||
|
hd($alert_fired);
|
||||||
|
}
|
||||||
|
@ -728,7 +728,9 @@ function html_print_select(
|
|||||||
$simple_multiple_options=false,
|
$simple_multiple_options=false,
|
||||||
$required=false,
|
$required=false,
|
||||||
$truncate_size=false,
|
$truncate_size=false,
|
||||||
$select2_enable=true
|
$select2_enable=true,
|
||||||
|
$select2_multiple_enable=false,
|
||||||
|
$select2_multiple_enable_all=false
|
||||||
) {
|
) {
|
||||||
$output = "\n";
|
$output = "\n";
|
||||||
|
|
||||||
@ -790,6 +792,12 @@ function html_print_select(
|
|||||||
$required = 'required';
|
$required = 'required';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($select2_multiple_enable === true
|
||||||
|
&& $select2_multiple_enable_all === true
|
||||||
|
) {
|
||||||
|
$output .= '<div class="flex-row-center">';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
|
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
|
||||||
|
|
||||||
if ($nothing !== false) {
|
if ($nothing !== false) {
|
||||||
@ -889,6 +897,24 @@ function html_print_select(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output .= '</select>';
|
$output .= '</select>';
|
||||||
|
|
||||||
|
if ($select2_multiple_enable === true
|
||||||
|
&& $select2_multiple_enable_all === true
|
||||||
|
) {
|
||||||
|
$output .= '<div class="margin-left-2 flex-column">';
|
||||||
|
$output .= '<span>'.__('All').'</span>';
|
||||||
|
$output .= html_print_checkbox_switch(
|
||||||
|
$id.'-check-all',
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
$disabled,
|
||||||
|
'checkMultipleAll('.$id.')'
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($modal && !enterprise_installed()) {
|
if ($modal && !enterprise_installed()) {
|
||||||
$output .= "
|
$output .= "
|
||||||
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
|
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
|
||||||
@ -900,7 +926,7 @@ function html_print_select(
|
|||||||
$select2 = 'select2_dark.min';
|
$select2 = 'select2_dark.min';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($multiple === false && $select2_enable === true) {
|
if (($multiple === false || $select2_multiple_enable === true) && $select2_enable === true) {
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$output .= '<script src="';
|
$output .= '<script src="';
|
||||||
$output .= ui_get_full_url(
|
$output .= ui_get_full_url(
|
||||||
@ -942,6 +968,32 @@ function html_print_select(
|
|||||||
});';
|
});';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($select2_multiple_enable === true
|
||||||
|
&& $select2_multiple_enable_all === true
|
||||||
|
) {
|
||||||
|
$output .= '$("#'.$id.'").on("change", function(e) {
|
||||||
|
var checked = false;
|
||||||
|
if(e.target.length !== $("#'.$id.' > option:selected").length) {
|
||||||
|
checked = false;
|
||||||
|
} else {
|
||||||
|
checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#checkbox-'.$id.'-check-all").prop("checked", checked);
|
||||||
|
});';
|
||||||
|
|
||||||
|
$output .= '$("#'.$id.'").trigger("change");';
|
||||||
|
|
||||||
|
$output .= 'function checkMultipleAll(id){
|
||||||
|
if ($("#checkbox-"+id.id+"-check-all").is(":checked")) {
|
||||||
|
$("#"+id.id+" > option").prop("selected", "selected");
|
||||||
|
$("#"+id.id).trigger("change");
|
||||||
|
} else {
|
||||||
|
$("#"+id.id).val(null).trigger("change");
|
||||||
|
}
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '</script>';
|
$output .= '</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,6 +734,13 @@ function reporting_make_reporting_data(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
$report['contents'][] = reporting_alert_report_actions(
|
||||||
|
$report,
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'agents_inventory':
|
case 'agents_inventory':
|
||||||
$report['contents'][] = reporting_agents_inventory(
|
$report['contents'][] = reporting_agents_inventory(
|
||||||
$report,
|
$report,
|
||||||
@ -2658,6 +2665,58 @@ function reporting_inventory($report, $content, $type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reporting_alert_report_actions($report, $content)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
$return = [];
|
||||||
|
|
||||||
|
$return['type'] = 'alert_report_actions';
|
||||||
|
if (empty($content['name']) === true) {
|
||||||
|
$content['name'] = __('Alert actions');
|
||||||
|
}
|
||||||
|
|
||||||
|
$return['title'] = io_safe_output($content['name']);
|
||||||
|
$return['landscape'] = $content['landscape'];
|
||||||
|
$return['pagebreak'] = $content['pagebreak'];
|
||||||
|
|
||||||
|
$return['subtitle'] = __('Actions');
|
||||||
|
$return['description'] = io_safe_output($content['description']);
|
||||||
|
$return['date'] = reporting_get_date_text($report, $content);
|
||||||
|
|
||||||
|
$return['data'] = [];
|
||||||
|
|
||||||
|
$es = json_decode($content['external_source'], true);
|
||||||
|
|
||||||
|
$period = $content['period'];
|
||||||
|
$id_group = $content['id_group'];
|
||||||
|
$modules = $es['modules'];
|
||||||
|
$agents = $es['id_agents'];
|
||||||
|
$templates = $es['templates'];
|
||||||
|
$actions = $es['actions'];
|
||||||
|
$show_summary = $es['show_summary'];
|
||||||
|
$group_by = $es['group_by'];
|
||||||
|
$lapse = $content['lapse'];
|
||||||
|
|
||||||
|
$filters = [
|
||||||
|
'group' => $id_group,
|
||||||
|
'agents' => $agents,
|
||||||
|
'modules' => $modules,
|
||||||
|
'templates' => $templates,
|
||||||
|
'actions' => $actions,
|
||||||
|
'period' => $period,
|
||||||
|
];
|
||||||
|
|
||||||
|
$goupsBy = [
|
||||||
|
'group_by' => $group_by,
|
||||||
|
'lapse' => $lapse,
|
||||||
|
];
|
||||||
|
|
||||||
|
alerts_get_alert_fired($filters, $goupsBy);
|
||||||
|
|
||||||
|
return reporting_check_structure_content($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function reporting_agent_module($report, $content)
|
function reporting_agent_module($report, $content)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -377,6 +377,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||||||
reporting_html_agent_module($table, $item);
|
reporting_html_agent_module($table, $item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'alert_report_actions':
|
||||||
|
reporting_html_alert_report_actions($table, $item);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'agents_inventory':
|
case 'agents_inventory':
|
||||||
reporting_html_agents_inventory($table, $item);
|
reporting_html_agents_inventory($table, $item);
|
||||||
break;
|
break;
|
||||||
@ -2729,6 +2733,12 @@ function reporting_html_group_configuration($table, $item, $pdf=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reporting_html_alert_report_actions($table, $item, $pdf=0)
|
||||||
|
{
|
||||||
|
hd($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This type of report element will generate the interface graphs
|
* This type of report element will generate the interface graphs
|
||||||
* of all those devices that belong to the selected group.
|
* of all those devices that belong to the selected group.
|
||||||
|
@ -834,6 +834,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
'optgroup' => __('Alerts'),
|
'optgroup' => __('Alerts'),
|
||||||
'name' => __('Agent alert report '),
|
'name' => __('Agent alert report '),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$template) {
|
if (!$template) {
|
||||||
$types['alert_report_group'] = [
|
$types['alert_report_group'] = [
|
||||||
'optgroup' => __('Alerts'),
|
'optgroup' => __('Alerts'),
|
||||||
@ -841,6 +842,11 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$types['alert_report_actions'] = [
|
||||||
|
'optgroup' => __('Alerts'),
|
||||||
|
'name' => __('Actions alert report '),
|
||||||
|
];
|
||||||
|
|
||||||
$types['event_report_module'] = [
|
$types['event_report_module'] = [
|
||||||
'optgroup' => __('Events'),
|
'optgroup' => __('Events'),
|
||||||
'name' => __('Module event report'),
|
'name' => __('Module event report'),
|
||||||
|
@ -8348,3 +8348,32 @@ div.stat-win-spinner img {
|
|||||||
#license_error_msg_dialog {
|
#license_error_msg_dialog {
|
||||||
min-height: 350px !important;
|
min-height: 350px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select2-container--default
|
||||||
|
.select2-selection--multiple
|
||||||
|
.select2-selection__rendered {
|
||||||
|
padding: 5px 10px 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default
|
||||||
|
.select2-selection--multiple
|
||||||
|
.select2-selection__choice {
|
||||||
|
background-color: #82b92e !important;
|
||||||
|
border: 1px solid #82b92e !important;
|
||||||
|
padding: 0.3em 0.6em !important;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default
|
||||||
|
.select2-selection--multiple
|
||||||
|
.select2-selection__choice__remove {
|
||||||
|
color: #fff !important;
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin-right: 5px !important;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user