diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-02-26 10:08:27 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-02-26 16:27:28 +0100 |
commit | 8941ce881187e55a1efe90cc5c497be95d110501 (patch) | |
tree | be889b5fc9eefbc466c6a2a32288b5a73927561c | |
parent | 8dd5740bdeb71b8fcabbfb7d428f2e73b2e0d727 (diff) | |
download | sonarqube-8941ce881187e55a1efe90cc5c497be95d110501.tar.gz sonarqube-8941ce881187e55a1efe90cc5c497be95d110501.zip |
SONAR-7334 display types facet on issues page
5 files changed, 59 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> diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index fcf3c58a316..3f1fc6a41af 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -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 |