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.

56 lignes
1.9KB

  1. import dash
  2. import dash_bootstrap_components as dbc
  3. import dash_html_components as html
  4. import dash_core_components as dcc
  5. import socket
  6. import arvados
  7. import functools
  8. from .projects import list_projects_html
  9. from .collections import list_collections_html
  10. from .processes import list_processes_html
  11. # list_projects_html = functools.lru_cache(maxsize=128)(list_projects_html)
  12. # list_collections_html = functools.lru_cache(maxsize=128)(list_collections_html)
  13. # list_processes_html = functools.lru_cache(maxsize=128)(list_processes_html)
  14. def main():
  15. app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
  16. arv = arvados.api('v1')
  17. user = arv.users().current().execute()
  18. # nav_btns = [ dbc.Button(a['name']) for a in projects ]
  19. app.layout = html.Div([
  20. dcc.Location(id='url', refresh=False),
  21. html.Div(id='page-content')
  22. ], style={ 'margin': '10px' })
  23. projects_table = list_projects_html(arv, user['uuid'])
  24. collections_table = list_collections_html(arv, user['uuid'])
  25. processes_table = list_processes_html(arv, user['uuid'])
  26. @app.callback(dash.dependencies.Output('page-content', 'children'),
  27. [ dash.dependencies.Input('url', 'pathname') ])
  28. def display_page(pathname):
  29. print('display_page(), pathname:', pathname)
  30. return html.Div([
  31. dbc.Tabs([
  32. dbc.Tab(projects_table, label="Projects",
  33. label_style={ 'cursor': 'pointer' })
  34. ], style={ 'borderBottom': 'none' }),
  35. dbc.Tabs([
  36. dbc.Tab(collections_table, label="Collections",
  37. label_style={ 'cursor': 'pointer' }),
  38. dbc.Tab(processes_table, label="Processes",
  39. label_style={ 'cursor': 'pointer' })
  40. ], style={ 'borderBottom': 'none' })
  41. ])
  42. app.run_server(host=socket.getfqdn(), debug=False)
  43. main()