From 88812b02dcd3956ea66018ed87c27344d7796294 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 25 Nov 2014 13:38:16 +0100 Subject: [PATCH] SONAR-5718 Group issues by component --- .../issues/component-viewer/issue-view.coffee | 5 ++ .../main/coffee/issues/models/issues.coffee | 5 ++ .../issues/workspace-list-item-view.coffee | 8 ++- .../coffee/issues/workspace-list-view.coffee | 16 +++++ server/sonar-web/src/main/hbs/issue/issue.hbs | 26 +++---- .../issues-workspace-list-component.hbs | 13 ++++ .../src/main/less/components/issues.less | 67 ++++++++++++++++++- server/sonar-web/src/main/less/issues.less | 23 +++++-- 8 files changed, 137 insertions(+), 26 deletions(-) create mode 100644 server/sonar-web/src/main/hbs/issues/issues-workspace-list-component.hbs diff --git a/server/sonar-web/src/main/coffee/issues/component-viewer/issue-view.coffee b/server/sonar-web/src/main/coffee/issues/component-viewer/issue-view.coffee index f698b8905a3..da845fc1e45 100644 --- a/server/sonar-web/src/main/coffee/issues/component-viewer/issue-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/component-viewer/issue-view.coffee @@ -6,6 +6,11 @@ define [ class extends IssueView + onRender: -> + super + @$el.removeClass 'issue-navigate-right' + @$el.addClass 'issue-navigate-left' + serializeData: -> _.extend super, showComponent: false 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 e76b26266d2..b7fd33484e6 100644 --- a/server/sonar-web/src/main/coffee/issues/models/issues.coffee +++ b/server/sonar-web/src/main/coffee/issues/models/issues.coffee @@ -23,6 +23,7 @@ define [ r.issues.map (issue, index) -> component = find r.components, issue.component project = find r.projects, issue.project + subProject = find r.components, issue.subProject rule = find r.rules, issue.rule _.extend issue, @@ -37,6 +38,10 @@ define [ _.extend issue, projectLongName: project.longName + if subProject + _.extend issue, + subProjectLongName: subProject.longName + if rule _.extend issue, ruleName: rule.name 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 581d0e2b4da..92eb8d53625 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 @@ -10,7 +10,7 @@ define [ events: -> _.extend super, 'click': 'selectCurrent' - 'click .js-issue-line': 'openComponentViewer' + 'click .js-issue-navigate': 'openComponentViewer' initialize: (options) -> @@ -19,6 +19,7 @@ define [ onRender: -> super + @$el.addClass 'issue-navigate-right' @select() @@ -46,7 +47,10 @@ define [ openComponentViewer: -> @options.app.state.set selectedIndex: @model.get('index') - @options.app.controller.showComponentViewer @model + if @options.app.state.has 'component' + @options.app.controller.closeComponentViewer() + else + @options.app.controller.showComponentViewer @model serializeData: -> diff --git a/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee b/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee index a81c3c9329c..a6f78ab570c 100644 --- a/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee @@ -18,6 +18,7 @@ define [ class extends Marionette.CompositeView template: Templates['issues-workspace-list'] + componentTemplate: Templates['issues-workspace-list-component'] itemView: IssueView itemViewContainer: '.js-issues-list' emptyView: EmptyView @@ -133,3 +134,18 @@ define [ $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom + BOTTOM_OFFSET + appendHtml: (compositeView, itemView, index) -> + $container = this.getItemViewContainer compositeView + model = @collection.at(index) + if model? + prev = @collection.at(index - 1) + putComponent = !prev? + if prev? + fullComponent = [model.get('project'), model.get('component')].join ' ' + fullPrevComponent = [prev.get('project'), prev.get('component')].join ' ' + putComponent = true unless fullComponent == fullPrevComponent + if putComponent + $container.append @componentTemplate model.toJSON() + $container.append itemView.el + + diff --git a/server/sonar-web/src/main/hbs/issue/issue.hbs b/server/sonar-web/src/main/hbs/issue/issue.hbs index edbcd21507d..fe034506b7a 100644 --- a/server/sonar-web/src/main/hbs/issue/issue.hbs +++ b/server/sonar-web/src/main/hbs/issue/issue.hbs @@ -1,20 +1,5 @@
{{message}}
-{{#if showComponent}} -
- - -
-{{/if}} -
{{#inArray actions "set_severity"}} @@ -91,6 +76,12 @@ + + {{#if line}} +
+ L{{line}} +
+ {{/if}}
{{#notEmpty comments}} @@ -111,3 +102,8 @@ {{/each}}
{{/notEmpty}} + + + + + diff --git a/server/sonar-web/src/main/hbs/issues/issues-workspace-list-component.hbs b/server/sonar-web/src/main/hbs/issues/issues-workspace-list-component.hbs new file mode 100644 index 00000000000..d5d0b439952 --- /dev/null +++ b/server/sonar-web/src/main/hbs/issues/issues-workspace-list-component.hbs @@ -0,0 +1,13 @@ +
+ + {{qualifierIcon 'TRK'}} {{projectLongName}} + + {{#if subProject}} + + {{qualifierIcon 'TRK'}} {{subProjectLongName}} + + {{/if}} + + {{qualifierIcon componentQualifier}} {{componentLongName}} + +
diff --git a/server/sonar-web/src/main/less/components/issues.less b/server/sonar-web/src/main/less/components/issues.less index 2492e2e1847..63affdf0489 100644 --- a/server/sonar-web/src/main/less/components/issues.less +++ b/server/sonar-web/src/main/less/components/issues.less @@ -16,15 +16,14 @@ .issue { + position: relative; padding-top: @topPadding; padding-bottom: @bottomPadding; - border: 1px solid transparent; - border-left-width: 3px; background-color: @barBackgroundColor; } .issue.selected { - border-color: @blue !important; + background-color: #e4ecf3 !important; } .issue + .issue { @@ -93,6 +92,13 @@ margin-right: 10px; } +.issue-meta-in-corner { + position: absolute; + top: @topPadding; + right: @rightPadding; + margin: 0 !important; +} + .issue-meta-label { display: inline-block; vertical-align: top; @@ -230,3 +236,58 @@ input.issue-action-options-search { line-height: 1.5; font-size: @smallFontSize; } + +.issue-navigate { + display: none; + position: absolute; + width: 24px; + top: 0; + bottom: 0; + border-bottom: none; + + .issue-navigate-to-left, + .issue-navigate-to-right { + position: absolute; + top: 50%; + left: 50%; + margin: -8px 0 0 -3px; + + &:before { + font-size: 18px; + } + } + + &:hover { + background-color: rgba(0, 0, 0, 0.05); + } +} + +.issue-navigate-right .issue-meta-in-corner { + padding-right: 24px; +} + +.issue-navigate-left { + padding-left: 24px; + + .issue-navigate { + display: block; + left: 0; + + .issue-navigate-to-right { + display: none; + } + } +} + +.issue-navigate-right { + padding-right: 24px; + + .issue-navigate { + display: block; + right: 0; + + .issue-navigate-to-left { + display: none; + } + } +} diff --git a/server/sonar-web/src/main/less/issues.less b/server/sonar-web/src/main/less/issues.less index d1185e565a1..975fca43e82 100644 --- a/server/sonar-web/src/main/less/issues.less +++ b/server/sonar-web/src/main/less/issues.less @@ -291,12 +291,6 @@ .issues-workspace-list { padding: 0 5px; - - .issue { - padding-top: 20px; - padding-bottom: 20px; - background-color: #fff; - } } .issues-workspace-list-more { @@ -307,6 +301,23 @@ text-align: center; } +.issues-workspace-list-component { + line-height: 1.5; +} + +.issues-workspace-list-component + .issue { + margin-top: 10px; +} + +.issue + .issues-workspace-list-component { + margin-top: 25px; +} + +.issues-workspace-list-component-part { + margin-right: 10px; + border-bottom: none; +} + .issues-workspace-component-viewer { padding: 1px 10px; min-height: 100vh; -- 2.39.5