]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5209 Add ability to create manual issues
authorStas Vilchik <vilchiks@gmail.com>
Thu, 19 Jun 2014 05:54:50 +0000 (11:54 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 19 Jun 2014 05:54:50 +0000 (11:54 +0600)
sonar-server/src/main/coffee/component-viewer/line-actions-popup.coffee
sonar-server/src/main/coffee/component-viewer/main.coffee
sonar-server/src/main/coffee/component-viewer/source.coffee
sonar-server/src/main/coffee/issues/manual-issue-view.coffee
sonar-server/src/main/hbs/issues/manual-issue.hbs

index 156ef17854486bac9518b6654414738d5a8d85ea..652e0dc679cc4d837d13970798746679bfb96ace 100644 (file)
@@ -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') || []
index 088a8878c195310e4a92248d9b05c8cefe2914a3..68a95f0f34ce7d1cffbe52c086e35035255e295b 100644 (file)
@@ -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) =>
index 7d2070fc09f89c40f493405e1e60708e0d74d96a..2420985c1fc45e331cdc921f3393d8a13e46c051 100644 (file)
@@ -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: ->
index 6b82f166017d75c688e569fa34224c10a09d6819..728cec2dfcdd06a748a9e388824685cd84d5ec6c 100644 (file)
@@ -77,3 +77,4 @@ define [
       _.extend super,
         line: @options.line
         component: @options.component
+        rules: _.sortBy @options.rules, 'name'
index bb6fcc105c45999e6f3c218ce9cf6ae6d588860e..5c567daeac3d3ab764f491ba6a14662e4cf1c3ef 100644 (file)
   <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>