Пример #1
0
def delete_snapshot_div(network_value, host_value):
    if not network_value:
        raise PreventUpdate
    batfish = Batfish(host_value)
    batfish.set_network(network_value)
    options = [{
        'label': snapshot,
        'value': snapshot
    } for snapshot in batfish.get_existing_snapshots()]
    children = [
        dbc.Form(
            [
                dcc.Dropdown(id="delete_snapshot_dropdown",
                             placeholder='Delete Snapshot',
                             style={
                                 'margin': '5px',
                                 'width': '150px',
                             },
                             options=options,
                             value=None),
                dbc.Button("Delete",
                           id="delete_snapshot_submit_button",
                           color="dark",
                           outline=True,
                           size="sm",
                           style=dict(
                               margin="5px",
                               height="25px",
                           )),
                html.P(id='delete_snapshot_hidden', style={"display": "none"})
            ],
            inline=True,
        ),
    ]
    return children
Пример #2
0
def set_batfish_snapshot(host_value, network_value):
    if not network_value:
        raise PreventUpdate
    batfish = Batfish(host_value)
    batfish.set_network(network_value)
    options = [{
        'label': snapshot,
        'value': snapshot
    } for snapshot in batfish.get_existing_snapshots()]
    dropdown = dcc.Dropdown(id="select-snapshot-button",
                            placeholder='Select Snapshot',
                            className="main_page_dropdown",
                            options=options,
                            value=None),
    return dropdown