From: Stas Vilchik Date: Thu, 8 Jan 2015 16:16:16 +0000 (+0100) Subject: SONAR-5884 Fix line fading in measures drilldown page X-Git-Tag: latest-silver-master-#65~278 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dbb38b5f26130ed4bb9bcb4147c2c5c537c994bb;p=sonarqube.git SONAR-5884 Fix line fading in measures drilldown page --- diff --git a/server/sonar-web/src/main/js/drilldown/app.js b/server/sonar-web/src/main/js/drilldown/app.js index dc86cfc6749..5ed7c996cc4 100644 --- a/server/sonar-web/src/main/js/drilldown/app.js +++ b/server/sonar-web/src/main/js/drilldown/app.js @@ -38,9 +38,9 @@ requirejs([ viewer = new SourceViewer(); App.viewerRegion.show(viewer); viewer.open(uuid); - if (typeof window.drilldown.period === 'number') { + if (window.drilldown.period != null) { viewer.on('loaded', function () { - viewer.filterLinesByPeriod(window.drilldown.period); + viewer.filterLinesByDate(window.drilldown.period); }); } }); diff --git a/server/sonar-web/src/main/js/source-viewer/viewer.js b/server/sonar-web/src/main/js/source-viewer/viewer.js index 0056db64dfd..3800f3407ec 100644 --- a/server/sonar-web/src/main/js/source-viewer/viewer.js +++ b/server/sonar-web/src/main/js/source-viewer/viewer.js @@ -614,18 +614,13 @@ define([ }); }, - filterLinesByPeriod: function (periodId) { - var periods = this.model.get('periods'), - period = _.find(periods, function (candidate) { - return candidate[0] === periodId; - }); - if (period) { - var sinceDate = moment(period[2]).toDate(); - this.filterLines(function (line) { - var scmDate = moment(line.scmDate).toDate(); - return scmDate >= sinceDate; - }); - } + filterLinesByDate: function (date) { + var sinceDate = moment(date).toDate(); + this.filterLines(function (line) { + var scmDate = moment(line.scmDate).toDate(); + console.log(scmDate, sinceDate); + return scmDate >= sinceDate; + }); } }); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb index 58f6d8cdd35..117ae080c94 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb @@ -124,7 +124,7 @@ metric: <% if @metric %>'<%= @metric.key -%>'<% else %>null<% end %>, rule: null, severity: null, - period: <% if @period %><%= @period -%><% else %>null<% end %> + period: <% if @period %>'<%= @snapshot.period_datetime(@period) -%>'<% else %>null<% end %> };