Skip to content

Commit

Permalink
Make workers table sortable (#8153)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Sep 4, 2023
1 parent 956e024 commit 3e3a31a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 43 deletions.
1 change: 1 addition & 0 deletions distributed/http/static/css/sortable.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions distributed/http/static/css/sortable.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions distributed/http/static/js/sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions distributed/http/templates/main.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<html lang="en">
<head>
<meta charset="utf-8"></meta>
<title> {{title}} </title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.0/css/bulma.min.css" media="all" />
<link rel="shortcut icon" href="{{ rel_path_statics }}statics/images/favicon.ico"/>
</head>

<body>
{% block content %} {% end %}

<head>
<meta charset="utf-8">
</meta>
<title> {{title}} </title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.0/css/bulma.min.css" media="all" />
<link rel="stylesheet" href="{{ rel_path_statics }}/statics/css/sortable.min.css" />
<link rel="shortcut icon" href="{{ rel_path_statics }}/statics/images/favicon.ico" />

</head>

<body>
{% block content %} {% end %}
<script src="{{ rel_path_statics }}/statics/js/sortable.min.js"></script>
</body>

</body>
</html>
71 changes: 38 additions & 33 deletions distributed/http/templates/worker-table.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
<table class="table is-striped is-hoverable">
<tr>
<th> Worker </th>
<th> Name </th>
<th> Cores </th>
<th> Memory </th>
<th> Memory use </th>
<th> Occupancy </th>
<th> Processing </th>
<th> In-memory </th>
<th> Services</th>
<th> Logs </th>
<th> Last seen </th>
</tr>
{% for ws in worker_list %}
<tr {{ "style=background-color:#ffcdd2" if time() - ws.last_seen > 60 else ""}}>
<td><a href="../worker/{{ url_escape(ws.address) }}.html">{{ws.address}}</a></td>
<td> {{ ws.name if ws.name is not None else "" }} </td>
<td> {{ ws.nthreads }} </td>
<td> {{ format_bytes(ws.memory_limit) if ws.memory_limit is not None else "" }} </td>
<td> <progress class="progress" value="{{ ws.metrics['memory'] }}" max="{{ ws.memory_limit }}"></progress> </td>
<td> {{ format_time(ws.occupancy) }} </td>
<td> {{ len(ws.processing) }} </td>
<td> {{ len(ws.has_what) }} </td>
{% if 'dashboard' in ws.services %}
<td> <a href="../../proxy/{{ ws.services['dashboard'] }}/{{ ws.host }}/status">dashboard</a> </td>
{% else %}
<td> </td>
<table class="table is-striped is-hoverable sortable">
<thead>
<tr>
<th> Worker </th>
<th> Name </th>
<th> Cores </th>
<th> Memory </th>
<th> Memory use </th>
<th> Occupancy </th>
<th> Processing </th>
<th> In-memory </th>
<th> Services</th>
<th> Logs </th>
<th> Last seen </th>
</tr>
</thead>
<tbody>
{% for ws in worker_list %}
<tr {{ "style=background-color:#ffcdd2" if time() - ws.last_seen> 60 else ""}}>
<td><a href="../worker/{{ url_escape(ws.address) }}.html">{{ws.address}}</a></td>
<td> {{ ws.name if ws.name is not None else "" }} </td>
<td> {{ ws.nthreads }} </td>
<td> {{ format_bytes(ws.memory_limit) if ws.memory_limit is not None else "" }} </td>
<td> <progress class="progress" value="{{ ws.metrics['memory'] }}" max="{{ ws.memory_limit }}"></progress>
</td>
<td> {{ format_time(ws.occupancy) }} </td>
<td> {{ len(ws.processing) }} </td>
<td> {{ len(ws.has_what) }} </td>
{% if 'dashboard' in ws.services %}
<td> <a href="../../proxy/{{ ws.services['dashboard'] }}/{{ ws.host }}/status">dashboard</a> </td>
{% else %}
<td> </td>
{% end %}
<td> <a href="../logs/{{ url_escape(ws.address) }}.html">logs</a></td>
<td> {{ format_time(time() - ws.last_seen) }} </td>
</tr>
{% end %}
<td> <a href="../logs/{{ url_escape(ws.address) }}.html">logs</a></td>
<td> {{ format_time(time() - ws.last_seen) }} </td>
</tr>
{% end %}
</table>
</tbody>
</table>

0 comments on commit 3e3a31a

Please sign in to comment.