mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch '2457-No-permite-editar-ni-eliminar-alertas-de-cluster' into 'develop'
Added new funcionality to cluster alert configuration: update alert See merge request artica/pandorafms!1634
This commit is contained in:
commit
d5b9ddec46
pandora_console
@ -218,7 +218,7 @@ $(document).ready (function () {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (data);
|
||||
$("#value", $value).append (parseInt(data));
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
@ -705,18 +705,26 @@ foreach ($simple_alerts as $alert) {
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
||||
$data[4] .= '</form>';
|
||||
|
||||
}
|
||||
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
|
@ -47,6 +47,7 @@ $add_action = (bool) get_parameter ('add_action');
|
||||
$update_action = (bool) get_parameter ('update_action');
|
||||
$delete_action = (bool) get_parameter ('delete_action');
|
||||
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||
$update_alert = (bool) get_parameter ('update_alert'); ////
|
||||
$disable_alert = (bool) get_parameter ('disable_alert');
|
||||
$enable_alert = (bool) get_parameter ('enable_alert');
|
||||
$standbyon_alert = (bool) get_parameter ('standbyon_alert');
|
||||
@ -67,10 +68,32 @@ $standby = get_parameter('standby','');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$messageAction = '';
|
||||
|
||||
if ($update_alert) {
|
||||
|
||||
$id_alert_agent_module = (int) get_parameter ('id_alert_update');
|
||||
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
$values_upd = array();
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_agent_module'] = $id_agent_module;
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_alert_template'] = $id_alert_template;
|
||||
|
||||
$id = alerts_update_alert_agent_module ($id_alert_agent_module, $values_upd);
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully updated'), __('Could not be updated'), '', true);
|
||||
|
||||
}
|
||||
|
||||
if ($create_alert) {
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
|
||||
if (db_get_value_sql("SELECT COUNT(id)
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = " . $id_agent_module . "
|
||||
@ -81,7 +104,7 @@ if ($create_alert) {
|
||||
}
|
||||
else {
|
||||
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
|
||||
|
||||
|
||||
$alert_template_name = db_get_value ("name",
|
||||
"talert_templates","id", $id_alert_template);
|
||||
$module_name = db_get_value ("nombre",
|
||||
@ -116,6 +139,7 @@ if ($create_alert) {
|
||||
$values['module_action_threshold'] =
|
||||
(int)get_parameter ('module_action_threshold');
|
||||
|
||||
|
||||
alerts_add_alert_agent_module_action ($id, $action_select, $values);
|
||||
}
|
||||
}
|
||||
|
@ -1019,14 +1019,16 @@ function alerts_create_alert_agent_module ($id_agent_module, $id_alert_template,
|
||||
* @return mixed Affected rows or false if something goes wrong.
|
||||
*/
|
||||
function alerts_update_alert_agent_module ($id_alert_agent_module, $values) {
|
||||
if (empty ($id_agent_module))
|
||||
|
||||
if (empty ($id_alert_agent_module))
|
||||
return false;
|
||||
|
||||
if (! is_array ($values))
|
||||
return false;
|
||||
|
||||
|
||||
return (@db_process_sql_update ('talert_template_modules',
|
||||
$values,
|
||||
array ('id' => $id_alert_template))) !== false;
|
||||
array ('id' => $id_alert_agent_module))) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user