summaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-06-19 18:19:45 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-06-19 18:52:26 +0600
commit0699bd08464de1f080051ee93aff1d5a5c0cbead (patch)
treeb9a1ef47bb5d95fd53af411d6c9a8b15cddeb8c2 /sonar-server
parente6a79a3f8da7bd3351aade2e9fb8a4f57c9fabe6 (diff)
downloadsonarqube-0699bd08464de1f080051ee93aff1d5a5c0cbead.tar.gz
sonarqube-0699bd08464de1f080051ee93aff1d5a5c0cbead.zip
SONAR-5209 Handle corner cases
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee1
-rw-r--r--sonar-server/src/main/coffee/component-viewer/header.coffee5
-rw-r--r--sonar-server/src/main/coffee/component-viewer/main.coffee22
-rw-r--r--sonar-server/src/main/coffee/component-viewer/mixins/main-duplications.coffee1
-rw-r--r--sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee10
-rw-r--r--sonar-server/src/main/coffee/component-viewer/source.coffee3
-rw-r--r--sonar-server/src/main/coffee/component-viewer/utils.coffee2
-rw-r--r--sonar-server/src/main/hbs/component-viewer/header.hbs234
-rw-r--r--sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs48
-rw-r--r--sonar-server/src/main/hbs/component-viewer/header/duplications-header.hbs6
-rw-r--r--sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs85
-rw-r--r--sonar-server/src/main/hbs/component-viewer/source.hbs2
-rw-r--r--sonar-server/src/main/js/issues/extra.js2
-rw-r--r--sonar-server/src/main/less/component-viewer.less2
14 files changed, 253 insertions, 170 deletions
diff --git a/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee b/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee
index fbe48909ee2..01701107e8a 100644
--- a/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee
@@ -20,6 +20,7 @@ define [
showExtension: (e) ->
+ e.preventDefault()
key = $(e.currentTarget).data 'key'
@trigger 'extension', key
diff --git a/sonar-server/src/main/coffee/component-viewer/header.coffee b/sonar-server/src/main/coffee/component-viewer/header.coffee
index 729ee508649..13c3a40488f 100644
--- a/sonar-server/src/main/coffee/component-viewer/header.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/header.coffee
@@ -112,10 +112,11 @@ define [
showExtension: (key) ->
- @ui.expandedBar.html('<i class="spinner spinner-margin"></i>').addClass 'active'
+ bar = @ui.expandedBar
+ bar.html('<i class="spinner spinner-margin"></i>').addClass 'active'
@ui.expandLinks.removeClass 'active'
$.get API_EXTENSION, id: @options.main.component.get('key'), tab: key, (r) =>
- @ui.expandedBar.html r
+ bar.html r
closeExtension: ->
diff --git a/sonar-server/src/main/coffee/component-viewer/main.coffee b/sonar-server/src/main/coffee/component-viewer/main.coffee
index 7b38f0fb8a1..891acfbcf0f 100644
--- a/sonar-server/src/main/coffee/component-viewer/main.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/main.coffee
@@ -132,7 +132,8 @@ define [
# Component
@component.clear() if clear
COMPONENT_FIELDS.forEach (f) => @component.set f, data[f]
- @component.set 'dir', utils.splitLongName(data.path).dir
+ if data.path?
+ @component.set 'dir', utils.splitLongName(data.path).dir
@component.set 'isUnitTest', data.q == 'UTS'
@@ -217,15 +218,22 @@ define [
source = @requestSource key
component = @requestComponent key
@currentIssue = null
- $.when(source, component).done =>
+ component.done =>
@workspace.where(key: key).forEach (model) =>
model.set 'component': @component.toJSON()
+ @state.set 'removed', false
+ source.always =>
+ @state.set 'hasSource', (source.status != 404)
+ @render()
+ @showAllLines() if showFullSource
+ if @settings.get('issues') then @showIssues() else @hideIssues()
+ if @settings.get('coverage') then @showCoverage() else @hideCoverage()
+ if @settings.get('duplications') then @showDuplications() else @hideDuplications()
+ if @settings.get('scm') then @showSCM() else @hideSCM()
+ .fail =>
+ @state.set 'removed', true
+ @state.set 'hasSource', false
@render()
- @showAllLines() if showFullSource
- if @settings.get('issues') then @showIssues() else @hideIssues()
- if @settings.get('coverage') then @showCoverage() else @hideCoverage()
- if @settings.get('duplications') then @showDuplications() else @hideDuplications()
- if @settings.get('scm') then @showSCM() else @hideSCM()
toggleWorkspace: (store = false) ->
diff --git a/sonar-server/src/main/coffee/component-viewer/mixins/main-duplications.coffee b/sonar-server/src/main/coffee/component-viewer/mixins/main-duplications.coffee
index 15c651fc44d..7dbbe896c83 100644
--- a/sonar-server/src/main/coffee/component-viewer/mixins/main-duplications.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/mixins/main-duplications.coffee
@@ -18,6 +18,7 @@ define [], () ->
augmentWithDuplications: (duplications) ->
formattedSource = @source.get 'formattedSource'
+ return unless formattedSource
formattedSource.forEach (line) ->
lineDuplications = []
duplications.forEach (d, i) ->
diff --git a/sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee b/sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee
index b60f4ca27be..eb3fdcd007a 100644
--- a/sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee
@@ -61,7 +61,10 @@ define [
@sourceView.resetShowBlocks()
issues.forEach (issue) =>
line = issue.line || 0
- @sourceView.addShowBlock line - LINES_AROUND_ISSUE, line + LINES_AROUND_ISSUE, line == 0
+ if issue.resolution == 'FIXED' || issue.resolution == 'REMOVED'
+ @sourceView.addShowBlock 0, 0, true
+ else
+ @sourceView.addShowBlock line - LINES_AROUND_ISSUE, line + LINES_AROUND_ISSUE, line == 0
@sourceView.render()
@@ -86,7 +89,10 @@ define [
issues.forEach (issue) =>
if predicate issue
line = issue.line || 0
- @sourceView.addShowBlock line - LINES_AROUND_ISSUE, line + LINES_AROUND_ISSUE, line == 0
+ if issue.resolution == 'FIXED' || issue.resolution == 'REMOVED'
+ @sourceView.addShowBlock 0, 0, true
+ else
+ @sourceView.addShowBlock line - LINES_AROUND_ISSUE, line + LINES_AROUND_ISSUE, line == 0
activeIssues.push issue
@source.set 'activeIssues', activeIssues
@sourceView.render()
diff --git a/sonar-server/src/main/coffee/component-viewer/source.coffee b/sonar-server/src/main/coffee/component-viewer/source.coffee
index 2420985c1fc..7eae208323d 100644
--- a/sonar-server/src/main/coffee/component-viewer/source.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/source.coffee
@@ -37,7 +37,7 @@ define [
events:
'click .sym': 'highlightUsages'
- 'click .lid': 'highlightLine'
+ 'click .js-line-actions': 'highlightLine'
'click .coverage-tests': 'showCoveragePopup'
@@ -101,6 +101,7 @@ define [
issues = @model.get 'activeIssues'
issues.forEach (issue) =>
line = issue.line || 0
+ line = 0 if issue.resolution == 'FIXED' || issue.resolution == 'REMOVED'
row = @$("[data-line-number=#{line}]")
if row.length > 0
row.removeClass 'row-hidden'
diff --git a/sonar-server/src/main/coffee/component-viewer/utils.coffee b/sonar-server/src/main/coffee/component-viewer/utils.coffee
index d2bdb1f00bf..46d6379cf07 100644
--- a/sonar-server/src/main/coffee/component-viewer/utils.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/utils.coffee
@@ -2,6 +2,8 @@ define ->
splitLongName: (longName) ->
lastSeparator = longName.lastIndexOf '/'
+ if lastSeparator == -1
+ lastSeparator = longName.lastIndexOf '.'
dir: longName.substr 0, lastSeparator
name: longName.substr lastSeparator + 1
diff --git a/sonar-server/src/main/hbs/component-viewer/header.hbs b/sonar-server/src/main/hbs/component-viewer/header.hbs
index c1eaf500d2e..99a36d1fbdf 100644
--- a/sonar-server/src/main/hbs/component-viewer/header.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/header.hbs
@@ -1,139 +1,145 @@
<div class="component-viewer-header-bar">
<div class="component-viewer-header-component">
- {{#if component.projectName}}
- <div class="component-viewer-header-component-project">
- {{qualifierIcon 'TRK'}}
- <a class="link-action" href="{{dashboardUrl component.project}}">{{component.projectName}}</a>
- {{#if component.subProjectName}}
- / <a class="link-action" href="{{dashboardUrl component.subProject}}">{{component.subProjectName}}</a>
- {{/if}}
- </div>
- {{/if}}
-
- <div class="component-viewer-header-component-name">
- {{qualifierIcon component.q}} {{component.path}}
-
- {{#if state.canMarkAsFavourite}}
- <a class="js-favorite component-viewer-header-favorite"
- title="{{#if component.fav}}{{t 'click_to_remove_from_favorites'}}{{else}}{{t 'click_to_add_to_favorites'}}{{/if}}">
- <i class="{{#if component.fav}}icon-favorite{{else}}icon-not-favorite{{/if}}"></i>
- </a>
+ {{#unless state.removed}}
+ {{#if component.projectName}}
+ <div class="component-viewer-header-component-project">
+ {{qualifierIcon 'TRK'}}
+ <a class="link-action" href="{{dashboardUrl component.project}}">{{component.projectName}}</a>
+ {{#if component.subProjectName}}
+ / <a class="link-action" href="{{dashboardUrl component.subProject}}">{{component.subProjectName}}</a>
+ {{/if}}
+ </div>
{{/if}}
- </div>
- </div>
- <div class="component-viewer-header-links">
- <a><i class="icon-link"></i></a>
- {{#ifNotEmpty state.extensions}}
- <a class="js-extensions">
- <i class="icon-extension"></i>
- <i class="icon-dropdown"></i>
- </a>
- {{/ifNotEmpty}}
- </div>
+ <div class="component-viewer-header-component-name">
+ {{qualifierIcon component.q}} {{default component.path component.name}}
- <div class="component-viewer-header-measures">
- {{#if component.isUnitTest}}
- <div class="component-viewer-header-measures-scope">
- <a data-scope="tests" class="component-viewer-header-measures-expand">
- <div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{component.measures.fTests}}</span>
- <span class="component-viewer-header-measure-label">{{t 'metric.tests.name'}}</span>
- </div>
- <i class="icon-dropdown"></i>
- </a>
+ {{#if state.canMarkAsFavourite}}
+ <a class="js-favorite component-viewer-header-favorite"
+ title="{{#if component.fav}}{{t 'click_to_remove_from_favorites'}}{{else}}{{t 'click_to_add_to_favorites'}}{{/if}}">
+ <i class="{{#if component.fav}}icon-favorite{{else}}icon-not-favorite{{/if}}"></i>
+ </a>
+ {{/if}}
</div>
- {{/if}}
+ {{else}}
+ <div class="component-viewer-header-component-project removed">Removed</div>
+ {{/unless}}
+ </div>
- {{#unless component.isUnitTest}}
- <div class="component-viewer-header-measures-scope">
- <span data-scope="basic" class="js-toggle-coverage component-viewer-header-measures-toggle-scope inactive"></span>
- <a data-scope="basic" class="component-viewer-header-measures-expand">
- <div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{default component.measures.fNcloc '–'}}</span>
- <span class="component-viewer-header-measure-label">{{t 'metric.ncloc.name'}}</span>
- </div>
+ {{#unless state.removed}}
+ <div class="component-viewer-header-links">
+ <a><i class="icon-link"></i></a>
+ {{#ifNotEmpty state.extensions}}
+ <a class="js-extensions">
+ <i class="icon-extension"></i>
<i class="icon-dropdown"></i>
</a>
- </div>
- {{/unless}}
+ {{/ifNotEmpty}}
+ </div>
- <div class="component-viewer-header-measures-scope">
- <a data-scope="issues" class="component-viewer-header-measures-expand">
- <div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{default component.measures.fDebt '–'}}</span>
- <span class="component-viewer-header-measure-label">{{t 'component_viewer.header.debt'}}</span>
- </div>
- {{#if component.measures.fIssues}}
- <div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{component.measures.fIssues}}</span>
- <span class="component-viewer-header-measure-label">{{t 'metric.violations.name'}}</span>
- </div>
- {{/if}}
- {{#if component.measures.fIssues}}
- <div class="component-viewer-header-measure">
- <div class="component-viewer-header-measure-issues">
- <div class="component-viewer-header-measure-issue s-blocker"
- style="width: {{percent component.measures.fBlockerIssues component.measures.maxIssues}};"></div>
- <div class="component-viewer-header-measure-issue s-critical"
- style="width: {{percent component.measures.fCriticalIssues component.measures.maxIssues}};"></div>
- <div class="component-viewer-header-measure-issue s-major"
- style="width: {{percent component.measures.fMajorIssues component.measures.maxIssues}};"></div>
- <div class="component-viewer-header-measure-issue s-minor"
- style="width: {{percent component.measures.fMinorIssues component.measures.maxIssues}};"></div>
- <div class="component-viewer-header-measure-issue s-info"
- style="width: {{percent component.measures.fInfoIssues component.measures.maxIssues}};"></div>
+ <div class="component-viewer-header-measures">
+ {{#if component.isUnitTest}}
+ <div class="component-viewer-header-measures-scope">
+ <a data-scope="tests" class="component-viewer-header-measures-expand">
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value">{{component.measures.fTests}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'metric.tests.name'}}</span>
</div>
- </div>
- {{/if}}
- <i class="icon-dropdown"></i>
- </a>
- <a data-scope="issues" title="{{t 'component_viewer.header.toggle_issues'}}"
- class="js-toggle-issues component-viewer-header-measures-toggle-scope {{#if settings.issues}}active{{/if}}"></a>
- </div>
+ <i class="icon-dropdown"></i>
+ </a>
+ </div>
+ {{/if}}
- {{#inArray state.tabs 'coverage'}}
- <div class="component-viewer-header-measures-scope">
- <a data-scope="coverage" class="component-viewer-header-measures-expand">
+ {{#unless component.isUnitTest}}
+ <div class="component-viewer-header-measures-scope">
+ <span data-scope="basic" class="js-toggle-coverage component-viewer-header-measures-toggle-scope inactive"></span>
+ <a data-scope="basic" class="component-viewer-header-measures-expand">
<div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{default component.measures.fCoverage '–'}}</span>
- <span class="component-viewer-header-measure-label">{{t 'metric.coverage.name'}}</span>
+ <span class="component-viewer-header-measure-value">{{default component.measures.fNcloc '–'}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'metric.ncloc.name'}}</span>
</div>
- <i class="icon-dropdown"></i>
- </a>
- <a data-scope="coverage" title="{{t 'component_viewer.header.toggle_coverage'}}"
- class="js-toggle-coverage component-viewer-header-measures-toggle-scope {{#if settings.coverage}}active{{/if}}"></a>
- </div>
- {{/inArray}}
+ <i class="icon-dropdown"></i>
+ </a>
+ </div>
+ {{/unless}}
- {{#inArray state.tabs 'duplications'}}
<div class="component-viewer-header-measures-scope">
- <a data-scope="duplications" class="component-viewer-header-measures-expand">
+ <a data-scope="issues" class="component-viewer-header-measures-expand">
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value">{{default component.measures.fDebt '–'}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'component_viewer.header.debt'}}</span>
+ </div>
+ {{#if component.measures.fIssues}}
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value">{{component.measures.fIssues}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'metric.violations.name'}}</span>
+ </div>
+ {{/if}}
+ {{#if component.measures.fIssues}}
<div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value">{{default component.measures.fDuplicationDensity '–'}}</span>
- <span class="component-viewer-header-measure-label">{{t 'metric.duplicated_lines_density.name'}}</span>
+ <div class="component-viewer-header-measure-issues">
+ <div class="component-viewer-header-measure-issue s-blocker"
+ style="width: {{percent component.measures.fBlockerIssues component.measures.maxIssues}};"></div>
+ <div class="component-viewer-header-measure-issue s-critical"
+ style="width: {{percent component.measures.fCriticalIssues component.measures.maxIssues}};"></div>
+ <div class="component-viewer-header-measure-issue s-major"
+ style="width: {{percent component.measures.fMajorIssues component.measures.maxIssues}};"></div>
+ <div class="component-viewer-header-measure-issue s-minor"
+ style="width: {{percent component.measures.fMinorIssues component.measures.maxIssues}};"></div>
+ <div class="component-viewer-header-measure-issue s-info"
+ style="width: {{percent component.measures.fInfoIssues component.measures.maxIssues}};"></div>
+ </div>
</div>
+ {{/if}}
<i class="icon-dropdown"></i>
</a>
- <a data-scope="duplications" title="{{t 'component_viewer.header.toggle_duplications'}}"
- class="js-toggle-duplications component-viewer-header-measures-toggle-scope {{#if settings.duplications}}active{{/if}}"></a>
+ <a data-scope="issues" title="{{t 'component_viewer.header.toggle_issues'}}"
+ class="js-toggle-issues component-viewer-header-measures-toggle-scope {{#if settings.issues}}active{{/if}}"></a>
</div>
- {{/inArray}}
- {{#inArray state.tabs 'scm'}}
- <div class="component-viewer-header-measures-scope">
- <a data-scope="scm" class="component-viewer-header-measures-expand">
- <div class="component-viewer-header-measure">
- <span class="component-viewer-header-measure-value"><i class="icon-calendar"></i></span>
- <span class="component-viewer-header-measure-label">SCM</span>
- </div>
- <i class="icon-dropdown"></i>
- </a>
- <a data-scope="scm" title="{{t 'component_viewer.header.toggle_scm'}}"
- class="js-toggle-scm component-viewer-header-measures-toggle-scope {{#if settings.scm}}active{{/if}}"></a>
- </div>
- {{/inArray}}
- </div>
+ {{#inArray state.tabs 'coverage'}}
+ <div class="component-viewer-header-measures-scope">
+ <a data-scope="coverage" class="component-viewer-header-measures-expand">
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value">{{default component.measures.fCoverage '–'}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'metric.coverage.name'}}</span>
+ </div>
+ <i class="icon-dropdown"></i>
+ </a>
+ <a data-scope="coverage" title="{{t 'component_viewer.header.toggle_coverage'}}"
+ class="js-toggle-coverage component-viewer-header-measures-toggle-scope {{#if settings.coverage}}active{{/if}}"></a>
+ </div>
+ {{/inArray}}
+
+ {{#inArray state.tabs 'duplications'}}
+ <div class="component-viewer-header-measures-scope">
+ <a data-scope="duplications" class="component-viewer-header-measures-expand">
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value">{{default component.measures.fDuplicationDensity '–'}}</span>
+ <span class="component-viewer-header-measure-label">{{t 'metric.duplicated_lines_density.name'}}</span>
+ </div>
+ <i class="icon-dropdown"></i>
+ </a>
+ <a data-scope="duplications" title="{{t 'component_viewer.header.toggle_duplications'}}"
+ class="js-toggle-duplications component-viewer-header-measures-toggle-scope {{#if settings.duplications}}active{{/if}}"></a>
+ </div>
+ {{/inArray}}
+
+ {{#inArray state.tabs 'scm'}}
+ <div class="component-viewer-header-measures-scope">
+ <a data-scope="scm" class="component-viewer-header-measures-expand">
+ <div class="component-viewer-header-measure">
+ <span class="component-viewer-header-measure-value"><i class="icon-calendar"></i></span>
+ <span class="component-viewer-header-measure-label">SCM</span>
+ </div>
+ <i class="icon-dropdown"></i>
+ </a>
+ <a data-scope="scm" title="{{t 'component_viewer.header.toggle_scm'}}"
+ class="js-toggle-scm component-viewer-header-measures-toggle-scope {{#if settings.scm}}active{{/if}}"></a>
+ </div>
+ {{/inArray}}
+ </div>
+ {{/unless}}
</div>
<div class="component-viewer-header-expanded-bar"></div> \ No newline at end of file
diff --git a/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs
index f2b084d9c2b..f43fcf32b12 100644
--- a/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs
@@ -1,8 +1,10 @@
-<div class="component-viewer-header-time-changes">
- <a class="highlighted-link js-coverage-time-changes">
- {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}}
- </a>
-</div>
+{{#if state.hasSource}}
+ <div class="component-viewer-header-time-changes">
+ <a class="highlighted-link js-coverage-time-changes">
+ {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}}
+ </a>
+ </div>
+{{/if}}
{{#with component.measures}}
{{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines branch_coverage conditions_to_cover covered_conditions uncovered_conditions it_coverage it_line_coverage it_lines_to_cover it_covered_lines it_uncovered_lines it_branch_coverage it_conditions_to_cover it_covered_conditions it_uncovered_conditions}}
@@ -22,8 +24,13 @@
<ul class="component-viewer-header-expanded-bar-section-list">
{{{componentViewerHeaderItem coverage 'coverage'}}}
{{{componentViewerHeaderItem line_coverage 'line_coverage'}}}
- {{{componentViewerHeaderLink lines_to_cover 'lines_to_cover' 'js-filter-lines-to-cover'}}}
- {{{componentViewerHeaderLink uncovered_lines 'uncovered_lines' 'js-filter-uncovered-lines'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink lines_to_cover 'lines_to_cover' 'js-filter-lines-to-cover'}}}
+ {{{componentViewerHeaderLink uncovered_lines 'uncovered_lines' 'js-filter-uncovered-lines'}}}
+ {{else}}
+ {{{componentViewerHeaderItem lines_to_cover 'lines_to_cover'}}}
+ {{{componentViewerHeaderItem uncovered_lines 'uncovered_lines'}}}
+ {{/if}}
</ul>
</div>
{{/any}}
@@ -42,8 +49,13 @@
<li><span class="item">&nbsp;</span></li>
{{/any}}
{{{componentViewerHeaderItem branch_coverage 'branch_coverage'}}}
- {{{componentViewerHeaderLink conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover'}}}
- {{{componentViewerHeaderLink uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover'}}}
+ {{{componentViewerHeaderLink uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches'}}}
+ {{else}}
+ {{{componentViewerHeaderItem conditions_to_cover 'conditions_to_cover'}}}
+ {{{componentViewerHeaderItem uncovered_conditions 'uncovered_conditions'}}}
+ {{/if}}
</ul>
</div>
{{/any}}
@@ -58,8 +70,13 @@
<ul class="component-viewer-header-expanded-bar-section-list">
{{{componentViewerHeaderItem it_coverage 'coverage'}}}
{{{componentViewerHeaderItem it_line_coverage 'line_coverage'}}}
- {{{componentViewerHeaderLink it_lines_to_cover 'lines_to_cover' 'js-filter-lines-to-cover-it'}}}
- {{{componentViewerHeaderLink it_uncovered_lines 'uncovered_lines' 'js-filter-uncovered-lines-it'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink it_lines_to_cover 'lines_to_cover' 'js-filter-lines-to-cover-it'}}}
+ {{{componentViewerHeaderLink it_uncovered_lines 'uncovered_lines' 'js-filter-uncovered-lines-it'}}}
+ {{else}}
+ {{{componentViewerHeaderItem it_lines_to_cover 'lines_to_cover'}}}
+ {{{componentViewerHeaderItem it_uncovered_lines 'uncovered_lines'}}}
+ {{/if}}
</ul>
</div>
{{/any}}
@@ -78,8 +95,13 @@
<li><span class="item">&nbsp;</span></li>
{{/any}}
{{{componentViewerHeaderItem it_branch_coverage 'branch_coverage'}}}
- {{{componentViewerHeaderLink it_conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover-it'}}}
- {{{componentViewerHeaderLink it_uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches-it'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink it_conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover-it'}}}
+ {{{componentViewerHeaderLink it_uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches-it'}}}
+ {{else}}
+ {{{componentViewerHeaderItem it_conditions_to_cover 'conditions_to_cover'}}}
+ {{{componentViewerHeaderItem it_uncovered_conditions 'uncovered_conditions'}}}
+ {{/if}}
</ul>
</div>
{{/any}}
diff --git a/sonar-server/src/main/hbs/component-viewer/header/duplications-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/duplications-header.hbs
index b0ffccc3a57..f6f599f97fe 100644
--- a/sonar-server/src/main/hbs/component-viewer/header/duplications-header.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/header/duplications-header.hbs
@@ -2,7 +2,11 @@
<div class="component-viewer-header-expanded-bar-section">
<div class="component-viewer-header-expanded-bar-section-title">{{t 'duplications'}}</div>
<ul class="component-viewer-header-expanded-bar-section-list">
- {{{componentViewerHeaderLink duplicated_blocks 'duplicated_blocks' 'js-filter-duplications'}}}
+ {{#if ../state.hasSource}}
+ {{{componentViewerHeaderLink duplicated_blocks 'duplicated_blocks' 'js-filter-duplications'}}}
+ {{else}}
+ {{{componentViewerHeaderItem duplicated_blocks 'duplicated_blocks'}}}
+ {{/if}}
{{{componentViewerHeaderItem duplicated_lines 'duplicated_lines'}}}
</ul>
</div>
diff --git a/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs
index 3a6236b6779..adf29fcb868 100644
--- a/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs
@@ -1,8 +1,10 @@
-<div class="component-viewer-header-time-changes">
- <a class="highlighted-link js-issues-time-changes">
- {{#if period}}{{t 'component_viewer.added'}} {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}}
- </a>
-</div>
+{{#if state.hasSource}}
+ <div class="component-viewer-header-time-changes">
+ <a class="highlighted-link js-issues-time-changes">
+ {{#if period}}{{t 'component_viewer.added'}} {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}}
+ </a>
+ </div>
+{{/if}}
{{#ifNotEmpty state.severities}}
<div class="component-viewer-header-expanded-bar-section">
@@ -11,11 +13,18 @@
</div>
<ul class="component-viewer-header-expanded-bar-section-list">
{{#each state.severities}}
- <li><a class="item js-filter-{{key}}-issues">
- <span>{{severityIcon key}} {{name}}</span>
- <span class="number">{{count}}</span>
- <i class="icon-chevron-right"></i>
- </a></li>
+ {{#if ../../state.hasSource}}
+ <li><a class="item js-filter-{{key}}-issues">
+ <span>{{severityIcon key}} {{name}}</span>
+ <span class="number">{{count}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ {{else}}
+ <li><span class="item">
+ <span>{{severityIcon key}} {{name}}</span>
+ <span class="number">{{count}}</span>
+ </span></li>
+ {{/if}}
{{/each}}
</ul>
</div>
@@ -28,11 +37,18 @@
</div>
<ul class="component-viewer-header-expanded-bar-section-list">
{{#each state.rules}}
- <li><a class="item js-filter-rule" data-rule="{{key}}" title="{{name}}">
- <span>{{name}}</span>
- <span class="number">{{count}}</span>
- <i class="icon-chevron-right"></i>
- </a></li>
+ {{#if ../../state.hasSource}}
+ <li><a class="item js-filter-rule" data-rule="{{key}}" title="{{name}}">
+ <span>{{name}}</span>
+ <span class="number">{{count}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ {{else}}
+ <li><span class="item">
+ <span>{{name}}</span>
+ <span class="number">{{count}}</span>
+ </span></li>
+ {{/if}}
{{/each}}
</ul>
</div>
@@ -49,19 +65,32 @@
<i class="icon-chevron-right"></i>
</a></li>
{{/if}}
- <li><a class="item js-filter-unresolved-issues">
- <span>{{t 'component_viewer.issues.unresolved_issues'}}</span>
- <i class="icon-chevron-right"></i>
- </a></li>
- <li><a class="item js-filter-fixed-issues">
- <span>{{t 'component_viewer.issues.fixed_issues'}}</span>
- <i class="icon-chevron-right"></i>
- </a></li>
- <li><a class="item js-filter-false-positive-issues">
- <span>{{t 'component_viewer.issues.false_positive_issues'}}</span>
- <span class="number">{{component.measures.false_positive_issues}}</span>
- <i class="icon-chevron-right"></i>
- </a></li>
+ {{#if state.hasSource}}
+ <li><a class="item js-filter-unresolved-issues">
+ <span>{{t 'component_viewer.issues.unresolved_issues'}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ {{/if}}
+ {{#if state.hasSource}}
+ <li><a class="item js-filter-fixed-issues">
+ <span>{{t 'component_viewer.issues.fixed_issues'}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ {{/if}}
+ {{#if state.hasSource}}
+ <li><a class="item js-filter-false-positive-issues">
+ <span>{{t 'component_viewer.issues.false_positive_issues'}}</span>
+ <span class="number">{{component.measures.false_positive_issues}}</span>
+ <i class="icon-chevron-right"></i>
+ </a></li>
+ {{else}}
+ {{#if component.measures.false_positive_issues}}
+ <li><span class="item">
+ <span>{{t 'component_viewer.issues.false_positive_issues'}}</span>
+ <span class="number">{{component.measures.false_positive_issues}}</span>
+ </span></li>
+ {{/if}}
+ {{/if}}
</ul>
</div>
diff --git a/sonar-server/src/main/hbs/component-viewer/source.hbs b/sonar-server/src/main/hbs/component-viewer/source.hbs
index 25d0a4e3e3d..ba9fc1444ec 100644
--- a/sonar-server/src/main/hbs/component-viewer/source.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/source.hbs
@@ -60,7 +60,7 @@
</td>
{{/if}}
- <td class="stat lid">{{lineNumber}}</td>
+ <td class="stat lid js-line-actions">{{lineNumber}}</td>
<td class="line"><pre>{{{code}}}</pre></td>
</tr>
diff --git a/sonar-server/src/main/js/issues/extra.js b/sonar-server/src/main/js/issues/extra.js
index bd1be25048a..073a8122876 100644
--- a/sonar-server/src/main/js/issues/extra.js
+++ b/sonar-server/src/main/js/issues/extra.js
@@ -156,7 +156,7 @@ define(
jQuery('.navigator-details').removeClass('navigator-fetching');
app.detailsRegion.show(componentViewer);
componentViewer.settings.set('issues', false);
- componentViewer.open(that.model.get('component')).done(function() {
+ componentViewer.open(that.model.get('component')).always(function() {
componentViewer.showIssues(false, that.model.toJSON());
});
};
diff --git a/sonar-server/src/main/less/component-viewer.less b/sonar-server/src/main/less/component-viewer.less
index b90034eba1b..0a6c4d8fcc3 100644
--- a/sonar-server/src/main/less/component-viewer.less
+++ b/sonar-server/src/main/less/component-viewer.less
@@ -332,6 +332,8 @@
.component-viewer-header-component-project {
color: #777;
font-size: @smallFontSize;
+
+ &.removed { text-decoration: line-through; }
}
.component-viewer-header-component-name {