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); array_push($table->data, $data);
} }
$activity .= html_print_table($table, true); $activity = html_print_table($table, true);
unset($table); unset($table);
ui_toggle( ui_toggle(

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Load global vars // Load global vars.
global $config; global $config;
check_login(); 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); $backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif);
asort($backgrounds_list); asort($backgrounds_list);
if (!enterprise_installed()) { $open = false;
if (enterprise_installed() === false) {
$open = true; $open = true;
} }
@ -953,7 +954,7 @@ $options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select( $table_chars->data[$row][1] = html_print_select(
$options_full_escale, $options_full_escale,
'full_scale_option', 'full_scale_option',
$config['full_scale_option'], (isset($config['full_scale_option']) === true) ? $config['full_scale_option'] : 0,
'', '',
'', '',
0, 0,
@ -973,7 +974,7 @@ $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
$table_chars->data[$row][1] = html_print_select( $table_chars->data[$row][1] = html_print_select(
$options_soft_graphs, $options_soft_graphs,
'type_mode_graph', 'type_mode_graph',
$config['type_mode_graph'], (isset($config['type_mode_graph']) === true) ? $config['type_mode_graph'] : 0,
'', '',
'', '',
0, 0,
@ -1053,13 +1054,31 @@ $table_vc->data[$row][1] = html_print_extended_select_for_time(
$row++; $row++;
$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console'); $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++; $row++;
$vc_favourite_view_array[0] = __('Classic view'); $vc_favourite_view_array[0] = __('Classic view');
$vc_favourite_view_array[1] = __('View of favorites'); $vc_favourite_view_array[1] = __('View of favorites');
$table_vc->data[$row][0] = __('Type of view of visual consoles'); $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++; $row++;
$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu'); $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++; $row++;
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console'); $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', 'tiny' => 'Short',
]; ];
$table_report->data[$row][0] = __('Interval description'); $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++; $row++;

View File

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

View File

@ -309,7 +309,7 @@ class WelcomeWindow extends Wizard
{ {
global $config; 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'); $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) { 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'); $error_update[] = __('Default line menu items for the Services');
} }
@ -3062,6 +3066,10 @@ function config_process_config()
config_update_value('vc_line_thickness', 2); 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'])) { if (!isset($config['agent_size_text_small'])) {
config_update_value('agent_size_text_small', 18); 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': case 'image':
$output .= html_print_input_image( $output .= html_print_input_image(
$data['name'], ((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'], $data['src'],
$data['value'], $data['value'],
((isset($data['style']) === true) ? $data['style'] : ''), ((isset($data['style']) === true) ? $data['style'] : ''),

View File

@ -34,15 +34,22 @@
* *
* @param boolean $id_user * @param boolean $id_user
* @param boolean $user_strict * @param boolean $user_strict
* @param [type] $acltags * @param array $acltags
* @param boolean $returnAllGroup * @param boolean $returnAllGroup
* @param string $mode * @param string $mode
* @param array $agent_filter * @param array $agent_filter
* @param array $module_filter * @param array $module_filter
* @return void * @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; global $config;
if ($id_user == false) { if ($id_user == false) {
$id_user = $config['id_user']; $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) function tactical_monitor_alerts($strict_user=false)
{ {
global $config;
$groups = users_get_groups($config['id_user'], 'AR', false); $groups = users_get_groups($config['id_user'], 'AR', false);
$id_groups = array_keys($groups); $id_groups = array_keys($groups);
if (empty($id_groups)) { $where_clause = '';
if (empty($id_groups) === true) {
$where_clause .= ' AND (1 = 0) '; $where_clause .= ' AND (1 = 0) ';
} else { } else {
$where_clause .= sprintf( $where_clause .= sprintf(

View File

@ -82,7 +82,7 @@ function visual_map_print_user_line_handles($layoutData)
function visual_map_print_item( function visual_map_print_item(
$mode='read', $mode='read',
$layoutData, $layoutData=[],
$proportion=null, $proportion=null,
$show_links=true, $show_links=true,
$isExternalLink=false, $isExternalLink=false,
@ -2554,13 +2554,13 @@ function visual_map_process_wizard_add(
$range, $range,
$width=0, $width=0,
$height=0, $height=0,
$period, $period='',
$process_value, $process_value='',
$percentileitem_width, $percentileitem_width='',
$max_value, $max_value=0,
$type_percentile, $type_percentile='',
$value_show, $value_show='',
$type $type=''
) { ) {
if (empty($id_agents)) { if (empty($id_agents)) {
print_error_message(__('No agents selected')); 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'); 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; $meta_connected_to = null;
foreach ($valid_layout_items as $layout_item_data) { 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( $ent_element_status = enterprise_hook(
'enterprise_visual_map_get_status_element', 'enterprise_visual_map_get_status_element',
[$layoutData] [$layout_item_data]
); );
if ($ent_element_status === ENTERPRISE_NOT_HOOK) { if ($ent_element_status === ENTERPRISE_NOT_HOOK) {
$ent_element_status = false; $ent_element_status = false;

View File

@ -1351,40 +1351,42 @@ function dashboardLoadVC(settings) {
: "dashboard" : "dashboard"
); );
$(window).on("orientationchange", function() { if (settings.mobile_view_orientation_vc === true) {
$(container).width($(window).height()); $(window).on("orientationchange", function() {
$(container).height($(window).width() - headerMobileFix); $(container).width($(window).height());
//Remove spinner change VC. $(container).height($(window).width() - headerMobileFix);
container.classList.remove("is-updating"); //Remove spinner change VC.
container.classList.remove("cv-overflow"); container.classList.remove("is-updating");
container.classList.remove("cv-overflow");
var div = container.querySelector(".div-visual-console-spinner"); var div = container.querySelector(".div-visual-console-spinner");
if (div !== null) { if (div !== null) {
var parent = div.parentElement; var parent = div.parentElement;
if (parent !== null) { if (parent !== null) {
parent.removeChild(div); parent.removeChild(div);
}
} }
}
container.classList.add("is-updating"); container.classList.add("is-updating");
container.classList.add("cv-overflow"); container.classList.add("cv-overflow");
const divParent = document.createElement("div"); const divParent = document.createElement("div");
divParent.className = "div-visual-console-spinner"; divParent.className = "div-visual-console-spinner";
const divSpinner = document.createElement("div"); const divSpinner = document.createElement("div");
divSpinner.className = "visual-console-spinner"; divSpinner.className = "visual-console-spinner";
divParent.appendChild(divSpinner); divParent.appendChild(divSpinner);
container.appendChild(divParent); container.appendChild(divParent);
var dimensions = { var dimensions = {
width: $(window).height(), width: $(window).height(),
height: $(window).width() - 40 height: $(window).width() - 40
}; };
visualConsoleManager.changeDimensionsVc(dimensions, interval); visualConsoleManager.changeDimensionsVc(dimensions, interval);
}); });
}
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars

View File

@ -438,16 +438,22 @@ class MapsMadeByUser extends Widget
$settings = \json_encode( $settings = \json_encode(
[ [
'props' => $visualConsoleData, 'props' => $visualConsoleData,
'items' => $visualConsoleItems, 'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false), 'baseUrl' => ui_get_full_url(
'ratio' => $ratio, '/',
'size' => $size, false,
'cellId' => $this->cellId, false,
'hash' => User::generatePublicHash(), false
'id_user' => $config['id_user'], ),
'page' => 'include/ajax/visual_console.ajax', 'ratio' => $ratio,
'uniq' => $uniq, 'size' => $size,
'cellId' => $this->cellId,
'hash' => User::generatePublicHash(),
'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', dataType: 'JSON',
success: function(data) { success: function(data) {
console.log(data);
$('#vcId').empty(); $('#vcId').empty();
Object.entries(data).forEach(e => { Object.entries(data).forEach(e => {
key = e[0]; key = e[0];

View File

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

View File

@ -174,6 +174,14 @@ final class StaticGraph extends Item
throw new \InvalidArgumentException('missing module Id'); 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 if ((bool) $data['agentDisabled'] === false
&& (bool) $data['moduleDisabled'] === false && (bool) $data['moduleDisabled'] === false
) { ) {

View File

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

View File

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

View File

@ -216,6 +216,7 @@ class Visualmap
*/ */
private function show_visualmap() private function show_visualmap()
{ {
global $config;
$ui = Ui::getInstance(); $ui = Ui::getInstance();
$system = System::getInstance(); $system = System::getInstance();
@ -279,6 +280,13 @@ class Visualmap
'height' => $this->height, 'height' => $this->height,
]; ];
if ((bool) $config['mobile_view_orientation_vc'] === true) {
$size = [
'width' => $this->height,
'height' => $this->width,
];
}
$ratio_t = $visualConsole->adjustToViewport($size, 'mobile'); $ratio_t = $visualConsole->adjustToViewport($size, 'mobile');
$visualConsoleData = $visualConsole->toArray(); $visualConsoleData = $visualConsole->toArray();
@ -340,16 +348,17 @@ class Visualmap
$settings = \json_encode( $settings = \json_encode(
[ [
'props' => $visualConsoleData, 'props' => $visualConsoleData,
'items' => $visualConsoleItems, 'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false), 'baseUrl' => ui_get_full_url('/', false, false, false),
'page' => 'include/ajax/visual_console.ajax', 'page' => 'include/ajax/visual_console.ajax',
'ratio' => $ratio_t, 'ratio' => $ratio_t,
'size' => $size, 'size' => $size,
'cellId' => $uniq, 'cellId' => $uniq,
'uniq' => $uniq, 'uniq' => $uniq,
'mobile' => true, 'mobile' => true,
'vcId' => $visualConsoleId, 'vcId' => $visualConsoleId,
'mobile_view_orientation_vc' => (bool) !$config['mobile_view_orientation_vc'],
] ]
); );