Fix container error message, prevent components from being loaded twice

This commit is contained in:
Jannis Moßhammer 2013-10-23 11:17:04 +02:00
parent 51909ce60c
commit b616b652bc
2 changed files with 8 additions and 4 deletions

View File

@ -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);

View File

@ -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<br/>';
} else {
errorReason = response.responseText;
}
this.replaceDom(
$('<div class="alert alert-danger">').text(errorReason)
);
this.replaceDom(response.responseText);
}).bind(this)
).always((function() {
this.containerDom.trigger('hideLoadIndicator');