summaryrefslogtreecommitdiffstats
path: root/public/js/module.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/module.js')
-rw-r--r--public/js/module.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/public/js/module.js b/public/js/module.js
new file mode 100644
index 0000000..1d30129
--- /dev/null
+++ b/public/js/module.js
@@ -0,0 +1,54 @@
+
+(function(Icinga) {
+
+ var Nagvis = function(module) {
+
+ this.module = module;
+
+ this.idCache = {};
+
+ this.initialize();
+
+ this.module.icinga.logger.debug('Nagvis module loaded');
+ };
+
+ Nagvis.prototype = {
+
+ initialize: function()
+ {
+ $('#nagvis-iframe').on('load', this.frameLoaded.bind(this));
+ },
+
+ frameLoaded: function (event) {
+ var currentMap;
+ var icinga = this.module.icinga;
+ var $iframe = $('#nagvis-iframe');
+ var matchNagvis = /[\?&]show=([^\&]+)/;
+ var matchIcinga = /[\?&]map=([^\&]+)/;
+ var currentMap = null;
+ var shownMap = null;
+
+ icinga.logger.debug('Nagvis frame loaded');
+ if (currentMap = $iframe.contents()[0].location.search.match(matchNagvis)) {
+ currentMap = currentMap[1];
+ }
+ if (shownMap = document.location.search.match(matchIcinga)) {
+ shownMap = shownMap[1];
+ }
+ if (currentMap !== null && shownMap !== currentMap) {
+ this.setCurrentMap(currentMap);
+ }
+ },
+
+ setCurrentMap: function (map) {
+//icinga.logger.info(icinga.utils.addUrlParams(document.location.pathname + '?' + document.location.search, { map: 'asd' }))
+// var url = parseUrl
+ this.module.icinga.logger.info("Setting current map", map);
+ }
+
+ };
+
+ Icinga.availableModules.nagvis = Nagvis;
+
+}(Icinga));
+