aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/widgets
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-11 13:55:22 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-03-11 13:55:31 +0100
commit58324bc44a6adabada7125e2b76884a5f7d218b7 (patch)
tree88a9ab4a316e24d55ac2fef2f529c8c412318fe4 /server/sonar-web/src/main/js/widgets
parentb74d5c59e89691d509bd1677491bdfef626fd7c9 (diff)
downloadsonarqube-58324bc44a6adabada7125e2b76884a5f7d218b7.tar.gz
sonarqube-58324bc44a6adabada7125e2b76884a5f7d218b7.zip
SONAR-6234 apply feedback
Diffstat (limited to 'server/sonar-web/src/main/js/widgets')
-rw-r--r--server/sonar-web/src/main/js/widgets/issue-filter.js24
1 files changed, 20 insertions, 4 deletions
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 03479ae361a..e43c28ab946 100644
--- a/server/sonar-web/src/main/js/widgets/issue-filter.js
+++ b/server/sonar-web/src/main/js/widgets/issue-filter.js
@@ -220,12 +220,19 @@ define(['templates/widgets'], function () {
},
initialize: function () {
+ this.shouldIgnorePeriod = false;
this.model = new Backbone.Model({
query: this.options.query,
parsedQuery: this.getParsedQuery(),
- property: this.options.distributionAxis,
- periodDate: this.options.periodDate
+ property: this.options.distributionAxis
});
+
+ // Ignore the period date if the filter contains any date criteria
+ // `this.shouldIgnorePeriod` is set in `this.getParsedQuery()`
+ if (!this.shouldIgnorePeriod) {
+ this.model.set({ periodDate: this.options.periodDate });
+ }
+
this.listenTo(this.model, 'change', this.render);
this.conf = byDistributionConf[this.options.distributionAxis];
this.query = this.getParsedQuery();
@@ -244,12 +251,21 @@ define(['templates/widgets'], function () {
if (this.options.componentKey != null) {
_.extend(query, { componentKey: this.options.componentKey });
}
- if (this.options.periodDate != null) {
+ if (!this.hasDateFilter(query) && this.options.periodDate != null) {
_.extend(query, { createdAfter: this.options.periodDate });
+ } else {
+ this.shouldIgnorePeriod = true;
}
return query;
},
+ hasDateFilter: function (query) {
+ var q = query || this.model.get('parsedQuery');
+ return _.some(['createdAt', 'createdBefore', 'createdAfter', 'createdInLast'], function (p) {
+ return q[p] != null;
+ });
+ },
+
sortItems: function (items) {
var comparator = this.conf != null && this.conf.comparator != null ? this.conf.comparator : defaultComparator;
return _.sortBy(items, comparator);
@@ -288,7 +304,7 @@ define(['templates/widgets'], function () {
if (this.options.componentUuid != null) {
_.extend(options, { componentUuids: this.options.componentUuid });
}
- if (this.options.periodDate != null) {
+ if (this.options.periodDate != null && !this.shouldIgnorePeriod) {
_.extend(options, { createdAfter: this.options.periodDate });
}
return $.get(url, options).done(function (r) {