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!
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

__main__.py 1.9KB

4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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()