diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e91bd7dec4..0b918f1db5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-12-04 Sergio Martin + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql + godmode/alerts/configure_alert_template.php: Add wizard_level flag to the + alert templates table + 2012-12-04 Miguel de Dios * godmode/reporting/reporting_builder.php, diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index 674ee18312..b4e2dd83cf 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -81,6 +81,7 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` ( -- Table `talert_templates` -- --------------------------------------------------------------------- ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; +ALTER TABLE `talert_templates` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') DEFAULT 'nowizard'; ------------------------------------------------------------------------ -- Table `tplanned_downtime` diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index 8080d97ee2..d92cfec02f 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -103,6 +103,8 @@ CREATE OR REPLACE TRIGGER talert_special_days_inc BEFORE INSERT ON talert_specia -- Table talert_templates -- ----------------------------------------------------- ALTER TABLE talert_templates ADD (special_day NUMBER(5,0) default 0); +ALTER TABLE talert_templates ADD (wizard_level VARCHAR2(100) default 'nowizard' NOT NULL); +ALTER TABLE talert_templates ADD CONSTRAINT t_alert_templates_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard')); -- ----------------------------------------------------- -- Table talert_templates @@ -297,7 +299,7 @@ WHERE token='prominent_time'; -- ----------------------------------------------------- -- Table tnetwork_component -- ----------------------------------------------------- -ALTER TABLE tnetwork_component ADD (wizard_level VARCHAR2(100) default 'custom' NOT NULL); +ALTER TABLE tnetwork_component ADD (wizard_level VARCHAR2(100) default 'nowizard' NOT NULL); ALTER TABLE tnetwork_component ADD CONSTRAINT t_network_component_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard')); ALTER TABLE tnetwork_component ADD (only_metaconsole NUMBER(5, 0) default 0 NOT NULL); ALTER TABLE tnetwork_component ADD (macros CLOB default ''); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index d276693fae..621ded428e 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -96,6 +96,8 @@ CREATE TABLE "talert_special_days" ( -- ----------------------------------------------------- ALTER TABLE "talert_templates" ADD COLUMN "special_day" SMALLINT default 0; +CREATE TYPE type_talert_templates_wizard_level AS ENUM ('basic','advanced','custom','nowizard'); +ALTER TABLE "talert_templates" ADD COLUMN "wizard_level" type_talert_templates_wizard_level default 'nowizard'; -- ----------------------------------------------------- -- Table "tplanned_downtime" diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index aa11bd2b42..9a80d68c38 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -179,6 +179,7 @@ function update_template ($step) { $max = (float) get_parameter ('max'); $min = (float) get_parameter ('min'); $matches = (bool) get_parameter ('matches_value'); + $wizard_level = (string) get_parameter ('wizard_level'); $priority = (int) get_parameter ('priority'); $id_group = get_parameter ("id_group"); $name_check = db_get_value ('name', 'talert_templates', 'name', $name); @@ -191,7 +192,8 @@ function update_template ($step) { 'min_value' => $min, 'id_group' => $id_group, 'matches_value' => $matches, - 'priority' => $priority); + 'priority' => $priority, + 'wizard_level' => $wizard_level); $result = alerts_update_alert_template ($id,$values); } @@ -327,6 +329,7 @@ if ($create_template) { $min = (float) get_parameter ('min'); $matches = (bool) get_parameter ('matches_value'); $priority = (int) get_parameter ('priority'); + $wizard_level = (string) get_parameter ('wizard_level'); $id_group = get_parameter ("id_group"); $name_check = db_get_value ('name', 'talert_templates', 'name', $name); @@ -336,7 +339,8 @@ if ($create_template) { 'min_value' => $min, 'id_group' => $id_group, 'matches_value' => $matches, - 'priority' => $priority); + 'priority' => $priority, + 'wizard_level' => $wizard_level); if($config['dbtype'] == "oracle") { $values['field3'] = ' '; @@ -415,7 +419,8 @@ if ($id && ! $create_template) { $default_action = $template['id_alert_action']; $priority = $template['priority']; - $id_group = $template["id_group"]; + $id_group = $template['id_group']; + $wizard_level = $template['wizard_level']; } print_alert_template_steps ($step, $id); @@ -582,6 +587,14 @@ else { $table->data[2][0] = __('Priority'); $table->data[2][1] = html_print_select (get_priorities (), 'priority', $priority, '', 0, 0, true, false, false); + + $table->data[2][0] = __('Wizard level'); + $wizard_levels = array('nowizard' => __('No wizard'), + 'basic' => __('Basic'), + 'advanced' => __('Advanced'), + //'custom' => __('Custom'), + ); + $table->data[2][1] = html_print_select($wizard_levels,'wizard_level',$wizard_level,'','',-1,true, false, false); $table->data[3][0] = __('Condition type'); $table->data[3][1] = html_print_select (alerts_get_alert_templates_types (), 'type', diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 2dedaa292d..a39861fca1 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -382,7 +382,9 @@ CREATE TABLE talert_templates ( priority NUMBER(10, 0) default 0 NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL, special_day NUMBER(5, 0) default 0, - CONSTRAINT t_alert_templates_type_cons CHECK (type IN ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always')) + wizard_level VARCHAR2(100) default 'nowizard' NOT NULL, + CONSTRAINT t_alert_templates_type_cons CHECK (type IN ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always')), + CONSTRAINT t_alert_templates_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard')) ); CREATE INDEX talert_templates_id_al_act_idx ON talert_templates(id_alert_action); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 361a66335d..e850c88a62 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -305,6 +305,7 @@ CREATE TABLE "talert_actions" ( ); CREATE TYPE type_talert_templates_alert_template AS ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always'); +CREATE TYPE type_talert_templates_wizard_level AS ENUM ('basic','advanced','custom','nowizard'); CREATE TABLE "talert_templates" ( "id" SERIAL NOT NULL PRIMARY KEY, "name" text default '', @@ -349,7 +350,8 @@ CREATE TABLE "talert_templates" ( "field10_recovery" text NOT NULL default '', "priority" INTEGER NOT NULL default 0, "id_group" INTEGER NOT NULL default 0, - "special_day" SMALLINT default 0 + "special_day" SMALLINT default 0, + "wizard_level" type_talert_templates_wizard_level default 'nowizard' ); CREATE INDEX "talert_templates_id_alert_action_idx" ON "talert_templates"("id_alert_action"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 4f73a54129..ee78841c42 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -373,6 +373,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` ( `priority` tinyint(4) default '0', `id_group` mediumint(8) unsigned NULL default 0, `special_day` tinyint(1) default 0, + `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard', PRIMARY KEY (`id`), KEY `idx_template_action` (`id_alert_action`), FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)