Added cache_expiration in builder items

This commit is contained in:
Daniel Maya 2019-05-09 12:44:58 +02:00
parent 0aa8bcda30
commit c2b8ad22d3
3 changed files with 38 additions and 2 deletions

View File

@ -1178,6 +1178,7 @@ function readFields() {
values["timezone"] = $("select[name=timezone]").val();
values["clock_animation"] = $("select[name=clock_animation]").val();
values["show_last_value"] = $("select[name=last_value]").val();
values["cache_expiration"] = $("select[name=cache_expiration]").val();
// Color Cloud values
if (selectedItem == "color_cloud" || creationItem == "color_cloud") {
@ -1221,7 +1222,6 @@ function readFields() {
function create_button_palette_callback() {
var values = readFields();
//VALIDATE DATA
var validate = true;
switch (creationItem) {
@ -2209,6 +2209,10 @@ function loadFieldsFromDB(item) {
});
}
if (key == "cache_expiration") {
$("select[name=cache_expiration]").val(val);
}
if (key == "value_show") {
$("select[name=value_show]").val(val);
}

View File

@ -176,6 +176,7 @@ $default_color = get_parameter('default_color', '#FFFFFF');
$color_range_from_values = get_parameter('color_range_from_values', []);
$color_range_to_values = get_parameter('color_range_to_values', []);
$color_range_colors = get_parameter('color_range_colors', []);
$cache_expiration = get_parameter('cache_expiration', 0);
switch ($action) {
case 'get_font':
@ -580,6 +581,7 @@ switch ($action) {
$values['label_position'] = $label_position;
$values['show_on_top'] = $show_on_top;
$values['cache_expiration'] = $cache_expiration;
// In Graphs, background color is stored in column image (sorry)
if ($type == 'module_graph') {
@ -997,6 +999,7 @@ switch ($action) {
unset($values['id_layout_linked']);
unset($values['element_group']);
unset($values['id_layout_linked_weight']);
unset($values['cache_expiration']);
// Don't change background color in graphs when move
switch ($type) {
case 'group_item':
@ -1406,6 +1409,7 @@ switch ($action) {
$values['type_graph'] = $type_graph;
$values['id_custom_graph'] = $id_custom_graph;
$values['cache_expiration'] = $cache_expiration;
switch ($type) {
case 'line_item':

View File

@ -1128,7 +1128,35 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
true
).'</td>';
// Insert and modify before the buttons to create or update.
$interval = [];
$interval[0] = __('No cache');
$interval[10] = '10 '.__('seconds');
$interval[30] = '30 '.__('seconds');
$interval[60] = '1 '.__('minutes');
$interval[300] = '5 '.__('minutes');
$interval[900] = '15 '.__('minutes');
$interval[1800] = '30 '.__('minutes');
$interval[3600] = '1 '.__('hour');
$form_items_advance['cache_expiration_row'] = [];
$form_items_advance['cache_expiration_row']['items'] = [
'group_item',
'static_graph',
'percentile_bar',
'percentile_item',
'module_graph',
'simple_value',
'label',
'icon',
'datos',
'auto_sla_graph',
'bars_graph',
'donut_graph',
];
$form_items_advance['cache_expiration_row']['html'] = '<td align="left">'.__('Cache expiration').'</td>
<td align="left">'.html_print_select($interval, 'cache_expiration', $jeje, '', '', '0', 10, false, false, false).'</td>';
// Insert and modify before the buttons to create or update.
if (enterprise_installed()) {
enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance);
}