#11852 warning time lapse more than 30 days

This commit is contained in:
Jonathan 2023-08-21 13:05:39 +02:00
parent b91798947e
commit 563323d0be
18 changed files with 185 additions and 20 deletions

View File

@ -190,14 +190,21 @@ $output .= html_print_label_input_block(
html_print_extended_select_for_time(
'period',
$period,
'',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',
false,
true,
false,
false,
'w100p'
'w100p',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
)
);
$output .= "</td><td class='datos2' width='50%'>";

View File

@ -1421,10 +1421,21 @@ $class = 'databox filters';
html_print_extended_select_for_time(
'period',
$period,
'',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',
10
10,
false,
false,
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
);
?>
</td>
@ -1444,10 +1455,21 @@ $class = 'databox filters';
html_print_extended_select_for_time(
'period_range',
$period_range,
'',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',
10
10,
false,
false,
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period_range\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
);
?>
</td>
@ -1487,10 +1509,21 @@ $class = 'databox filters';
html_print_extended_select_for_time(
'period1',
$period_pg,
'',
'check_period_warning(this)',
'',
'0',
10
10,
false,
false,
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\')'
);
?>
</td>
@ -1506,10 +1539,21 @@ $class = 'databox filters';
html_print_extended_select_for_time(
'period2',
$projection_period,
'',
'check_period_warning(this)',
'',
'0',
10
10,
false,
false,
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\')'
);
?>
</td>
@ -3440,7 +3484,7 @@ $class = 'databox filters';
html_print_extended_select_for_time(
'lapse',
$lapse,
'',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
__('None'),
'0',
10,
@ -3448,7 +3492,13 @@ $class = 'databox filters';
'',
'',
'',
!$lapse_calc
!$lapse_calc,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'lapse\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
);
?>
</td>

View File

@ -542,13 +542,21 @@ class CustomNetScan extends Wizard
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
'',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
'0',
false,
true,
false,
false
false,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'interval\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
).'</span>',
];

View File

@ -2166,7 +2166,8 @@ function html_print_extended_select_for_time(
$style_icon='',
$no_change=false,
$allow_zero=0,
$units=null
$units=null,
$script_input=''
) {
global $config;
$admin = is_user_admin($config['id_user']);
@ -2256,7 +2257,7 @@ function html_print_extended_select_for_time(
echo '</div>';
echo '<div id="'.$uniq_name.'_manual" class="w100p inline_flex">';
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class, $script_input);
html_print_input_hidden($name, $selected, false, $uniq_name);
html_print_select(
@ -5771,7 +5772,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['readonly']) === true) ? $data['readonly'] : false),
((isset($data['custom_fields']) === true) ? $data['custom_fields'] : false),
((isset($data['style_icon']) === true) ? $data['style_icon'] : '')
((isset($data['style_icon']) === true) ? $data['style_icon'] : ''),
((isset($data['no_change']) === true) ? $data['no_change'] : ''),
((isset($data['allow_zero']) === true) ? $data['allow_zero'] : ''),
((isset($data['units']) === true) ? $data['units'] : null),
((isset($data['script_input']) === true) ? $data['script_input'] : '')
);
break;

View File

@ -2487,3 +2487,39 @@ function menuActionButtonResizing() {
"width: calc(100% - " + $("#menu_full").width() + "px);"
);
}
function check_period_warning(time, title, message) {
var period = time.value;
var times = 0;
if (period >= 2592000 && period < 7776000) {
WarningPeriodicityModal(title, message);
} else if (period >= 7776000 && period < 15552000) {
do {
WarningPeriodicityModal(title, message);
times = times + 1;
} while (times < 2);
} else if (period >= 15552000) {
do {
WarningPeriodicityModal(title, message);
times = times + 1;
} while (times < 3);
}
}
function check_period_warning_manual(input_name, title, message) {
var period = {
value:
$("#text-" + input_name + "_text").val() *
$("#" + input_name + "_units option:selected").val()
};
check_period_warning(period, title, message);
}
function WarningPeriodicityModal(title, message) {
confirmDialog({
title: title,
message: message,
strCancelButton: "Ok",
hideOkButton: 1
});
}

View File

@ -421,6 +421,8 @@ class BasicChart extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -304,7 +304,8 @@ class BlockHistogram extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -308,6 +308,8 @@ class DataMatrix extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];
@ -324,6 +326,8 @@ class DataMatrix extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'slice\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -392,6 +392,8 @@ class CustomGraphWidget extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -367,6 +367,8 @@ class GraphModuleHistogramWidget extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -205,6 +205,8 @@ class Netflow extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];
$chart_types = netflow_get_chart_types();

View File

@ -352,6 +352,8 @@ class SingleGraphWidget extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -381,6 +381,8 @@ class SLAPercentWidget extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -260,6 +260,8 @@ class TopNWidget extends Widget
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -317,6 +317,8 @@ final class BasicChart extends Item
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -633,6 +633,8 @@ final class ModuleGraph extends Item
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
],
];

View File

@ -233,7 +233,25 @@ $table->data[2][2] .= html_print_image(
$table->data[3][1] = __('Time range');
$table->data[3][2] = html_print_extended_select_for_time('period', $period, '', '', 0, 7, true);
$table->data[3][2] = html_print_extended_select_for_time(
'period',
$period,
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
0,
7,
true,
false,
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
);
$table->data[4][2] = __('Show events');
$table->data[4][3] = html_print_checkbox('draw_events', 1, (bool) $draw_events, true);

View File

@ -344,7 +344,25 @@ if ($view_graph) {
$searchForm .= "<td class='datos w30p'>";
$searchForm .= html_print_label_input_block(
__('Time range'),
html_print_extended_select_for_time('period', (string) $period, '', '', 0, 10, true, 'width:100%')
html_print_extended_select_for_time(
'period',
(string) $period,
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'',
0,
10,
true,
'width:100%',
true,
'',
false,
false,
'',
false,
0,
null,
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
)
);
$searchForm .= '</td>';
$searchForm .= '</tr><tr>';