|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import dash_bootstrap_components as dbc
- import dash_html_components as html
- from .users import get_user
-
-
- def list_processes(arv, parent, limit=100):
- res = arv.container_requests().list(where={
- 'owner_uuid': parent
- }, limit=100).execute()['items']
- return res
-
-
- def list_processes_html(arv, parent, limit=100):
- processes = list_processes(arv, parent, limit=limit)
-
- header = html.Tr([
- html.Th('Name'),
- html.Th('Description'),
- html.Th('Owner')
- ])
- header = [ html.Thead(header) ]
-
- rows = []
- for a in processes:
- owner = get_user(arv, a['owner_uuid'])
- rows.append(
- html.Tr([
- html.Td([
- html.Div(html.A(href='/processes/' + a['uuid'],
- children=a['name'])),
- html.Div(a['uuid'])
- ]),
-
- html.Td(a['description'] or 'Process'),
-
- html.Td([
- html.Div(html.A(href='mailto:' + owner['email'],
- children=owner['first_name'] + ' ' + owner['last_name'])),
- html.Div(a['owner_uuid'])
- ])
- ]))
- rows = [ html.Tbody(rows) ]
-
- res = dbc.Table(header + rows,
- striped=True,
- hover=True,
- responsive=True)
-
- return res
|