Skip to content

Commit

Permalink
Merge pull request #1871 from locustio/disable-setting-custom-paramet…
Browse files Browse the repository at this point in the history
…ers-of-None-or-boolean-type-in-web-ui

Disable setting custom parameters of None or boolean type in web UI. Fixes #1870
  • Loading branch information
cyberw committed Sep 2, 2021
2 parents 5d2f24e + 645475e commit a8c4ffe
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions locust/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,20 @@ <h2>Start new load test</h2>
<input type="text" name="host" id="host" class="val" autocapitalize="off" autocorrect="off" value="{{ host or "" }}" onfocus="this.select()"/><br>
{% if extra_options %}<label>Custom parameters:</label>{% endif %}
{% for key, value in extra_options.items() %}
<label for="{{key}}">{{key}}</label>
<input type="text" name="{{key}}" id="{{key}}" class="val" value="{{value}}" /><br>
{% if not ((value is none) or (value is boolean)) %}
<label for="{{key}}">{{key}}</label>
<input type="text" name="{{key}}" id="{{key}}" class="val" value="{{value}}" /><br>
{% endif %}
{% endfor %}
{% set glob={'header_printed': False} %}
{% for key, value in extra_options.items() %}
{% if (value is none) or (value is boolean) %}
{% if not glob.header_printed %}
The following custom parameters can't be set in the Web UI, because it is a boolean or None type:<br>
{% set _ = glob.update({'header_printed':True}) %}
{% endif %}
{{key}}<br>
{% endif %}
{% endfor %}
<button type="submit">Start swarming</button>
</form>
Expand Down

0 comments on commit a8c4ffe

Please sign in to comment.