summaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-02-26 10:08:27 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-02-26 16:27:28 +0100
commit8941ce881187e55a1efe90cc5c497be95d110501 (patch)
treebe889b5fc9eefbc466c6a2a32288b5a73927561c /server/sonar-web/src
parent8dd5740bdeb71b8fcabbfb7d428f2e73b2e0d727 (diff)
downloadsonarqube-8941ce881187e55a1efe90cc5c497be95d110501.tar.gz
sonarqube-8941ce881187e55a1efe90cc5c497be95d110501.zip
SONAR-7334 display types facet on issues page
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/type-facet.js35
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/state.js6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/templates/facets/issues-type-facet.hbs13
4 files changed, 54 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/facets-view.js b/server/sonar-web/src/main/js/apps/issues/facets-view.js
index 87830ac6942..6a27534a049 100644
--- a/server/sonar-web/src/main/js/apps/issues/facets-view.js
+++ b/server/sonar-web/src/main/js/apps/issues/facets-view.js
@@ -19,6 +19,7 @@
*/
import FacetsView from '../../components/navigator/facets-view';
import BaseFacet from './facets/base-facet';
+import TypeFacet from './facets/type-facet';
import SeverityFacet from './facets/severity-facet';
import StatusFacet from './facets/status-facet';
import ProjectFacet from './facets/project-facet';
@@ -38,6 +39,7 @@ import ContextFacet from './facets/context-facet';
import ModeFacet from './facets/mode-facet';
const viewsMapping = {
+ types: TypeFacet,
severities: SeverityFacet,
statuses: StatusFacet,
assignees: AssigneeFacet,
diff --git a/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js
new file mode 100644
index 00000000000..47218c9a0cc
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/issues/facets/type-facet.js
@@ -0,0 +1,35 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import _ from 'underscore';
+import BaseFacet from './base-facet';
+import Template from '../templates/facets/issues-type-facet.hbs';
+
+export default BaseFacet.extend({
+ template: Template,
+
+ sortValues (values) {
+ const order = ['BUG', 'VULNERABILITY', 'CODE_SMELL'];
+ 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 cb0a76b4830..26c08a44b5f 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
@@ -25,13 +25,14 @@ export default State.extend({
page: 1,
maxResultsReached: false,
query: {},
- facets: ['facetMode', 'severities', 'resolutions'],
+ facets: ['facetMode', 'types', 'resolutions'],
isContext: false,
allFacets: [
'facetMode',
'issues',
- 'severities',
+ 'types',
'resolutions',
+ 'severities',
'statuses',
'createdAt',
'rules',
@@ -47,6 +48,7 @@ export default State.extend({
'actionPlans'
],
facetsFromServer: [
+ 'types',
'severities',
'statuses',
'resolutions',
diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-type-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-type-facet.hbs
new file mode 100644
index 00000000000..87ac51ac1a4
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-type-facet.hbs
@@ -0,0 +1,13 @@
+{{> "_issues-facet-header"}}
+
+<div class="search-navigator-facet-list">
+ {{#each values}}
+ <a class="facet search-navigator-facet js-facet"
+ data-value="{{val}}">
+ <span class="facet-name">{{t 'issue.type' val}}</span>
+ <span class="facet-stat">
+ {{#eq ../state.facetMode 'count'}}{{numberShort count}}{{else}}{{formatMeasure count 'SHORT_WORK_DUR'}}{{/eq}}
+ </span>
+ </a>
+ {{/each}}
+</div>