]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5137 Add rule param type to WS response, use it in rule activation dialog
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 25 Jul 2014 09:32:42 +0000 (11:32 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 25 Jul 2014 09:32:42 +0000 (11:32 +0200)
sonar-server/src/main/hbs/coding-rules/coding-rules-quality-profile-activation.hbs
sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapping.java
sonar-server/src/test/resources/org/sonar/server/rule/ws/CreateActionMediumTest/create_custom_rule.json
sonar-server/src/test/resources/org/sonar/server/rule/ws/RulesWebServiceMediumTest/search_active_rules_params.json

index d604642ce4ef15d0c26cca6c2000598697a8b506..560972b992b0454dfd1f17b35ea732692d28ce0e 100644 (file)
             {{#eq type 'TEXT'}}
               <textarea class="width100" rows="3" name="{{key}}" placeholder="{{defaultValue}}">{{value}}</textarea>
             {{else}}
+              {{#eq type 'BOOLEAN'}}
+              <select name="{{key}}" value="{{value}}">
+                <option value="{{defaultValue}}">{{t 'default'}}</option>
+                <option value="true"{{#eq value 'true'}} selected="selected"{{/eq}}>{{t 'true'}}</option>
+                <option value="false"{{#eq value 'false'}} selected="selected"{{/eq}}>{{t 'false'}}</option>
+              </select>
+              {{else}}
               <input type="text" name="{{key}}" value="{{value}}" placeholder="{{defaultValue}}">
+              {{/eq}}
             {{/eq}}
             <div class="note">{{description}}</div>
             {{#if extra}}
index 5f68223b13662a848275ca27d68359a844a5a168..30c0430e7ec4b900061ef4b8b12494904208700f 100644 (file)
@@ -159,6 +159,7 @@ public class RuleMapping extends BaseMapping<RuleDoc, RuleMappingContext> {
             .beginObject()
             .prop("key", param.key())
             .prop("desc", param.description())
+            .prop("type", param.type().type())
             .prop("defaultValue", param.defaultValue())
             .endObject();
         }
index 648e6c9b2fe5971685a268774fb937e4751404ea..8ee000b5f6b29e8afc068ba24a76401473f4f7c1 100644 (file)
@@ -19,7 +19,8 @@
       {
         "key": "regex",
         "desc": "Reg ex",
-        "defaultValue": "a.*"
+        "defaultValue": "a.*",
+        "type": "STRING"
       }
     ]
   }
index c2938aeb995f4bf6bb1d80351056052552b13d94..03d35338f6cf041e06e86d2d6bd6c1ee66e5e7dd 100644 (file)
@@ -5,12 +5,14 @@
       {
         "key": "my_var",
         "desc": "My small description",
-        "defaultValue": "some value"
+        "defaultValue": "some value",
+        "type": "string"
       },
       {
         "key": "the_var",
         "desc": "My small description",
-        "defaultValue": "other value"
+        "defaultValue": "other value",
+        "type": "integer"
       }
     ]
   }