WIP new report alert fired actions
This commit is contained in:
parent
bfa8dc4473
commit
e70ecd461e
|
@ -748,6 +748,38 @@ switch ($action) {
|
|||
$idAgentModule = $module;
|
||||
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':
|
||||
$description = $item['description'];
|
||||
$es = json_decode($item['external_source'], true);
|
||||
|
@ -1648,7 +1680,7 @@ $class = 'databox filters';
|
|||
<td class="bolder"><?php echo __('Agents'); ?></td>
|
||||
<td>
|
||||
<?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) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
|
@ -1680,7 +1712,18 @@ $class = 'databox filters';
|
|||
true,
|
||||
'',
|
||||
false,
|
||||
'min-width: 180px'
|
||||
'min-width: 500px; max-height: 100px',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -1721,7 +1764,7 @@ $class = 'databox filters';
|
|||
$all_modules = '';
|
||||
} else {
|
||||
$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)).')'
|
||||
);
|
||||
}
|
||||
|
@ -1730,12 +1773,12 @@ $class = 'databox filters';
|
|||
$all_modules = [];
|
||||
}
|
||||
|
||||
$modules_select = [];
|
||||
$all_modules_structured = [];
|
||||
$modules_select = [];
|
||||
$all_modules_structured = [];
|
||||
if (is_array($idAgentModule) || is_object($idAgentModule)) {
|
||||
foreach ($idAgentModule as $id) {
|
||||
foreach ($all_modules as $key => $a) {
|
||||
if ($a['id_agente_modulo'] == (int) $id) {
|
||||
foreach ($all_modules as $key => $a) {
|
||||
foreach ($idAgentModule as $id) {
|
||||
if ((int) $a['id_agente_modulo'] === (int) $id) {
|
||||
$modules_select[$a['id_agente_modulo']] = $a['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
|
@ -1751,14 +1794,115 @@ $class = 'databox filters';
|
|||
'module[]',
|
||||
$modules_select,
|
||||
$script = '',
|
||||
__('None'),
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
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>
|
||||
|
@ -3108,7 +3252,60 @@ $class = 'databox filters';
|
|||
?>
|
||||
</td>
|
||||
</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">
|
||||
<td class="bolder">
|
||||
<?php
|
||||
|
@ -3772,23 +3969,23 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
|
@ -4252,12 +4449,12 @@ $(document).ready (function () {
|
|||
// Load selected modules by default
|
||||
$("#id_agents2").trigger('click');
|
||||
|
||||
$('#combo_server').change (function (){
|
||||
$('#combo_server').change(function () {
|
||||
$("#id_agents").html('');
|
||||
$("#id_agents2").html('');
|
||||
$("#module").html('');
|
||||
$("#inventory_modules").html('');
|
||||
})
|
||||
$("#id_agents2").html('');
|
||||
$("#module").html('');
|
||||
$("#inventory_modules").html('');
|
||||
});
|
||||
|
||||
$("#text-url").keyup (
|
||||
function () {
|
||||
|
@ -4273,7 +4470,6 @@ $(document).ready (function () {
|
|||
|
||||
$("#combo_group").change (
|
||||
function () {
|
||||
|
||||
// Alert report group must show all matches when selecting All group
|
||||
// ignoring 'recursion' option. #6497.
|
||||
if ($("#combo_group").val() == 0) {
|
||||
|
@ -4284,7 +4480,12 @@ $(document).ready (function () {
|
|||
}
|
||||
|
||||
$("#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);
|
||||
|
||||
$("#inventory_modules").html('');
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
|
@ -4310,7 +4511,6 @@ $(document).ready (function () {
|
|||
);
|
||||
}
|
||||
);
|
||||
$("#combo_group").change();
|
||||
|
||||
$("#checkbox-recursion").change (
|
||||
function () {
|
||||
|
@ -4324,6 +4524,11 @@ $(document).ready (function () {
|
|||
},
|
||||
function (data, status) {
|
||||
$("#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) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
@ -4351,6 +4556,8 @@ $(document).ready (function () {
|
|||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
// Check module all.
|
||||
$("#checkbox-module-check-all").prop('checked', false);
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente_modulo"])
|
||||
|
@ -4374,6 +4581,8 @@ $(document).ready (function () {
|
|||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
// Check module all.
|
||||
$("#checkbox-module-check-all").prop('checked', false);
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
|
@ -4399,6 +4608,8 @@ $(document).ready (function () {
|
|||
},
|
||||
function (data, status) {
|
||||
$("#module").html('');
|
||||
// Check module all.
|
||||
$("#checkbox-module-check-all").prop('checked', false);
|
||||
if(data){
|
||||
jQuery.each (data, function (id, value) {
|
||||
option = $("<option></option>")
|
||||
|
@ -5538,6 +5749,8 @@ function chooseType() {
|
|||
$('#row_hide_notinit_agents').hide();
|
||||
$('#row_priority_mode').hide();
|
||||
$("#row_module_group").hide();
|
||||
$("#row_alert_templates").hide();
|
||||
$("#row_alert_actions").hide();
|
||||
$("#row_servers").hide();
|
||||
$("#row_sort").hide();
|
||||
$("#row_date").hide();
|
||||
|
@ -5896,6 +6109,18 @@ function chooseType() {
|
|||
$("#row_historical_db_check").hide();
|
||||
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':
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
|
|
|
@ -1692,6 +1692,36 @@ switch ($action) {
|
|||
$good_format = true;
|
||||
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':
|
||||
$values['period'] = 0;
|
||||
$es['date'] = get_parameter('date');
|
||||
|
@ -2436,6 +2466,36 @@ switch ($action) {
|
|||
$good_format = true;
|
||||
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':
|
||||
$values['period'] = get_parameter('period');
|
||||
$es['id_agents'] = get_parameter('id_agents');
|
||||
|
|
|
@ -2949,3 +2949,100 @@ function alerts_get_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,
|
||||
$required=false,
|
||||
$truncate_size=false,
|
||||
$select2_enable=true
|
||||
$select2_enable=true,
|
||||
$select2_multiple_enable=false,
|
||||
$select2_multiple_enable_all=false
|
||||
) {
|
||||
$output = "\n";
|
||||
|
||||
|
@ -790,6 +792,12 @@ function html_print_select(
|
|||
$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.'>';
|
||||
|
||||
if ($nothing !== false) {
|
||||
|
@ -889,6 +897,24 @@ function html_print_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()) {
|
||||
$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>
|
||||
|
@ -900,7 +926,7 @@ function html_print_select(
|
|||
$select2 = 'select2_dark.min';
|
||||
}
|
||||
|
||||
if ($multiple === false && $select2_enable === true) {
|
||||
if (($multiple === false || $select2_multiple_enable === true) && $select2_enable === true) {
|
||||
if (is_ajax()) {
|
||||
$output .= '<script src="';
|
||||
$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>';
|
||||
}
|
||||
|
||||
|
|
|
@ -734,6 +734,13 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
$report['contents'][] = reporting_alert_report_actions(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
break;
|
||||
|
||||
case 'agents_inventory':
|
||||
$report['contents'][] = reporting_agents_inventory(
|
||||
$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)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -377,6 +377,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_agent_module($table, $item);
|
||||
break;
|
||||
|
||||
case 'alert_report_actions':
|
||||
reporting_html_alert_report_actions($table, $item);
|
||||
break;
|
||||
|
||||
case 'agents_inventory':
|
||||
reporting_html_agents_inventory($table, $item);
|
||||
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
|
||||
* 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'),
|
||||
'name' => __('Agent alert report '),
|
||||
];
|
||||
|
||||
if (!$template) {
|
||||
$types['alert_report_group'] = [
|
||||
'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'] = [
|
||||
'optgroup' => __('Events'),
|
||||
'name' => __('Module event report'),
|
||||
|
|
|
@ -8348,3 +8348,32 @@ div.stat-win-spinner img {
|
|||
#license_error_msg_dialog {
|
||||
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…
Reference in New Issue