Skip to content

Commit

Permalink
rizal - locustio#66 remove /new and redirect it to /
Browse files Browse the repository at this point in the history
  • Loading branch information
Amadeea authored May 14, 2018
2 parents c0c9c6b + b653231 commit 42cbbad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion locust/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h4 class="modal-title">Are you sure?</h4>
<p>Creating new test will erase all current test result?</p>
</div>
<div class="modal-footer">
<form action="/new" method="POST">
<form action="/" method="POST">
<button type="submit" class="btn btn-default btn-newtest">Yes</button>
<button type="button" class="btn btn-default btn-newtest" data-dismiss="modal">No</button>
</form>
Expand Down
12 changes: 5 additions & 7 deletions locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
locustfile = None
opsgenie_id = None

@app.route('/')
@app.route('/', methods=["GET","POST"])
def index():
is_distributed = isinstance(runners.locust_runner, MasterLocustRunner)
if is_distributed:
Expand All @@ -66,7 +66,10 @@ def index():
modules = tests_loader.populate_directories(fileio.os_path(),'tests/modules/')
modules.update(pages)
directories = modules


if request.method == 'POST':
runners.locust_runner.state = runners.STATE_INIT

return render_template("index.html",
state=runners.locust_runner.state,
is_distributed=is_distributed,
Expand All @@ -79,11 +82,6 @@ def index():
host=host
)

@app.route('/new', methods=["POST"])
def newtest():
runners.locust_runner.state = runners.STATE_INIT
return index()

@app.route('/swarm', methods=["POST"])
def swarm():
assert request.method == "POST"
Expand Down

0 comments on commit 42cbbad

Please sign in to comment.