diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c83d2a92e5..7f6d694e4b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-10-30 Sergio Martin + + * include/javascript/pandora_alerts.js + godmode/alerts/configure_alert_action.php: Fix some bugs in + the action form (jquery headache) + 2012-10-30 Vanessa Gil * include/functions_reporting.php: Changed agent diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index a4479e65c3..b64a4bb999 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -157,7 +157,7 @@ $(document).ready (function () { $command = io_safe_output($command); echo addslashes($command); ?>"; - render_command_preview (); + render_command_preview (original_command); command_description = "",addslashes(io_safe_output(alerts_get_alert_command_description ($id_command)))); ?>"; render_command_description(command_description); @@ -189,6 +189,10 @@ $(document).ready (function () { $('#table1-field'+i).replaceWith(data["fields_rows"][i]); $("[name=field"+i+"_value]").val(old_value); } + + $(".fields").keyup (function() { + render_command_preview(original_command) + }); }, "json" ); @@ -196,7 +200,6 @@ $(document).ready (function () { // Charge the fields of the $("#id_command").trigger('change'); - - $(".fields").keyup (render_command_preview); }); + diff --git a/pandora_console/include/javascript/pandora_alerts.js b/pandora_console/include/javascript/pandora_alerts.js index 709782540a..feefa37f7f 100644 --- a/pandora_console/include/javascript/pandora_alerts.js +++ b/pandora_console/include/javascript/pandora_alerts.js @@ -3,6 +3,10 @@ var original_command = ""; function parse_alert_command (command) { var nfield = 1; $('.fields').each(function() { + // Only render values different from '' + if($(this).val() == '') { + return; + } var field = '_field'+nfield+'_'; nfield++; var regex = new RegExp(field,"gi"); @@ -12,7 +16,7 @@ function parse_alert_command (command) { return command; } -function render_command_preview () { +function render_command_preview (original_command) { $("#textarea_command_preview").text (parse_alert_command (original_command)); } function render_command_description (command_description) {