From b616b652bc90ec3ce0e090c236251675ac48f788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Mo=C3=9Fhammer?= Date: Wed, 23 Oct 2013 11:17:04 +0200 Subject: [PATCH] Fix container error message, prevent components from being loaded twice --- public/js/icinga/componentLoader.js | 4 +++- public/js/icinga/components/container.js | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/js/icinga/componentLoader.js b/public/js/icinga/componentLoader.js index e966b74ab..8c5470305 100644 --- a/public/js/icinga/componentLoader.js +++ b/public/js/icinga/componentLoader.js @@ -48,7 +48,9 @@ define(['jquery', 'logging', 'icinga/componentRegistry'], function ($, log, regi function (Cmp) { var cmp; try { - cmp = new Cmp(target); + if (typeof $(target).attr('id') === 'undefined') { + cmp = new Cmp(target); + } } catch (e) { log.emergency('Error in component "' + cmpType + '" : "' + e + '"'); err(e); diff --git a/public/js/icinga/components/container.js b/public/js/icinga/components/container.js index fedda398b..c13a762eb 100644 --- a/public/js/icinga/components/container.js +++ b/public/js/icinga/components/container.js @@ -205,15 +205,17 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe }).bind(this) ).fail( (function(response, reason) { + if (reason === 'abort') { + return; + } + var errorReason; if (response.statusCode.toString()[0] === '4') { errorReason = 'The Requested View Couldn\'t Be Found
'; } else { errorReason = response.responseText; } - this.replaceDom( - $('
').text(errorReason) - ); + this.replaceDom(response.responseText); }).bind(this) ).always((function() { this.containerDom.trigger('hideLoadIndicator');