aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-11-25 13:38:16 +0100
committerStas Vilchik <vilchiks@gmail.com>2014-11-25 14:20:24 +0100
commit88812b02dcd3956ea66018ed87c27344d7796294 (patch)
treed21b47f9a497b01ab57d595d2ef24802879399e1 /server/sonar-web
parentdb28a02df42984e29ffaf12153e885ce6460500a (diff)
downloadsonarqube-88812b02dcd3956ea66018ed87c27344d7796294.tar.gz
sonarqube-88812b02dcd3956ea66018ed87c27344d7796294.zip
SONAR-5718 Group issues by component
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/coffee/issues/component-viewer/issue-view.coffee5
-rw-r--r--server/sonar-web/src/main/coffee/issues/models/issues.coffee5
-rw-r--r--server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee8
-rw-r--r--server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee16
-rw-r--r--server/sonar-web/src/main/hbs/issue/issue.hbs26
-rw-r--r--server/sonar-web/src/main/hbs/issues/issues-workspace-list-component.hbs13
-rw-r--r--server/sonar-web/src/main/less/components/issues.less67
-rw-r--r--server/sonar-web/src/main/less/issues.less23
8 files changed, 137 insertions, 26 deletions
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 @@
<div class="issue-message">{{message}}</div>
-{{#if showComponent}}
- <div class="issue-meta-list">
- <div class="issue-meta">
- <a class="issue-action" href="{{dashboardUrl project}}">
- {{qualifierIcon 'TRK'}} {{default projectLongName projectName}}
- </a>
- </div>
- <div class="issue-meta">
- <a class="issue-action js-issue-line">
- {{qualifierIcon componentQualifier}} {{componentLongName}}{{#if line}} (L{{line}}){{/if}}
- </a>
- </div>
- </div>
-{{/if}}
-
<div class="issue-meta-list">
<div class="issue-meta">
{{#inArray actions "set_severity"}}
@@ -91,6 +76,12 @@
<div class="issue-meta issue-meta-on-right">
<a class="issue-action js-issue-rule">Rule</a>
</div>
+
+ {{#if line}}
+ <div class="issue-meta issue-meta-in-corner">
+ <span class="issue-meta-label">L{{line}}</span>
+ </div>
+ {{/if}}
</div>
{{#notEmpty comments}}
@@ -111,3 +102,8 @@
{{/each}}
</div>
{{/notEmpty}}
+
+<a class="issue-navigate js-issue-navigate">
+ <i class="issue-navigate-to-left icon-chevron-left"></i>
+ <i class="issue-navigate-to-right icon-chevron-right"></i>
+</a>
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 @@
+<div class="issues-workspace-list-component">
+ <a class="issues-workspace-list-component-part" href="{{dashboardUrl project}}">
+ {{qualifierIcon 'TRK'}}&nbsp;{{projectLongName}}
+ </a>
+ {{#if subProject}}
+ <a class="issues-workspace-list-component-part" href="{{dashboardUrl subProject}}">
+ {{qualifierIcon 'TRK'}}&nbsp;{{subProjectLongName}}
+ </a>
+ {{/if}}
+ <a class="issues-workspace-list-component-part" href="{{dashboardUrl component}}">
+ {{qualifierIcon componentQualifier}}&nbsp;{{componentLongName}}
+ </a>
+</div>
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;