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);
|
||||||
|
|
||||||
$is_management_allowed = !is_management_allowed();
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
// 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,42 +987,21 @@ 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']) {
|
html_print_select_from_sql(
|
||||||
case 'mysql':
|
'SELECT id, name
|
||||||
case 'postgresql':
|
FROM talert_commands
|
||||||
html_print_select_from_sql(
|
ORDER BY name',
|
||||||
'SELECT id, name
|
'alert_type',
|
||||||
FROM talert_actions
|
$alert_type,
|
||||||
ORDER BY name',
|
'',
|
||||||
'alert_type',
|
'',
|
||||||
$alert_type,
|
0,
|
||||||
'',
|
false,
|
||||||
'',
|
false,
|
||||||
0,
|
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();
|
||||||
|
@ -1491,9 +1469,9 @@ $(document).ready (function () {
|
||||||
$("input[name='delete_ids[]']").uncheck();
|
$("input[name='delete_ids[]']").uncheck();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#alert_type").change (function () {
|
$("#alert_type").change (function () {
|
||||||
values = Array ();
|
values = Array ();
|
||||||
values.push ({
|
values.push ({
|
||||||
name: "page",
|
name: "page",
|
||||||
value: "godmode/alerts/alert_commands"
|
value: "godmode/alerts/alert_commands"
|
||||||
|
@ -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,44 +1492,28 @@ $(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") {
|
||||||
old_value = $("[name=field" + i + "_value]").val();
|
old_value = $("[name=field" + i + "_value]").val();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the row is empty, hide de row
|
// If the row is empty, hide de row
|
||||||
if (data["fields_rows"][i] == '') {
|
if (data["fields_rows"][i] == '') {
|
||||||
$('#table_macros-field' + i).hide();
|
$('#table_macros-field' + i).hide();
|
||||||
}
|
}
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -1561,17 +1522,17 @@ $(document).ready (function () {
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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 () {
|
||||||
confirmation = confirm("<?php echo __('Are you sure?'); ?>");
|
confirmation = confirm("<?php echo __('Are you sure?'); ?>");
|
||||||
if (!confirmation) {
|
if (!confirmation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var added_config = {
|
var added_config = {
|
||||||
"selector": "textarea.tiny-mce-editor",
|
"selector": "textarea.tiny-mce-editor",
|
||||||
"plugins": "preview, print, table, searchreplace, nonbreaking, xhtmlxtras, noneditable",
|
"plugins": "preview, print, table, searchreplace, nonbreaking, xhtmlxtras, noneditable",
|
||||||
|
|
Loading…
Reference in New Issue