aegis_gui.layout
1import dash 2from dash import html, dcc 3import dash_bootstrap_components as dbc 4from aegis_gui.utilities import sim_tracker 5from aegis_gui.utilities.utilities import get_icon 6from aegis_gui import offcanvas 7from aegis_gui.guisettings.GuiSettings import gui_settings 8from aegis_sim import _version as aegis_version 9 10 11def get_app_layout(): 12 # Responsive Bootstrap grid: sidebar (3 cols on md+, full width below) 13 # next to main (9 cols on md+). On small screens the cols stack — the 14 # sidebar appears above main as a horizontal nav strip. 15 return dbc.Container( 16 id="body-container", 17 fluid=True, 18 children=[ 19 dcc.Location(id="url", refresh=False), 20 dbc.Row( 21 [ 22 dbc.Col(get_sidebar(), xs=12, md=3, lg=2, id="sidebar-col"), 23 dbc.Col( 24 html.Div(id="main-container", children=[dash.page_container]), 25 xs=12, 26 md=9, 27 lg=10, 28 ), 29 ], 30 className="g-0", 31 ), 32 get_footer(), 33 ], 34 ) 35 36 37def get_footer(): 38 """Small version footer at the bottom of every page. 39 40 Shows the running package version, the git commit short hash (when set 41 via AEGIS_GIT_COMMIT at container build time), and the build date. 42 Lets a sysadmin verify which AEGIS revision is live without inspecting 43 the container internals. 44 """ 45 return html.Footer( 46 html.Small( 47 aegis_version.version_string(), 48 className="text-muted", 49 ), 50 id="aegis-version-footer", 51 style={ 52 "textAlign": "center", 53 "padding": "1rem 0 0.5rem 0", 54 "marginTop": "2rem", 55 "fontSize": "0.75rem", 56 "opacity": "0.6", 57 }, 58 ) 59 60 61def get_sidebar(): 62 return dash.html.Div( 63 [ 64 dbc.Nav( 65 children=[ 66 html.A( 67 [ 68 html.Img( 69 src="assets/aegis-ager.svg", width="80%", style={"margin": "0 10%"}, id="aegis-logo" 70 ) 71 ], 72 href=gui_settings.wrap_href(""), 73 className="mb-5", 74 ), 75 dbc.NavItem( 76 [ 77 dbc.NavLink( 78 [ 79 dash.html.I(className="bi bi-house-door-fill"), 80 "Home", 81 # get_icon("house-door-fill"), 82 ], 83 href=gui_settings.wrap_href(""), 84 id="link-nav-home", 85 ) 86 ] 87 ), 88 dbc.NavItem( 89 [ 90 dbc.NavLink( 91 [dash.html.I(className="bi bi-rocket-takeoff-fill"), "Launch"], 92 href=gui_settings.wrap_href("config"), 93 id="link-nav-config", 94 ) 95 ] 96 ), 97 dbc.NavItem( 98 [ 99 dbc.NavLink( 100 [dash.html.I(className="bi bi-bar-chart-fill"), "Plot"], 101 href=gui_settings.wrap_href("plot"), 102 id="link-nav-plot", 103 ) 104 ] 105 ), 106 dbc.NavItem( 107 [ 108 dbc.NavLink( 109 [dash.html.I(className="bi bi-eye-fill"), "Control"], 110 href=gui_settings.wrap_href("simlog"), 111 id="link-nav-simlog", 112 ) 113 ] 114 ), 115 dbc.NavItem( 116 [ 117 dbc.NavLink( 118 [dash.html.I(className="bi bi-info-square-fill"), "Wiki"], 119 href=gui_settings.wrap_href("wiki"), 120 id="link-nav-wiki", 121 ) 122 ] 123 ), 124 dbc.NavItem( 125 [ 126 dbc.NavLink( 127 [dash.html.I(className="bi bi-newspaper"), "News"], 128 href=gui_settings.wrap_href("news"), 129 id="link-nav-news", 130 ) 131 ] 132 ), 133 ] 134 + sim_tracker.init_tracker_box() 135 + [offcanvas.get_offcanvas_trigger(), offcanvas.get_offcanvas()], 136 id="sidebar", 137 vertical="md", 138 pills=True, # TODO fix because it is not showing since i changed the href logic with gui_settings.wrap_href 139 # fill=True, 140 ), 141 ], 142 )
def
get_app_layout():
12def get_app_layout(): 13 # Responsive Bootstrap grid: sidebar (3 cols on md+, full width below) 14 # next to main (9 cols on md+). On small screens the cols stack — the 15 # sidebar appears above main as a horizontal nav strip. 16 return dbc.Container( 17 id="body-container", 18 fluid=True, 19 children=[ 20 dcc.Location(id="url", refresh=False), 21 dbc.Row( 22 [ 23 dbc.Col(get_sidebar(), xs=12, md=3, lg=2, id="sidebar-col"), 24 dbc.Col( 25 html.Div(id="main-container", children=[dash.page_container]), 26 xs=12, 27 md=9, 28 lg=10, 29 ), 30 ], 31 className="g-0", 32 ), 33 get_footer(), 34 ], 35 )