aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/custom-measures/templates
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-07-08 13:59:26 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-07-08 14:08:01 +0200
commit920d1b368b9b3ecb55ac5271e4ae813e022278ea (patch)
treedde2425deb8bb5140fa5f688e5ee6b787d2126ac /server/sonar-web/src/main/js/apps/custom-measures/templates
parentbfef505c8a0de560805234643f6ee8b58d37d04a (diff)
downloadsonarqube-920d1b368b9b3ecb55ac5271e4ae813e022278ea.tar.gz
sonarqube-920d1b368b9b3ecb55ac5271e4ae813e022278ea.zip
SONAR-6697 filter available metrics
Diffstat (limited to 'server/sonar-web/src/main/js/apps/custom-measures/templates')
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-form.hbs27
1 files changed, 18 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-form.hbs b/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-form.hbs
index 52e16a0e98b..71b01cc044c 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-form.hbs
+++ b/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-form.hbs
@@ -4,27 +4,36 @@
</div>
<div class="modal-body">
<div class="js-modal-messages"></div>
+
{{#unless id}}
- <div class="modal-field">
- <label for="create-custom-measure-metric">Metric<em class="mandatory">*</em></label>
- <select id="create-custom-measure-metric" name="metric" required>
- {{#each metrics}}
- <option value="{{id}}" {{#eq id ../metric.id}}selected{{/eq}}>{{name}}</option>
- {{/each}}
- </select>
- </div>
+ {{#if canCreateMetric}}
+ <div class="modal-field">
+ <label for="create-custom-measure-metric">Metric<em class="mandatory">*</em></label>
+ <select id="create-custom-measure-metric" name="metric" required>
+ {{#each metrics}}
+ <option value="{{id}}" {{#eq id ../metric.id}}selected{{/eq}}>{{name}}</option>
+ {{/each}}
+ </select>
+ </div>
+ {{else}}
+ <div class="alert alert-warning">{{t 'custom_measures.all_metrics_taken'}}</div>
+ {{/if}}
{{/unless}}
+
<div class="modal-field">
<label for="create-custom-measure-value">Value<em class="mandatory">*</em></label>
<input id="create-custom-measure-value" name="value" type="text" maxlength="200" required value="{{value}}">
</div>
+
<div class="modal-field">
<label for="create-custom-measure-description">Description</label>
<textarea id="create-custom-measure-description" name="description">{{description}}</textarea>
</div>
</div>
<div class="modal-foot">
- <button id="create-custom-measure-submit">{{#if id}}Update{{else}}Create{{/if}}</button>
+ <button id="create-custom-measure-submit" {{#unless canCreateMetric}}disabled{{/unless}}>
+ {{#if id}}Update{{else}}Create{{/if}}
+ </button>
<a href="#" class="js-modal-close" id="create-custom-measure-cancel">Cancel</a>
</div>
</form>