| 
                        1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | 
                        - import dash_html_components as html
 - import dash_bootstrap_components as dbc
 - import humanize
 - from .users import get_user
 - 
 - 
 - def list_collections(arv, owner_uuid, limit=100):
 -     res = arv.collections().list(where = {
 -         'owner_uuid': owner_uuid
 -     }, limit=limit).execute()
 -     res = res['items']
 -     #while res['items_available'] > len(res['items']):
 -         #res = arv.collections().list(where = {})
 -     return res
 - 
 - 
 - def list_collections_html(arv, parent, limit=100):
 -     projects = list_collections(arv, parent, limit=limit)
 - 
 -     header = html.Tr([
 -         html.Th('Name'),
 -         html.Th('Description'),
 -         html.Th('Owner'),
 -         html.Th('Size')
 -     ])
 -     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 'Modified at ' + a['modified_at']),
 - 
 -                 html.Td([
 -                     html.Div(html.A(href='mailto:' + owner['email'],
 -                         children=owner['first_name'] + ' ' + owner['last_name'])),
 -                     html.Div(a['owner_uuid'])
 -                 ]),
 - 
 -                 html.Td(humanize.naturalsize(a['file_size_total']))
 -             ]))
 -     rows = [ html.Tbody(rows) ]
 - 
 -     res = dbc.Table(header + rows,
 -         striped=True,
 -         hover=True,
 -         responsive=True)
 - 
 -     return res
 
 
  |