window.SonarWidgets.Widget.prototype.render = function(container) {
var that = this;
+ this.showSpinner(container);
d3.json(this.source(), function(error, response) {
if (response && !error) {
+ that.hideSpinner();
if (response.components.length > 0) {
that.widget = new SonarWidgets[that.type()]();
that.widget
};
+ window.SonarWidgets.Widget.prototype.showSpinner = function(container) {
+ this.spinner = d3.select(container).append('i').classed('spinner', true);
+ };
+
+
+ window.SonarWidgets.Widget.prototype.hideSpinner = function() {
+ if (this.spinner) {
+ this.spinner.remove();
+ }
+ };
+
+
window.SonarWidgets.Widget.prototype.update = function(container) {
return this.widget && this.widget.update(container);
};