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!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

57 lignes
1.6KB

  1. import dash_html_components as html
  2. import dash_bootstrap_components as dbc
  3. import humanize
  4. from .users import get_user
  5. def list_collections(arv, owner_uuid, limit=100):
  6. res = arv.collections().list(where = {
  7. 'owner_uuid': owner_uuid
  8. }, limit=limit).execute()
  9. res = res['items']
  10. #while res['items_available'] > len(res['items']):
  11. #res = arv.collections().list(where = {})
  12. return res
  13. def list_collections_html(arv, parent, limit=100):
  14. projects = list_collections(arv, parent, limit=limit)
  15. header = html.Tr([
  16. html.Th('Name'),
  17. html.Th('Description'),
  18. html.Th('Owner'),
  19. html.Th('Size')
  20. ])
  21. header = [ html.Thead(header) ]
  22. rows = []
  23. for a in projects:
  24. owner = get_user(arv, a['owner_uuid'])
  25. rows.append(
  26. html.Tr([
  27. html.Td([
  28. html.Div(html.A(href='/projects/' + a['uuid'],
  29. children=a['name'])),
  30. html.Div(a['uuid'])
  31. ]),
  32. html.Td(a['description'] or 'Modified at ' + a['modified_at']),
  33. html.Td([
  34. html.Div(html.A(href='mailto:' + owner['email'],
  35. children=owner['first_name'] + ' ' + owner['last_name'])),
  36. html.Div(a['owner_uuid'])
  37. ]),
  38. html.Td(humanize.naturalsize(a['file_size_total']))
  39. ]))
  40. rows = [ html.Tbody(rows) ]
  41. res = dbc.Table(header + rows,
  42. striped=True,
  43. hover=True,
  44. responsive=True)
  45. return res