]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7334 display types facet on issues page
authorStas Vilchik <vilchiks@gmail.com>
Fri, 26 Feb 2016 09:08:27 +0000 (10:08 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 26 Feb 2016 15:27:28 +0000 (16:27 +0100)
server/sonar-web/src/main/js/apps/issues/facets-view.js
server/sonar-web/src/main/js/apps/issues/facets/type-facet.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/issues/models/state.js
server/sonar-web/src/main/js/apps/issues/templates/facets/issues-type-facet.hbs [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 87830ac6942c755111330c230b16925f4f9743c1..6a27534a049f9736a782ec0f5280a35ecd2fdd40 100644 (file)
@@ -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 (file)
index 0000000..47218c9
--- /dev/null
@@ -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);
+    });
+  }
+});
+
+
index cb0a76b48303bef70825cd6daca4da1264d56688..26c08a44b5fbf1385b7444100f733c7048daa6a3 100644 (file)
@@ -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 (file)
index 0000000..87ac51a
--- /dev/null
@@ -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>
index fcf3c58a3161fc3bf2e70b0687a97c205c35f107..3f1fc6a41af2f46b756f57d880d4e09c8e06c431 100644 (file)
@@ -694,6 +694,10 @@ issue.unplanned=Not planned
 issue.unplan.submit=Unplan
 issue.plan.error.plan_must_be_created_first=At least one action plan must be created on this project. Please contact your project administrator if you don't have the permission to do it.
 
+issue.type.CODE_SMELL=Code Smell
+issue.type.BUG=Bug
+issue.type.VULNERABILITY=Vulnerability
+
 issue.status.REOPENED=Reopened
 issue.status.REOPENED.description=Transitioned to and then back from some other status.
 issue.status.RESOLVED=Resolved
@@ -833,6 +837,7 @@ issues.found=Found
 # ISSUES FACETS
 #
 #------------------------------------------------------------------------------
+issues.facet.types=Type
 issues.facet.severities=Severity
 issues.facet.projectUuids=Project
 issues.facet.statuses=Status