Merge branch 'ent-11819-cambios-en-wizard-de-las-consolas-visuales' into 'develop'

Ent 11819 cambios en wizard de las consolas visuales

See merge request artica/pandorafms!6338
This commit is contained in:
Rafael Ameijeiras 2023-08-23 05:54:46 +00:00
commit 1bca8b0006
4 changed files with 149 additions and 37 deletions

View File

@ -555,6 +555,7 @@ switch ($activeTab) {
$type = (int) get_parameter('type', STATIC_GRAPH); $type = (int) get_parameter('type', STATIC_GRAPH);
$image = get_parameter('image'); $image = get_parameter('image');
$range = (int) get_parameter('range', 50); $range = (int) get_parameter('range', 50);
$range_vertical = (int) get_parameter('range_vertical', 50);
$width = (int) get_parameter('width', 0); $width = (int) get_parameter('width', 0);
$height = (int) get_parameter('height', 0); $height = (int) get_parameter('height', 0);
$period = (int) get_parameter('period', 0); $period = (int) get_parameter('period', 0);
@ -567,6 +568,9 @@ switch ($activeTab) {
$label_type = get_parameter('label_type', 'agent_module'); $label_type = get_parameter('label_type', 'agent_module');
$enable_link = get_parameter('enable_link', 'enable_link'); $enable_link = get_parameter('enable_link', 'enable_link');
$show_on_top = get_parameter('show_on_top', 0); $show_on_top = get_parameter('show_on_top', 0);
$pos_x = get_parameter('pos_x', 0);
$pos_y = get_parameter('pos_y', 0);
$max_elements_row = (int) get_parameter('max_elements_row', 0);
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent // This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
$item_per_agent = get_parameter('item_per_agent', 0); $item_per_agent = get_parameter('item_per_agent', 0);
@ -611,6 +615,7 @@ switch ($activeTab) {
$image, $image,
$idVisualConsole, $idVisualConsole,
$range, $range,
$range_vertical,
$width, $width,
$height, $height,
$period, $period,
@ -626,7 +631,10 @@ switch ($activeTab) {
$kind_relationship, $kind_relationship,
$item_in_the_map, $item_in_the_map,
$fontf, $fontf,
$fonts $fonts,
$pos_x,
$pos_y,
$max_elements_row
); );
$statusProcessInDB = [ $statusProcessInDB = [
@ -668,6 +676,7 @@ switch ($activeTab) {
$image, $image,
$idVisualConsole, $idVisualConsole,
$range, $range,
$range_vertical,
$width, $width,
$height, $height,
$period, $period,
@ -683,7 +692,10 @@ switch ($activeTab) {
$kind_relationship, $kind_relationship,
$item_in_the_map, $item_in_the_map,
$fontf, $fontf,
$fonts $fonts,
$pos_x,
$pos_y,
$max_elements_row
); );
} else { } else {
$id_modules = []; $id_modules = [];
@ -722,6 +734,7 @@ switch ($activeTab) {
$image, $image,
$idVisualConsole, $idVisualConsole,
$range, $range,
$range_vertical,
$width, $width,
$height, $height,
$period, $period,
@ -737,7 +750,10 @@ switch ($activeTab) {
$kind_relationship, $kind_relationship,
$item_in_the_map, $item_in_the_map,
$fontf, $fontf,
$fonts $fonts,
$pos_x,
$pos_y,
$max_elements_row
); );
} }
} }

View File

