]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5726 apply feedback
authorStas Vilchik <vilchiks@gmail.com>
Tue, 10 Mar 2015 08:51:56 +0000 (09:51 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 10 Mar 2015 09:22:13 +0000 (10:22 +0100)
12 files changed:
server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-limit.hbs [new file with mode: 0644]
server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs
server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs
server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs
server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs
server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs
server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs
server/sonar-web/src/main/js/widgets/issue-filter.js
server/sonar-web/src/test/js/global-issue-filter-widget.js
server/sonar-web/src/test/js/project-issue-filter-widget.js
server/sonar-web/src/test/json/global-issues-filter-widget/unresolved-issues-by-reporter.json [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

diff --git a/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-limit.hbs b/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-limit.hbs
new file mode 100644 (file)
index 0000000..6da8283
--- /dev/null
@@ -0,0 +1 @@
+<div class="note text-center spacer-top">{{tp 'max_items_reached' maxResults}}</div>
index cec1a9a6748bc29292046874a11c03d9f3d64b07..07c9b17f40cc0278a8dbbad43612fe24bb02c9ef 100644 (file)
@@ -20,3 +20,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index 3e1add4abd2206825e2a3ac6f46fe8863cd87a2d..494104f3ee93deabbed3639a20a54335ad2aafbd 100644 (file)
@@ -20,3 +20,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index 8c03461b61998475c132c7b1371e479e07e49cb6..50827ba41bbcc209f11f15c32e8749f9a51b5f1b 100644 (file)
@@ -20,3 +20,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index 98b255ce6404bfd4bdce75997f4fe4b8d66539dc..99f8f487c1f2f8c049d8d3d44a5d0529284abdbe 100644 (file)
@@ -17,3 +17,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index b27fc32964fdf1a5a0fdc0cd7c71d5636d0bd684..70d5a57c76524d9169ba584c9adfae487ef17ec4 100644 (file)
@@ -17,3 +17,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index ffb3e072557a58ecf2c8a30ec5180ec77c4aef61..dc78bba0232ba732a08321824f6052866ad3da20 100644 (file)
@@ -16,3 +16,7 @@
     </tr>
   {{/each}}
 </table>
+
+{{#if maxResultsReached}}
+  {{> '_widget-issue-filter-limit'}}
+{{/if}}
index c8d27bf5196eb093bb6889cfa7a7198945aefe81..03479ae361a86c6c8a2c877c9075b800d6435350 100644 (file)
@@ -20,6 +20,7 @@
 define(['templates/widgets'], function () {
 
   var $ = jQuery,
+      FACET_LIMIT = 15,
       defaultComparator = function (item) {
         return -item.count;
       },
@@ -119,6 +120,16 @@ define(['templates/widgets'], function () {
             }
           }
         },
+        'reporters': {
+          label: function (item, r) {
+            if (_.isArray(r.users)) {
+              var reporter = _.findWhere(r.users, { login: item.val });
+              if (reporter != null) {
+                return reporter.name;
+              }
+            }
+          }
+        },
         'actionPlans': {
           template: 'widget-issue-filter-action-plans',
           label: function (item, r) {
@@ -139,7 +150,7 @@ define(['templates/widgets'], function () {
         },
         'createdAt': {
           comparator: function (item) {
-            return moment(item.val).toDate();
+            return -moment(item.val).unix();
           },
           label: function (item, r, items, index, query) {
             var beginning = moment(item.val),
@@ -284,8 +295,11 @@ define(['templates/widgets'], function () {
         if (_.isArray(r.facets) && r.facets.length === 1) {
           // save response object, but do not trigger repaint
           that.model.set({ rawResponse: r }, { silent: true });
+          var items = that.sortItems(that.withLabels(that.withLink(that.filterItems(r.facets[0].values))));
           that.model.set({
-            items: that.sortItems(that.withLabels(that.withLink(that.filterItems(r.facets[0].values)))),
+            items: items,
+            maxResultsReached: r.facets[0].values.length >= FACET_LIMIT,
+            maxResults: items.length,
             total: r.total
           });
         }
index ac2f5f78acf6f7acf21bbb7bbb2b5ad03dfc8166..128006d6041e5673f4167aaaac06f2811dcfe023 100644 (file)
@@ -545,6 +545,66 @@ casper.test.begin(testName('Unresolved Unassigned Issues By Assignee'), 6, funct
 });
 
 
+casper.test.begin(testName('Unresolved Issues By Reporter'), 12, function (test) {
+  casper
+      .start(lib.buildUrl('issue-filter-widget'), function () {
+        lib.setDefaultViewport();
+
+        lib.mockRequest('/api/l10n/index', '{}');
+        lib.mockRequestFromFile('/api/issues/search', 'unresolved-issues-by-reporter.json',
+            { data: { resolved: 'false' } });
+      })
+
+      .then(function () {
+        casper.evaluate(function () {
+          require(['/js/widgets/issue-filter.js'], function (IssueFilter) {
+            window.requestMessages().done(function () {
+              new IssueFilter({
+                el: '#issue-filter-widget',
+                query: 'resolved=false',
+                distributionAxis: 'reporters'
+              });
+            });
+          });
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('#issue-filter-widget > table');
+      })
+
+      .then(function () {
+        // check count
+        test.assertElementCount('tr', 4);
+
+        // check order and values
+        test.assertSelectorContains('tr:nth-child(1)', '6851');
+        test.assertSelectorContains('tr:nth-child(2)', '698');
+        test.assertSelectorContains('tr:nth-child(3)', '504');
+        test.assertSelectorContains('tr:nth-child(4)', '426');
+
+        // check links
+        test.assertExists('tr:nth-child(1) a[href="/issues/search#resolved=false"]');
+        test.assertExists('tr:nth-child(2) a[href="/issues/search#resolved=false|reporters=first.user"]');
+        test.assertExists('tr:nth-child(3) a[href="/issues/search#resolved=false|reporters=second.user"]');
+        test.assertExists('tr:nth-child(4) a[href="/issues/search#resolved=false|reporters=third.user"]');
+
+        // check labels
+        test.assertSelectorContains('tr:nth-child(2)', 'First User');
+        test.assertSelectorContains('tr:nth-child(3)', 'Second User');
+        test.assertSelectorContains('tr:nth-child(4)', 'Third User');
+      })
+
+      .then(function () {
+        lib.sendCoverage();
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
+
+
 casper.test.begin(testName('Unresolved Issues By Language'), 15, function (test) {
   casper
       .start(lib.buildUrl('issue-filter-widget'), function () {
@@ -759,28 +819,28 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) {
 
         // check order and values
         test.assertSelectorContains('tr:nth-child(1)', '6851');
-        test.assertSelectorContains('tr:nth-child(2)', '72');
-        test.assertSelectorContains('tr:nth-child(3)', '64');
+        test.assertSelectorContains('tr:nth-child(2)', '1724');
+        test.assertSelectorContains('tr:nth-child(3)', '3729');
         test.assertSelectorContains('tr:nth-child(4)', '1262');
-        test.assertSelectorContains('tr:nth-child(5)', '3729');
-        test.assertSelectorContains('tr:nth-child(6)', '1724');
+        test.assertSelectorContains('tr:nth-child(5)', '64');
+        test.assertSelectorContains('tr:nth-child(6)', '72');
 
         // check links
         test.assertExists('tr:nth-child(1) a[href="/issues/search#resolved=false"]');
-        test.assertExists('tr:nth-child(2) a[href="/issues/search#resolved=false|createdAfter=2011-01-01|createdBefore=2011-12-31"]');
-        test.assertExists('tr:nth-child(3) a[href="/issues/search#resolved=false|createdAfter=2012-01-01|createdBefore=2012-12-31"]');
-        test.assertExists('tr:nth-child(4) a[href="/issues/search#resolved=false|createdAfter=2013-01-01|createdBefore=2013-12-31"]');
-        test.assertExists('tr:nth-child(5) a[href="/issues/search#resolved=false|createdAfter=2014-01-01|createdBefore=2014-12-31"]');
         // do not check createdBefore value, because it is set dynamically to *now*
-        test.assertExists('tr:nth-child(6) a[href^="/issues/search#resolved=false|createdAfter=2015-01-01|createdBefore="]');
+        test.assertExists('tr:nth-child(2) a[href^="/issues/search#resolved=false|createdAfter=2015-01-01|createdBefore="]');
+        test.assertExists('tr:nth-child(3) a[href="/issues/search#resolved=false|createdAfter=2014-01-01|createdBefore=2014-12-31"]');
+        test.assertExists('tr:nth-child(4) a[href="/issues/search#resolved=false|createdAfter=2013-01-01|createdBefore=2013-12-31"]');
+        test.assertExists('tr:nth-child(5) a[href="/issues/search#resolved=false|createdAfter=2012-01-01|createdBefore=2012-12-31"]');
+        test.assertExists('tr:nth-child(6) a[href="/issues/search#resolved=false|createdAfter=2011-01-01|createdBefore=2011-12-31"]');
 
         // check labels
-        test.assertSelectorContains('tr:nth-child(2)', 'January 1 2011 – December 31 2011');
-        test.assertSelectorContains('tr:nth-child(3)', 'January 1 2012 – December 31 2012');
-        test.assertSelectorContains('tr:nth-child(4)', 'January 1 2013 – December 31 2013');
-        test.assertSelectorContains('tr:nth-child(5)', 'January 1 2014 – December 31 2014');
         // do not check label fully, because it is set dynamically using *now*
-        test.assertSelectorContains('tr:nth-child(6)', 'January 1 2015 – ');
+        test.assertSelectorContains('tr:nth-child(2)', 'January 1 2015 – ');
+        test.assertSelectorContains('tr:nth-child(3)', 'January 1 2014 – December 31 2014');
+        test.assertSelectorContains('tr:nth-child(4)', 'January 1 2013 – December 31 2013');
+        test.assertSelectorContains('tr:nth-child(5)', 'January 1 2012 – December 31 2012');
+        test.assertSelectorContains('tr:nth-child(6)', 'January 1 2011 – December 31 2011');
       })
 
       .then(function () {
@@ -827,20 +887,20 @@ casper.test.begin(testName('Unresolved Issues on a Limited Period By Date'), 12,
 
         // check order and values
         test.assertSelectorContains('tr:nth-child(1)', '6851');
-        test.assertSelectorContains('tr:nth-child(2)', '49');
+        test.assertSelectorContains('tr:nth-child(2)', '47');
         test.assertSelectorContains('tr:nth-child(3)', '48');
-        test.assertSelectorContains('tr:nth-child(4)', '47');
+        test.assertSelectorContains('tr:nth-child(4)', '49');
 
         // check links
         test.assertExists('tr:nth-child(1) a[href="/issues/search#resolved=false|createdAfter=2015-02-16|createdBefore=2015-02-18"]');
-        test.assertExists('tr:nth-child(2) a[href="/issues/search#resolved=false|createdAfter=2015-02-16|createdBefore=2015-02-17"]');
+        test.assertExists('tr:nth-child(2) a[href="/issues/search#resolved=false|createdAfter=2015-02-18|createdBefore=2015-02-19"]');
         test.assertExists('tr:nth-child(3) a[href="/issues/search#resolved=false|createdAfter=2015-02-17|createdBefore=2015-02-18"]');
-        test.assertExists('tr:nth-child(4) a[href="/issues/search#resolved=false|createdAfter=2015-02-18|createdBefore=2015-02-19"]');
+        test.assertExists('tr:nth-child(4) a[href="/issues/search#resolved=false|createdAfter=2015-02-16|createdBefore=2015-02-17"]');
 
         // check labels
-        test.assertSelectorContains('tr:nth-child(2)', 'February 16 2015');
+        test.assertSelectorContains('tr:nth-child(2)', 'February 18 2015');
         test.assertSelectorContains('tr:nth-child(3)', 'February 17 2015');
-        test.assertSelectorContains('tr:nth-child(4)', 'February 18 2015');
+        test.assertSelectorContains('tr:nth-child(4)', 'February 16 2015');
       })
 
       .then(function () {
index 25e69cdeff8acab5a285693e8c13c3842120932a..961c79a987c5c6ede6755b9dc13adfc29a5738eb 100644 (file)
@@ -125,28 +125,28 @@ casper.test.begin(testName('Unresolved Issues By Date'), 18, function (test) {
 
         // check order and values
         test.assertSelectorContains('tr:nth-child(1)', '6851');
-        test.assertSelectorContains('tr:nth-child(2)', '72');
-        test.assertSelectorContains('tr:nth-child(3)', '64');
+        test.assertSelectorContains('tr:nth-child(2)', '1724');
+        test.assertSelectorContains('tr:nth-child(3)', '3729');
         test.assertSelectorContains('tr:nth-child(4)', '1262');
-        test.assertSelectorContains('tr:nth-child(5)', '3729');
-        test.assertSelectorContains('tr:nth-child(6)', '1724');
+        test.assertSelectorContains('tr:nth-child(5)', '64');
+        test.assertSelectorContains('tr:nth-child(6)', '72');
 
         // check links
         test.assertExists('tr:nth-child(1) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false"]');
-        test.assertExists('tr:nth-child(2) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2011-01-01|createdBefore=2011-12-31"]');
-        test.assertExists('tr:nth-child(3) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2012-01-01|createdBefore=2012-12-31"]');
-        test.assertExists('tr:nth-child(4) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2013-01-01|createdBefore=2013-12-31"]');
-        test.assertExists('tr:nth-child(5) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2014-01-01|createdBefore=2014-12-31"]');
         // do not check createdBefore value, because it is set dynamically to *now*
-        test.assertExists('tr:nth-child(6) a[href^="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2015-01-01|createdBefore="]');
+        test.assertExists('tr:nth-child(2) a[href^="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2015-01-01|createdBefore="]');
+        test.assertExists('tr:nth-child(3) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2014-01-01|createdBefore=2014-12-31"]');
+        test.assertExists('tr:nth-child(4) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2013-01-01|createdBefore=2013-12-31"]');
+        test.assertExists('tr:nth-child(5) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2012-01-01|createdBefore=2012-12-31"]');
+        test.assertExists('tr:nth-child(6) a[href="/component_issues/index?id=org.codehaus.sonar%3Asonar#resolved=false|createdAfter=2011-01-01|createdBefore=2011-12-31"]');
 
         // check labels
-        test.assertSelectorContains('tr:nth-child(2)', 'January 1 2011 – December 31 2011');
-        test.assertSelectorContains('tr:nth-child(3)', 'January 1 2012 – December 31 2012');
-        test.assertSelectorContains('tr:nth-child(4)', 'January 1 2013 – December 31 2013');
-        test.assertSelectorContains('tr:nth-child(5)', 'January 1 2014 – December 31 2014');
         // do not check label fully, because it is set dynamically using *now*
-        test.assertSelectorContains('tr:nth-child(6)', 'January 1 2015 – ');
+        test.assertSelectorContains('tr:nth-child(2)', 'January 1 2015 – ');
+        test.assertSelectorContains('tr:nth-child(3)', 'January 1 2014 – December 31 2014');
+        test.assertSelectorContains('tr:nth-child(4)', 'January 1 2013 – December 31 2013');
+        test.assertSelectorContains('tr:nth-child(5)', 'January 1 2012 – December 31 2012');
+        test.assertSelectorContains('tr:nth-child(6)', 'January 1 2011 – December 31 2011');
       })
 
       .then(function () {
diff --git a/server/sonar-web/src/test/json/global-issues-filter-widget/unresolved-issues-by-reporter.json b/server/sonar-web/src/test/json/global-issues-filter-widget/unresolved-issues-by-reporter.json
new file mode 100644 (file)
index 0000000..1a24507
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "total": 6851,
+  "p": 1,
+  "ps": 1,
+  "users": [
+    {
+      "login": "second.user",
+      "name": "Second User",
+      "active": true,
+      "email": "second.user@example.com"
+    },
+    {
+      "login": "third.user",
+      "name": "Third User",
+      "active": true,
+      "email": "third.user@example.com"
+    },
+    {
+      "login": "first.user",
+      "name": "First User",
+      "active": true,
+      "email": "first.user@example.com"
+    }
+  ],
+  "facets": [
+    {
+      "property": "reporters",
+      "values": [
+        {
+          "val": "first.user",
+          "count": 698
+        },
+        {
+          "val": "second.user",
+          "count": 504
+        },
+        {
+          "val": "third.user",
+          "count": 426
+        }
+      ]
+    }
+  ]
+}
index d979e3fc24e584e74360a0c1c24f5831f7490417..ed6d84bc7bd7e7b0417db0fea1fd6fc0a629716b 100644 (file)
@@ -88,6 +88,7 @@ load_verb=Load
 login=Login
 major=Major
 max=Max
+max_items_reached=Only the first {0} components are displayed
 me=Me
 min=Min
 minor=Minor
@@ -1340,7 +1341,7 @@ widget.issue_filter.insufficient_privileges_warning=Widget cannot be displayed:
 widget.issue_filter.property.distributionAxis.option.severities.name=By Severity
 widget.issue_filter.property.distributionAxis.option.projectUuids.name=By Project
 widget.issue_filter.property.distributionAxis.option.statuses.name=By Status
-widget.issue_filter.property.distributionAxis.option.createdAt.name=New Issues
+widget.issue_filter.property.distributionAxis.option.createdAt.name=By Creation Date
 widget.issue_filter.property.distributionAxis.option.actionPlans.name=By Action Plan
 widget.issue_filter.property.distributionAxis.option.assignees.name=By Assignee
 widget.issue_filter.property.distributionAxis.option.tags.name=By Tag