aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-10-05 13:56:34 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-10-05 14:06:42 +0200
commit1007662192640a2b93899859f4eb7b76105b0065 (patch)
treed7444f714f1ae473290bcc192284a65dfb6157d4 /server/sonar-web
parent1dd375690cf8f15bdb5795539676be7f4373a17f (diff)
downloadsonarqube-1007662192640a2b93899859f4eb7b76105b0065.tar.gz
sonarqube-1007662192640a2b93899859f4eb7b76105b0065.zip
SONAR-6870 pre-select unresolved on the issues home page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/controller.js16
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js36
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/state.js5
-rw-r--r--server/sonar-web/src/main/js/apps/issues/templates/facets/issues-resolution-facet.hbs7
4 files changed, 50 insertions, 14 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js
index fb952246b91..54e74f39980 100644
--- a/server/sonar-web/src/main/js/apps/issues/controller.js
+++ b/server/sonar-web/src/main/js/apps/issues/controller.js
@@ -34,12 +34,6 @@ export default Controller.extend({
}
},
- ensureResolution(query) {
- return query.resolutions || query.statuses ?
- _.omit(query, 'resolved') :
- _.extend({}, query, { resolved: false });
- },
-
fetchList: function (firstPage) {
var that = this;
if (firstPage == null) {
@@ -50,9 +44,8 @@ export default Controller.extend({
this.hideHomePage();
this.closeComponentViewer();
}
- var data = this._issuesParameters(),
- query = this.ensureResolution(this.options.app.state.get('query'));
- _.extend(data, query);
+ var data = this._issuesParameters();
+ _.extend(data, this.options.app.state.get('query'));
if (this.options.app.state.get('isContext')) {
_.extend(data, this.options.app.state.get('contextQuery'));
}
@@ -151,7 +144,7 @@ export default Controller.extend({
newSearch: function () {
this.options.app.state.unset('filter');
- return this.options.app.state.setQuery({});
+ return this.options.app.state.setQuery({ resolved: 'false' });
},
applyFilter: function (filter, ignoreQuery) {
@@ -179,7 +172,7 @@ export default Controller.extend({
if (addContext == null) {
addContext = false;
}
- var filter = this.ensureResolution(this.options.app.state.get('query'));
+ var filter = this.options.app.state.get('query');
if (addContext && this.options.app.state.get('isContext')) {
_.extend(filter, this.options.app.state.get('contextQuery'));
}
@@ -237,6 +230,7 @@ export default Controller.extend({
},
showHomePage: function () {
+ this.options.app.state.set({ query: { resolved: 'false' } }, { silent: true });
this.fetchList();
this.options.app.layout.workspaceComponentViewerRegion.reset();
key.setScope('home');
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
index 8c09c1cfccb..a15cf51aed7 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets/resolution-facet.js
@@ -1,3 +1,4 @@
+import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
import '../templates';
@@ -5,8 +6,41 @@ import '../templates';
export default BaseFacet.extend({
template: Templates['issues-resolution-facet'],
+ onRender: function () {
+ BaseFacet.prototype.onRender.apply(this, arguments);
+ var value = this.options.app.state.get('query').resolved;
+ if ((value != null) && (!value || value === 'false')) {
+ return this.$('.js-facet').filter('[data-unresolved]').addClass('active');
+ }
+ },
+
+ toggleFacet: function (e) {
+ var unresolved = $(e.currentTarget).is('[data-unresolved]');
+ $(e.currentTarget).toggleClass('active');
+ if (unresolved) {
+ var checked = $(e.currentTarget).is('.active'),
+ value = checked ? 'false' : null;
+ return this.options.app.state.updateFilter({
+ resolved: value,
+ resolutions: null
+ });
+ } else {
+ return this.options.app.state.updateFilter({
+ resolved: null,
+ resolutions: this.getValue()
+ });
+ }
+ },
+
+ disable: function () {
+ return this.options.app.state.updateFilter({
+ resolved: null,
+ resolutions: null
+ });
+ },
+
sortValues: function (values) {
- var order = ['FIXED', 'FALSE-POSITIVE', 'REMOVED', 'WONTFIX'];
+ var order = ['', 'FIXED', 'FALSE-POSITIVE', 'WONTFIX', 'REMOVED'];
return _.sortBy(values, function (v) {
return order.indexOf(v.val);
});
diff --git a/server/sonar-web/src/main/js/apps/issues/models/state.js b/server/sonar-web/src/main/js/apps/issues/models/state.js
index bb4f6c7427f..f49d2566dfc 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/state.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/state.js
@@ -6,14 +6,14 @@ export default State.extend({
page: 1,
maxResultsReached: false,
query: {},
- facets: ['facetMode', 'severities'],
+ facets: ['facetMode', 'severities', 'resolutions'],
isContext: false,
allFacets: [
'facetMode',
'issues',
'severities',
- 'statuses',
'resolutions',
+ 'statuses',
'createdAt',
'rules',
'tags',
@@ -45,6 +45,7 @@ export default State.extend({
'createdAt'
],
transform: {
+ 'resolved': 'resolutions',
'assigned': 'assignees',
'planned': 'actionPlans',
'createdBefore': 'createdAt',
diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-resolution-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-resolution-facet.hbs
index 9150250b08d..19e47071f8b 100644
--- a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-resolution-facet.hbs
+++ b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-resolution-facet.hbs
@@ -4,6 +4,13 @@
{{#each values}}
{{#eq val ""}}
{{! unresolved }}
+ <a class="facet search-navigator-facet search-navigator-facet-half js-facet" data-unresolved
+ title="{{t "issue.unresolved.description"}}" data-toggle="tooltip" data-placement="right">
+ <span class="facet-name">{{t "unresolved"}}</span>
+ <span class="facet-stat">
+ {{#eq ../../state.facetMode 'count'}}{{numberShort count}}{{else}}{{formatMeasure count 'SHORT_WORK_DUR'}}{{/eq}}
+ </span>
+ </a>
{{else}}
<a class="facet search-navigator-facet search-navigator-facet-half js-facet" data-value="{{val}}"
title="{{t "issue.resolution" val "description"}}" data-toggle="tooltip" data-placement="right">