Icinga / icinga-core

Icinga 1.x, the old core (EOL 31.12.2018)
GNU General Public License v2.0
45 stars 27 forks source link

[dev.icinga.com #11732] Classic UI hides menu items (JQuery 1.11, Debian/Ubuntu) #1580

Closed icinga-migration closed 8 years ago

icinga-migration commented 8 years ago

This issue has been migrated from Redmine: https://dev.icinga.com/issues/11732

Created by frenzy on 2016-05-05 18:38:06 +00:00

Assignee: ricardo Status: Resolved (closed on 2016-07-18 21:04:33 +00:00) Target Version: 1.14 Last Update: 2016-07-18 21:04:33 +00:00 (in Redmine)

Icinga Version: r2.4.1-1
OS Version: Ubuntu Server 16.04 LTS

Hi.

I've installed icinga2 with the classic interface and configure it to monitor only one host and two services on them. Everything looks ok but then I try to show the classic web UI and there I've found the bug.

Before the page is fully loaded, everything is ok (screen1). After that, Javascript hides every item in the left menu (screen2).

I found that the problematic part of code is in /usr/share/icinga2/classicui/js/menu.js:

elem.prepend( img )
        .css( "cursor", "pointer" )
        .toggle( function() {
                img.attr('src', 'images/menu_more.gif');
                list.slideToggle("slow");
        }, function() {
                img.attr('src', 'images/menu_less.gif');
                list.slideToggle("slow");
});

Actual problem solution is to comment out "toggle" call in this part of JS file.

System: Ubuntu Server 16.04 LTS Icinga2 version: 2.4.1-2ubuntu1 Installed packages: icinga-cgi-bin icinga2 icinga2-bin icinga2-classicui icinga2-common icinga2-doc libicinga2

$ icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.4.1-1)

