Commit 6c6e70ff authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

web/services-table: allow top-level user to pass custom actions (form inputs) for the services

parent 58da1c17742e
......@@ -12,7 +12,7 @@ from sqlalchemy import select
from pml import HTML
from rework.schema import task, worker
from rework.schema import task, worker, operation
from rework.task import Task
from rework_ui.helper import argsdict
......@@ -43,7 +43,7 @@ class sliceargs(argsdict):
def reworkui(engine):
def reworkui(engine, serviceactions=None):
def job_status(jobid):
......@@ -246,9 +246,14 @@ def reworkui(engine):
def list_services():
sql = 'select id, host, name, path, domain from rework.operation order by id'
ops = engine.execute(sql)
args = uiargsdict(request.args)
sql = select([,,,
operation.c.path, operation.c.domain]
if args.domain != 'all':
sql = sql.where(operation.c.domain == args.domain)
ops = engine.execute(sql)
h = HTML()
with h.table(klass='table table-sm table-bordered table-striped table-hover') as t:
with t.thead(klass='thead-inverse') as th:
......@@ -258,6 +263,8 @@ def reworkui(engine):'name')'path')'domain')
if serviceactions:'action')
for opid, host, name, path, domain in ops.fetchall():
with as r:, scope='row')
......@@ -265,6 +272,11 @@ def reworkui(engine):
if not serviceactions:
with as t:
action = serviceactions.get(name, serviceactions.get('default'))
action(t, host, name, domain)
return str(h)
Markdown is supported
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