mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-25 19:09:08 +02:00
Wip command center, alerts SNMP broken
This commit is contained in:
parent
ca59034cf3
commit
da6c75f5b0
@ -48,7 +48,11 @@ if (is_ajax()) {
|
|||||||
$id = (int) get_parameter('id', 0);
|
$id = (int) get_parameter('id', 0);
|
||||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||||
|
|
||||||
|
// Snmp alerts are not in the metaconsole so they cannot be centralized.
|
||||||
|
$is_management_allowed = false;
|
||||||
|
if ($get_recovery_fields !== 0) {
|
||||||
$is_management_allowed = !is_management_allowed();
|
$is_management_allowed = !is_management_allowed();
|
||||||
|
}
|
||||||
|
|
||||||
// If command ID is not provided, check for action id.
|
// If command ID is not provided, check for action id.
|
||||||
if ($id == 0) {
|
if ($id == 0) {
|
||||||
|
@ -987,14 +987,11 @@ if ($create_alert || $update_alert) {
|
|||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Alert type (e-mail, event etc.)
|
// Alert type (e-mail, event etc.)
|
||||||
echo '<tr><td class="datos">'.__('Alert action').'</td><td class="datos">';
|
echo '<tr><td class="datos">'.__('Alert commands').'</td><td class="datos">';
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
|
||||||
case 'mysql':
|
|
||||||
case 'postgresql':
|
|
||||||
html_print_select_from_sql(
|
html_print_select_from_sql(
|
||||||
'SELECT id, name
|
'SELECT id, name
|
||||||
FROM talert_actions
|
FROM talert_commands
|
||||||
ORDER BY name',
|
ORDER BY name',
|
||||||
'alert_type',
|
'alert_type',
|
||||||
$alert_type,
|
$alert_type,
|
||||||
@ -1005,24 +1002,6 @@ if ($create_alert || $update_alert) {
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
html_print_select_from_sql(
|
|
||||||
'SELECT id, dbms_lob.substr(name,4000,1) as name
|
|
||||||
FROM talert_actions
|
|
||||||
ORDER BY dbms_lob.substr(name,4000,1)',
|
|
||||||
'alert_type',
|
|
||||||
$alert_type,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '<tr><td class="datos">'.__('Position').'</td><td class="datos">';
|
echo '<tr><td class="datos">'.__('Position').'</td><td class="datos">';
|
||||||
@ -1482,7 +1461,6 @@ function time_changed () {
|
|||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$('#time_threshold').change (time_changed);
|
$('#time_threshold').change (time_changed);
|
||||||
|
|
||||||
$("input[name=all_delete_box]").change (function() {
|
$("input[name=all_delete_box]").change (function() {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$("input[name='delete_ids[]']").check();
|
$("input[name='delete_ids[]']").check();
|
||||||
@ -1503,10 +1481,9 @@ $(document).ready (function () {
|
|||||||
value: "1"
|
value: "1"
|
||||||
});
|
});
|
||||||
values.push ({
|
values.push ({
|
||||||
name: "id_action",
|
name: "id",
|
||||||
value: this.value
|
value: this.value
|
||||||
});
|
});
|
||||||
|
|
||||||
values.push ({
|
values.push ({
|
||||||
name: "get_recovery_fields",
|
name: "get_recovery_fields",
|
||||||
value: "0"
|
value: "0"
|
||||||
@ -1515,13 +1492,11 @@ $(document).ready (function () {
|
|||||||
values,
|
values,
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||||
|
|
||||||
original_command = js_html_entity_decode (data["command"]);
|
original_command = js_html_entity_decode (data["command"]);
|
||||||
command_description = js_html_entity_decode (data["description"]);
|
command_description = js_html_entity_decode (data["description"]);
|
||||||
for (i = 1; i <= max_fields; i++) {
|
for (i = 1; i <= max_fields; i++) {
|
||||||
var old_value = '';
|
var old_value = '';
|
||||||
// Only keep the value if is provided from hidden (first time)
|
// Only keep the value if is provided from hidden (first time).
|
||||||
|
|
||||||
var id_field = $("[name=field" + i + "_value]").attr('id');
|
var id_field = $("[name=field" + i + "_value]").attr('id');
|
||||||
|
|
||||||
if (id_field == "hidden-field" + i + "_value") {
|
if (id_field == "hidden-field" + i + "_value") {
|
||||||
@ -1535,24 +1510,10 @@ $(document).ready (function () {
|
|||||||
else {
|
else {
|
||||||
$('#table_macros-field' + i).replaceWith(data["fields_rows"][i]);
|
$('#table_macros-field' + i).replaceWith(data["fields_rows"][i]);
|
||||||
|
|
||||||
// The row provided has a predefined class. We delete it
|
// The row provided has a predefined class. We delete it.
|
||||||
$('#table_macros-field' + i)
|
$('#table_macros-field' + i)
|
||||||
.removeAttr('class');
|
.removeAttr('class');
|
||||||
|
|
||||||
//Remove this to put the help message in alert commands, to do it more general
|
|
||||||
// Add help hint only in first field
|
|
||||||
/*if (i == 1) {
|
|
||||||
var td_content =
|
|
||||||
$('#table_macros-field' + i)
|
|
||||||
.find('td').eq(0);
|
|
||||||
|
|
||||||
td_content
|
|
||||||
.html(
|
|
||||||
td_content.html() +
|
|
||||||
$('#help_snmp_alert_hint').html()
|
|
||||||
);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$("[name=field" + i + "_value]").val(old_value);
|
$("[name=field" + i + "_value]").val(old_value);
|
||||||
$('#table_macros-field').show();
|
$('#table_macros-field').show();
|
||||||
}
|
}
|
||||||
@ -1562,7 +1523,7 @@ $(document).ready (function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Charge the fields of the action
|
// Charge the fields of the action.
|
||||||
$("#alert_type").trigger('change');
|
$("#alert_type").trigger('change');
|
||||||
|
|
||||||
$("#submit-delete_button").click (function () {
|
$("#submit-delete_button").click (function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user