centreon-archived
centreon-archived copied to clipboard
Topology NavigationList Error
BUG REPORT INFORMATION
Prerequisites
The opened issue, must be code related. GitHub is not meant for support. Feel free to check the CONTRIBUTING section for more details.
Versions
For the RPM based systems
-- Copy/Paste the result of the following command --
$ rpm -qa | grep centreon | egrep -v "(plugin|pack)" | sort
centreon-20.04.0-7.el7.centos.noarch centreon-auto-discovery-server-20.04.0-8.el7.centos.noarch centreon-base-config-centreon-engine-20.04.0-7.el7.centos.noarch centreon-broker-20.04.0-5.el7.centos.x86_64 centreon-broker-cbd-20.04.0-5.el7.centos.x86_64 centreon-broker-cbmod-20.04.0-5.el7.centos.x86_64 centreon-broker-core-20.04.0-5.el7.centos.x86_64 centreon-broker-storage-20.04.0-5.el7.centos.x86_64 centreon-clib-20.04.0-7.el7.centos.x86_64 centreon-common-20.04.0-7.el7.centos.noarch centreon-connector-20.04.0-2.el7.centos.x86_64 centreon-connector-perl-20.04.0-2.el7.centos.x86_64 centreon-connector-ssh-20.04.0-2.el7.centos.x86_64 centreon-database-20.04.0-7.el7.centos.noarch centreon-engine-20.04.0-3.el7.centos.x86_64 centreon-engine-daemon-20.04.0-3.el7.centos.x86_64 centreon-engine-extcommands-20.04.0-3.el7.centos.x86_64 centreon-gorgone-20.04.0-7.el7.centos.noarch centreon-gorgone-centreon-config-20.04.0-7.el7.centos.noarch centreon-license-manager-20.04.0-10.el7.centos.noarch centreon-license-manager-common-20.04.0-10.el7.centos.noarch centreon-perl-libs-20.04.0-7.el7.centos.noarch centreon-poller-centreon-engine-20.04.0-7.el7.centos.noarch centreon-pp-manager-20.04.0-9.el7.centos.noarch centreon-release-20.04-1.el7.centos.noarch centreon-trap-20.04.0-7.el7.centos.noarch centreon-web-20.04.0-7.el7.centos.noarch centreon-widget-engine-status-20.04.0-5.el7.centos.noarch centreon-widget-global-health-20.04.0-5.el7.centos.noarch centreon-widget-graph-monitoring-20.04.0-5.el7.centos.noarch centreon-widget-grid-map-20.04.0-5.el7.centos.noarch centreon-widget-hostgroup-monitoring-20.04.0-5.el7.centos.noarch centreon-widget-host-monitoring-20.04.0-5.el7.centos.noarch centreon-widget-httploader-20.04.0-5.el7.centos.noarch centreon-widget-live-top10-cpu-usage-20.04.0-5.el7.centos.noarch centreon-widget-live-top10-memory-usage-20.04.0-5.el7.centos.noarch centreon-widget-servicegroup-monitoring-20.04.0-5.el7.centos.noarch centreon-widget-service-monitoring-20.04.0-5.el7.centos.noarch centreon-widget-tactical-overview-20.04.0-5.el7.centos.noarch moso5-centreon-toolbox-19.04-svn152.el7.noarch
Operating System
CentOS via official Centreon ISO
Browser used
- [x] Google Chrome
- [x] Firefox
- [ ] Internet Explorer IE11
- [ ] Safari
Version: 20.04
Proxmox
Description
If adding new top-level menu entrys the submenus will be show as a new, empty top-level entry. This is caused by using the topology_id for top-level menu id's in JSON and using topology_page for submenus: See src/Centreon/Application/DataRepresenter/Topology/NavigationList.php Line 145
if (preg_match('/^(\d)$/', $entity->getTopologyPage(), $matches)) {
$naviList[$entity->getTopologyId()] = [
Should be:
if (preg_match('/^(\d)$/', $entity->getTopologyPage(), $matches)) {
$naviList[$entity->**getTopologyPage()**] = [
Steps to Reproduce
Please describe precisely the steps to reproduce the encountered issue.
- I logged in Centreon DB
- Add new Top-Level entry
- Add second level entry for the new toplevel entry
SQL:
INSERT INTO `centreon`.`topology` (`topology_id`, `topology_name`, `topology_page`, `topology_order`, `topology_group`, `topology_popup`, `topology_show`, `readonly`, `is_react`) VALUES ('270', 'Modules', '8', '60', '1', '0', '1', '1', '0');
INSERT INTO `centreon`.`topology` (`topology_id`, `topology_name`, `topology_parent`, `topology_page`, `topology_group`, `topology_url`, `topology_url_opt`, `topology_show`, `readonly`, `is_react`) VALUES ('302', 'TestModule1', '8', '801', '1', '', '', '1', '1', '0');
INSERT INTO `centreon`.`topology` (`topology_id`, `topology_name`, `topology_parent`, `topology_page`, `topology_group`, `topology_show`, `readonly`, `is_react`) VALUES ('304', 'TestModule2', '8', '802', '2', '1', '1', '0');
Describe the received result
A new Top-Level-Menuentry apper withoud icon or text with the added submenu entrys
Describe the expected result
The submenu entrys should be childs of the top level menu
Hi @itsul ,
When you add your topology entries into Centreon you set a fixed topology_id. You must set NULL to do not overwrite an existing entry.
Regards,
Hi @lpinsivy , the insert was just an example (using existing data). To extend the topology we use NULL as topology_id. And that's the problem with using getTopologyId() instead of getTopologyPage(): as Example to add a entry for PageID 8 a topology_id 8 will be needed for the Menu to render correct. Using getTopologyPage() instead of getTopologyId() is fixing this.
Hi @itsul so you have a workaround?
Hi @lpinsivy , yes - by changing $entity->getTopologyId() to $entity->getTopologyPage() Is there a reason not to adapt it this way?
We're extending the menu for almost all of our customers.
We're fixing this with a trigger on centreon-web package by all customers since Sep 2020 this way:
%triggerin -- centreon-web
grep getTopologyId /usr/share/centreon/src/Centreon/Application/DataRepresenter/Topology/NavigationList.php > /dev/null
if [[ $? -eq 0 ]]; then
/bin/cp -af /usr/share/centreon/src/Centreon/Application/DataRepresenter/Topology/NavigationList.php /usr/share/centreon/src/Centreon/Application/DataRepresenter/Topology/NavigationList.php.rpmsave
sed -i "s|getTopologyId|getTopologyPage|g" /usr/share/centreon/src/Centreon/Application/DataRepresenter/Topology/NavigationList.php
fi
But a fix in the Source would be preferred - can you provide a better way to fix this? Or apply the Change to the Source?
It seems to be still a Problem at 22.04