From a60652739e086aa10f9ce680c4530e5b6e9167fd Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 10 May 2012 15:35:28 +0000 Subject: [PATCH] 2012-05-10 Sergio Martin * include/javascript/pandora_modules.js pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql godmode/agentes/module_manager_editor_common.php godmode/modules/manage_network_components_form.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components.php: Fix some layout little bugs in module editor and added unit parameter to network components for pending task #3520706 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6287 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 ++++++++++++++++ .../pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 1 + .../pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 6 ++++++ ...pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 7 +++++++ .../agentes/module_manager_editor_common.php | 4 +++- .../modules/manage_network_components.php | 7 +++++-- .../modules/manage_network_components_form.php | 2 ++ .../manage_network_components_form_common.php | 3 +++ .../include/javascript/pandora_modules.js | 1 + pandora_console/pandoradb.oracle.sql | 3 ++- pandora_console/pandoradb.postgreSQL.sql | 3 ++- pandora_console/pandoradb.sql | 1 + 12 files changed, 49 insertions(+), 5 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 96bfa594bd..55acb54ecf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2012-05-10 Sergio Martin + + * include/javascript/pandora_modules.js + pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql + godmode/agentes/module_manager_editor_common.php + godmode/modules/manage_network_components_form.php + godmode/modules/manage_network_components_form_common.php + godmode/modules/manage_network_components.php: Fix some layout + little bugs in module editor and added unit parameter + to network components for pending task #3520706 + 2012-05-10 Miguel de Dios * include/functions_users.php: fixes from the equal chat in the diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index 5ff9b4654c..4c4ba5cfa8 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -121,6 +121,7 @@ ALTER TABLE `tagente_modulo` CHANGE COLUMN `post_process` `post_process` double( -- Table `tnetwork_component` -- ----------------------------------------------------- ALTER TABLE `tnetwork_component` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `unit` TEXT NOT NULL AFTER `post_process`; -- ----------------------------------------------------- -- Table `tgraph_source` Alter table to allow negative values in weight diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index 654b4043a8..7e9791ea42 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -212,3 +212,9 @@ CREATE TABLE IF NOT EXISTS ttimezone ( CREATE SEQUENCE ttimezone_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER ttimezone_inc BEFORE INSERT ON ttimezone REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttimezone_s.nextval INTO :NEW.ID_TZ FROM dual; END ttimezone_inc;; + +-- ----------------------------------------------------- +-- Table `tnetwork_component` +-- ----------------------------------------------------- + +ALTER TABLE tnetwork_component ADD COLUMN unit CLOB default ''; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index 8bbed6237c..992bd9457b 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -201,3 +201,10 @@ CREATE TABLE "ttimezone" ( "zone" varchar(60) NOT NULL, "timezone" varchar(60) NOT NULL ); + +-- ----------------------------------------------------- +-- Table `tnetwork_component` +-- ----------------------------------------------------- + +ALTER TABLE "tnetwork_component" ADD COLUMN "unit" text default ''; + diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 3f2f8aa08d..be58569549 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -258,10 +258,12 @@ if ($__code_from == 'policies'){ } $table_advanced->data[4][1] = html_print_select_from_sql ('SELECT id, name FROM tserver_export ORDER BY name', 'id_export', $id_export, '', $none_text, '0', true, false, false, $disabled_export).ui_print_help_tip (__('In case you use an Export server you can link this module and export data to one these.'), true); -$table_advanced->colspan[4][1] = 3; +$table_advanced->colspan[4][1] = 4; $table_advanced->data[5][0] = __('Unit'); $table_advanced->data[5][1] = html_print_input_text ('unit', $unit, '', 20, 65, true); +$table_advanced->colspan[5][1] = 4; + /* Tags */ // This var comes from module_manager_editor.php or policy_modules.php global $__code_from; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index c5b009db3c..d2baa48b83 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -58,6 +58,7 @@ $str_critical = (string) get_parameter ('str_critical'); $ff_event = (int) get_parameter ('ff_event'); $history_data = (bool) get_parameter ('history_data'); $post_process = (float) get_parameter('post_process'); +$unit = (string) get_parameter('unit'); $id = (int) get_parameter ('id'); $snmp_version = (string) get_parameter('snmp_version'); @@ -138,7 +139,8 @@ if ($create_component) { 'custom_string_1' => $custom_string_1, 'custom_string_2' => $custom_string_2, 'custom_string_3' => $custom_string_3, - 'post_process' => $post_process)); + 'post_process' => $post_process, + 'unit' => $unit)); } else { $id = ''; @@ -204,7 +206,8 @@ if ($update_component) { 'custom_string_1' => $custom_string_1, 'custom_string_2' => $custom_string_2, 'custom_string_3' => $custom_string_3, - 'post_process' => $post_process)); + 'post_process' => $post_process, + 'unit' => $unit)); } else { $result = ''; diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 1f7b91dc6f..18aaa7d07e 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -57,6 +57,7 @@ if (isset ($id)) { $ff_event = $component["min_ff_event"]; $history_data = $component["history_data"]; $post_process = $component["post_process"]; + $unit = $component["unit"]; if ($type >= 15 && $type <= 18) { @@ -96,6 +97,7 @@ if (isset ($id)) { $ff_event = 0; $history_data = true; $post_process = 0; + $unit = ''; $snmp_version = 1; $snmp3_auth_user = ''; diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index ab0e3c7172..b7c350d548 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -99,4 +99,7 @@ $table->data[5][0] = __('Min. Value'); $table->data[5][1] = html_print_input_text ('min', $min, '', 5, 15, true); $table->data[5][2] = __('Max. Value'); $table->data[5][3] = html_print_input_text ('max', $max, '', 5, 15, true); +$table->data[6][0] = __('Unit'); +$table->data[6][1] = html_print_input_text ('unit', $unit, '', 12, 25, true); +$table->data[6][2] = $table->data[6][3] = ''; ?> diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 8dbc83d259..78d4bb4594 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -154,6 +154,7 @@ function configure_modules_form () { $("#text-max_critical").attr ("value", (data["max_critical"] == 0) ? 0 : data["max_critical"]); $("#text-ff_threshold").attr ("value", (data["min_ff_event"] == 0) ? 0 : data["min_ff_event"]); $("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]) + $("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]) $("#component_loading").hide (); $("#id_module_type").change (); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 3f4caf923c..f33f16030c 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -645,7 +645,8 @@ CREATE TABLE tnetwork_component ( custom_string_3 CLOB default '', custom_integer_1 INTEGER default 0, custom_integer_2 INTEGER default 0, - post_process BINARY_DOUBLE default 0 + post_process BINARY_DOUBLE default 0. + unit CLOB default '' ); CREATE SEQUENCE tnetwork_component_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index a9e308bad2..664a42f94d 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -512,7 +512,8 @@ CREATE TABLE "tnetwork_component" ( "custom_string_3" text default '', "custom_integer_1" INTEGER default 0, "custom_integer_2" INTEGER default 0, - "post_process" DOUBLE PRECISION default 0 + "post_process" DOUBLE PRECISION default 0, + "unit" text default '' ); CREATE TABLE "tnetwork_component_group" ( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 2f8417f4b9..cc3e90c513 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -567,6 +567,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` ( `custom_integer_1` int(10) default 0, `custom_integer_2` int(10) default 0, `post_process` double(18,5) default 0, + `unit` text, PRIMARY KEY (`id_nc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;