From a1916dc4b948cdbebf2509a53ab52fce8ee700a4 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 24 Nov 2023 12:56:21 +0100 Subject: [PATCH] implement demo data load --- pandora_console/godmode/menu.php | 8 +- pandora_console/godmode/setup/demo.php | 147 ++++++++++-------- pandora_console/godmode/setup/setup.php | 15 ++ pandora_console/images/demo_data.png | Bin 0 -> 655 bytes .../include/ajax/demo_data.ajax.php | 29 ++-- pandora_console/include/functions_agents.php | 4 +- 6 files changed, 118 insertions(+), 85 deletions(-) create mode 100644 pandora_console/images/demo_data.png diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 0e41b1925b..e779ad11eb 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -496,6 +496,9 @@ if ($access_console_node === true) { $sub2['godmode/setup/setup§ion=welcome_tips']['text'] = __('Welcome Tips'); $sub2['godmode/setup/setup§ion=welcome_tips']['refr'] = 0; + $sub2['godmode/setup/setup§ion=demo_data']['text'] = __('Demo data'); + $sub2['godmode/setup/setup§ion=demo_data']['refr'] = 0; + if ((bool) $config['activate_gis'] === true) { $sub2['godmode/setup/setup§ion=gis']['text'] = __('Map conections GIS'); } @@ -506,12 +509,7 @@ if ($access_console_node === true) { enterprise_hook('skins_submenu'); - - $sub['godmode/setup/demo']['text'] = __('Demo data'); - $sub['godmode/setup/demo']['id'] = 'demo'; - $menu_godmode['gsetup']['sub'] = $sub; - } } diff --git a/pandora_console/godmode/setup/demo.php b/pandora_console/godmode/setup/demo.php index b1caf6f9cc..800701a2b9 100644 --- a/pandora_console/godmode/setup/demo.php +++ b/pandora_console/godmode/setup/demo.php @@ -131,9 +131,8 @@ if ($display_loading === true || $running_create === true || $running_delete) { DEMO_DASHBOARD => 'dashboards', ]; - if ($adv_options_is_enabled === true) { + if ((bool) $adv_options_is_enabled === true) { $enabled_keys = array_keys(array_filter($enabled_items)); - $items_ids_text_map = array_filter( $items_ids_text_map, function ($k) use ($dir_item_id_map, $enabled_keys) { @@ -141,10 +140,13 @@ if ($display_loading === true || $running_create === true || $running_delete) { }, ARRAY_FILTER_USE_KEY ); - - array_merge([DEMO_AGENT => 'agents'], $items_ids_text_map); } + if (enterprise_installed() === false) { + unset($items_ids_text_map[DEMO_SERVICE]); + } + + $items_ids_text_map = ([DEMO_AGENT => 'agents'] + $items_ids_text_map); $list_mkup = '