aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-06-19 11:54:50 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-06-19 11:54:50 +0600
commitb373de2d0cc912708315b2ce45b6b48e9bda6849 (patch)
treed9fcc8cd3629153c1d0867e7f017c326d0449b2a /sonar-server/src/main
parentfdfa664d0e54fc56a3f86de41d30d3437cbbc1c0 (diff)
downloadsonarqube-b373de2d0cc912708315b2ce45b6b48e9bda6849.tar.gz
sonarqube-b373de2d0cc912708315b2ce45b6b48e9bda6849.zip
SONAR-5209 Add ability to create manual issues
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee1
-rw-r--r--sonar-server/src/main/coffee/component-viewer/main.coffee2
-rw-r--r--sonar-server/src/main/coffee/component-viewer/source.coffee2
-rw-r--r--sonar-server/src/main/coffee/issues/manual-issue-view.coffee1
-rw-r--r--sonar-server/src/main/hbs/issues/manual-issue.hbs9
5 files changed, 7 insertions, 8 deletions
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 156ef178544..652e0dc679c 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
@@ -28,6 +28,7 @@ define [
manualIssueView = new ManualIssueView
line: line
component: component
+ rules: @options.main.state.get 'manual_rules'
manualIssueView.render().$el.appendTo @options.row.find('.line')
manualIssueView.on 'add', (issue) =>
issues = @options.main.source.get('issues') || []
diff --git a/sonar-server/src/main/coffee/component-viewer/main.coffee b/sonar-server/src/main/coffee/component-viewer/main.coffee
index 088a8878c19..68a95f0f34c 100644
--- a/sonar-server/src/main/coffee/component-viewer/main.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/main.coffee
@@ -123,7 +123,7 @@ define [
requestComponent: (key, clear = false, full = true) ->
- STATE_FIELDS = ['canBulkChange', 'canMarkAsFavourite', 'tabs']
+ STATE_FIELDS = ['canBulkChange', 'canMarkAsFavourite', 'canCreateManualIssue', 'tabs', 'manual_rules']
COMPONENT_FIELDS = ['key', 'name', 'path', 'q', 'projectName', 'subProjectName', 'measures', 'fav']
$.get API_COMPONENT, key: key, (data) =>
diff --git a/sonar-server/src/main/coffee/component-viewer/source.coffee b/sonar-server/src/main/coffee/component-viewer/source.coffee
index 7d2070fc09f..2420985c1fc 100644
--- a/sonar-server/src/main/coffee/component-viewer/source.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/source.coffee
@@ -132,7 +132,7 @@ define [
row = $(e.currentTarget).closest('.row')
row.addClass HIGHLIGHTED_ROW_CLASS
@highlightedLine = row.data 'line-number'
- @showLineActionsPopup(e)
+ @showLineActionsPopup(e) if @options.main.state.get 'canCreateManualIssue'
highlightCurrentLine: ->
diff --git a/sonar-server/src/main/coffee/issues/manual-issue-view.coffee b/sonar-server/src/main/coffee/issues/manual-issue-view.coffee
index 6b82f166017..728cec2dfcd 100644
--- a/sonar-server/src/main/coffee/issues/manual-issue-view.coffee
+++ b/sonar-server/src/main/coffee/issues/manual-issue-view.coffee
@@ -77,3 +77,4 @@ define [
_.extend super,
line: @options.line
component: @options.component
+ rules: _.sortBy @options.rules, 'name'
diff --git a/sonar-server/src/main/hbs/issues/manual-issue.hbs b/sonar-server/src/main/hbs/issues/manual-issue.hbs
index bb6fcc105c4..5c567daeac3 100644
--- a/sonar-server/src/main/hbs/issues/manual-issue.hbs
+++ b/sonar-server/src/main/hbs/issues/manual-issue.hbs
@@ -14,13 +14,10 @@
<input type="hidden" name="component" value="{{component}}">
<div class="code-issue-name">
- {{! TODO: replace mock data }}
<select name="rule">
- <option value="manual:api">API</option>
- <option value="manual:design">Design</option>
- <option value="manual:error_handling">Error handling</option>
- <option value="manual:performance">Performance</option>
- <option value="manual:sql_pitfalls">SQL Pitfall</option>
+ {{#each rules}}
+ <option value="{{key}}">{{name}}</option>
+ {{/each}}
</select>
</div>