Not orientation CV view mobile pandora_enterprise#8888

This commit is contained in:
Daniel Barbero Martin 2022-05-13 12:54:58 +02:00
parent 03aa36593e
commit ececdca0b6
15 changed files with 184 additions and 75 deletions

View File

@ -288,7 +288,7 @@ foreach ($sessions as $session) {
array_push($table->data, $data);
}
$activity .= html_print_table($table, true);
$activity = html_print_table($table, true);
unset($table);
ui_toggle(

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
check_login();
@ -181,7 +181,8 @@ $backgrounds_list = array_merge($backgrounds_list_jpg, $backgrounds_list_png);
$backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif);
asort($backgrounds_list);
if (!enterprise_installed()) {
$open = false;
if (enterprise_installed() === false) {
$open = true;
}
@ -953,7 +954,7 @@ $options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select(
$options_full_escale,
'full_scale_option',
$config['full_scale_option'],
(isset($config['full_scale_option']) === true) ? $config['full_scale_option'] : 0,
'',
'',
0,
@ -973,7 +974,7 @@ $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
$table_chars->data[$row][1] = html_print_select(
$options_soft_graphs,
'type_mode_graph',
$config['type_mode_graph'],
(isset($config['type_mode_graph']) === true) ? $config['type_mode_graph'] : 0,
'',
'',
0,
@ -1053,13 +1054,31 @@ $table_vc->data[$row][1] = html_print_extended_select_for_time(
$row++;
$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console');
$table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false);
$table_vc->data[$row][1] = html_print_select(
$values,
'vc_refr',
(int) $config['vc_refr'],
'',
'N/A',
0,
true,
false,
false
);
$row++;
$vc_favourite_view_array[0] = __('Classic view');
$vc_favourite_view_array[1] = __('View of favorites');
$table_vc->data[$row][0] = __('Type of view of visual consoles');
$table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config['vc_favourite_view'], '', '', 0, true);
$table_vc->data[$row][1] = html_print_select(
$vc_favourite_view_array,
'vc_favourite_view',
$config['vc_favourite_view'],
'',
'',
0,
true
);
$row++;
$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu');
@ -1067,7 +1086,23 @@ $table_vc->data[$row][1] = "<input type ='number' value=".$config['vc_menu_items
$row++;
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console');
$table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', (int) $config['vc_line_thickness'], '', 5, 5, true);
$table_vc->data[$row][1] = html_print_input_text(
'vc_line_thickness',
(int) $config['vc_line_thickness'],
'',
5,
5,
true
);
$table_vc->data[$row][0] = __('Mobile view not allow visual console orientation');
$table_vc->data[$row][1] = html_print_checkbox_switch(
'mobile_view_orientation_vc',
1,
(bool) $config['mobile_view_orientation_vc'],
true
);
$row++;
// ----------------------------------------------------------------------
@ -1133,7 +1168,17 @@ $interval_description = [
'tiny' => 'Short',
];
$table_report->data[$row][0] = __('Interval description');
$table_report->data[$row][1] = html_print_select($interval_description, 'interval_description', $config['interval_description'], '', '', '', true, false, false);
$table_report->data[$row][1] = html_print_select(
$interval_description,
'interval_description',
(isset($config['interval_description']) === true) ? $config['interval_description'] : 'large',
'',
'',
'',
true,
false,
false
);
$row++;

View File

@ -851,6 +851,8 @@ class HTML
foreach ($inputs as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);

View File

@ -309,7 +309,7 @@ class WelcomeWindow extends Wizard
{
global $config;
return $config['welcome_id_agent'];
return (isset($config['welcome_id_agent']) === true) ? $config['welcome_id_agent'] : '';
}

View File

@ -1183,6 +1183,10 @@ function config_update_config()
$error_update[] = __('Default line thickness for the Visual Console');
}
if (config_update_value('mobile_view_orientation_vc', (int) get_parameter('mobile_view_orientation_vc'), true) === false) {
$error_update[] = __('Mobile view not allow visual console orientation');
}
if (config_update_value('ser_menu_items', (int) get_parameter('ser_menu_items', 10), true) === false) {
$error_update[] = __('Default line menu items for the Services');
}
@ -3062,6 +3066,10 @@ function config_process_config()
config_update_value('vc_line_thickness', 2);
}
if (isset($config['mobile_view_orientation_vc']) === false) {
config_update_value('mobile_view_orientation_vc', 0);
}
if (!isset($config['agent_size_text_small'])) {
config_update_value('agent_size_text_small', 18);
}

View File

@ -4844,7 +4844,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'image':
$output .= html_print_input_image(
$data['name'],
((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),

View File

@ -34,15 +34,22 @@
*
* @param boolean $id_user
* @param boolean $user_strict
* @param [type] $acltags
* @param array $acltags
* @param boolean $returnAllGroup
* @param string $mode
* @param array $agent_filter
* @param array $module_filter
* @return void
*/
function tactical_get_data($id_user=false, $user_strict=false, $acltags, $returnAllGroup=false, $mode='group', $agent_filter=[], $module_filter=[])
{
function tactical_get_data(
$id_user=false,
$user_strict=false,
$acltags=[],
$returnAllGroup=false,
$mode='group',
$agent_filter=[],
$module_filter=[]
) {
global $config;
if ($id_user == false) {
$id_user = $config['id_user'];
@ -504,10 +511,12 @@ function tactical_status_modules_agents($id_user=false, $user_strict=false, $acc
function tactical_monitor_alerts($strict_user=false)
{
global $config;
$groups = users_get_groups($config['id_user'], 'AR', false);
$id_groups = array_keys($groups);
if (empty($id_groups)) {
$where_clause = '';
if (empty($id_groups) === true) {
$where_clause .= ' AND (1 = 0) ';
} else {
$where_clause .= sprintf(

View File

@ -82,7 +82,7 @@ function visual_map_print_user_line_handles($layoutData)
function visual_map_print_item(
$mode='read',
$layoutData,
$layoutData=[],
$proportion=null,
$show_links=true,
$isExternalLink=false,
@ -2554,13 +2554,13 @@ function visual_map_process_wizard_add(
$range,
$width=0,
$height=0,
$period,
$process_value,
$percentileitem_width,
$max_value,
$type_percentile,
$value_show,
$type
$period='',
$process_value='',
$percentileitem_width='',
$max_value=0,
$type_percentile='',
$value_show='',
$type=''
) {
if (empty($id_agents)) {
print_error_message(__('No agents selected'));
@ -3956,7 +3956,15 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
sort_by_column($valid_layout_items, 'id_metaconsole');
}
$num_elements_by_status = [];
$num_elements_by_status = [
VISUAL_MAP_STATUS_CRITICAL_BAD => 0,
VISUAL_MAP_STATUS_CRITICAL_ALERT => 0,
VISUAL_MAP_STATUS_NORMAL => 0,
VISUAL_MAP_STATUS_WARNING => 0,
VISUAL_MAP_STATUS_UNKNOWN => 0,
VISUAL_MAP_STATUS_WARNING_ALERT => 0,
];
$meta_connected_to = null;
foreach ($valid_layout_items as $layout_item_data) {
@ -3993,7 +4001,7 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
$ent_element_status = enterprise_hook(
'enterprise_visual_map_get_status_element',
[$layoutData]
[$layout_item_data]
);
if ($ent_element_status === ENTERPRISE_NOT_HOOK) {
$ent_element_status = false;

View File

@ -1351,6 +1351,7 @@ function dashboardLoadVC(settings) {
: "dashboard"
);
if (settings.mobile_view_orientation_vc === true) {
$(window).on("orientationchange", function() {
$(container).width($(window).height());
$(container).height($(window).width() - headerMobileFix);
@ -1385,6 +1386,7 @@ function dashboardLoadVC(settings) {
visualConsoleManager.changeDimensionsVc(dimensions, interval);
});
}
}
// eslint-disable-next-line no-unused-vars

View File

@ -440,7 +440,12 @@ class MapsMadeByUser extends Widget
[
'props' => $visualConsoleData,
'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false),
'baseUrl' => ui_get_full_url(
'/',
false,
false,
false
),
'ratio' => $ratio,
'size' => $size,
'cellId' => $this->cellId,
@ -448,6 +453,7 @@ class MapsMadeByUser extends Widget
'id_user' => $config['id_user'],
'page' => 'include/ajax/visual_console.ajax',
'uniq' => $uniq,
'mobile_view_orientation_vc' => false,
]
);
@ -507,7 +513,6 @@ class MapsMadeByUser extends Widget
},
dataType: 'JSON',
success: function(data) {
console.log(data);
$('#vcId').empty();
Object.entries(data).forEach(e => {
key = e[0];

View File

@ -223,6 +223,7 @@ abstract class Model
*/
public function adjustToViewport($size, $mode='')
{
global $config;
$ratio_visualconsole = $this->getRatio();
$ratio_w = ($size['width'] / $this->data['width']);
$ratio_h = ($size['height'] / $this->data['height']);
@ -232,6 +233,7 @@ abstract class Model
$ratio = $ratio_w;
if ($mode === 'mobile') {
if ((bool) $config['mobile_view_orientation_vc'] === true) {
if ($this->data['height'] < $this->data['width']) {
if ($this->data['height'] > $size['height']) {
$ratio = $ratio_h;
@ -239,6 +241,13 @@ abstract class Model
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
}
} else {
if ($this->data['height'] > $this->data['width']) {
$ratio = $ratio_h;
$this->data['height'] = $size['height'];
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
}
} else {
if ($this->data['height'] > $size['height']) {
$ratio = $ratio_h;

View File

@ -174,6 +174,14 @@ final class StaticGraph extends Item
throw new \InvalidArgumentException('missing module Id');
}
if (isset($data['agentDisabled']) === false) {
$data['agentDisabled'] = false;
}
if (isset($data['moduleDisabled']) === false) {
$data['moduleDisabled'] = false;
}
if ((bool) $data['agentDisabled'] === false
&& (bool) $data['moduleDisabled'] === false
) {

View File

@ -1396,7 +1396,7 @@ div.ui-mobile-viewport {
overflow: visible;
overflow-x: hidden;
padding: 1em;
min-height: calc(100vh - 60px);
/*min-height: calc(100vh - 60px);*/
}
.ui-corner-all > .ui-toolbar-header:first-child,
.ui-corner-all > .ui-content:first-child,

View File

@ -1003,6 +1003,10 @@ class Ui
$(document).ready(function () {
dashboardLoadVC(settings);
if(settings.mobile_view_orientation_vc === false) {
$(".container-center").css("transform", "rotate(90deg)");
$(".container-center").css("margin-top", "40px");
}
});
</script>'
);

View File

@ -216,6 +216,7 @@ class Visualmap
*/
private function show_visualmap()
{
global $config;
$ui = Ui::getInstance();
$system = System::getInstance();
@ -279,6 +280,13 @@ class Visualmap
'height' => $this->height,
];
if ((bool) $config['mobile_view_orientation_vc'] === true) {
$size = [
'width' => $this->height,
'height' => $this->width,
];
}
$ratio_t = $visualConsole->adjustToViewport($size, 'mobile');
$visualConsoleData = $visualConsole->toArray();
@ -350,6 +358,7 @@ class Visualmap
'uniq' => $uniq,
'mobile' => true,
'vcId' => $visualConsoleId,
'mobile_view_orientation_vc' => (bool) !$config['mobile_view_orientation_vc'],
]
);