summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-06-26 12:04:17 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-06-26 12:04:17 +0600
commitc99cbb7754882e23f461833bc1c0ed4010ac510c (patch)
treea49727d990a1b811092eb83f394dc1836c3d458a
parent340836f19edd1b89f2079107caa53877f70269bb (diff)
downloadsonarqube-c99cbb7754882e23f461833bc1c0ed4010ac510c.tar.gz
sonarqube-c99cbb7754882e23f461833bc1c0ed4010ac510c.zip
SONAR-5209 Permalink feedback
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
-rw-r--r--sonar-server/src/main/coffee/component-viewer/app.coffee6
-rw-r--r--sonar-server/src/main/coffee/component-viewer/header.coffee6
-rw-r--r--sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee9
-rw-r--r--sonar-server/src/main/coffee/component-viewer/source.coffee1
-rw-r--r--sonar-server/src/main/hbs/component-viewer/line-options-popup.hbs8
-rw-r--r--sonar-server/src/main/hbs/component-viewer/source.hbs6
7 files changed, 31 insertions, 6 deletions
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 d3a8c178e74..93e5f0f0b79 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2663,6 +2663,7 @@ component_viewer.show_full_source=Show full source
component_viewer.show_raw_source=Show raw source
component_viewer.more_actions=More actions
component_viewer.new_window=Open in new window
+component_viewer.get_permalink=Get Permalink
component_viewer.workspace=Workspace
component_viewer.workspace.tooltip=Keeps track of history of navigation
diff --git a/sonar-server/src/main/coffee/component-viewer/app.coffee b/sonar-server/src/main/coffee/component-viewer/app.coffee
index 7b3e11fd674..030b538f6d9 100644
--- a/sonar-server/src/main/coffee/component-viewer/app.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/app.coffee
@@ -65,6 +65,12 @@ requirejs [
viewer.off 'sized'
viewer.scrollToLine params.line
+ if params.blocks?
+ blocks = params.blocks.split(';').map (b) ->
+ t = b.split ','
+ from: +t[0], to: +t[1]
+ viewer.on 'resetShowBlocks', -> viewer.sourceView.showBlocks = blocks
+
viewer.open params.component
viewer.on 'loaded', ->
diff --git a/sonar-server/src/main/coffee/component-viewer/header.coffee b/sonar-server/src/main/coffee/component-viewer/header.coffee
index 5ded3d82d61..6889b2a66e3 100644
--- a/sonar-server/src/main/coffee/component-viewer/header.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/header.coffee
@@ -207,12 +207,18 @@ define [
method.call @options.main, extra
+ serializeShowBlocks: ->
+ blocks = @options.main.sourceView.showBlocks.map (b) -> "#{b.from},#{b.to}"
+ blocks.join ';'
+
+
getPermalink: ->
params = []
params.push key: 'component', value: @options.main.component.get 'key'
settings = []
_.map @options.main.settings.toJSON(), (v, k) -> settings.push k if v
params.push key: 'settings', value: settings.join ','
+ params.push key: 'blocks', value: @serializeShowBlocks()
activeHeaderTab = @state.get 'activeHeaderTab'
if activeHeaderTab
params.push key: 'tab', value: activeHeaderTab
diff --git a/sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee b/sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee
index 652e0dc679c..303fe28b1e5 100644
--- a/sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee
@@ -18,9 +18,15 @@ define [
events:
+ 'click .js-get-permalink': 'getPermalink'
'click .js-add-manual-issue': 'addManualIssue'
+ getPermalink: (e) ->
+ e.preventDefault()
+ @options.main.headerView.getPermalink()
+
+
addManualIssue: (e) ->
e.preventDefault()
line = @options.row.data 'line-number'
@@ -42,3 +48,6 @@ define [
@options.main.sourceView.render()
+ serializeData: ->
+ _.extend super,
+ state: @options.main.state.toJSON()
diff --git a/sonar-server/src/main/coffee/component-viewer/source.coffee b/sonar-server/src/main/coffee/component-viewer/source.coffee
index 37dec376836..9b15f4e6276 100644
--- a/sonar-server/src/main/coffee/component-viewer/source.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/source.coffee
@@ -58,6 +58,7 @@ define [
resetShowBlocks: ->
@showBlocks = []
+ @options.main.trigger 'resetShowBlocks'
addShowBlock: (from, to, forceIncludeZero = false) ->
diff --git a/sonar-server/src/main/hbs/component-viewer/line-options-popup.hbs b/sonar-server/src/main/hbs/component-viewer/line-options-popup.hbs
index eccd2e20a09..04e4e6c6457 100644
--- a/sonar-server/src/main/hbs/component-viewer/line-options-popup.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/line-options-popup.hbs
@@ -2,8 +2,14 @@
<div class="component-viewer-popup-title">{{t 'component_viewer.line_actions'}}</div>
<div class="component-viewer-popup-section">
- <a href="#" class="js-add-manual-issue link-action">{{t 'component_viewer.add_manual_issue'}}</a>
+ <a href="#" class="js-get-permalink link-action">{{t 'component_viewer.get_permalink'}}</a>
</div>
+
+ {{#if state.canCreateManualIssue}}
+ <div class="component-viewer-popup-section">
+ <a href="#" class="js-add-manual-issue link-action">{{t 'component_viewer.add_manual_issue'}}</a>
+ </div>
+ {{/if}}
</div>
<div class="component-viewer-popup-arrow"></div> \ No newline at end of file
diff --git a/sonar-server/src/main/hbs/component-viewer/source.hbs b/sonar-server/src/main/hbs/component-viewer/source.hbs
index a0ae95fe133..f033fb4d582 100644
--- a/sonar-server/src/main/hbs/component-viewer/source.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/source.hbs
@@ -66,11 +66,7 @@
</td>
{{/if}}
- {{#if ../../state.canCreateManualIssue}}
- <td class="stat lid js-line-actions" title="{{t 'component_viewer.line_actions'}}">{{lineNumber}}</td>
- {{else}}
- <td class="stat lid js-line-actions">{{lineNumber}}</td>
- {{/if}}
+ <td class="stat lid js-line-actions" title="{{t 'component_viewer.line_actions'}}">{{lineNumber}}</td>
<td class="line"><pre>{{{code}}}</pre></td>
</tr>