Dashboard: Render exceptions on failing requests

refs #5507
This commit is contained in:
Eric Lippmann 2014-01-22 14:58:23 +01:00
parent 4473008d65
commit bbe018567f

View File

@ -44,22 +44,26 @@ define(['jquery', 'logging', 'URIjs/URI', 'icinga/componentLoader'], function($,
/** /**
* Refresh the container content and layout * Refresh the container content and layout
*/ */
this.refresh = function() { this.refresh = function () {
$.ajax({ $.ajax({
url: this.dashboardUrl url: this.dashboardUrl,
}).done((function(response) { context: this
this.container.empty(); })
this.container.html(response); .done(function (response) {
dashboardContainer.freetile('layout'); this.container.empty();
$(window).on('layoutchange', function() { this.container.html(response);
components.load();
})
.fail(function (response, reason) {
this.container.html(response.responseText);
})
.always(function () {
dashboardContainer.freetile('layout'); dashboardContainer.freetile('layout');
}); $(window).on('layoutchange', function() {
dashboardContainer.freetile('layout');
this.triggerRefresh(); });
components.load(); this.triggerRefresh();
}).bind(this)).fail((function(response, reason) { })
this.container.html(response);
}).bind(this));
}; };
this.triggerRefresh = function() { this.triggerRefresh = function() {
@ -70,4 +74,4 @@ define(['jquery', 'logging', 'URIjs/URI', 'icinga/componentLoader'], function($,
}; };
this.refresh(); this.refresh();
}; };
}); });