Skip to content

Commit

Permalink
Merge pull request #447 from thaffenden/display-host
Browse files Browse the repository at this point in the history
Adds host name to the header
  • Loading branch information
justiniso authored Apr 9, 2017
2 parents 5241250 + e5c2bfa commit 349c491
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions locust/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ a:hover {
color: #000;
font-size: 16px;
font-weight: bold;
max-width: 165px;
word-wrap: break-word;
}
.boxes .box_rps .value, .boxes .box_slaves .value {
font-size: 32px;
Expand Down Expand Up @@ -128,6 +130,10 @@ a:hover {
background: #4e4141;
}

#host_url {
font-size: 14px;
font-weight: normal;
}
.boxes .box_running {
display: none;
}
Expand Down
6 changes: 6 additions & 0 deletions locust/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<div class="top-content container">
<img src="/static/img/logo.png?v={{ version }}" class="logo" />
<div class="boxes">
<div class="top_box box_url">
<div class="label">HOST</div>
<div class="value" id="host_url">
{{host}}
</div>
</div>
<div class="top_box box_status">
<div class="label">STATUS</div>
<div class="value" id="status_text">
Expand Down
10 changes: 9 additions & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ def index():
slave_count = runners.locust_runner.slave_count
else:
slave_count = 0

if runners.locust_runner.host:
host = runners.locust_runner.host
elif len(runners.locust_runner.locust_classes) > 0:
host = runners.locust_runner.locust_classes[0].host
else:
host = None

return render_template("index.html",
state=runners.locust_runner.state,
is_distributed=is_distributed,
slave_count=slave_count,
user_count=runners.locust_runner.user_count,
version=version
version=version,
host=host
)

@app.route('/swarm', methods=["POST"])
Expand Down

0 comments on commit 349c491

Please sign in to comment.