Copyright (c) 2012-2015 Icinga Development Team (https://www.icinga.org)
License GPLv2+: GNU GPL version 2 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: _CODENAME=xenia
  Platform version: ID="16.04
  Kernel: Linux
  Kernel version: 4.4.0-21-generic
  Architecture: x86_64

Have a nice day.

Attachments

Changesets

2016-07-13 23:44:49 +00:00 by ricardo d3158e0140b19bc578556d0172a5ec69c943d4d1

Classic UI: fixed menu disappear with jQuery 1.11+, updated jQuery to 1.12.4 #11732

Applied suggestion from lcars84 to menu.js. Now the menu gets
displayed properly with jQuery version > 1.11
Also updated jQuery to 1.12.4

Refs: #11732
Whatthecommit: Apparently works-for-me is a crappy excuse.
icinga-migration commented 8 years ago

Updated by mfriedrich on 2016-05-06 07:21:23 +00:00

icinga-migration commented 8 years ago

Updated by pstiffel on 2016-05-12 09:07:33 +00:00

I second that, same problem here with Ubuntu 16.04 LTS. The menu appears, but vanishes when the page is fully loaded. The fix mentioned above is working though.

root@icinga2a.xxx.xx:/# icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.4.7-1)

Copyright (c) 2012-2016 Icinga Development Team (https://www.icinga.org/)
License GPLv2+: GNU GPL version 2 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid

System information:
  Platform: Ubuntu
  Platform version: 16.04 LTS (Xenial Xerus)
  Kernel: Linux
  Kernel version: 4.4.0-21-generic
  Architecture: x86_64

Found out, that the libjs-jquery-Version of ubuntu 16.04 is the problem:

root@icinga2a.xxx.xx:/# apt-cache policy libjs-jquery
libjs-jquery:
  Installiert:           1.11.3+dfsg-4
  Installationskandidat: 1.11.3+dfsg-4
  Versionstabelle:
 *** 1.11.3+dfsg-4 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

When downgrading to libjs-jquery 1.7.2 (e.g. from the wily-repo), the menu is shown without the workaround of commenting out the .toggle-stuff:

root@icinga2a.xxx.xx/# apt-cache policy libjs-jquery
libjs-jquery:
  Installiert:           1.7.2+dfsg-3ubuntu2
  Installationskandidat: 1.11.3+dfsg-4
  Versionstabelle:
     1.11.3+dfsg-4 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu xenial/main i386 Packages
 *** 1.7.2+dfsg-3ubuntu2 500
        500 http://de.archive.ubuntu.com/ubuntu wily/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu wily/main i386 Packages
        100 /var/lib/dpkg/status
icinga-migration commented 8 years ago

Updated by mfriedrich on 2016-05-21 15:59:44 +00:00

icinga-migration commented 8 years ago

Updated by mfriedrich on 2016-05-21 16:01:07 +00:00

Only happens with changed dependencies on Debian/Ubuntu pointing to 1.11 packages. The JQuery version from inside the released tarball works fine.

icinga-migration commented 8 years ago

Updated by lcars84 on 2016-05-30 13:23:11 +00:00

How about this?

                elem.prepend( img )
                        .css( "cursor", "pointer" )
                        .click( function() {
                                if($(this).hasClass("collapsed")) {
                                        img.attr('src', 'images/menu_less.gif');
                                        $(this).removeClass("collapsed");
                                } else {
                                        img.attr('src', 'images/menu_more.gif');
                                        $(this).addClass("collapsed");
                                }
                                list.slideToggle("slow");
                        });

I came across this problem a couple of times already and the general recommendation appears to be to build the "toggle" yourself by simply remembering the toggle state somehow.

In this case, I'm simply adding a class "collapsed" but one may also work with .data() to attach arbitrary data to the element.

icinga-migration commented 8 years ago

Updated by ziesemer on 2016-06-21 01:25:05 +00:00

I almost ended up reporting this as a duplicate, as I just spent over an hour rediscovering everything that was already reported above. :) I was confused in that https://launchpad.net/~formorer/+archive/ubuntu/icinga also contained its own jqueryui packages and didn't realize until just now that libjs-jquery / libjs-jquery-ui were OS-provided packages being symlinked to in an admirable effort here.

Will apply one of the above workarounds for now - or inspired by dnsmichi's comment - just ignore at least a portion of the OS package for now, and overwrite with at least a portion of a tarball release extract. I'd then hope that once the OS package is updated with a fix, my changes would at least be prompted for overwrite.

In summary, +1 in waiting for a fix here, please!

icinga-migration commented 8 years ago

Updated by ricardo on 2016-06-21 21:34:56 +00:00

will try to switch to newest 1.x jquery library.

icinga-migration commented 8 years ago

Updated by nacc on 2016-07-05 20:02:22 +00:00

ricardo wrote:

will try to switch to newest 1.x jquery library.

Just as an FYI, I'm the downstream Ubuntu developer watching this issue (https://bugs.launchpad.net/ubuntu/+source/icinga/+bug/1593319). If we can get a suggested fix, I can get that sent up to Debian and Ubuntu as appropriate.

-Nish

icinga-migration commented 8 years ago

Updated by ricardo on 2016-07-14 00:00:08 +00:00

Hi,

I fixed in https://git.icinga.org/?p=icinga-core.git;a=commitdiff;h=d3158e0140b19bc578556d0172a5ec69c943d4d1;js=1

could someone test it please?

Thank you

icinga-migration commented 8 years ago

Updated by nacc on 2016-07-14 00:36:17 +00:00

ricardo wrote:

Hi,

I fixed in https://git.icinga.org/?p=icinga-core.git;a=commitdiff;h=d3158e0140b19bc578556d0172a5ec69c943d4d1;js=1

could someone test it please?

Thank you

For those using Ubuntu 16.04, I'll build a test package in a PPA and update the Launchpad bug.

-Nish

icinga-migration commented 8 years ago

Updated by nacc on 2016-07-14 15:36:45 +00:00

nacc wrote:

ricardo wrote: > Hi, > > I fixed in https://git.icinga.org/?p=icinga-core.git;a=commitdiff;h=d3158e0140b19bc578556d0172a5ec69c943d4d1;js=1 > > could someone test it please? > > Thank you

For those using Ubuntu 16.04, I'll build a test package in a PPA and update the Launchpad bug.

Build provided, I ran a quick test in a LXD container of 16.04 and it seemed to work fine (at least the menu doesn't run away :). Thanks!

-Nish

icinga-migration commented 8 years ago

Updated by ricardo on 2016-07-14 20:34:38 +00:00

great, thank you for testing.

and thanks to lcars84, I totally used your suggestion.

Cheers Ricardo

icinga-migration commented 8 years ago

Updated by ricardo on 2016-07-18 21:04:33 +00:00