Fixed demo graphs generation

This commit is contained in:
Enrique Martin 2023-11-30 08:54:21 +01:00
parent dc2ac2a1b3
commit 76327c6d73
2 changed files with 11 additions and 13 deletions

View File

@ -114,7 +114,7 @@ type[11]="module_graph"
image[11]="black"
agent_name[11]="linux-1"
module[11]="CPU Load"
interval[11]="86N00"
interval[11]="86400"
graph_type[11]="area"
label[11]=""
label_position[11]="down"
@ -127,7 +127,7 @@ type[12]="module_graph"
image[12]="black"
agent_name[12]="linux-1"
module[12]="Memory Usage"
interval[12]="86N00"
interval[12]="86400"
graph_type[12]="area"
label[12]=""
label_position[12]="down"
@ -140,7 +140,7 @@ type[13]="module_graph"
image[13]="black"
agent_name[13]="linux-1"
module[13]="Disk Usage"
interval[13]="86N00"
interval[13]="86400"
graph_type[13]="area"
label[13]=""
label_position[13]="down"

View File

@ -2113,19 +2113,13 @@ if ($action === 'create_demo_data') {
if (isset($items_array['graph_type']) === true) {
$element_values['type_graph'] = $items_array['graph_type'];
}
if (isset($items_array['image']) === true) {
$element_values['image'] = $items_array['image'];
}
}
if ($items_array['type'] === 'custom_graph') {
if (isset($items_array['image']) === false
|| is_string($items_array['image']) === false
) {
// The above fields are required for this item.
register_error(
DEMO_VISUAL_CONSOLE,
__('Error in %s: image field must be specified for custom_graph item type. Skipping creation of item with index %d', $filename, ($item_access_idx - 1))
);
continue;
}
if (isset($items_array['graph_name']) === true
&& is_string($items_array['graph_name']) === true
@ -2142,6 +2136,10 @@ if ($action === 'create_demo_data') {
if (isset($items_array['interval']) === true) {
$element_values['period'] = $items_array['interval'];
}
if (isset($items_array['image']) === true) {
$element_values['image'] = $items_array['image'];
}
}
if ($items_array['type'] === 'icon') {