Commit 3ad3f569 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

web: introduce domain filter (server side)

Some js parts are needed for this to work.
parent 8239e929667f
......@@ -8,6 +8,8 @@ from flask import (
from sqlalchemy import select
from pml import HTML
from rework.schema import task, worker
......@@ -111,13 +113,22 @@ def reworkui(engine):
return json.dumps(True)
class uiargsdict(argsdict):
defaults = {
'domain': 'all'
def list_workers():
workers = engine.execute('select id, host, pid, mem, debugport, shutdown, kill, domain '
'from rework.worker '
'where running = true '
'order by id'
sql = select([,, worker.c.domain,,
worker.c.mem, worker.c.shutdown, worker.c.kill, worker.c.debugport]
).where(worker.c.running == True)
domain = uiargsdict(request.args).domain
if domain != 'all':
sql = sql.where(worker.c.domain == domain)
workers = engine.execute(sql).fetchall()
h = HTML()
with h.table(klass='table table-sm table-bordered table-striped table-hover') as t:
......@@ -129,7 +140,7 @@ def reworkui(engine):'memory (Mb)')'debug port')'action')
for wid, host, pid, mem, debugport, shutdown, kill, domain in workers:
for wid, host, domain, pid, mem, shutdown, kill, debugport in workers:
with as r:, scope='row')'{}@{}'.format(pid, host))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment