]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5877 Integrate the duplications info
authorStas Vilchik <vilchiks@gmail.com>
Tue, 2 Dec 2014 13:18:15 +0000 (14:18 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 2 Dec 2014 13:18:20 +0000 (14:18 +0100)
server/sonar-web/src/main/js/source-viewer/viewer.js

index 036f3042ea73955655e8017b52081e9adb69b3a3..f9a38e8942793af4525b58f9798d72a5a5108e7e 100644 (file)
@@ -74,7 +74,13 @@ define([
         },
 
         open: function (id, key) {
-          var that = this;
+          var that = this,
+              finalize = function () {
+                that.requestIssues().done(function () {
+                  that.render();
+                  that.trigger('loaded');
+                });
+              };
           this.model.clear();
           this.model.set({
             uuid: id,
@@ -82,24 +88,12 @@ define([
           });
           this.requestComponent().done(function () {
             that.requestSource()
-                .done(function () {
-                  that.requestDuplications().done(function () {
-                    that.requestIssues().done(function () {
-                      that.render();
-                      that.trigger('loaded');
-                    });
-                  });
-                })
+                .done(finalize)
                 .fail(function () {
-                  that.model.set({
-                    source: [
-                      { line: 0 }
-                    ]
-                  });
-                  that.requestIssues().done(function () {
-                    that.render();
-                    that.trigger('loaded');
-                  });
+                  that.model.set({ source: [
+                    { line: 0 }
+                  ] });
+                  finalize();
                 });
           });
           return this;
@@ -295,7 +289,11 @@ define([
         },
 
         showDuplications: function () {
-          this.$el.addClass('source-duplications-expanded');
+          var that = this;
+          this.requestDuplications().done(function () {
+            that.render();
+            that.$el.addClass('source-duplications-expanded');
+          });
         },
 
         showDuplicationPopup: function (e) {