Skip to content

Instantly share code, notes, and snippets.

@guntiss
Last active April 1, 2022 19:40
Show Gist options
  • 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
@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