|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import dash_bootstrap_components as dbc
- import dash_html_components as html
- from .users import get_user
-
-
- def list_projects(arv, parent):
- res = arv.groups().list(where={
- 'owner_uuid': parent,
- 'group_class': 'project'
- }).execute()['items']
- return res
-
-
- def list_projects_html(arv, parent):
- projects = list_projects(arv, parent)
-
- header = html.Tr([
- html.Th('Name'),
- html.Th('Description'),
- html.Th('Owner')
- ])
- header = [ html.Thead(header) ]
-
- rows = []
- for a in projects:
- owner = get_user(arv, a['owner_uuid'])
- rows.append(
- html.Tr([
- html.Td([
- html.Div(html.A(href='/projects/' + a['uuid'],
- children=a['name'])),
- html.Div(a['uuid'])
- ]),
-
- html.Td(a['description'] or 'Project'),
-
- 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
|