From 44f379162480eda755a0c82142a1df4285084c38 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 18 Mar 2015 18:01:44 +0100 Subject: [PATCH] SONAR-5968 Allow modification of issue filter using issue properties --- .../coffee/issue/collections/issues.coffee | 1 + .../issue/views/action-options-view.coffee | 4 +- .../coffee/issues/issue-filter-view.coffee | 47 ++++++++++++ .../main/coffee/issues/models/issues.coffee | 2 + .../issues/workspace-list-item-view.coffee | 39 ++++++++++ server/sonar-web/src/main/hbs/issue/issue.hbs | 2 +- .../hbs/issues/issues-issue-filter-form.hbs | 72 ++++++++++++++++++ .../main/hbs/issues/issues-issue-filter.hbs | 5 ++ .../hbs/issues/issues-workspace-list-item.hbs | 24 ------ .../main/js/common/handlebars-extensions.js | 4 + .../sonar-web/src/main/less/init/icons.less | 14 ++-- .../fonts/{sonar-5.1.eot => sonar-5.2.eot} | Bin 17564 -> 17664 bytes .../fonts/{sonar-5.1.svg => sonar-5.2.svg} | 1 + .../fonts/{sonar-5.1.woff => sonar-5.2.ttf} | Bin 17476 -> 17500 bytes .../fonts/{sonar-5.1.ttf => sonar-5.2.woff} | Bin 17400 -> 17576 bytes .../resources/org/sonar/l10n/core.properties | 1 + 16 files changed, 184 insertions(+), 32 deletions(-) create mode 100644 server/sonar-web/src/main/coffee/issues/issue-filter-view.coffee create mode 100644 server/sonar-web/src/main/hbs/issues/issues-issue-filter-form.hbs create mode 100644 server/sonar-web/src/main/hbs/issues/issues-issue-filter.hbs delete mode 100644 server/sonar-web/src/main/hbs/issues/issues-workspace-list-item.hbs rename server/sonar-web/src/main/webapp/fonts/{sonar-5.1.eot => sonar-5.2.eot} (86%) rename server/sonar-web/src/main/webapp/fonts/{sonar-5.1.svg => sonar-5.2.svg} (99%) rename server/sonar-web/src/main/webapp/fonts/{sonar-5.1.woff => sonar-5.2.ttf} (89%) rename server/sonar-web/src/main/webapp/fonts/{sonar-5.1.ttf => sonar-5.2.woff} (85%) diff --git a/server/sonar-web/src/main/coffee/issue/collections/issues.coffee b/server/sonar-web/src/main/coffee/issue/collections/issues.coffee index 9ff4b2f0dd5..b8b4d105495 100644 --- a/server/sonar-web/src/main/coffee/issue/collections/issues.coffee +++ b/server/sonar-web/src/main/coffee/issue/collections/issues.coffee @@ -56,6 +56,7 @@ define [ if project _.extend issue, projectLongName: project.longName + projectUuid: project.uuid if rule _.extend issue, diff --git a/server/sonar-web/src/main/coffee/issue/views/action-options-view.coffee b/server/sonar-web/src/main/coffee/issue/views/action-options-view.coffee index f58f7bf7280..aea1b758d31 100644 --- a/server/sonar-web/src/main/coffee/issue/views/action-options-view.coffee +++ b/server/sonar-web/src/main/coffee/issue/views/action-options-view.coffee @@ -69,12 +69,12 @@ define [ selectNextOption: -> - @makeActive @getActiveOption().next('.issue-action-option') + @makeActive @getActiveOption().nextAll('.issue-action-option').first() false # return `false` to use with keymaster selectPreviousOption: -> - @makeActive @getActiveOption().prev('.issue-action-option') + @makeActive @getActiveOption().prevAll('.issue-action-option').first() false # return `false` to use with keymaster diff --git a/server/sonar-web/src/main/coffee/issues/issue-filter-view.coffee b/server/sonar-web/src/main/coffee/issues/issue-filter-view.coffee new file mode 100644 index 00000000000..3eba1223409 --- /dev/null +++ b/server/sonar-web/src/main/coffee/issues/issue-filter-view.coffee @@ -0,0 +1,47 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +define [ + 'issue/views/action-options-view' + 'templates/issues' +], ( + ActionOptionsView +) -> + + $ = jQuery + + + class extends ActionOptionsView + template: Templates['issues-issue-filter-form'] + + + selectInitialOption: -> + @makeActive @getOptions().first() + + + selectOption: (e) -> + property = $(e.currentTarget).data 'property' + value = $(e.currentTarget).data 'value' + @trigger 'select', property, value + super + + + serializeData: -> + _.extend super, s: @model.get 'severity' diff --git a/server/sonar-web/src/main/coffee/issues/models/issues.coffee b/server/sonar-web/src/main/coffee/issues/models/issues.coffee index a76adb2d0f6..1376d8327d9 100644 --- a/server/sonar-web/src/main/coffee/issues/models/issues.coffee +++ b/server/sonar-web/src/main/coffee/issues/models/issues.coffee @@ -56,10 +56,12 @@ define [ if project _.extend issue, projectLongName: project.longName + projectUuid: project.uuid if subProject _.extend issue, subProjectLongName: subProject.longName + subProjectUuid: subProject.uuid if rule _.extend issue, diff --git a/server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee b/server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee index c9b10fbfab4..8c52c44898f 100644 --- a/server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee @@ -20,17 +20,32 @@ define [ 'issue/issue-view' + 'issues/issue-filter-view' + 'templates/issues' ], ( IssueView + IssueFilterView ) -> + $ = jQuery + + SHOULD_NULL = + resolutions: ['resolved'] + resolved: ['resolutions'] + assignees: ['assigned'] + assigned: ['assignees'] + actionPlans: ['planned'] + planned: ['actionPlans'] + class extends IssueView + filterTemplate: Templates['issues-issue-filter'] events: -> _.extend super, 'click': 'selectCurrent' 'dblclick': 'openComponentViewer' 'click .js-issue-navigate': 'openComponentViewer' + 'click .js-issue-filter': 'onIssueFilterClick' initialize: (options) -> @@ -41,9 +56,33 @@ define [ onRender: -> super @select() + @addFilterSelect() @$el.addClass 'issue-navigate-right' + onIssueFilterClick: (e) -> + e.preventDefault() + e.stopPropagation() + $('body').click() + @popup = new IssueFilterView + triggerEl: $(e.currentTarget) + bottomRight: true + model: @model + @popup.on 'select', (property, value) => + obj = {} + obj[property] = '' + value + if SHOULD_NULL[property]? + SHOULD_NULL[property].forEach (p) -> obj[p] = null + @options.app.state.updateFilter obj + @popup.close() + @popup.render() + + + + addFilterSelect: -> + @$('.issue-table-meta-cell-first').find('.issue-meta-list').append @filterTemplate @model.toJSON() + + select: -> selected = @model.get('index') == @options.app.state.get 'selectedIndex' @$el.toggleClass 'selected', selected diff --git a/server/sonar-web/src/main/hbs/issue/issue.hbs b/server/sonar-web/src/main/hbs/issue/issue.hbs index f9825f28342..0e63dcbdeed 100644 --- a/server/sonar-web/src/main/hbs/issue/issue.hbs +++ b/server/sonar-web/src/main/hbs/issue/issue.hbs @@ -6,7 +6,7 @@
{{message}}
- +
diff --git a/server/sonar-web/src/main/hbs/issues/issues-issue-filter-form.hbs b/server/sonar-web/src/main/hbs/issues/issues-issue-filter-form.hbs new file mode 100644 index 00000000000..f8f6f1d41fa --- /dev/null +++ b/server/sonar-web/src/main/hbs/issues/issues-issue-filter-form.hbs @@ -0,0 +1,72 @@ +
{{t 'issue.filter_similar_issues'}}
+ +
+ +
diff --git a/server/sonar-web/src/main/hbs/issues/issues-issue-filter.hbs b/server/sonar-web/src/main/hbs/issues/issues-issue-filter.hbs new file mode 100644 index 00000000000..875bc3bc4a5 --- /dev/null +++ b/server/sonar-web/src/main/hbs/issues/issues-issue-filter.hbs @@ -0,0 +1,5 @@ + diff --git a/server/sonar-web/src/main/hbs/issues/issues-workspace-list-item.hbs b/server/sonar-web/src/main/hbs/issues/issues-workspace-list-item.hbs deleted file mode 100644 index 51a7282857d..00000000000 --- a/server/sonar-web/src/main/hbs/issues/issues-workspace-list-item.hbs +++ /dev/null @@ -1,24 +0,0 @@ - - -{{#if source}} -
- - - {{#if scmAuthor}} - - {{/if}} - - - -
- {{scmDate}} - {{scmAuthor}} - {{line}}
{{{source}}}
-
-{{/if}} - -
diff --git a/server/sonar-web/src/main/js/common/handlebars-extensions.js b/server/sonar-web/src/main/js/common/handlebars-extensions.js index 260396cc73e..fd82874005a 100644 --- a/server/sonar-web/src/main/js/common/handlebars-extensions.js +++ b/server/sonar-web/src/main/js/common/handlebars-extensions.js @@ -491,4 +491,8 @@ return ret; }); + Handlebars.registerHelper('limitString', function (str) { + return str.substr(0, 30) + '...'; + }); + })(); diff --git a/server/sonar-web/src/main/less/init/icons.less b/server/sonar-web/src/main/less/init/icons.less index 2c1a113474c..ea0a9c63e04 100644 --- a/server/sonar-web/src/main/less/init/icons.less +++ b/server/sonar-web/src/main/less/init/icons.less @@ -23,11 +23,11 @@ @font-face { font-family: 'sonar'; - src:url('../fonts/sonar-5.1.eot?'); - src:url('../fonts/sonar-5.1.eot?#iefix') format('embedded-opentype'), - url('../fonts/sonar-5.1.woff?') format('woff'), - url('../fonts/sonar-5.1.ttf?') format('truetype'), - url('../fonts/sonar-5.1.svg?#sonar') format('svg'); + src:url('../fonts/sonar-5.2.eot?'); + src:url('../fonts/sonar-5.2.eot?#iefix') format('embedded-opentype'), + url('../fonts/sonar-5.2.woff?') format('woff'), + url('../fonts/sonar-5.2.ttf?') format('truetype'), + url('../fonts/sonar-5.2.svg?#sonar') format('svg'); font-weight: normal; font-style: normal; } @@ -581,6 +581,10 @@ a[class^="icon-"], a[class*=" icon-"] { content: "\f068"; font-size: @iconSmallFontSize; } +.icon-filter:before { + content: "\f0b0"; + font-size: @iconFontSize; +} .icon-issues { display: inline-block; .square(60px); diff --git a/server/sonar-web/src/main/webapp/fonts/sonar-5.1.eot b/server/sonar-web/src/main/webapp/fonts/sonar-5.2.eot similarity index 86% rename from server/sonar-web/src/main/webapp/fonts/sonar-5.1.eot rename to server/sonar-web/src/main/webapp/fonts/sonar-5.2.eot index 4e519106bb18b760d0798f1cbbc76088171c498a..2b2f832e8c809f68fe5c903af01cf5cc4ff4a55a 100755 GIT binary patch delta 439 zcmbQ!$=J}v$j0Exz!2jykBGvABSNfkA+Qfhhn; zbEM}~rZG9^TmkYU7#QpfGEx&$SdTyPVPJ6R0Lq(X00lUBSb~B4137&RF;Oy**81(JSD&eHw-_53yb+57?g?)im3sCxQAICvRl3nS6kWbMsrK8T!GDAS0QTm{l3XfR>1{GYX2Zvnea-Gpd;i zGOC%I87mrzGb?cl{(C0I!OqV$nd{#(AucWnrrQ!+%zWa4|DOMg0J69zaq}~ZF-i)G zi;FXCZZQhslhHVAI3u3l<|_j?3&_n37Y+R1!05?e9LyPmChIu<1=`CzS;Ogsp7<5q^z`$U8CnGg6g>|Aq7XyQX4p81K11P}3!x9AKrvUjX8M!4D5)-&2 zf&31jc`iBm$%%G1{GTx}IGzE@FUd`;C}2orG+E|Y_qoFwb`tNF9|{rTPaUHHxT zHTl)}dHGHNbuv!g$mG2FE7J`9%@2)&`DA){%}nC?ZN4&avw%!xxG3_C8%9qKa5QHO zoZR8~cXFrGaV?1^iBFPZl2(#&l1)+uQY}(9q}ilRq*uv^$Q+T~BF80{Aoq@e5vVzE JbDeV&BLD);Rto?C diff --git a/server/sonar-web/src/main/webapp/fonts/sonar-5.1.svg b/server/sonar-web/src/main/webapp/fonts/sonar-5.2.svg similarity index 99% rename from server/sonar-web/src/main/webapp/fonts/sonar-5.1.svg rename to server/sonar-web/src/main/webapp/fonts/sonar-5.2.svg index 3b377b7638f..972c3f3ee0c 100755 --- a/server/sonar-web/src/main/webapp/fonts/sonar-5.1.svg +++ b/server/sonar-web/src/main/webapp/fonts/sonar-5.2.svg @@ -65,6 +65,7 @@ + diff --git a/server/sonar-web/src/main/webapp/fonts/sonar-5.1.woff b/server/sonar-web/src/main/webapp/fonts/sonar-5.2.ttf similarity index 89% rename from server/sonar-web/src/main/webapp/fonts/sonar-5.1.woff rename to server/sonar-web/src/main/webapp/fonts/sonar-5.2.ttf index 1d1d8b90d544facb471b801ee4c64a0e1c937643..d4e65cacf9d053703305f179c8ef3bfdfb7a4ef2 100755 GIT binary patch delta 463 zcmX@o!FZ>Gv7UjEfq{XWp@D&!!N5OQ--us`Zxc{t4-h9L=Oz}&To!g=U|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6Nx5?Pm*GiR+4d&O;QF@EmAk6*`!URSILOT h9Fg53$0e5__YNGWfsA?#{9x0VfHn$mc6Lr>1OVRrSbG2f 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 98c670389f7..b8a8104addc 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -717,6 +717,7 @@ issue.technical_debt=Technical Debt: issue.technical_debt_short=Debt issue.technical_debt_deleted=Rule not configured to generate technical debt estimate. issue.creation_date=Created +issue.filter_similar_issues=Filter Similar Issues issues.return_to_list=Return to List issues.issues_limit_reached=For usability reasons, only the {0} issues are displayed. issues.home.recent_issues=Recent Issues -- 2.39.5