Skip to content

Instantly share code, notes, and snippets.

@guntiss
Last active April 1, 2022 19:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guntiss/6c87c19319f1c9796b64d56bc97052af to your computer and use it in GitHub Desktop.
Save guntiss/6c87c19319f1c9796b64d56bc97052af to your computer and use it in GitHub Desktop.
Zabbix 5.2 patch to open Map URLs in blank page
Backup original file:
$ cp /usr/share/zabbix/js/menupopup.js /usr/share/zabbix/js/menupopup.js.original
Apply patch:
$ patch -i menupopup.patch /usr/share/zabbix/js/menupopup.js
Generate this patch file or compare with original:
$ git diff /usr/share/zabbix/js/menupopup.js.original /usr/share/zabbix/js/menupopup.js
--- a/usr/share/zabbix/js/menupopup.js.original
+++ b/usr/share/zabbix/js/menupopup.js
@@ -250,6 +250,16 @@ function getMenuPopupHost(options, trigger_elmnt) {
label: t('URLs'),
items: options.urls
});
+
+ for (var key in options.urls) {
+ options.urls[key].clickCallback = function(url) {
+ return function(e) {
+ window.open(url, '_blank');
+ cancelEvent(e);
+ jQuery(this).closest('.menu-popup').hide();
+ };
+ }(options.urls[key].url);
+ }
}
// scripts
@Universal32
Copy link

Universal32 commented Apr 15, 2021

How to use it? "sudo patch -p1 < zab.patch"? In /usr/share/zabbix/js ?

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?

[root@appliance /]# sudo patch -p1 < zab.patch
patching file usr/share/zabbix/js/menupopup.js
Hunk #1 FAILED at 250.
1 out of 1 hunk FAILED -- saving rejects to file usr/share/zabbix/js/menupopup.js.rej

@denser
Copy link

denser commented Apr 21, 2021

May be better make it via Module? I am new with modules and cant find pointer for this menu, any pro advice?

@guntiss
Copy link
Author

guntiss commented May 16, 2021

I have updated Gist to include instructions for applying the patch.

@layer3lv
Copy link

layer3lv commented Apr 1, 2022

Hi, Guntis

Thx for sharing your knowledge but it only fixes how you open links via a popup window in the Zabbix map, but if you have a link in the Zabbix map it still opens in the same windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment