From 816b9697412cfc6a64605448166d2d7a68915fe9 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Thu, 6 Sep 2018 16:48:18 +0200 Subject: [PATCH 01/18] Added table tlog_graph_models --- pandora_console/extras/mr/20.sql | 9 +++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 12 ++++++++++++ pandora_console/pandoradb.sql | 12 ++++++++++++ 3 files changed, 33 insertions(+) diff --git a/pandora_console/extras/mr/20.sql b/pandora_console/extras/mr/20.sql index 94e55dcf83..8b903e45ba 100644 --- a/pandora_console/extras/mr/20.sql +++ b/pandora_console/extras/mr/20.sql @@ -16,4 +16,13 @@ ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_type` ENUM ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0; ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0; +CREATE TABLE IF NOT EXISTS `tlog_graph_models` ( + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `title` TEXT NOT NULL, + `regexp` TEXT NOT NULL, + `fields` TEXT NOT NULL, + `average` tinyint(1) NOT NULL default '0', + PRIMARY KEY(`id`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 88478f5c9b..5a9f16b870 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1768,3 +1768,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` ( PRIMARY KEY(`id`), FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tlog_graph_models` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tlog_graph_models` ( + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `title` TEXT NOT NULL, + `regexp` TEXT NOT NULL, + `fields` TEXT NOT NULL, + `average` tinyint(1) NOT NULL default '0', + PRIMARY KEY(`id`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index f8eaf58854..0a0227b4ac 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -3327,3 +3327,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` ( PRIMARY KEY(`id`), FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tlog_graph_models` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tlog_graph_models` ( + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `title` TEXT NOT NULL, + `regexp` TEXT NOT NULL, + `fields` TEXT NOT NULL, + `average` tinyint(1) NOT NULL default '0', + PRIMARY KEY(`id`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 39673ed93ab684eefcfbf59e1ac0db9e8b960f36 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Fri, 7 Sep 2018 14:15:21 +0200 Subject: [PATCH 02/18] Added class modaldeletebutton in pandora.css --- pandora_console/include/styles/pandora.css | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 7ffd0d59a4..8cdfa3a9e7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -3709,6 +3709,57 @@ div.simple_value > a > span.text p color:white; } +.modaldeletebutton{ + transition-property: background-color, color; + transition-duration: 1s; + transition-timing-function: ease-out; + -webkit-transition-property: background-color, color; + -webkit-transition-duration: 1s; + -o-transition-property: background-color, color; + -o-transition-duration: 1s; + cursor:pointer; + text-align:center; + margin-left:45px; + float:left; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + margin-bottom:30px; + border-radius: 3px;width:90px;height:30px;background-color:white;border: 1px solid #FA5858; +} + +.modaldeletebuttontext{ + transition-property: background-color, color; + transition-duration: 1s; + transition-timing-function: ease-out; + -webkit-transition-property: background-color, color; + -webkit-transition-duration: 1s; + -o-transition-property: background-color, color; + -o-transition-duration: 1s; + color:#FA5858;font-family:Nunito;font-size:10pt;position:relative;top:6px; +} + +.modaldeletebutton:hover .modaldeletebuttontext { + transition-property: background-color, color; + transition-duration: 1s; + transition-timing-function: ease-out; + -webkit-transition-property: background-color, color; + -webkit-transition-duration: 1s; + -o-transition-property: background-color, color; + -o-transition-duration: 1s; + color:white; +} + +.modaldeletebutton:hover { + transition-property: background-color, color; + transition-duration: 1s; + transition-timing-function: ease-out; + -webkit-transition-property: background-color, color; + -webkit-transition-duration: 1s; + -o-transition-property: background-color, color; + -o-transition-duration: 1s; + background-color:#FA5858; +} + .modalgobutton{ transition-property: background-color, color; transition-duration: 1s; From 98b29078574261d637f70395e7a603cd7e3ccd0a Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 12 Sep 2018 16:16:04 +0200 Subject: [PATCH 03/18] Bug fixes --- .../godmode/reporting/visual_console_builder.editor.js | 9 +++++++-- .../include/ajax/visual_console_builder.ajax.php | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 7d3021bfd2..26e34f80aa 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1543,8 +1543,13 @@ function loadFieldsFromDB(item) { $("select[name=parent]").val(val); if (key == 'linked_layout_status_type') $("select[name=linked_map_status_calculation_type]").val(val).change(); - if (key == 'id_layout_linked') - $("select[name=map_linked]").val(val).change(); + if (key == 'id_layout_linked') { + if (data['linked_layout_node_id'] == null) + $("select[name=map_linked]").val(val).change(); + else + $("select[name=map_linked] > option[data-node-id=" + data['linked_layout_node_id'] + "][value=" + val + "]") + .prop("selected", true).change(); + } if (key == 'linked_layout_node_id') $("input[name=linked_map_node_id]").val(val); if (key == 'id_layout_linked_weight') diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index d472542390..690aa437b8 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -615,8 +615,8 @@ switch ($action) { $values['id_agent'] = $id_agent; } - if ($linked_map_node_id) { - $values['linked_layout_node_id'] = $linked_map_node_id; + if ($linked_map_node_id !== null) { + $values['linked_layout_node_id'] = (int) $linked_map_node_id; } } else if ($id_agent == 0) { From 7930f22dd0bb03c9bee916dc3e100dd7231aaba2 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 12 Sep 2018 16:54:18 +0200 Subject: [PATCH 04/18] WIP: Improved the linked visual console status help --- .../include/functions_visual_map_editor.php | 8 ++--- .../help/en/help_linked_map_status_calc.php | 36 +++++++++++++++++++ .../help/es/help_linked_map_status_calc.php | 36 +++++++++++++++++++ 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 pandora_console/include/help/en/help_linked_map_status_calc.php create mode 100644 pandora_console/include/help/es/help_linked_map_status_calc.php diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index abbc179c61..675272a7f8 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -700,7 +700,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $visual_maps = db_get_all_rows_filter("tlayout", "id != " . (int) $visualConsole_id, array("id", "name")); $form_items_advance['map_linked_row']['html'] = '' - . __('Linked map') + . __('Linked visual console') . '' . ''; @@ -790,7 +790,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'percentile_item', 'module_graph', 'simple_value', 'icon', 'label', 'datos', 'donut_graph'); $form_items_advance['linked_map_status_calculation_row']['html'] = ''. - __('Type of the status calculation of the linked map') . '' + __('Type of the status calculation of the linked visual console') . '' . '' . html_print_select( $status_type_select_items, @@ -803,6 +803,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { false, false ) + . ui_print_help_icon("linked_map_status_calc", true) . ''; $form_items_advance['map_linked_weight'] = array(); @@ -811,13 +812,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'percentile_item', 'module_graph', 'simple_value', 'icon', 'label', 'datos', 'donut_graph'); $form_items_advance['map_linked_weight']['html'] = '' - . __('Linked map weight') . '' + . __('Linked visual console weight') . '' . '' . html_print_input_text( 'map_linked_weight', 80, '', 5, 5, true, false, false, "", "type_number percentage" ) . '%' - . ui_print_help_icon("linked_map_weight", true) . ''; $form_items_advance['linked_map_status_service_critical_row'] = array(); diff --git a/pandora_console/include/help/en/help_linked_map_status_calc.php b/pandora_console/include/help/en/help_linked_map_status_calc.php new file mode 100644 index 0000000000..40c5682d7a --- /dev/null +++ b/pandora_console/include/help/en/help_linked_map_status_calc.php @@ -0,0 +1,36 @@ + +

Formas de calcular el estado de la consola visual enlazada

+ +

Por defecto

+

+ Calcula el estado a partir del estado de todos los elementos, como lo haría un agente. +

+ +

Por peso

+

+ Calcula el estado de los elementos que tienen asignados una consola visual, un módulo o un agente en relación a un porcentaje de elementos configurado por el usuario. Este porcentaje es el que tiene que superar el número de elementos de un estado no normal respecto al número de elementos tenidos en cuenta en el cálculo para que el ese estado cambie. +

+ +

+ Por ejemplo, dado un elemento con un porcentaje del 50% y una consola visual enlazada con 5 elementos: +

+
    +
  • 1 critical, 1 warning y 3 normal -> Estado normal.
  • +
  • 2 critical, 2 warning y 1 normal -> Estado normal.
  • +
  • 1 critical, 3 warning y 1 normal -> Estado warning.
  • +
  • 3 critical, 1 warning y 1 normal -> Estado critical.
  • +
  • 1 critical, 1 warning y 3 unknown -> Estado unknown.
  • +
+ +

+ Si varios estados superan el peso, la prioridad es igual que en el resto de cálculo de estados (critical > warning > unknown). Si no hay elementos para realizar el cálculo, el estado pasa a ser unknown. +

+ +

Por elementos críticos

+

+ Calcula el estado usando los elementos en estado critical y los porcentajes de los umbrales definidos por el usuario. Si el número de los elementos en estado critical respecto al número de elementos tenidos en cuenta en el cálculo supera el porcentaje asignado como warning, el estado pasa a ser warning. Lo mismo para el porcentaje asignado como critical, que además tiene preferencia. +

diff --git a/pandora_console/include/help/es/help_linked_map_status_calc.php b/pandora_console/include/help/es/help_linked_map_status_calc.php new file mode 100644 index 0000000000..40c5682d7a --- /dev/null +++ b/pandora_console/include/help/es/help_linked_map_status_calc.php @@ -0,0 +1,36 @@ + +

Formas de calcular el estado de la consola visual enlazada

+ +

Por defecto

+

+ Calcula el estado a partir del estado de todos los elementos, como lo haría un agente. +

+ +

Por peso

+

+ Calcula el estado de los elementos que tienen asignados una consola visual, un módulo o un agente en relación a un porcentaje de elementos configurado por el usuario. Este porcentaje es el que tiene que superar el número de elementos de un estado no normal respecto al número de elementos tenidos en cuenta en el cálculo para que el ese estado cambie. +

+ +

+ Por ejemplo, dado un elemento con un porcentaje del 50% y una consola visual enlazada con 5 elementos: +

+
    +
  • 1 critical, 1 warning y 3 normal -> Estado normal.
  • +
  • 2 critical, 2 warning y 1 normal -> Estado normal.
  • +
  • 1 critical, 3 warning y 1 normal -> Estado warning.
  • +
  • 3 critical, 1 warning y 1 normal -> Estado critical.
  • +
  • 1 critical, 1 warning y 3 unknown -> Estado unknown.
  • +
+ +

+ Si varios estados superan el peso, la prioridad es igual que en el resto de cálculo de estados (critical > warning > unknown). Si no hay elementos para realizar el cálculo, el estado pasa a ser unknown. +

+ +

Por elementos críticos

+

+ Calcula el estado usando los elementos en estado critical y los porcentajes de los umbrales definidos por el usuario. Si el número de los elementos en estado critical respecto al número de elementos tenidos en cuenta en el cálculo supera el porcentaje asignado como warning, el estado pasa a ser warning. Lo mismo para el porcentaje asignado como critical, que además tiene preferencia. +

From 8601e38eed5d480a7911d11b12c5f178f3cf80e8 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 13 Sep 2018 16:38:17 +0200 Subject: [PATCH 05/18] Minor visual improvements for the GIS views --- .../operation/agentes/gis_view.php | 52 +++++++------------ .../operation/gis_maps/render_view.php | 37 +++++++------ 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index c67a97037a..1b7d341917 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -36,7 +36,6 @@ $agentId = (int)get_parameter('id_agente'); $id_agente = $agentId; $agent_name = agents_get_name($id_agente); $agent_alias = agents_get_alias($id_agente); -$agentData = gis_get_data_last_position_agent($id_agente); //Avoid the agents with characters that fails the div. $agent_name_original = $agent_name; @@ -83,35 +82,22 @@ switch ($config["dbtype"]) { gis_activate_ajax_refresh(null, $timestampLastOperation); gis_activate_select_control(); -if ($agentData === false) { - ui_print_info_message ( - __("There is no GIS data for this agent, so it's positioned in default position of map.") ); -} - -$dataLastPosition = gis_get_data_last_position_agent($agentId); -if ($dataLastPosition !== false) { - echo "" . __("Last position in ") . - $dataLastPosition['start_timestamp'] . ": " . - $dataLastPosition['stored_longitude'] . ", " . $dataLastPosition['stored_latitude'] . ", " . $dataLastPosition['stored_altitude']; -} - +echo "
"; echo "
"; echo ""; -echo "
" . __("Period to show data as path") . ": "; +echo "
" . __("Period to show data as path"); echo ""; html_print_extended_select_for_time ('period', $period, '', '', '0', 10); echo ""; html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"'); echo "
"; -echo "

" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."

"; /* Get the total number of Elements for the pagination */ $sqlCount = sprintf ("SELECT COUNT(*) FROM tgis_data_history WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period); -$countData = db_get_value_sql($sqlCount); - +$countData = (int) db_get_value_sql($sqlCount); /* Get the elements to present in this page */ switch ($config["dbtype"]) { @@ -141,9 +127,7 @@ switch ($config["dbtype"]) { $result = db_get_all_rows_sql ($sql, true); - if ($result === false) { - $sql2 = sprintf (" SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude, start_timestamp, description, number_of_packages, manual_placement @@ -163,10 +147,11 @@ if ($result === false) { } if ($result !== false) { - if(!$countData){ - $countData = 1; - } - ui_pagination ($countData, false) ; + echo "

" . __("Positional data from the last") . " " . human_time_description_raw($period) ."

"; + + if ($countData > 0) ui_pagination($countData, false); + + $table = new StdClass(); $table->data = array(); foreach ($result as $key => $row) { $distance = 0; @@ -187,9 +172,13 @@ if ($result !== false) { $rowdata = array( $row['longitude'], $row['latitude'], - $row['altitude'], - $row['start_timestamp'], - $row['end_timestamp'], + (int) $row['altitude'] . " m", + is_numeric($row['start_timestamp']) + ? date($config["date_format"], $row['start_timestamp']) + : date_w_fixed_tz($row['start_timestamp']), + is_numeric($row['end_timestamp']) + ? date($config["date_format"], $row['end_timestamp']) + : date_w_fixed_tz($row['end_timestamp']), $row['description'], sprintf(__('%s Km'), $distance), $row['number_of_packages'], @@ -206,13 +195,12 @@ if ($result !== false) { __('Distance'), __("# of Packages"), __("Manual placement")); - $table->class = 'position_data_table'; + $table->class = 'databox data'; $table->id = $agent_name.'_position_data_table'; - $table->title = $agent_alias . " " . __("positional data"); - $table->titlestyle = "background-color:#799E48;"; - html_print_table($table); unset($table); + $table->width = '100%'; + html_print_table($table); + unset($table); - ui_pagination ($countData, false) ; - echo "

" . __('Total') . ' ' . $countData . ' ' . __('Data') . "

"; + if ($countData > 0) ui_pagination($countData, false); } ?> diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index eabefebbfe..de453a5a81 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -108,6 +108,9 @@ $layers = gis_get_layers($idMap); // Render map +$has_management_acl = check_acl($config["id_user"], $map['group_id'], "MW") + || check_acl ($config["id_user"], $map['group_id'], "MM"); + $buttons = array(); if ($config["pure"] == 0) { @@ -119,22 +122,14 @@ else { html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . ""; } -if (check_acl ($config["id_user"], $map['group_id'], "MW") || check_acl ($config["id_user"], $map['group_id'], "MM")) { - $buttons['setup']['text'] = ''.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).''; - $buttons['setup']['godmode'] = 1; - - +if ($has_management_acl) { $hash = md5($config["dbpass"] . $idMap . $config["id_user"]); - $buttons['public_link']['text'] = ''. html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).''; } -$buttonsString = '' . - html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . '  Agent - test_gis1