aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-04 11:51:29 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-03-04 13:09:22 +0100
commit6c41cba0d29e744f90347ae98975f8e4e55c8bd7 (patch)
tree23c56afa5125b5fc4fac77ba094684e222038bc4 /server/sonar-web
parent29bc3c690a0d29d157042477ead84b5abeda3a1d (diff)
downloadsonarqube-6c41cba0d29e744f90347ae98975f8e4e55c8bd7.tar.gz
sonarqube-6c41cba0d29e744f90347ae98975f8e4e55c8bd7.zip
SONAR-6234 add project issue filter widget
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-total.hbs4
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs12
-rw-r--r--server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs2
-rw-r--r--server/sonar-web/src/main/js/widgets/issue-filter.js53
8 files changed, 58 insertions, 21 deletions
diff --git a/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-total.hbs b/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-total.hbs
index 407209bb5ab..1619ed5ab8c 100644
--- a/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-total.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/_widget-issue-filter-total.hbs
@@ -1,8 +1,8 @@
<tr>
<td>
- <a href="{{link '/issues/search#' query}}"><strong>{{t 'total'}}</strong></a>
+ <a href="{{issueFilterTotalLink parsedQuery}}"><strong>{{t 'total'}}</strong></a>
</td>
- <td class="text-right"><strong>{{total}}</strong></td>
+ <td class="text-right"><strong>{{#notNull periodDate}}+{{/notNull}}{{total}}</strong></td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
<div style="width: 100%;"></div>
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs
index 748c57df613..cec1a9a6748 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-action-plans.hbs
@@ -10,7 +10,7 @@
{{/eq}}
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs
index 030e94370c1..3e1add4abd2 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-assignees.hbs
@@ -10,7 +10,7 @@
{{/eq}}
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs
index 2d83a97ba4a..8c03461b619 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-resolutions.hbs
@@ -10,7 +10,7 @@
{{/eq}}
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs
index 64cb0477d9f..c18b9ecbe82 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-severities.hbs
@@ -12,7 +12,7 @@
<a href="{{issueFilterItemLink ../parsedQuery ../property val}}">{{t 'severity' val}}</a>
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
</tr>
{{/each}}
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs
index 97dc5ec5e70..b27fc32964f 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter-statuses.hbs
@@ -1,13 +1,5 @@
<table class="data zebra">
- <tr>
- <td><strong>{{t 'total'}}</strong></td>
- <td class="text-right"><strong>{{total}}</strong></td>
- <td class="barchart">
- <div class="barchart" style="width: 100%;">
- <div style="width: 100%;"></div>
- </div>
- </td>
- </tr>
+ {{> '_widget-issue-filter-total'}}
{{#each items}}
<tr>
<td>
@@ -15,7 +7,7 @@
<a href="{{issueFilterItemLink ../parsedQuery ../property val}}">{{t 'issue.status' val}}</a>
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
diff --git a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs
index e635a2fdcde..ffb3e072557 100644
--- a/server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs
+++ b/server/sonar-web/src/main/hbs/widgets/widget-issue-filter.hbs
@@ -6,7 +6,7 @@
<a href="{{searchLink}}">{{default label val}}</a>
</td>
<td class="text-right nowrap">
- {{numberShort count}}
+ {{#notNull ../periodDate}}+{{/notNull}}{{numberShort count}}
</td>
<td class="barchart">
<div class="barchart" style="width: 100%;">
diff --git a/server/sonar-web/src/main/js/widgets/issue-filter.js b/server/sonar-web/src/main/js/widgets/issue-filter.js
index de810bf8e66..2e40e16578c 100644
--- a/server/sonar-web/src/main/js/widgets/issue-filter.js
+++ b/server/sonar-web/src/main/js/widgets/issue-filter.js
@@ -16,7 +16,12 @@ define(['templates/widgets'], function () {
var criterion = {};
criterion[property] = item.val;
var r = _.extend({}, query, criterion);
- return baseUrl + '/issues/search#' + getQuery(r);
+ if (r.componentKey != null) {
+ return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ '#' + getQuery(_.omit(r, 'componentKey'));
+ } else {
+ return baseUrl + '/issues/search#' + getQuery(r);
+ }
},
byDistributionConf = {
'severities': {
@@ -38,6 +43,13 @@ define(['templates/widgets'], function () {
comparator: function (item) {
var order = ['', 'FALSE-POSITIVE', 'WONTFIX', 'FIXED', 'REMOVED'];
return order.indexOf(item.val);
+ },
+ filter: function (item) {
+ if ('' + this.query.resolved === 'false') {
+ return item.val === '';
+ } else {
+ return defaultFilter.call(this, item);
+ }
}
},
'rules': {
@@ -115,7 +127,12 @@ define(['templates/widgets'], function () {
createdAfter: createdAfter.format('YYYY-MM-DD'),
createdBefore: createdBefore.format('YYYY-MM-DD')
});
- return baseUrl + '/issues/search#' + getQuery(r);
+ if (r.componentKey != null) {
+ return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ '#' + getQuery(_.omit(r, 'componentKey'));
+ } else {
+ return baseUrl + '/issues/search#' + getQuery(r);
+ }
}
}
};
@@ -133,7 +150,22 @@ define(['templates/widgets'], function () {
var criterion = {};
criterion[property] = value;
var r = _.extend({}, query, criterion);
- return baseUrl + '/issues/search#' + getQuery(r);
+ if (r.componentKey != null) {
+ return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ '#' + getQuery(_.omit(r, 'componentKey'));
+ } else {
+ return baseUrl + '/issues/search#' + getQuery(r);
+ }
+ });
+
+ Handlebars.registerHelper('issueFilterTotalLink', function (query) {
+ var r = _.extend({}, query);
+ if (r.componentKey != null) {
+ return baseUrl + '/component_issues/index?id=' + encodeURIComponent(r.componentKey) +
+ '#' + getQuery(_.omit(r, 'componentKey'));
+ } else {
+ return baseUrl + '/issues/search#' + getQuery(r);
+ }
});
return Marionette.ItemView.extend({
@@ -147,7 +179,8 @@ define(['templates/widgets'], function () {
this.model = new Backbone.Model({
query: this.options.query,
parsedQuery: this.getParsedQuery(),
- property: this.options.distributionAxis
+ property: this.options.distributionAxis,
+ periodDate: this.options.periodDate
});
this.listenTo(this.model, 'change', this.render);
this.conf = byDistributionConf[this.options.distributionAxis];
@@ -164,6 +197,12 @@ define(['templates/widgets'], function () {
query[criterion[0]] = criterion[1];
}
});
+ if (this.options.componentKey != null) {
+ _.extend(query, { componentKey: this.options.componentKey });
+ }
+ if (this.options.periodDate != null) {
+ _.extend(query, { createdAfter: this.options.periodDate });
+ }
return query;
},
@@ -202,6 +241,12 @@ define(['templates/widgets'], function () {
ps: 1,
facets: this.options.distributionAxis
});
+ if (this.options.componentUuid != null) {
+ _.extend(options, { componentUuids: this.options.componentUuid });
+ }
+ if (this.options.periodDate != null) {
+ _.extend(options, { createdAfter: this.options.periodDate });
+ }
return $.get(url, options).done(function (r) {
if (_.isArray(r.facets) && r.facets.length === 1) {
// save response object, but do not trigger repaint