#11819 wizard visual console update

This commit is contained in:
Jonathan 2023-08-14 14:54:15 +02:00
parent c9868eec3e
commit 53bf10acc0
4 changed files with 161 additions and 37 deletions

View File

@ -555,6 +555,7 @@ switch ($activeTab) {
$type = (int) get_parameter('type', STATIC_GRAPH);
$image = get_parameter('image');
$range = (int) get_parameter('range', 50);
$range_vertical = (int) get_parameter('range_vertical', 50);
$width = (int) get_parameter('width', 0);
$height = (int) get_parameter('height', 0);
$period = (int) get_parameter('period', 0);
@ -567,6 +568,9 @@ switch ($activeTab) {
$label_type = get_parameter('label_type', 'agent_module');
$enable_link = get_parameter('enable_link', 'enable_link');
$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
$item_per_agent = get_parameter('item_per_agent', 0);
@ -611,6 +615,7 @@ switch ($activeTab) {
$image,
$idVisualConsole,
$range,
$range_vertical,
$width,
$height,
$period,
@ -626,7 +631,10 @@ switch ($activeTab) {
$kind_relationship,
$item_in_the_map,
$fontf,
$fonts
$fonts,
$pos_x,
$pos_y,
$max_elements_row
);
$statusProcessInDB = [
@ -668,6 +676,7 @@ switch ($activeTab) {
$image,
$idVisualConsole,
$range,
$range_vertical,
$width,
$height,
$period,
@ -683,7 +692,10 @@ switch ($activeTab) {
$kind_relationship,
$item_in_the_map,
$fontf,
$fonts
$fonts,
$pos_x,
$pos_y,
$max_elements_row
);
} else {
$id_modules = [];
@ -722,6 +734,7 @@ switch ($activeTab) {
$image,
$idVisualConsole,
$range,
$range_vertical,
$width,
$height,
$period,
@ -737,7 +750,10 @@ switch ($activeTab) {
$kind_relationship,
$item_in_the_map,
$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->colspan['staticgraph'][0] = 2;
$table->data['staticgraph'][0] = html_print_label_input_block(
__('Image'),
html_print_select(
'<div class="flex">'.html_print_select(
$images_list,
'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->data['all_1'][0] = html_print_label_input_block(
__('Range between elements (px)'),
__('Horizontal range between elements (px)'),
html_print_input_text(
'range',
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 .= html_print_input_text('width', 0, '', 5, 5, true);
$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->data['all_4'][0] = html_print_label_input_block(
__('Agents').ui_print_help_tip(
@ -549,6 +577,16 @@ $table->data['all_8'][1] = html_print_label_input_block(
).'</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) {
$pure = get_parameter('pure', 0);
@ -831,6 +869,44 @@ function item_per_agent_change(itemPerAgent) {
function metaconsole_init() {
$("#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>
<style type="text/css">
select[name='kind_relationship'] option[disabled='disabled'] {

View File

@ -2554,6 +2554,7 @@ function visual_map_process_wizard_add(
$image,
$id_layout,
$range,
$range_vertical,
$width=0,
$height=0,
$period='',
@ -2562,7 +2563,10 @@ function visual_map_process_wizard_add(
$max_value=0,
$type_percentile='',
$value_show='',
$type=''
$type='',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) {
if (empty($id_agents)) {
print_error_message(__('No agents selected'));
@ -2572,14 +2576,11 @@ function visual_map_process_wizard_add(
$id_agents = (array) $id_agents;
$error = false;
$pos_y = 10;
$pos_x = 10;
$initial_x = $pos_x;
$initial_y = $pos_y;
$elements_row = 1;
$total_rows = 1;
foreach ($id_agents as $id_agent) {
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
$value_height = $height;
$value_image = $image;
$value_type = $type;
@ -2628,7 +2629,16 @@ function visual_map_process_wizard_add(
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 + ($range * $total_rows));
$pos_y = ($initial_y + ($range_vertical * $total_rows));
$total_rows++;
} else {
$pos_x = ($pos_x + $range);
$pos_y = ($pos_y + $range_vertical);
$elements_row++;
}
}
$return = ui_print_success_message(__('Agent successfully added to layout'), '', true);
@ -2654,6 +2664,7 @@ function visual_map_process_wizard_add_modules(
$image,
$id_layout,
$range,
$range_vertical,
$width,
$height,
$period,
@ -2669,7 +2680,10 @@ function visual_map_process_wizard_add_modules(
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
$item_in_the_map=0,
$fontf='lato',
$fonts='12pt'
$fonts='12pt',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) {
if (empty($width) === true) {
$width = 0;
@ -2691,15 +2705,11 @@ function visual_map_process_wizard_add_modules(
$id_modules = (array) $id_modules;
$error = false;
$pos_y = 10;
$pos_x = 10;
$initial_x = $pos_x;
$initial_y = $pos_y;
$elements_row = 1;
$total_rows = 1;
foreach ($id_modules as $id_module) {
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
if ($id_server != 0) {
$connection = db_get_row_filter(
'tmetaconsole_setup',
@ -2820,7 +2830,16 @@ function visual_map_process_wizard_add_modules(
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 + ($range * $total_rows));
$pos_y = ($initial_y + ($range_vertical * $total_rows));
$total_rows++;
} else {
$pos_x = ($pos_x + $range);
$pos_y = ($pos_y + $range_vertical);
$elements_row++;
}
}
$return = ui_print_success_message(__('Modules successfully added to layout'), '', true);
@ -2885,6 +2904,7 @@ function visual_map_process_wizard_add_agents(
$image,
$id_layout,
$range,
$range_vertical,
$width,
$height,
$period,
@ -2900,7 +2920,10 @@ function visual_map_process_wizard_add_agents(
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
$item_in_the_map=0,
$fontf='lato',
$fonts='12pt'
$fonts='12pt',
$pos_x=10,
$pos_y=10,
$max_elements_row=0
) {
global $config;
@ -2925,9 +2948,10 @@ function visual_map_process_wizard_add_agents(
$id_agents = (array) $id_agents;
$error = false;
$pos_y = 10;
$pos_x = 10;
$initial_x = $pos_x;
$initial_y = $pos_y;
$elements_row = 1;
$total_rows = 1;
$relationship = true;
$relationships_agents = [];
// Check if the set a none relationship
@ -2945,11 +2969,6 @@ function visual_map_process_wizard_add_agents(
$id_agent = $id_a;
}
if ($pos_x > 600) {
$pos_x = 10;
$pos_y = ($pos_y + $range);
}
$value_height = $height;
$value_image = $image;
$value_type = $type;
@ -3061,6 +3080,17 @@ function visual_map_process_wizard_add_agents(
$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 + ($range * $total_rows));
$pos_y = ($initial_y + ($range_vertical * $total_rows));
$total_rows++;
} else {
$pos_x = ($pos_x + $range);
$pos_y = ($pos_y + $range_vertical);
$elements_row++;
}
if ($relationship) {
switch ($kind_relationship) {
case VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP:
@ -3093,8 +3123,6 @@ function visual_map_process_wizard_add_agents(
break;
}
}
$pos_x = ($pos_x + $range);
}
foreach ($relationships_agents as $relationship_item) {

View File

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