icingaweb2 icon indicating copy to clipboard operation
icingaweb2 copied to clipboard

Dashboard Error for pane that is disabled

Open gbin2265 opened this issue 2 years ago • 2 comments

Describe the bug

I have an error when I want to view a specific dashboard (option pane) that is disabled.

To Reproduce

Disable a pane and then do the view of this pane.

http://x.x.x.x/icingaweb2/dashboard?pane=YYYYYYYYY

Can't activate tab YYYYYYYYY. Tab does not exist

#0 /usr/share/php/Icinga/Web/Widget/Dashboard.php(63): Icinga\Web\Widget\Tabs->activate(String)
#1 /usr/share/icingaweb2/application/controllers/DashboardController.php(313): Icinga\Web\Widget\Dashboard->activate(String)

Expected behavior

I was hoping with the url parameter to also be able to show a dashboard that is disabled. This way I can create dashboards that are not in the top menu but can be called up via the navigation menu.

Which with my little knowledge of php I think needs to be changed

Before -> getTabs will say that the pane does not exist because it is disabled. File : /usr/share/php/Icinga/Web/Widget/Dashboard.php Line : 63

    public function activate($name)
    {
        $this->getTabs()->activate($name);
    }

After -> just testing that the pane exists

    public function activate($name)
    {
        if (array_key_exists($name, $this->panes)) {
            return $this;
        }
    }

Your Environment

See here the versions i running of icingaweb2 -> latest snapshot on 2023-08-12 03:00 for centos 7

icingadb-web-1.0.2+162.g3aedcca-1691795049.el7.noarch icingaweb2-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-common-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-HTMLPurifier-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-JShrink-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-Parsedown-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-dompdf-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-lessphp-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icingaweb2-vendor-zf1-2.11.4+124.g4ccebb78b-1691186619.el7.noarch php-icinga-2.11.4+124.g4ccebb78b-1691186619.el7.noarch icinga-cube-1.3.1+0.gf259240-1691795070.el7.noarch icinga-cube-web-1.3.1+0.gf259240-1691795070.el7.noarch icinga-l10n-1.2.0+128.g04dd51aa-1691787812.el7.noarch icinga-php-common-1.0.0165655404400000000-0.20220630.0154.el7.icinga.noarch icinga-php-library-0.12.0+5.gceb969c-1691787808.el7.noarch icinga-php-thirdparty-0.11.0+14.g3bb888b-1691787810.el7.noarch icingacli-2.11.4+124.g4ccebb78b-1691186619.el7.noarch

gbin2265 avatar Aug 14 '23 23:08 gbin2265

Hi, when you disable a pane, it will no longer be loaded from the INI file and it's not intended to be accessed by simply editing the URL manually afterwards. This defeats the purpose of "disabled panes" and we won't make any changes in this regard. However, you can test this PR in your test environment and send us some feedbacks, since that PR addresses what you try to overcome with workarounds.

yhabteab avatar Aug 15 '23 07:08 yhabteab

That's not what I'm experiencing after doing the debugging. It does load the dashboard from the ini file but gets the parameter that it is disabled. If I do the modification I suggest then I can still displaying the dashboard without any problems, even if it is disabled.

My proposal only checks that the dashboard exists, even if it is disabled. The getTabs do the filtering of the disabled dashboard because they should not appear in the menu on the page.

If I have too many dashboards and my screen is not wide enough, I will lose them together with the arrow (sub menu 'Add dashlet /Settings) When resizing the screen, he will not place the excess dashboards under the arrow.

As you suggested, I'm going also test the PR.

gbin2265 avatar Aug 15 '23 08:08 gbin2265