@ -144,22 +144,28 @@ $table->data['all_0'][0] = html_print_label_input_block(
$table->rowstyle['staticgraph'] = 'display: none;'; $table->rowstyle['staticgraph'] = 'display: none;';
$table->colspan['staticgraph'][0] = 2;
$table->data['staticgraph'][0] = html_print_label_input_block( $table->data['staticgraph'][0] = html_print_label_input_block(
__('Image'), __('Image'),
html_print_select( '<div class="flex">'.html_print_select(
$images_list, $images_list,
'image', 'image',
'', '',
'', '',
'', '',
'', '',
true true,
) false,
true,
'',
false,
'width: 49%'
).'<span id="image_prev" class="mrgn_lft_10px mrgn_top-10px"><img src="'.$config['homeurl'].'/images/console/icons/appliance_ok.png"></span></div>'
); );
$table->rowstyle['all_1'] = 'display: none;'; $table->rowstyle['all_1'] = 'display: none;';
$table->data['all_1'][0] = html_print_label_input_block( $table->data['all_1'][0] = html_print_label_input_block(
__('Range between elements (px)'), __('Horizontal range between elements (px)'),
html_print_input_text( html_print_input_text(
'range', 'range',
50, 50,
@ -170,6 +176,18 @@ $table->data['all_1'][0] = html_print_label_input_block(
) )
); );
$table->data['all_1'][1] = html_print_label_input_block(
__('Vertical range between elements (px)'),
html_print_input_text(
'range_vertical',
50,
'',
5,
5,
true
)
);
$input_size = __('Width').': '; $input_size = __('Width').': ';
$input_size .= html_print_input_text('width', 0, '', 5, 5, true); $input_size .= html_print_input_text('width', 0, '', 5, 5, true);
$input_size .= __('Height').': '; $input_size .= __('Height').': ';
@ -425,6 +443,16 @@ if (is_metaconsole() === false) {
); );
} }
$table->data['all_4_01'][0] = html_print_label_input_block(
__('Filter agents'),
html_print_input_text('filter_agents', '', '', false, 255, true)
);
$table->data['all_4_01'][1] = html_print_label_input_block(
__('Filter modules'),
html_print_input_text('filter_modules', '', '', false, 255, true)
);
$table->rowstyle['all_4'] = 'display: none;'; $table->rowstyle['all_4'] = 'display: none;';
$table->data['all_4'][0] = html_print_label_input_block( $table->data['all_4'][0] = html_print_label_input_block(
__('Agents').ui_print_help_tip( __('Agents').ui_print_help_tip(
@ -549,6 +577,16 @@ $table->data['all_8'][1] = html_print_label_input_block(
).'</span>' ).'</span>'
); );
$table->data['all_10'][0] = html_print_label_input_block(
__('Max. elements for row'),
html_print_input_text('max_elements_row', 0, '', false, 255, true)
);
$table->data['all_10'][1] = html_print_label_input_block(
__('Position'),
'<div class="flex_center"><span class="mrgn_right_10px">X</span>'.html_print_input_text('pos_x', 0, '', false, 255, true, false, false, '', 'w50p').'<span class="margin-lr-10">Y</span>'.html_print_input_text('pos_y', 0, '', false, 255, true, false, false, '', 'w50p').'</div>'
);
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
@ -831,6 +869,44 @@ function item_per_agent_change(itemPerAgent) {
function metaconsole_init() { function metaconsole_init() {
$("#groups").change(); $("#groups").change();
} }
$('#text-filter_agents').on('keyup',function(){
if ($(this).val() !== ''){
findInSelect('id_agents',$(this).val());
} else {
$('#id_agents option').each(function(){
$(this).removeClass('invisible');
});
}
});
$('#text-filter_modules').on('keyup',function(){
if ($(this).val() !== ''){
findInSelect('module',$(this).val());
} else {
$('#module option').each(function(){
$(this).removeClass('invisible');
});
}
});
function findInSelect(selectid, find){
var select = $('#'+selectid+' option');
select.each(function(){
var regex = new RegExp(find, "gi");
if ($(this).html().match(regex) === null) {
$(this).addClass('invisible');
} else {
$(this).removeClass('invisible');
}
})
}
$('#image').on('change', function(){
var img = $(this).val();
$('#image_prev').html('<img src="<?php echo $config['homeurl']; ?>/images/console/icons/'+img+'.png">');
})
</script> </script>
<style type="text/css"> <style type="text/css">
select[name='kind_relationship'] option[disabled='disabled'] { select[name='kind_relationship'] option[disabled='disabled'] {

View File

@ -2554,6 +2554,7 @@ function visual_map_process_wizard_add(
$image, $image,
$id_layout, $id_layout,
$range, $range,
$range_vertical,
$width=0, $width=0,
$height=0, $height=0,
$period='', $period='',
@ -2562,7 +2563,10 @@ function visual_map_process_wizard_add(
$max_value=0, $max_value=0,
$type_percentile='', $type_percentile='',
$value_show='', $value_show='',
$type='' $type='',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) { ) {
if (empty($id_agents)) { if (empty($id_agents)) {
print_error_message(__('No agents selected')); print_error_message(__('No agents selected'));
@ -2572,14 +2576,9 @@ function visual_map_process_wizard_add(
$id_agents = (array) $id_agents; $id_agents = (array) $id_agents;
$error = false; $error = false;
$pos_y = 10; $elements_row = 1;
$pos_x = 10; $initial_x = $pos_x;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
$value_height = $height; $value_height = $height;
$value_image = $image; $value_image = $image;
$value_type = $type; $value_type = $type;
@ -2628,7 +2627,14 @@ function visual_map_process_wizard_add(
db_process_sql_insert('tlayout_data', $values); db_process_sql_insert('tlayout_data', $values);
$pos_x = ($pos_x + $range); if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
$elements_row = 1;
$pos_x = $initial_x;
$pos_y = ($range_vertical + $pos_y);
} else {
$pos_x = ($pos_x + $range);
$elements_row++;
}
} }
$return = ui_print_success_message(__('Agent successfully added to layout'), '', true); $return = ui_print_success_message(__('Agent successfully added to layout'), '', true);
@ -2654,6 +2660,7 @@ function visual_map_process_wizard_add_modules(
$image, $image,
$id_layout, $id_layout,
$range, $range,
$range_vertical,
$width, $width,
$height, $height,
$period, $period,
@ -2669,7 +2676,10 @@ function visual_map_process_wizard_add_modules(
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE, $kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
$item_in_the_map=0, $item_in_the_map=0,
$fontf='lato', $fontf='lato',
$fonts='12pt' $fonts='12pt',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) { ) {
if (empty($width) === true) { if (empty($width) === true) {
$width = 0; $width = 0;
@ -2691,15 +2701,9 @@ function visual_map_process_wizard_add_modules(
$id_modules = (array) $id_modules; $id_modules = (array) $id_modules;
$error = false; $error = false;
$pos_y = 10; $elements_row = 1;
$pos_x = 10; $initial_x = $pos_x;
foreach ($id_modules as $id_module) { foreach ($id_modules as $id_module) {
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
if ($id_server != 0) { if ($id_server != 0) {
$connection = db_get_row_filter( $connection = db_get_row_filter(
'tmetaconsole_setup', 'tmetaconsole_setup',
@ -2820,7 +2824,14 @@ function visual_map_process_wizard_add_modules(
db_process_sql_insert('tlayout_data', $values); db_process_sql_insert('tlayout_data', $values);
$pos_x = ($pos_x + $range); if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
$elements_row = 1;
$pos_x = $initial_x;
$pos_y = ($range_vertical + $pos_y);
} else {
$pos_x = ($pos_x + $range);
$elements_row++;
}
} }
$return = ui_print_success_message(__('Modules successfully added to layout'), '', true); $return = ui_print_success_message(__('Modules successfully added to layout'), '', true);
@ -2885,6 +2896,7 @@ function visual_map_process_wizard_add_agents(
$image, $image,
$id_layout, $id_layout,
$range, $range,
$range_vertical,
$width, $width,
$height, $height,
$period, $period,
@ -2900,7 +2912,10 @@ function visual_map_process_wizard_add_agents(
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE, $kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
$item_in_the_map=0, $item_in_the_map=0,
$fontf='lato', $fontf='lato',
$fonts='12pt' $fonts='12pt',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) { ) {
global $config; global $config;
@ -2925,9 +2940,8 @@ function visual_map_process_wizard_add_agents(
$id_agents = (array) $id_agents; $id_agents = (array) $id_agents;
$error = false; $error = false;
$pos_y = 10; $elements_row = 1;
$pos_x = 10; $initial_x = $pos_x;
$relationship = true; $relationship = true;
$relationships_agents = []; $relationships_agents = [];
// Check if the set a none relationship // Check if the set a none relationship
@ -2945,11 +2959,6 @@ function visual_map_process_wizard_add_agents(
$id_agent = $id_a; $id_agent = $id_a;
} }
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
$value_height = $height; $value_height = $height;
$value_image = $image; $value_image = $image;
$value_type = $type; $value_type = $type;
@ -3061,6 +3070,15 @@ function visual_map_process_wizard_add_agents(
$id_item = db_process_sql_insert('tlayout_data', $values); $id_item = db_process_sql_insert('tlayout_data', $values);
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
$elements_row = 1;
$pos_x = $initial_x;
$pos_y = ($range_vertical + $pos_y);
} else {
$pos_x = ($pos_x + $range);
$elements_row++;
}
if ($relationship) { if ($relationship) {
switch ($kind_relationship) { switch ($kind_relationship) {
case VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP: case VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP:
@ -3093,8 +3111,6 @@ function visual_map_process_wizard_add_agents(
break; break;
} }
} }
$pos_x = ($pos_x + $range);
} }
foreach ($relationships_agents as $relationship_item) { foreach ($relationships_agents as $relationship_item) {

View File

@ -7092,6 +7092,10 @@ div.graph div.legend table {
margin-top: -10px; margin-top: -10px;
} }
.mrgn_top-15px {
margin-top: -15px;
}
.mrgn_top_0px { .mrgn_top_0px {
margin-top: 0px; margin-top: 0px;
} }