Beispiel #1
0
def map_layout():
    token = "pk.eyJ1IjoianNoYWppIiwiYSI6ImNqeG13N29hZjA0M2UzbnBrcHR4c2MweDUifQ.1ug21CZIfFS7KPCDX-rJVA"
    lat = [12.937591, 12.935666]
    lon = [77.672863, 77.694879]

    data = [
        go.Scattermapbox(
            lat=lat,
            lon=lon,
            mode='markers',
            marker=go.scattermapbox.Marker(symbol='circle',
                                           size=14,
                                           color='red'),
            text=[i.replace("_", '.') for i in get_list_of_routers()],
        )
    ]

    layout = go.Layout(
        autosize=True,
        hovermode='closest',
        mapbox=go.layout.Mapbox(accesstoken=token,
                                bearing=0,
                                center=go.layout.mapbox.Center(lat=lat[0],
                                                               lon=lon[0]),
                                pitch=0,
                                zoom=10),
    )
    fig = go.Figure(data=data, layout=layout)
    return html.Div([dcc.Graph(id='map_g', figure=fig)])
Beispiel #2
0
def home_page():
    return html.Div([
        dash_table.DataTable(id='table',
                             columns=[{
                                 'name': 'Choose a Router',
                                 'id': 'Router_id'
                             }],
                             data=[{
                                 'Router_id': i.replace('_', '.')
                             } for i in get_list_of_routers()],
                             style_cell={'textAlign': 'center'},
                             style_table={
                                 'margin': 'auto',
                                 'width': '30%',
                                 'paddingTop': '20px'
                             },
                             style_as_list_view=True)
    ],
                    id='main')
Beispiel #3
0
        if times.size:
            time=np.max(times)
            if time==t_r:
                return router_dash_layout(router_id),True,False,False,False
            elif time==t_nw:
                return router_details(router_id,'network'),False,True,False,False
            elif time==t_sw:
                return router_details(router_id,'software'),False,False,True,False
            else:
                return router_details(router_id,'hardware'),False,False,False,True
            
        return router_dash_layout(router_id),True,False,False,False
            
        
    return generate_nw_details_tabs_sub
    
for router_id in get_list_of_routers():
    app.callback(
        [Output('dash_contents'+router_id,'children'),
        Output('dash'+router_id,'active'),
        Output('nw'+router_id,'active'),
        Output('sw'+router_id,'active'),
        Output('hw'+router_id,'active')],
        [Input('dash'+router_id,'n_clicks_timestamp'),
        Input('nw'+router_id,'n_clicks_timestamp'),
        Input('sw'+router_id,'n_clicks_timestamp'),
        Input('hw'+router_id,'n_clicks_timestamp'),
        Input("update","n_intervals")]
    )(generate_nw_details_tabs(router_id))