|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import dash_bootstrap_components as dbc
- import dash_html_components as html
- import dash_core_components as dcc
- 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(dcc.Link(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
|