From e76b49e6a11cc9b5d18f88105e24e697e4443ceb Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 23 May 2014 17:47:41 +0200 Subject: [PATCH] SONAR-5333 Add spinners for measure filters --- sonar-server/src/main/js/widgets/widget.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sonar-server/src/main/js/widgets/widget.js b/sonar-server/src/main/js/widgets/widget.js index 4c7f3a6a06e..13e290a3af1 100644 --- a/sonar-server/src/main/js/widgets/widget.js +++ b/sonar-server/src/main/js/widgets/widget.js @@ -40,8 +40,10 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; 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 @@ -64,6 +66,18 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; }; + 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); }; -- 2.39.5