IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4KB

  1. import dash_bootstrap_components as dbc
  2. import dash_html_components as html
  3. import dash_core_components as dcc
  4. from .users import get_user
  5. def list_projects(arv, parent):
  6. res = arv.groups().list(where={
  7. 'owner_uuid': parent,
  8. 'group_class': 'project'
  9. }).execute()['items']
  10. return res
  11. def list_projects_html(arv, parent):
  12. projects = list_projects(arv, parent)
  13. header = html.Tr([
  14. html.Th('Name'),
  15. html.Th('Description'),
  16. html.Th('Owner')
  17. ])
  18. header = [ html.Thead(header) ]
  19. rows = []
  20. for a in projects:
  21. owner = get_user(arv, a['owner_uuid'])
  22. rows.append(
  23. html.Tr([
  24. html.Td([
  25. html.Div(dcc.Link(href='/projects/' + a['uuid'],
  26. children=a['name'])),
  27. html.Div(a['uuid'])
  28. ]),
  29. html.Td(a['description'] or 'Project'),
  30. html.Td([
  31. html.Div(html.A(href='mailto:' + owner['email'],
  32. children=owner['first_name'] + ' ' + owner['last_name'])),
  33. html.Div(a['owner_uuid'])
  34. ])
  35. ]))
  36. rows = [ html.Tbody(rows) ]
  37. res = dbc.Table(header + rows,
  38. striped=True,
  39. hover=True,
  40. responsive=True)
  41. return res