From e8a783a44a255edca8a7f38466cfa9f564de06f2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 20 Mar 2014 15:41:36 +0000 Subject: [PATCH] Better JS link target detection, fix a few edge cases --- public/js/icinga/events.js | 13 +++++++++---- public/js/icinga/ui.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 0e28271e4..30008eaa0 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -270,19 +270,24 @@ targetId = $el.closest('[data-base-target]').data('baseTarget'); // Simulate _next to prepare migration to dynamic column layout + // YES, there are duplicate lines right now. if (targetId === '_next') { if ($el.closest('#col2').length) { this.icinga.ui.moveToLeft(); } targetId = 'col2'; - } - - if (targetId === '_main') { + $target = $('#' + targetId); + } else if (targetId === '_self') { + $target = $el.closest('.container'); + targetId = $target.attr('id'); + } else if (targetId === '_main') { targetId = 'col1'; + $target = $('#' + targetId); icinga.ui.layout1col(); + } else { + $target = $('#' + targetId); } - $target = $('#' + targetId); } // Hardcoded layout switch unless columns are dynamic diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index f31bd8d0b..cb6472d50 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -99,7 +99,7 @@ }, cutContainer: function ($col) { - return { + var props = { 'elements': $('#' + $col.attr('id') + ' > div').detach(), 'data': { 'data-icinga-url': $col.data('icingaUrl'), @@ -108,7 +108,14 @@ 'data-icinga-module': $col.data('icingaModule') }, 'class': $col.attr('class') - } + }; + this.icinga.loader.stopPendingRequestsFor($col); + $col.removeData('icingaUrl'); + $col.removeData('icingaRefresh'); + $col.removeData('lastUpdate'); + $col.removeData('icingaModule'); + $col.removeAttr('class').attr('class', 'container'); + return props; }, pasteContainer: function ($col, backup) {