Skip to content

Commit

Permalink
Disable setting custom parameters of None or boolean type in web UI. F…
Browse files Browse the repository at this point in the history
…ixes #1870
  • Loading branch information
cyberw committed Sep 2, 2021
1 parent 5d2f24e commit 645475e
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 645475e

Please sign in to comment.