add sliced mode simple graph reports and CV pandora_enterprise#9640

This commit is contained in:
daniel 2023-10-25 15:55:54 +02:00
parent 6a0a855311
commit 868700f9f1
22 changed files with 651 additions and 56 deletions

View File

@ -35,7 +35,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['last_id']
).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',
@ -235,6 +235,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$header_autorefresh = '';
$header_autorefresh_counter = '';
$header_setup = '';
if (($_GET['sec2'] !== 'operation/visual_console/render_view')) {
if ($autorefresh_list !== null
@ -352,7 +353,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$display_counter = 'display:none';
}
$header_setup = '';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$header_setup .= '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general').'">';
$header_setup .= html_print_image(

View File

@ -719,7 +719,7 @@ if ((bool) $config['pure'] === false) {
echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {

View File

@ -151,6 +151,14 @@ $percentil = false;
$image_threshold = false;
$time_compare_overlapped = false;
$periodicity_chart = false;
$period_maximum = true;
$period_minimum = true;
$period_average = true;
$period_summatory = false;
$period_slice_chart = SECONDS_1HOUR;
$period_mode = CUSTOM_GRAPH_VBARS;
// Added for events items.
$server_multiple = [0];
$show_summary_group = false;
@ -350,10 +358,18 @@ switch ($action) {
break;
case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$fullscale = (isset($style['fullscale']) === true) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
$image_threshold = (isset($style['image_threshold']) === true) ? (bool) $style['image_threshold'] : false;
$graph_render = $item['graph_render'];
$periodicity_chart = (isset($style['periodicity_chart']) === true) ? $style['periodicity_chart'] : false;
$period_maximum = (isset($style['period_maximum']) === true) ? $style['period_maximum'] : true;
$period_minimum = (isset($style['period_minimum']) === true) ? $style['period_minimum'] : true;
$period_average = (isset($style['period_average']) === true) ? $style['period_average'] : true;
$period_summatory = (isset($style['period_summatory']) === true) ? $style['period_summatory'] : false;
$period_slice_chart = (isset($style['period_slice_chart']) === true) ? $style['period_slice_chart'] : SECONDS_1HOUR;
$period_mode = (isset($style['period_mode']) === true) ? $style['period_mode'] : CUSTOM_GRAPH_VBARS;
// The break hasn't be forgotten.
case 'simple_baseline_graph':
case 'projection_graph':
@ -2853,6 +2869,22 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_periodicity_chart" class="datos">
<td class="bolder"><?php echo __('Sliced mode'); ?></td>
<td >
<?php
html_print_checkbox_switch(
'periodicity_chart',
1,
(bool) $periodicity_chart,
false,
false,
'showPeriodicityOptions(this)'
);
?>
</td>
</tr>
<tr id="row_graph_render" class="datos">
<td class="bolder">
<?php
@ -2983,6 +3015,111 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_period_maximum" class="datos">
<td class="bolder"><?php echo __('Maximum'); ?></td>
<td >
<?php
html_print_checkbox_switch(
'period_maximum',
1,
(bool) $period_maximum,
false
);
?>
</td>
</tr>
<tr id="row_period_minimum" class="datos">
<td class="bolder"><?php echo __('Minimum'); ?></td>
<td >
<?php
html_print_checkbox_switch(
'period_minimum',
1,
(bool) $period_minimum,
false
);
?>
</td>
</tr>
<tr id="row_period_average" class="datos">
<td class="bolder"><?php echo __('Average'); ?></td>
<td >
<?php
html_print_checkbox_switch(
'period_average',
1,
(bool) $period_average,
false
);
?>
</td>
</tr>
<tr id="row_period_summatory" class="datos">
<td class="bolder"><?php echo __('Summatory'); ?></td>
<td >
<?php
html_print_checkbox_switch(
'period_summatory',
1,
(bool) $period_summatory,
false
);
?>
</td>
</tr>
<tr id="row_period_slice_chart" class="datos">
<td class="bolder"><?php echo __('Slice'); ?></td>
<td >
<?php
html_print_extended_select_for_time(
'period_slice_chart',
(string) $period_slice_chart,
'',
'',
0,
7,
false,
false,
true,
'',
false,
[
SECONDS_1HOUR => __('1 hour'),
SECONDS_1DAY => __('1 day'),
SECONDS_1WEEK => __('1 week'),
SECONDS_1MONTH => __('1 month'),
]
);
?>
</td>
</tr>
<tr id="row_period_mode" class="datos">
<td class="bolder"><?php echo __('Mode'); ?></td>
<td >
<?php
$options_period_mode = [
CUSTOM_GRAPH_AREA => __('Area'),
CUSTOM_GRAPH_LINE => __('Line'),
CUSTOM_GRAPH_VBARS => __('Vertical bars'),
];
html_print_select(
$options_period_mode,
'period_mode',
$period_mode,
'',
'',
0,
false,
false,
false
);
?>
</td>
</tr>
<tr id="row_exception_condition" class="datos">
<td class="bolder"><?php echo __('Condition'); ?></td>
<td>
@ -6854,6 +6991,13 @@ function chooseType() {
$("#row_filter_search").hide();
$("#row_filter_exclude").hide();
$("#row_percentil").hide();
$("#row_periodicity_chart").hide();
$("#row_period_maximum").hide();
$("#row_period_minimum").hide();
$("#row_period_average").hide();
$("#row_period_summatory").hide();
$("#row_period_slice_chart").hide();
$("#row_period_mode").hide();
$("#log_help_tip").css("visibility", "hidden");
$("#agents_row").hide();
$("#agents_modules_row").hide();
@ -6983,11 +7127,22 @@ function chooseType() {
break;
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_fullscale").show();
$("#row_image_threshold").show();
$("#row_graph_render").show();
$("#row_percentil").show();
$("#row_periodicity_chart").show();
var periodicity_chart = $("input[name='periodicity_chart']").prop("checked");
if(periodicity_chart){
$("#row_period_maximum").show();
$("#row_period_minimum").show();
$("#row_period_average").show();
$("#row_period_summatory").show();
$("#row_period_slice_chart").show();
$("#row_period_mode").show();
} else {
$("#row_time_compare_overlapped").show();
$("#row_fullscale").show();
$("#row_image_threshold").show();
$("#row_graph_render").show();
$("#row_percentil").show();
}
// Force type.
if('<?php echo $action; ?>' === 'new'){

View File

@ -2437,6 +2437,15 @@ switch ($action) {
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
$style['periodicity_chart'] = (int) get_parameter_checkbox('periodicity_chart', 0);
$style['period_maximum'] = (int) get_parameter_checkbox('period_maximum', 1);
$style['period_minimum'] = (int) get_parameter_checkbox('period_minimum', 1);
$style['period_average'] = (int) get_parameter_checkbox('period_average', 1);
$style['period_summatory'] = (int) get_parameter_checkbox('period_summatory', 0);
$style['period_slice_chart'] = get_parameter('period_slice_chart', SECONDS_1HOUR);
$style['period_mode'] = get_parameter('period_mode', CUSTOM_GRAPH_VBARS);
if ($label != '') {
$style['label'] = $label;
} else {
@ -3342,6 +3351,15 @@ switch ($action) {
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
$style['periodicity_chart'] = (int) get_parameter_checkbox('periodicity_chart', 0);
$style['period_maximum'] = (int) get_parameter_checkbox('period_maximum', 1);
$style['period_minimum'] = (int) get_parameter_checkbox('period_minimum', 1);
$style['period_average'] = (int) get_parameter_checkbox('period_average', 1);
$style['period_summatory'] = (int) get_parameter_checkbox('period_summatory', 0);
$style['period_slice_chart'] = get_parameter('period_slice_chart', SECONDS_1HOUR);
$style['period_mode'] = get_parameter('period_mode', CUSTOM_GRAPH_VBARS);
if ($label != '') {
$style['label'] = $label;
} else {

View File

@ -492,6 +492,7 @@ class HTML
$class = '';
}
$style_li = '';
if (empty($input['style']) === false) {
$style_li = $input['style'];
}

View File

@ -3969,6 +3969,7 @@ function series_type_graph_array($data, $show_elements_graph)
$i = 0;
if (isset($data) && is_array($data)) {
foreach ($data as $key => $value) {
$str = '';
if ($show_elements_graph['compare'] == 'overlapped') {
if ($key == 'sum2') {
$str = ' ('.__('Previous').')';
@ -4052,7 +4053,7 @@ function series_type_graph_array($data, $show_elements_graph)
} else {
$name_legend = '';
if ($show_elements_graph['graph_analytics'] === true) {
if (isset($show_elements_graph['graph_analytics']) === true && $show_elements_graph['graph_analytics'] === true) {
$name_legend .= '<div class="graph-analytics-legend-main">';
$name_legend .= '<div class="graph-analytics-legend-square" style="background-color: '.$color_series[$i]['color'].';">';
$name_legend .= '<span class="square-value">';

View File

@ -2546,6 +2546,7 @@ function graphic_periodicity_module(array $params): string
'legend' => [
'display' => (isset($params['show_legend'])) ? $params['show_legend'] : true,
],
'ttl' => (isset($params['ttl']) === true) ? $params['ttl'] : 1,
];
if ((int) $params['period_mode'] === CUSTOM_GRAPH_HBARS

View File

@ -5849,7 +5849,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_radio_button_extended(
$data['name'],
$data['value'],
$data['label'],
((isset($data['label']) === true) ? $data['label'] : ''),
((isset($data['checkedvalue']) === true) ? $data['checkedvalue'] : 1),
((isset($data['disabled']) === true) ? $data['disabled'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
@ -5906,7 +5906,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
}
$params = [];
$params['disabled'] = $data['disabled'];
$params['disabled'] = ($data['disabled'] ?? false);
$params['return'] = $data['return'];
$params['show_helptip'] = false;
$params['input_name'] = $data['name'];
@ -5971,11 +5971,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
];
} else {
$string_filter = '';
if ($data['get_only_string_modules'] === true) {
if (isset($data['get_only_string_modules']) === true && $data['get_only_string_modules'] === true) {
$string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)';
}
if ($data['from_wux'] === true) {
if (isset($data['from_wux']) === true && $data['from_wux'] === true) {
$string_filter = ' AND id_tipo_modulo = 25';
}

View File

@ -11244,6 +11244,41 @@ function reporting_simple_graph(
$fullscale = (bool) $content['style']['fullscale'];
}
$periodicity_chart = false;
if (isset($content['style']['periodicity_chart'])) {
$periodicity_chart = (bool) $content['style']['periodicity_chart'];
}
$period_maximum = true;
if (isset($content['style']['period_maximum'])) {
$period_maximum = (bool) $content['style']['period_maximum'];
}
$period_minimum = true;
if (isset($content['style']['period_minimum'])) {
$period_minimum = (bool) $content['style']['period_minimum'];
}
$period_average = true;
if (isset($content['style']['period_average'])) {
$period_average = (bool) $content['style']['period_average'];
}
$period_summatory = false;
if (isset($content['style']['period_summatory'])) {
$period_summatory = (bool) $content['style']['period_summatory'];
}
$period_slice_chart = SECONDS_1HOUR;
if (isset($content['style']['period_slice_chart'])) {
$period_slice_chart = $content['style']['period_slice_chart'];
}
$period_mode = CUSTOM_GRAPH_VBARS;
if (isset($content['style']['period_mode'])) {
$period_mode = $content['style']['period_mode'];
}
$image_threshold = false;
if (isset($content['style']['image_threshold'])) {
$image_threshold = (bool) $content['style']['image_threshold'];
@ -11306,10 +11341,28 @@ function reporting_simple_graph(
'image_threshold' => $image_threshold,
];
if ((bool) $periodicity_chart === true) {
$params['width'] = null;
$params['period_maximum'] = $period_maximum;
$params['period_minimum'] = $period_minimum;
$params['period_average'] = $period_average;
$params['period_summatory'] = $period_summatory;
$params['period_slice_chart'] = $period_slice_chart;
$params['period_mode'] = $period_mode;
}
if ($only_image === false) {
$return['chart'] = grafico_modulo_sparse($params);
if ((bool) $periodicity_chart === false) {
$return['chart'] = \grafico_modulo_sparse($params);
} else {
$return['chart'] = \graphic_periodicity_module($params);
}
} else {
$return['chart'] = '<img src="data:image/png;base64,'.grafico_modulo_sparse($params).'" />';
if ((bool) $periodicity_chart === false) {
$return['chart'] = '<img src="data:image/png;base64,'.\grafico_modulo_sparse($params).'" />';
} else {
$return['chart'] = '<img src="data:image/png;base64,'.\graphic_periodicity_module($params).'" />';
}
}
break;

View File

@ -691,6 +691,7 @@ function get_build_setup_charts($type, $options, $data)
if (isset($options['waterMark']) === true
&& empty($options['waterMark']) === false
&& isset($options['waterMark']['url']) === true
) {
// WaterMark.
$chart->defaults()->getWaterMark()->setWidth(88);

View File

@ -277,7 +277,7 @@ function flot_area_graph(
'></div>";
$return .= "<div id='$graph_id' class='";
if ($params['type'] == 'area_simple') {
if (isset($params['type']) === true && $params['type'] == 'area_simple') {
$return .= 'noresizevc ';
}
@ -287,10 +287,12 @@ function flot_area_graph(
$width = 'width: '.$params['width'].';';
}
if (strpos($params['graph_width'], '%') === false) {
$width = 'width: '.$params['graph_width'].'px;';
} else {
$width = 'width: '.$params['graph_width'].';';
if (isset($params['graph_width']) === true) {
if (strpos($params['graph_width'], '%') === false) {
$width = 'width: '.$params['graph_width'].'px;';
} else {
$width = 'width: '.$params['graph_width'].';';
}
}
$return .= 'graph'.$params['adapt_key']."'
@ -346,10 +348,6 @@ function flot_area_graph(
$array_events_alerts = json_encode($array_events_alerts);
// Javascript code.
if ($font_size == '') {
$font_size = '\'\'';
}
$return .= "<script type='text/javascript'>";
$return .= "pandoraFlotArea(\n";

View File

@ -2557,3 +2557,35 @@ function WarningPeriodicityModal(title, message) {
hideOkButton: 1
});
}
function showPeriodicityOptions(element) {
if ($(element).is(":checked") === true) {
$("#row_period_maximum").show();
$("#row_period_minimum").show();
$("#row_period_average").show();
$("#row_period_summatory").show();
$("#row_period_slice_chart").show();
$("#row_period_mode").show();
$("#li-row_period_type").show();
$("#row_time_compare_overlapped").hide();
$("#row_fullscale").hide();
$("#row_image_threshold").hide();
$("#row_graph_render").hide();
$("#row_percentil").hide();
$("#MGgraphType").hide();
} else {
$("#row_time_compare_overlapped").show();
$("#row_fullscale").show();
$("#row_image_threshold").show();
$("#row_graph_render").show();
$("#row_percentil").show();
$("#MGgraphType").show();
$("#row_period_maximum").hide();
$("#row_period_minimum").hide();
$("#row_period_average").hide();
$("#row_period_summatory").hide();
$("#row_period_slice_chart").hide();
$("#row_period_mode").hide();
$("#li-row_period_type").hide();
}
}

View File

@ -1415,12 +1415,23 @@ function typeModuleGraph(type) {
$("#MGshowLegend").show();
$("#MGcustomGraph").hide();
$("#customGraphId").val(0);
$("#row_periodicity_chart").show();
if ($("#periodicityChart").is(":checked") === true) {
$("#MGgraphType").hide();
$("#li-row_period_type").show();
$("#row_period_slice_chart").show();
$("#row_period_mode").show();
}
} else if (type == "custom") {
$("#MGautoCompleteAgent").hide();
$("#MGautoCompleteModule").hide();
$("#MGgraphType").hide();
$("#MGshowLegend").hide();
$("#MGcustomGraph").show();
$("#row_periodicity_chart").hide();
$("#li-row_period_type").hide();
$("#row_period_slice_chart").hide();
$("#row_period_mode").hide();
}
}

View File

@ -95,7 +95,7 @@ if ($doLogin === true) {
if ($visualConsoleId) {
// Retrieve the visual console.
$visualConsole = VisualConsole::fromDB(['id' => $visualConsoleId], $ratio);
$visualConsole = VisualConsole::fromDB(['id' => $visualConsoleId]);
$visualConsoleData = $visualConsole->toArray();
$vcGroupId = $visualConsoleData['groupId'];

View File

@ -2515,7 +2515,7 @@ class Item extends CachedModel
'arguments' => [
'name' => 'linkedLayoutStatusTypeWeight',
'type' => 'number',
'value' => $values['linkedLayoutStatusTypeWeight'],
'value' => ($values['linkedLayoutStatusTypeWeight'] ?? 0),
'return' => true,
'min' => 0,
],

View File

@ -60,9 +60,8 @@ final class ModuleGraph extends Item
protected static function encode(array $data): array
{
$return = parent::encode($data);
$id_custom_graph = static::extractIdCustomGraph($data);
if (!empty($id_custom_graph)) {
if (empty($id_custom_graph) === false) {
if (\is_metaconsole()) {
$explode_custom_graph = explode('|', $id_custom_graph);
$return['id_custom_graph'] = $explode_custom_graph[0];
@ -82,6 +81,18 @@ final class ModuleGraph extends Item
$return['show_statistics'] = static::parseBool($show_legend);
}
$return['label'] = json_encode(
[
'periodicityChart' => static::extractPeriodicityChart($data),
'periodMaximum' => static::extractPeriodMaximum($data),
'periodMinimum' => static::extractPeriodMinimum($data),
'periodAverage' => static::extractPeriodAverage($data),
'periodSummatory' => static::extractPeriodSummatory($data),
'periodSliceChart' => static::extractPeriodSliceChart($data),
'periodMode' => static::extractPeriodMode($data),
]
);
return $return;
}
@ -149,6 +160,15 @@ final class ModuleGraph extends Item
$return['period'] = static::extractPeriod($data);
$return['showLegend'] = static::extractShowLegend($data);
$return['label'] = static::extractDynamicData($data);
$return['periodicityChart'] = static::extractPeriodicityChart($return['label']);
$return['periodMaximum'] = static::extractPeriodMaximum($return['label']);
$return['periodMinimum'] = static::extractPeriodMinimum($return['label']);
$return['periodAverage'] = static::extractPeriodAverage($return['label']);
$return['periodSummatory'] = static::extractPeriodSummatory($return['label']);
$return['periodSliceChart'] = static::extractPeriodSliceChart($return['label']);
$return['periodMode'] = static::extractPeriodMode($return['label']);
$customGraphId = static::extractCustomGraphId($data);
if (empty($customGraphId) === false) {
@ -161,6 +181,30 @@ final class ModuleGraph extends Item
}
/**
* Extract a dynamic data structure from the 'label' field.
*
* @param array $data Unknown input data structure.
*
* @return array Dynamic data structure.
* @throws \InvalidArgumentException If the structure cannot be built.
*/
private static function extractDynamicData(array $data): array
{
$sliceMode = static::notEmptyStringOr($data['label'], null);
$result = [];
if ($sliceMode !== null) {
try {
$result = \json_decode($sliceMode, true);
} catch (\Throwable $e) {
throw new \InvalidArgumentException('invalid dynamic data');
}
}
return $result;
}
/**
* Extract a background type value.
*
@ -216,6 +260,118 @@ final class ModuleGraph extends Item
}
/**
* Extract the "type sliced" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodicityChart(array $data): bool
{
return static::parseBool(
static::issetInArray($data, ['periodicityChart']),
false
);
}
/**
* Extract the "period maximum" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodMaximum(array $data): bool
{
return static::parseBool(
static::issetInArray($data, ['periodMaximum']),
true
);
}
/**
* Extract the "period minimum" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodMinimum(array $data): bool
{
return static::parseBool(
static::issetInArray($data, ['periodMinimum']),
true
);
}
/**
* Extract the "period average" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodAverage(array $data): bool
{
return static::parseBool(
static::issetInArray($data, ['periodAverage']),
true
);
}
/**
* Extract the "period summatory" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodSummatory(array $data): bool
{
return static::parseBool(
static::issetInArray($data, ['periodSummatory']),
false
);
}
/**
* Extract the "period Slice" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodSliceChart(array $data): int
{
return static::parseIntOr(
static::issetInArray($data, ['periodSliceChart']),
SECONDS_1HOUR
);
}
/**
* Extract the "period mode" switch value.
*
* @param array $data Unknown input data structure.
*
* @return boolean
*/
private static function extractPeriodMode(array $data): int
{
return static::parseIntOr(
static::issetInArray($data, ['periodMode']),
CUSTOM_GRAPH_VBARS
);
}
/**
* Extract a custom graph Id value.
*
@ -288,6 +444,14 @@ final class ModuleGraph extends Item
$backgroundType = static::extractBackgroundType($data);
$period = static::extractPeriod($data);
$showLegend = static::extractShowLegend($data);
$label = static::extractDynamicData($data);
$periodicityChart = static::extractPeriodicityChart($label);
$periodMaximum = static::extractPeriodMaximum($label);
$periodMinimum = static::extractPeriodMinimum($label);
$periodAverage = static::extractPeriodAverage($label);
$periodSummatory = static::extractPeriodSummatory($label);
$periodSliceChart = static::extractPeriodSliceChart($label);
$periodMode = static::extractPeriodMode($label);
$customGraphId = static::extractCustomGraphId($data);
$graphType = static::extractGraphType($data);
@ -425,7 +589,23 @@ final class ModuleGraph extends Item
'server_id' => $metaconsoleId,
];
$chart = \grafico_modulo_sparse($params);
if ($periodicityChart === true) {
$params['width'] = null;
$params['period_maximum'] = $periodMaximum;
$params['period_minimum'] = $periodMinimum;
$params['period_average'] = $periodAverage;
$params['period_summatory'] = $periodSummatory;
$params['period_slice_chart'] = $periodSliceChart;
$params['period_mode'] = $periodMode;
}
if ($periodicityChart === false) {
$chart = \grafico_modulo_sparse($params);
} else {
$chart = '<div style="background:'.$params['backgroundColor'].'; width: inherit; height: inherit;">';
$chart .= \graphic_periodicity_module($params);
$chart .= '</div>';
}
}
$data['html'] = $chart;
@ -505,6 +685,26 @@ final class ModuleGraph extends Item
$values['showLegend'] = true;
}
if (isset($values['periodMaximum']) === false) {
$values['periodMaximum'] = true;
}
if (isset($values['periodMinimum']) === false) {
$values['periodMinimum'] = true;
}
if (isset($values['periodAverage']) === false) {
$values['periodAverage'] = true;
}
if (isset($values['periodSliceChart']) === false) {
$values['periodSliceChart'] = SECONDS_1HOUR;
}
if (isset($values['periodMode']) === false) {
$values['periodMode'] = CUSTOM_GRAPH_VBARS;
}
// Background color.
$fields = [
'white' => __('White'),
@ -608,9 +808,13 @@ final class ModuleGraph extends Item
// Custom graph.
$fields = self::getListCustomGraph();
$selected_custom_graph = (\is_metaconsole() === true)
? $values['customGraphId'].'|'.$values['metaconsoleId']
: $values['customGraphId'];
$selected_custom_graph = 0;
if (isset($values['customGraphId']) === true) {
$selected_custom_graph = (\is_metaconsole() === true)
? $values['customGraphId'].'|'.$values['metaconsoleId']
: $values['customGraphId'];
}
$inputs[] = [
'id' => 'MGcustomGraph',
'hidden' => $hiddenCustom,
@ -640,25 +844,6 @@ final class ModuleGraph extends Item
],
];
// Graph Type.
$fields = [
'line' => __('Line'),
'area' => __('Area'),
];
$inputs[] = [
'id' => 'MGgraphType',
'hidden' => $hiddenModule,
'label' => __('Graph Type'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'graphType',
'selected' => $values['graphType'],
'return' => true,
],
];
// Show legend.
$inputs[] = [
'id' => 'MGshowLegend',
@ -672,6 +857,124 @@ final class ModuleGraph extends Item
],
];
$inputs[] = [
'label' => __('Sliced mode'),
'id' => 'row_periodicity_chart',
'hidden' => $hiddenModule,
'arguments' => [
'name' => 'periodicityChart',
'id' => 'periodicityChart',
'type' => 'switch',
'value' => $values['periodicityChart'],
'onclick' => 'showPeriodicityOptions(this)',
],
];
// Graph Type.
$fields = [
'line' => __('Line'),
'area' => __('Area'),
];
$inputs[] = [
'label' => __('Graph Type'),
'id' => 'MGgraphType',
'style' => ($values['periodicityChart'] === false) ? '' : 'display:none',
'hidden' => $hiddenModule,
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'graphType',
'selected' => $values['graphType'],
'return' => true,
],
];
$displayPeriodicityChart = ($values['periodicityChart'] === true) ? '' : 'display:none';
$inputs[] = [
'block_id' => 'row_period_type',
'class' => 'flex-row flex-start w100p',
'style' => $displayPeriodicityChart,
'hidden' => $hiddenModule,
'direct' => 1,
'block_content' => [
[
'label' => __('Maximum'),
'arguments' => [
'name' => 'periodMaximum',
'id' => 'periodMaximum',
'type' => 'switch',
'value' => $values['periodMaximum'],
],
],
[
'label' => __('Minimum'),
'arguments' => [
'name' => 'periodMinimum',
'id' => 'periodMinimum',
'type' => 'switch',
'value' => $values['periodMinimum'],
],
],
[
'label' => __('Average'),
'arguments' => [
'name' => 'periodAverage',
'id' => 'periodAverage',
'type' => 'switch',
'value' => $values['periodAverage'],
],
],
[
'label' => __('Summatory'),
'arguments' => [
'name' => 'periodSummatory',
'id' => 'periodSummatory',
'type' => 'switch',
'value' => $values['periodSummatory'],
],
],
],
];
$inputs[] = [
'label' => __('Slice period'),
'id' => 'row_period_slice_chart',
'style' => $displayPeriodicityChart,
'hidden' => $hiddenModule,
'arguments' => [
'name' => 'periodSliceChart',
'type' => 'interval',
'value' => (string) $values['periodSliceChart'],
'custom_fields' => [
SECONDS_1HOUR => __('1 hour'),
SECONDS_1DAY => __('1 day'),
SECONDS_1WEEK => __('1 week'),
SECONDS_1MONTH => __('1 month'),
],
],
];
$optionsPeriodMode = [
CUSTOM_GRAPH_AREA => __('Area'),
CUSTOM_GRAPH_LINE => __('Line'),
CUSTOM_GRAPH_VBARS => __('Vertical bars'),
];
$inputs[] = [
'label' => __('Type chart'),
'id' => 'row_period_mode',
'style' => $displayPeriodicityChart,
'hidden' => $hiddenModule,
'arguments' => [
'type' => 'select',
'fields' => $optionsPeriodMode,
'name' => 'periodMode',
'selected' => $values['periodMode'],
'return' => true,
],
];
// Inputs LinkedVisualConsole.
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
$values

View File

@ -341,6 +341,13 @@ class View extends \HTML
$data['graphType'] = \get_parameter('graphType');
$data['showLegend'] = \get_parameter_switch('showLegend');
$data['period'] = \get_parameter('period');
$data['periodicityChart'] = \get_parameter_switch('periodicityChart');
$data['periodMaximum'] = \get_parameter_switch('periodMaximum');
$data['periodMinimum'] = \get_parameter_switch('periodMinimum');
$data['periodAverage'] = \get_parameter_switch('periodAverage');
$data['periodSummatory'] = \get_parameter_switch('periodSummatory');
$data['periodSliceChart'] = \get_parameter('periodSliceChart');
$data['periodMode'] = \get_parameter('periodMode');
break;
case SIMPLE_VALUE:

View File

@ -12144,6 +12144,14 @@ td[id^="table_info_box"] a {
border-bottom: 1px solid #dedede !important;
}
div#visual-console-container div.parent_graph > p.legend_background {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
margin: 0px;
}
div.parent_graph > p.legend_background > table > tbody {
display: flex;
flex-direction: row;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -357,7 +357,7 @@ ui_print_message_dialog(
'class' => 'invert_filter main_menu_icon',
]
);
$output .= __('Period graph');
$output .= __('Sliced');
$output .= '</a>';
$output .= '</li>';
$output .= '</ul>';

View File

@ -815,7 +815,13 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
this.elementRef.style.minWidth = "max-content";
this.elementRef.style.minHeight = "max-content";
}
this.updateDomElement(this.childElementRef);
if (
prevProps.type == ItemType.LINE_ITEM ||
prevProps.type == ItemType.NETWORK_LINK
) {
this.updateDomElement(this.childElementRef);
}
}
// Move box.
if (!prevProps || this.positionChanged(prevProps, this.props)) {