Fix container error message, prevent components from being loaded twice
This commit is contained in:
parent
51909ce60c
commit
b616b652bc
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue