From acce7617fa05c898e163786af5c6c97c3dddecf9 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 11 Sep 2012 10:51:23 +0000 Subject: [PATCH] 2012-09-11 Sergio Martin * include/javascript/pandora_modules.js: Fixed the reset of the form of local modules after select a module component and unselect it git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6952 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++ .../include/javascript/pandora_modules.js | 35 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e0dccd4364..d4b1d67df8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-09-11 Sergio Martin + + * include/javascript/pandora_modules.js: Fixed the reset of the + form of local modules after select a module component and + unselect it + 2012-09-10 Miguel de Dios * general/header.php: fixed the link to logout when the Pandora diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 40005cd383..8b45fdd372 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -23,8 +23,10 @@ function configure_modules_form () { var $select = $("#local_component").hide (); $("#component").hide (); - if (this.value == 0) + if (this.value == 0) { + reset_data_module_form(); return; + } $("#component_loading").show (); $(".error, #no_component").hide (); $("option[value!=0]", $select).remove (); @@ -56,10 +58,39 @@ function configure_modules_form () { } ); + function reset_data_module_form() { + // Delete macro fields + $('.macro_field').remove(); + + // Hide show/hide configuration data switch + $('#simple-show_configuration_data').hide(); + $('#simple-hide_configuration_data').hide(); + $('#configuration_data_legend').hide(); + + $("#textarea_configuration_data").val(''); + $('#simple-configuration_data').show(); + + $("#text-name").val(''); + $("#textarea_description").val(''); + $("#checkbox-history_data").check (); + $("#text-max").attr ("value", ""); + $("#text-min").attr ("value", ""); + $("#text-min_warning").attr ("value", 0); + $("#text-max_warning").attr ("value", 0); + $("#text-str_warning").attr ("value", ''); + $("#text-min_critical").attr ("value", 0); + $("#text-max_critical").attr ("value", 0); + $("#text-str_critical").attr ("value", ''); + $("#text-ff_event").attr ("value", 0); + $("#text-post_process").attr("value", 0); + $("#text-unit").attr("value", ''); + } $("#local_component").change (function () { - if (this.value == 0) + if (this.value == 0) { + reset_data_module_form(); return; + } $("#component_loading").show (); $(".error").hide (); jQuery.post ("ajax.php",