Add Task Sorting and Pagination
This commit is contained in:
parent
1c48a43738
commit
1a46eaf51b
4 changed files with 119 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
{{template "head"}}
|
||||
<script src="/static/js/table_sort.js"></script>
|
||||
<h2>New Tasks</h2>
|
||||
<form method="POST">
|
||||
<label for="library">Library:</label>
|
||||
|
@ -42,16 +43,25 @@ Total: {{.Stats.TotalCount}}
|
|||
|
||||
|
||||
<h2>Tasks</h2>
|
||||
<label for="limit">Limit:</label>
|
||||
<select id="limit" name="limit" onchange="setLimit(this.value)">
|
||||
<option selected value="{{.Limit}}">{{.Limit}}</option>
|
||||
{{if ne .Limit 100 }}<option value="100">100</option>{{end}}
|
||||
{{if ne .Limit 500 }}<option value="500">500</option>{{end}}
|
||||
{{if ne .Limit 1000 }}<option value="1000">1000</option>{{end}}
|
||||
{{if ne .Limit 10000 }}<option value="10000">10000</option>{{end}}
|
||||
</select>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Library</th>
|
||||
<th>Worker</th>
|
||||
<th>Type</th>
|
||||
<th>FFmpeg Command</th>
|
||||
<th>Status</th>
|
||||
<th>File</th>
|
||||
<th>Updated At</th>
|
||||
<th onclick="setTableSort('id')">ID</th>
|
||||
<th onclick="setTableSort('library')">Library</th>
|
||||
<th onclick="setTableSort('worker')">Worker</th>
|
||||
<th onclick="setTableSort('type')">Type</th>
|
||||
<th onclick="setTableSort('ffmpeg_command')">FFmpeg Command</th>
|
||||
<th onclick="setTableSort('status')">Status</th>
|
||||
<th onclick="setTableSort('file')">File</th>
|
||||
<th onclick="setTableSort('updated_at')">Updated At</th>
|
||||
</tr>
|
||||
{{range $t := .Tasks}}
|
||||
<tr onclick="window.location='/tasks/{{ $t.ID }}';">
|
||||
|
@ -82,4 +92,8 @@ Total: {{.Stats.TotalCount}}
|
|||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{if ne .Page 0 }}<button type="button" onclick="setPage(0)">First Page</button>{{end}}
|
||||
{{if ne .Page 0 }}<button type="button" onclick="setPage({{.Page}} -1)">Previous Page</button>{{end}}
|
||||
Page {{.Page}}
|
||||
{{if ne .Count 0}}<button type="button" onclick="setPage({{.Page}} +1)">Next Page</button>{{end}}
|
||||
{{template "tail"}}
|
Loading…
Add table
Add a link
Reference in a new issue