コード例 #1
0
ファイル: objectives.py プロジェクト: apehex/driven-moodule
def make_objectives_form(id='objectives-form', style={}):
    objective_labels = ['Safety', 'Cost', 'Stability', 'Reliability']

    objective_input_labels = [
        html.Label(children=l,
                   id=l.lower() + '-label',
                   htmlFor=l.lower() + '-slider',
                   style={'flex': '1 1 auto'}) for l in objective_labels
    ]

    objective_input_sliders = [
        html.Div(id=l.lower() + '-slider-div',
                 style={
                     'flex': '1 1 auto',
                     'padding': '10px'
                 },
                 children=[
                     dcc.Slider(id=l.lower() + '-slider',
                                min=1,
                                max=4,
                                marks={j: str(j)
                                       for j in range(1, 5)} if i == 3 else {},
                                value=1 if i else 4,
                                vertical=True)
                 ]) for i, l in enumerate(objective_labels)
    ]

    return html.Form(children=html.Fieldset(children=[
        html.Div(children=objective_input_sliders,
                 style={
                     'display': 'flex',
                     'flex': '5 5 auto',
                     'columnCount': 4,
                     'height': '100px'
                 }),
        html.Div(children=objective_input_labels,
                 style={
                     'display': 'flex',
                     'flex': '1 1 auto',
                     'columnCount': 4
                 })
    ]),
                     id=id,
                     style=style)
コード例 #2
0
ファイル: app.py プロジェクト: mazikeen-bot/stock-tracker
def display_page(pathname):

    if pathname == "/":

        #STOCKS APP
        return html.Div([
            html.Div(
                className='container',
                children=[
                    html.Hr(className="seperator"),
                    html.Div(
                        className='row',

                        #TICKER COLUMN
                        children=[
                            html.Div(
                                className='col-lg-12',
                                children=[
                                    html.Form(children=[
                                        html.Fieldset(children=[
                                            html.Div(
                                                className='form-group',
                                                children=[
                                                    html.Label(
                                                        children="""Ticker"""),
                                                    dcc.Input(id='input',
                                                              className=
                                                              'form-control',
                                                              value='',
                                                              type='text')
                                                ])
                                        ])
                                    ])
                                ])
                        ]),

                    #GRAPH COLUMN
                    html.Div(className="row",
                             children=html.Div(
                                 className='col-lg-12',
                                 children=[html.Div(id='output_graph')]))
                ])
        ])
コード例 #3
0
ファイル: form.py プロジェクト: Vayel/dash-forms
 def render(self):
     return dhtml.Fieldset(
         [
             dhtml.Legend(self.render_header(),
                          id=self.chained_id('header'),
                          className='header'),
             dhtml.Div([
                 *[child.render() for child in self.children],
                 dhtml.Div(dhtml.Div(className='errors',
                                     id=self.chained_id('errors')),
                           id=self.chained_id('errors_wrapper'),
                           className='form_errors_row'),
                 dhtml.Div(self.btn,
                           className='btn_wrapper' +
                           (' hide' if not self.btn.children else '')),
             ],
                       id=self.chained_id('content'),
                       className='body')
         ],
         id=self.chained_id(),
         className='form' +
         (' with_header' if self.title or self.collapsable else ''))
コード例 #4
0
def get_app(ms: MachineState) -> dash.Dash:
    """
        Creates the Dash app and creates all the callbacks.
        `ms` is the MachineState instance to which callbacks should be connected.
        Returns a `dash.Dash` instance to be run.
    """
    app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
    app.config.suppress_callback_exceptions = False
    app.logger.disabled = False

    def timestamp_to_datetime(x: int) -> datetime.datetime:
        """Converts the timestamps sotred in `PINSoftware.DataAnalyser.DataAnalyser` to a `datetime.datetime` object"""
        return datetime.datetime.fromtimestamp(
            ms.data.first_processed_timestamp + x * ms.data.period)

    full_graph_base_fig = {
        'data': [{
            'x': [],
            'y': [],
            'type': 'scatter',
            'name': 'Live peak voltage'
        }, {
            'x': [],
            'y': [],
            'type': 'scatter',
            'name': 'Live averaged peak voltage'
        }]
    }

    def full_graph_extend(n, graph_indices):
        """Full graph extend function"""
        pro_index = min(graph_indices['pro_index'], len(ms.data.processed_ys))
        avg_index = min(graph_indices['avg_index'],
                        len(ms.data.averaged_processed_ys))
        pro_top_index = min(pro_index + 30000, len(ms.data.processed_ys))
        avg_top_index = min(avg_index + 30000,
                            len(ms.data.averaged_processed_ys))
        result = [{
            'x': [
                list(
                    map(timestamp_to_datetime, ms.data.
                        processed_timestamps[pro_index:pro_top_index])),
                list(
                    map(
                        timestamp_to_datetime,
                        ms.data.averaged_processed_timestamps[
                            avg_index:avg_top_index]))
            ],
            'y': [
                ms.data.processed_ys[pro_index:pro_top_index],
                ms.data.averaged_processed_ys[avg_index:avg_top_index]
            ]
        }]
        graph_indices['pro_index'] = pro_top_index
        graph_indices['avg_index'] = avg_top_index
        return [result, graph_indices]

    def live_graph_func(n, T):
        """Live graph figure function"""
        show_from = len(ms.data.ys) - T * 50000
        data = []
        current_avg = None
        current_count = None
        if ms.data.processed_ys and ms.data.processed_timestamps[
                -1] >= show_from:
            pro_index = -1
            max_pro_index = -len(ms.data.processed_timestamps)
            while ms.data.processed_timestamps[
                    pro_index] > show_from and pro_index > max_pro_index:
                pro_index -= 1
            data.append({
                'x':
                list(
                    map(timestamp_to_datetime,
                        ms.data.processed_timestamps[pro_index:])),
                'y':
                ms.data.processed_ys[pro_index:],
                'type':
                'scatter',
                'name':
                'Live averaged peak voltage'
            })
            current_count = -pro_index / T
        if ms.data.averaged_processed_ys and ms.data.averaged_processed_timestamps[
                -1] >= show_from:
            avg_index = -1
            max_avg_index = -len(ms.data.averaged_processed_timestamps)
            while ms.data.averaged_processed_timestamps[
                    avg_index] > show_from and avg_index > max_avg_index:
                avg_index -= 1
            data.append({
                'x':
                list(
                    map(timestamp_to_datetime,
                        ms.data.averaged_processed_timestamps[avg_index:])),
                'y':
                ms.data.averaged_processed_ys[avg_index:],
                'type':
                'scatter',
                'name':
                'Live peak voltage'
            })
            current_avg = sum(
                ms.data.averaged_processed_ys[avg_index:]) / -avg_index
        return [{
            'data': data
        }, "The average value is: " + str(current_avg) if current_avg else "",
                "Current peak voltages per second are: " +
                str(current_count) if current_avg else ""]

    app.layout = lambda: dbc.Container([
        html.H1("xPIN, Sample and Hold, NI-DAQmx system software",
                style={'textAlign': 'center'}),
        dbc.Modal([
            dbc.ModalHeader("Warning"),
            dbc.ModalBody("Something went wrong", id='warning-modal-body')
        ],
                  id='warning-modal'),
        dbc.Container([
            dbc.Tabs([
                dbc.Tab(dbc.Container([
                    dbc.Row(dbc.Col(id='ad-session_id', width='auto'),
                            justify='center',
                            className='mt-2 mb-2'),
                    dbc.Row(dbc.Col(dbc.ButtonGroup([
                        dbc.Button("Grab control",
                                   id='ad-grab',
                                   color='warning',
                                   disabled=ms.experiment_running),
                        dbc.Button("Release control",
                                   id='ad-release',
                                   color='secondary',
                                   disabled=(not ms.experiment_running))
                    ]),
                                    width='auto'),
                            justify='center',
                            className='mt-3 mb-2'),
                    dbc.Row(dbc.Col("There is currently no controller.",
                                    id='ad-controller-info',
                                    width='auto'),
                            justify='center',
                            className='mt-3 mb-2')
                ],
                                      className='mt-3 mb-3'),
                        label="Administration",
                        tab_id='administration-tab'),
                dbc.Tab(dbc.Container([
                    dbc.Row([
                        dbc.Col(dbc.ButtonGroup([
                            dbc.Button("Start",
                                       id='cp-start',
                                       color='success',
                                       disabled=ms.experiment_running),
                            dbc.Button("Stop",
                                       id='cp-stop',
                                       color='danger',
                                       disabled=(not ms.experiment_running))
                        ]),
                                width='auto')
                    ],
                            justify='center',
                            className='mt-3 mb-2'),
                    dbc.Row(dbc.Col(html.Fieldset(dbc.Container([
                        dbc.Row(dbc.Col(SingleSwitch('cp-save-toggle',
                                                     "Save captured data?",
                                                     default=False),
                                        width='auto'),
                                justify='center'),
                        dbc.Row(dbc.Col(dbc.Input(id='cp-save-base_filename',
                                                  value="log",
                                                  type='text'),
                                        width='auto'),
                                id='cp-save-base_filename-row',
                                justify='center'),
                        dbc.Row(dbc.Col(dbc.Select(
                            id='cp-save-select_ft',
                            value="hdf5",
                            options=[{
                                "label": "csv",
                                "value": "csv"
                            }, {
                                "label": "hdf5",
                                "value": "hdf5"
                            }],
                        ),
                                        width=2),
                                id='cp-save-select_ft-row',
                                justify='center',
                                className='mt-1'),
                        dbc.Row(dbc.Col(dbc.Checklist(
                            id='cp-save-items',
                            options=[{
                                'label': "Save raw data",
                                'value': 'ys'
                            }, {
                                'label': "Save peak voltages",
                                'value': 'processed_ys'
                            }, {
                                'label': "Save averaged peak voltages",
                                'value': 'averaged_processed_ys'
                            }, {
                                'label': "Save debug markers",
                                'value': 'markers'
                            }],
                            value=['ys', 'processed_ys'],
                            switch=True,
                            inline=True),
                                        width='auto'),
                                id='cp-save-items-row',
                                justify='center'),
                        dbc.Row(dbc.Col(id='cp-save-messagebox', width='auto'),
                                justify='center')
                    ],
                                                                id=
                                                                'cp-saving-options',
                                                                fluid=True,
                                                                className=
                                                                'border mt-1 mb-1 pt-1 pb-2'
                                                                ),
                                                  id=
                                                  'cp-saving-options-fieldset'
                                                  ),
                                    width=8),
                            justify='center'),
                    dbc.Row(dbc.Col(dbc.ButtonGroup([
                        html.A(dbc.Button("Show all logs",
                                          id='ad-show-logs',
                                          color='warning'),
                               href='logs'),
                        dbc.Button("Delete all saved logs?",
                                   id='ad-delete-logs',
                                   color='danger')
                    ]),
                                    width='auto'),
                            justify='center',
                            className='mt-3 mb-1')
                ]),
                        label="Run controls",
                        id='run-options',
                        tab_id='run-options-tab',
                        disabled=True),
                dbc.Tab(dbc.Container([
                    dbc.Row(dbc.Col(html.Fieldset(dbc.Container([
                        dbc.Row(dbc.Col(dbc.ButtonGroup([
                            dcc.Upload(dbc.Button(
                                "Load configuration from file", color='info'),
                                       id='cp-da-config_upload',
                                       max_size=256 * 1024 * 1024),
                            dcc.Link(dbc.Button("Save configuration to file",
                                                color='secondary'),
                                     id='cp-da-config_link',
                                     href='',
                                     refresh=True),
                        ]),
                                        width='auto'),
                                className='mt-2 mb-2',
                                justify='center'),
                        dbc.Row(
                            dbc.Col(
                                dbc.FormGroup([
                                    dbc.Label("Edge detection threshold [V]:",
                                              html_for=
                                              'cp-da-edge_detection_threshold',
                                              width='auto'),
                                    dbc.Col(dbc.Input(
                                        id='cp-da-edge_detection_threshold',
                                        type='number',
                                        min=0,
                                        value=0.003,
                                        step=0.0001),
                                            width=3)
                                ],
                                              row=True))),
                        dbc.Row([
                            dbc.Col(
                                dbc.FormGroup([
                                    dbc.Label("Correction a",
                                              html_for='cp-da-correction_a',
                                              width='auto'),
                                    dbc.Col(dbc.Input(id='cp-da-correction_a',
                                                      type='number',
                                                      value=1,
                                                      step=0.01),
                                            width=5)
                                ],
                                              row=True)),
                            dbc.Col(
                                dbc.FormGroup([
                                    dbc.Label("Correction b",
                                              html_for='cp-da-correction_b',
                                              width='auto'),
                                    dbc.Col(dbc.Input(id='cp-da-correction_b',
                                                      type='number',
                                                      value=0,
                                                      step=0.0001),
                                            width=5)
                                ],
                                              row=True))
                        ]),
                        dbc.Row(
                            dbc.Col(
                                dbc.FormGroup([
                                    dbc.Label("Average count:",
                                              html_for='cp-da-average_count',
                                              width='auto'),
                                    dbc.Col(dbc.Input(id='cp-da-average_count',
                                                      type='number',
                                                      min=0,
                                                      value=200,
                                                      step=1),
                                            width=3)
                                ],
                                              row=True))),
                    ],
                                                                id=
                                                                'cp-dataanalyser-options',
                                                                fluid=True,
                                                                className=
                                                                'border mt-1 mb-1 pt-1 pb-2'
                                                                ),
                                                  id=
                                                  'cp-dataanalyser-options-fieldset'
                                                  ),
                                    width=10),
                            justify='center',
                            className='mt-3')
                ]),
                        label="Processing controls",
                        id='processing-options',
                        tab_id='processing-options-tab',
                        disabled=True),
                dbc.Tab(dbc.Container([
                    html.H3("System overview"),
                    html.P("""
                        The application is internally divided into two parts, the machine controls themselves and the user interface.
                        There are only one machine controls per server but there can be multiple user interfaces if multiple people open the website at once.
                        Because of this there is a 'user' system and only the current controller can control the machine.
                        When you open the website you are given a session id which can be seen at the top of the Administration tab and looks like this "9fb86f8a-51f5-40f0-b629-1f508a904e6a".
                        Under the session id there are two buttons, those are used to grab and release control of the machine.
                        Under those is the current controller info box, this shows if there is a controller and who it is.
                        If there is a controller which isn't you, you can force remove their control.
                        This has its problems but since the device is meant to be run in a controlled environment it should be good enough.
                    """),
                    html.P("""
                        Once you are the current controller you get access to two controls tabs.
                        In the Run controls tab you can start and stop data acquisition and choose how/if the data should be saved.
                        In the Processing controls tab you can modify parameters which are used during data analysis.
                    """),
                    html.H3("Processing parameters"),
                    html.P("""
                        The device processes the data by detecting sections and it then gets the differences between certain sections.
                        The Edge detection threshold parameter is the voltage difference which constitutes a section transition.
                        What is meant by that is that when the difference between the new datapoint and the average of the current section is greater than the EDT, then this is labeled as an edge and a new section begins.
                    """),
                    html.P("""
                        Peak voltage refers to the voltage difference between the lower section average and the peak of the up section.
                        If there are a 1000 pulses per second then there should be a 1000 peak voltages per second.
                        Correction a and Correction b modify this value.
                        It has been observed that the sample and hold alters the voltages it gets, thereby it is necessary to correct the values.
                        When the data analysis gets a new peak voltage it then multiplies that value by Correction a and adds Correction b to it.
                        The defaults have been calibrated for our setup using a signal generator and should be fine but you want to get raw data just set them to 1 and 0 respectively.
                    """),
                    html.P("""
                        Lastly, there are also the Averaged peak voltages, those are calculated from Peak voltages by averaging a set amount of them, this is done to reduce noise.
                        The Average count parameter sets how many peak voltages should be averaged.
                    """),
                    html.H3("Graph controls and info"),
                    html.P("""
                        Both graphs have two options.
                        First is to show the graph and the second is to update it.
                        When both are on then the graph checks every 2 seconds for new data.
                        If you switch Update graph off, the graph will no longer update but will still be visible.
                        If you switch Update graph back on after a while it's still going to update every 2 seconds but it might not be able to catch up instantly, there is a set maximum datapoints that it can transfer not to overload the network.
                        When switch Show graph off, it automatically switches Update graph off too.
                        When you plan to let the acquisition run for a longer time it is strongly recommended to switch Show graph off for graphs of all data, otherwise they might cause issues.
                    """),
                    html.P("""
                        On the live graph there are two extra things.
                        First you can set how much data it will show and secondly, once it's running it will tell you how many Peak voltages it gets per second (in that interval).
                        The Peaks per second display can be very useful to find the right value for Edge detection threshold.
                    """)
                ],
                                      className='mt-3'),
                        label="Help",
                        tab_id='help-tab')
            ],
                     id='main-tabs')
        ]),
        dbc.Container(
            id='graphs',
            children=[
                ExtendableGraph(app,
                                ms,
                                'full-graph',
                                "All data from this measurement",
                                full_graph_base_fig,
                                full_graph_extend,
                                extend_func_output=[
                                    Output('full-graph', 'extendData'),
                                    Output('full-graph-indices', 'data')
                                ],
                                extend_func_state=
                                [State('full-graph-indices', 'data')]),
                FullRedrawGraph(
                    app,
                    ms,
                    'live-graph',
                    "Data from the last few seconds",
                    live_graph_func,
                    fig_func_output=[
                        Output('live-graph', 'figure'),
                        Output('live-graph-average', 'children'),
                        Output('live-graph-count', 'children')
                    ],
                    fig_func_state=[State('live-graph-T', 'value')],
                    additional_controls=[
                        dbc.Row([
                            dbc.Col(dbc.FormGroup([
                                dbc.Label(
                                    "How many seconds to look in the past:",
                                    html_for='live-graph-T',
                                    width='auto'),
                                dbc.Col(dbc.Input(id='live-graph-T',
                                                  type='number',
                                                  min=0,
                                                  value=5,
                                                  step=0.01),
                                        width=4)
                            ],
                                                  row=True),
                                    width='auto')
                        ],
                                justify='center'),
                        dbc.Row([
                            dbc.Col("", id='live-graph-average', width='auto')
                        ],
                                justify='center'),
                        dbc.Row(
                            [dbc.Col("", id='live-graph-count', width='auto')],
                            justify='center')
                    ])
            ]),
        dbc.Container(id='extras',
                      className='mb-5',
                      style={'display': 'none'},
                      children=[
                          dcc.Store(id='session-id', storage_type='session'),
                          dcc.Store(id='full-graph-indices',
                                    storage_type='session',
                                    data={
                                        'pro_index': 0,
                                        'avg_index': 0
                                    }),
                          html.Div(id='ut-fake-output'),
                          html.Div(id='ut-on_load'),
                          html.Div(id='ut-on_load-2'),
                          html.Div(id='ut-update-controller-status'),
                          html.Div(id='ut-update-controller-status-2'),
                          html.Div(id='ut-update-controller-status-3'),
                          html.Div(id='ut-update-controller-status-4'),
                          html.Div(id='ut-show-warning-modal-0'),
                          html.Div(id='ut-show-warning-modal-1'),
                          html.Div(id='ut-show-warning-modal-2'),
                          html.Div(id='ut-show-warning-modal-3')
                      ])
    ])

    @app.callback([
        Output('ad-grab', 'n_clicks'),
        Output('session-id', 'data'),
        Output('ad-session_id', 'children'),
        Output('ut-update-controller-status', 'children')
    ], [Input('ut-on_load', 'children')], [State('session-id', 'data')])
    def on_load(not_used, old_sid):
        """Triggers on load"""
        if not old_sid:
            sid = str(uuid.uuid4())
            return [42, sid, sid, ""]
        return [42, old_sid, old_sid, ""]

    warning_modal_count = 4
    warning_modal_div_names = [
        'ut-show-warning-modal-' + str(i) for i in range(warning_modal_count)
    ]
    warning_modal_prop_id_names = [
        warning_modal_div_name + '.children'
        for warning_modal_div_name in warning_modal_div_names
    ]

    @app.callback([
        Output('warning-modal', 'is_open'),
        Output('warning-modal-body', 'children')
    ], [
        Input(warning_modal_div_name, 'children')
        for warning_modal_div_name in warning_modal_div_names
    ])
    def show_warning_modal(*args):
        """
        This shows a modal with a warning whenever the children of one of the warning-modal divs
        change. It displays the contents of the div in the modal.
        """
        prop_id = dash.callback_context.triggered[0]['prop_id']
        try:
            children = args[warning_modal_prop_id_names.index(prop_id)]
            if children:
                return [True, children]
            else:
                raise PreventUpdate()
        except ValueError:
            raise PreventUpdate()

    @app.callback([
        Output('ad-grab', 'disabled'),
        Output('ad-release', 'disabled'),
        Output('run-options', 'disabled'),
        Output('processing-options', 'disabled'),
        Output('ad-controller-info', 'children'),
        Output('main-tabs', 'active_tab')
    ], [
        Input('ut-update-controller-status', 'children'),
        Input('ut-update-controller-status-2', 'children'),
        Input('ut-update-controller-status-3', 'children'),
        Input('ut-update-controller-status-4', 'children')
    ], [State('session-id', 'data'),
        State('main-tabs', 'active_tab')])
    def update_controller_status(not_used, not_used_2, not_used_3, not_used_4,
                                 sid, active):
        """Updates the current controller information box"""
        if not ms.controller:
            return [
                False, True, True, True, "There is currently no controller!",
                'administration-tab'
            ]
        elif ms.controller == sid:
            return [
                True, False, False, False, "You are the current controller",
                active
            ]
        else:
            infobox = [ms.controller + " is the current controller"]
            infobox.append(
                dbc.Button("Force release?",
                           id='ad-force_release',
                           color='danger',
                           className='ml-3 mr-3'))
            return [True, True, True, True, infobox, 'administration-tab']

    @app.callback(Output('ut-fake-output', 'children'),
                  [Input('ad-delete-logs', 'n_clicks')])
    def deleter_logs(n_clicks):
        if n_clicks:
            ms.delete_logs()
        raise PreventUpdate()

    @app.callback([
        Output('ut-update-controller-status-2', 'children'),
        Output('ut-show-warning-modal-1', 'children'),
    ], [Input('ad-grab', 'n_clicks'),
        Input('ad-release', 'n_clicks')], [State('session-id', 'data')])
    def grab_release(not_used, not_used_2, sid):
        """Handles the "Grab" and "Release" buttons"""
        prop_id = dash.callback_context.triggered[0]['prop_id']
        if prop_id.startswith('ad-grab'):
            if not ms.controller:
                ms.grab_control(sid)
                return ["", ""]
            else:
                return [
                    "", "Sorry, someone has grabbed control before you have."
                ]
        elif prop_id.startswith('ad-release'):
            if ms.controller == sid:
                ms.release_control()
                return ["", "You are now not in control of the system."]
            else:
                return [
                    "",
                    "Someone has removed your control before, you are now not the controller."
                ]
        else:
            raise PreventUpdate()

    @app.callback([
        Output('ut-update-controller-status-3', 'children'),
        Output('ut-show-warning-modal-2', 'children')
    ], [
        Input('ad-force_release', 'n_clicks'),
    ], [
        State('ad-controller-info', 'children'),
        State('ut-show-warning-modal-2', 'children')
    ])
    def force_release(n_clicks, controller_info, warning_msg):
        """Handles the "Force Release" button"""
        if n_clicks:
            if ms.controller:
                if controller_info[0].startswith(ms.controller):
                    ms.release_control()
                    return ["", ""]
                else:
                    return [
                        "",
                        "Someone else has become the controller since last refresh."
                    ]
            else:
                return ["", ""]
        return ["", warning_msg]

    @app.callback([
        Output('ut-show-warning-modal-0', 'children'),
        Output('cp-start', 'disabled'),
        Output('cp-stop', 'disabled'),
        Output('cp-saving-options-fieldset', 'disabled'),
        Output('cp-dataanalyser-options-fieldset', 'disabled'),
        Output('cp-save-messagebox', 'children'),
        Output('ut-update-controller-status-4', 'children')
    ], [Input('cp-start', 'n_clicks'),
        Input('cp-stop', 'n_clicks')], [
            State('session-id', 'data'),
            State('cp-save-toggle', 'checked'),
            State('cp-save-base_filename', 'value'),
            State('cp-save-select_ft', 'value'),
            State('cp-save-items', 'value'),
            State('cp-da-edge_detection_threshold', 'value'),
            State('cp-da-average_count', 'value'),
            State('cp-da-correction_a', 'value'),
            State('cp-da-correction_b', 'value')
        ])
    def start_stop(start_ncl, stop_ncl, sid, should_save, save_filename,
                   save_filetype, save_items, edge_detection_threshold,
                   average_count, correction_a, correction_b):
        """
        Handles the "Start" and "Stop" buttons, this is the most complicated callback.

        First if the client isn't the current controller it disables the control tabs for him,
        updates his current controller info and shows a warning modal explaining what happened to him.

        Otherwise it splits based on if he pressed "Start" or "Stop".
        If he pressed "Start", it tries to start data acquisition and shows an info box
        telling the client if it worked, failed or what, it also disables one of the buttons.
        For "Stop" it just stops the data acquisition and shows a message with possibly a link to the data.
        """
        prop_id = dash.callback_context.triggered[0]['prop_id']
        if (start_ncl or stop_ncl) and sid != ms.controller:
            return [
                "Someone has forcefully removed your control of the system.",
                prop_id.startswith('cp-start'),
                prop_id.startswith('cp-stop'),
                prop_id.startswith('cp-stop'),
                prop_id.startswith('cp-stop'),
                prop_id.startswith('cp-stop'), ""
            ]
        out = []
        if prop_id.startswith('cp-start'):
            if should_save and (not save_filename.isalnum()):
                return [
                    "The supplied filename is not valid, aborting. The filename must only contain letters and numbers.",
                    False, True, False, False,
                    "Aborted due to invalid filename", ""
                ]
            ms.start_experiment(
                save_filename if should_save else None,
                Filetype.from_str(save_filetype),
                edge_detection_threshold=edge_detection_threshold,
                average_count=average_count,
                items=save_items,
                correction_func=linear_correct_func(correction_a,
                                                    correction_b))
            if should_save:
                out = ["", True, False, True, True]
                if ms.saver:
                    out.append("Started acquiring and saving to file \"" +
                               ms.saver.full_filename + "\"")
                elif should_save:
                    out.append(
                        "Acquiring has started but there has been an error with saving the data"
                    )
            else:
                out = [
                    "", True, False, True, True,
                    "Acquisition has started successfully"
                ]
        elif prop_id.startswith('cp-stop'):
            ms.stop_experiment()
            msgbox = ["The Acquisition has been successfully stopped."]
            if ms.data:
                if ms.saver:
                    msgbox.append(
                        html.A("Download the data here.",
                               href=ms.saver.full_filename[1:]))
            out = ["", False, True, False, False, msgbox]
        else:
            raise PreventUpdate()
        return out + [""]

    @app.callback([
        Output('cp-save-base_filename-row', 'style'),
        Output('cp-save-select_ft-row', 'style'),
        Output('cp-save-items-row', 'style')
    ], [
        Input('cp-save-toggle', 'checked'),
        Input('cp-save-select_ft', 'value')
    ])
    def cp_save_ui_callbacks(should_save, filetype):
        """This toggles visibility of the save options based on if saving is enabled"""
        out = [{}, {}, {}]
        if not should_save:
            out[0]['display'] = 'none'
            out[1]['display'] = 'none'
            out[2]['display'] = 'none'
        if filetype != "hdf5":
            out[2]['display'] = 'none'
        return out

    @app.callback([
        Output('cp-da-edge_detection_threshold', 'value'),
        Output('cp-da-correction_a', 'value'),
        Output('cp-da-correction_b', 'value'),
        Output('cp-da-average_count', 'value'),
        Output('ut-show-warning-modal-3', 'children'),
    ], [Input('cp-da-config_upload', 'contents')], [
        State('cp-da-edge_detection_threshold', 'value'),
        State('cp-da-correction_a', 'value'),
        State('cp-da-correction_b', 'value'),
        State('cp-da-average_count', 'value'),
    ])
    def upload_config(cont, edt, ca, cb, ac):
        """
        This handles the processing configuration uploading.

        It processes the file line by line, stripping each line. Then it tries
        to split it on the '=' character into exactly two parts. Then if the
        first part matches any of the property names, the second part is converted
        to the correct type and assigned as the property value.

        If anything goes wrong during it, then all of the values stay the same.
        """
        if not cont:
            raise PreventUpdate()
        old_edt = edt
        old_ca = ca
        old_cb = cb
        old_ac = ac
        try:
            for k, v in [
                    map(lambda x: x.strip(),
                        line.split('=')) for line in base64.b64decode(
                            cont.split(',')[1]).decode().strip().split('\n')
            ]:
                if k == 'edge_detection_threshold':
                    edt = float(v)
                elif k == 'correction_a':
                    ca = float(v)
                elif k == 'correction_b':
                    cb = float(v)
                elif k == 'average_count':
                    ac = int(v)
                else:
                    ms.debugger.warning(
                        "Config loading: \"" + k +
                        "\" does not match any of the parameter names.")
                    raise Exception()
            return [edt, ca, cb, ac, ""]
        except:
            return [
                old_edt, old_ca, old_cb, old_ac,
                "The uploaded file could not be parsed, try a different one."
            ]

    @app.callback(Output('cp-da-config_link', 'href'), [
        Input('cp-da-edge_detection_threshold', 'value'),
        Input('cp-da-correction_a', 'value'),
        Input('cp-da-correction_b', 'value'),
        Input('cp-da-average_count', 'value'),
        Input('ut-on_load-2', 'children')
    ])
    def save_config(edt, ca, cb, ac, not_used):
        """Sets the href on the download link to the new value whenever the parameters change."""
        config = 'edge_detection_threshold=' + str(
            edt) + '\n' + 'correction_a=' + str(
                ca) + '\n' + 'correction_b=' + str(
                    cb) + '\n' + 'average_count=' + str(ac) + '\n'
        return 'data:text/csv;charset=utf-8,' + urllib.parse.quote(config),

    logs_page_template = """
        <ul>
            {% for file in files %}
            <li>
                <a href="{{ file }}">{{ file }}</a>
            </li>
            {% endfor %}
        </ul>
    """

    @app.server.route('/logs/')
    def get_logs_dir():
        files = filter(
            lambda x: os.path.isfile(os.path.join(ms.log_directory, x)),
            os.listdir(ms.log_directory))
        return flask.render_template_string(logs_page_template, files=files)

    @app.server.route('/logs/<path:path>')
    def get_log(path):
        """This enables downloading logs, whenever a request is made to /logs/something,
        the file named something is downloaded from the current log folder"""
        result = flask.send_from_directory(ms.log_directory, path)
        return result

    return app
コード例 #5
0
def get_chaos_form(n, graph_elements, batfish_host, batfish_network,
                   original_snapshot):

    ctx = dash.callback_context
    button_id = ctx.triggered[0]['prop_id'].split('.')[0]

    if button_id != "traceroute_chaos_switch":
        raise PreventUpdate

    if not n:
        return None, None

    traceroute_nodes = []
    try:
        for traceroute_node in graph_elements:
            traceroute_nodes.append(traceroute_node['data']['label'])
    except KeyError:
        pass

    batfish = Batfish(batfish_host)
    batfish.set_network(batfish_network)
    batfish.set_snapshot(original_snapshot)

    batfish_df = batfish.get_info("nodeProperties")
    batfish_df = batfish_df.set_index('Node')

    nodes_dict = [{
        'label': node,
        'value': node
    } for node in set(traceroute_nodes)]
    node = nodes_dict[0]['value']
    interfaces = batfish_df.loc[node].at['Interfaces']

    interfaces_dict = [{'label': '', 'value': ''}]

    interfaces_dict += [{
        'label': interface,
        'value': interface
    } for interface in interfaces]

    form_children = [
        dbc.Col(children=[
            html.Fieldset(
                id="traceroute_source_fieldset",
                children=[
                    html.Legend("Choose Node"),
                    dbc.InputGroup([
                        dbc.Select(
                            id="traceroute_choose_node",
                            options=nodes_dict,
                            value=node,
                        ),
                    ]),
                ],
            ),
        ], ),
        dbc.Col(children=[
            html.Fieldset(
                id="traceroute_source_fieldset",
                children=[
                    html.Legend("Deactivate Node?"),
                    daq.BooleanSwitch(
                        id='deactivate_node_switch',
                        on=False,
                    ),
                ],
            ),
        ], ),
        dbc.Col(
            id="traceroute_deactivate_interface_col",
            children=[
                html.Fieldset(
                    id="traceroute_source_fieldset",
                    children=[
                        html.Legend("Deactivate Interface"),
                        dbc.InputGroup([
                            dbc.Select(
                                id="traceroute_deactivate_interface",
                                options=interfaces_dict,
                                value='',
                            ),
                        ]),
                    ],
                ),
            ],
        ),
        dbc.Col(children=[
            html.Div(
                dbc.Button("Change Configuration?",
                           id="chaos_traceroute_change_config_button")),
            daq.BooleanSwitch(id='change_configuration_switch',
                              on=False,
                              style={"display": "none"}),
        ]),
        dbc.Col(html.Div(dbc.Button("Chaos!",
                                    id="chaos_traceroute_submit")), ),
    ]

    fieldset_children = [
        html.Legend("Chaos Trace Route"),
        html.Div(id="chaos_traceroute_graph"),
        html.Div(dcc.Tabs(id="chaos_traceroute_tabs")),
    ]

    return form_children, fieldset_children
コード例 #6
0
def get_advanced_options_form(advanced_option_sw):

    if advanced_option_sw:
        hidden = False
    else:
        hidden = True
    children = [
        html.Div(
            hidden=hidden,
            children=[
                dbc.Form(
                    [
                        dbc.Col(children=[
                            dbc.FormGroup(
                                [
                                    html.Fieldset(
                                        id="traceroute_src_ports_fieldset",
                                        children=[
                                            html.Legend("Source Ports"),
                                            dbc.Input(
                                                id="traceroute_src_ports",
                                                placeholder="e.g., 22"),
                                        ],
                                    ),
                                ],
                                className="mr-3",
                            ),
                        ]),
                        dbc.Col(children=[
                            dbc.FormGroup(
                                [
                                    html.Fieldset(
                                        id="traceroute_dst_ports_fieldset",
                                        children=[
                                            html.Legend("Destination Port"),
                                            dbc.Input(
                                                id="traceroute_dst_ports",
                                                placeholder="e.g., 22"),
                                        ],
                                    ),
                                ],
                                className="mr-3",
                            ),
                        ]),
                        dbc.Col(children=[
                            dbc.FormGroup(
                                [
                                    html.Fieldset(
                                        id="traceroute_application_fieldset",
                                        children=[
                                            html.Legend("Application"),
                                            dbc.Input(
                                                id="traceroute_applications",
                                                placeholder=
                                                "e.g., SSH, DNS, SNMP"),
                                        ],
                                    ),
                                ],
                                className="mr-3",
                            ),
                        ]),
                        dbc.Col(children=[
                            dbc.FormGroup(
                                [
                                    html.Fieldset(
                                        id="traceroute_ip_protocol_fieldset",
                                        children=[
                                            html.Legend("IP Protocol"),
                                            dbc.Input(
                                                id="traceroute_ip_protocols",
                                                placeholder=
                                                "e.g., TCP, UDP, ICMP"),
                                        ],
                                    ),
                                ],
                                className="mr-3",
                            ),
                        ]),
                    ],
                    inline=True,
                )
            ])
    ]

    return children
コード例 #7
0
ファイル: app.py プロジェクト: omelyanchikd/ace_analytics
 html.Div(html.Fieldset([
     html.Button(id='reset-button',
                 n_clicks=0,
                 children='Очистити'),
     html.Label('Виберіть таблицю:'),
     dcc.Dropdown(id='table',
                  options=[
                      {
                          'label': 'Світ',
                          'value':
                          'models_worldresult'
                      },
                      {
                          'label': 'Фірми',
                          'value': 'models_firmresult'
                      },
                      {
                          'label':
                          'Ринок товарів',
                          'value':
                          'models_goodmarketresult'
                      },
                      {
                          'label':
                          'Ринок праці',
                          'value':
                          'models_labormarketresult'
                      },
                  ],
                  value='models_worldresult'),
     html.Label('Виберіть X:'),
     dcc.Dropdown(id='xaxis-field'),
     html.Label('Виберіть Y:'),
     dcc.Dropdown(id='yaxis-fields', multi=True),
     html.Label('Виберіть фільтри:'),
     html.Br(),
     html.Label('Змінна фільтрування 1:'),
     dcc.Dropdown(id='filter-variable1'),
     html.Label('Значення фільтрування 1:'),
     dcc.Dropdown(id='filter-values1',
                  multi=True,
                  clearable=False),
     html.Label('Зміна фільтрування 2:'),
     dcc.Dropdown(id='filter-variable2'),
     html.Label('Значення фільтрування 2:'),
     dcc.Dropdown(id='filter-values2',
                  multi=True,
                  clearable=False),
     html.Label('Зміна фільтрування 3:'),
     dcc.Dropdown(id='filter-variable3'),
     html.Label('Значення фільтрування 3:'),
     dcc.Dropdown(id='filter-values3',
                  multi=True,
                  clearable=False),
     html.Label('Виберіть змінні розбиття:'),
     dcc.Dropdown(id='split', multi=True),
     html.Label('Виберіть спосіб розбиття:'),
     dcc.RadioItems(id='split-type',
                    options=[
                        {
                            'label': 'Фасет',
                            'value': 'facet'
                        },
                        {
                            'label': 'Колір',
                            'value': 'color'
                        },
                    ],
                    value='facet',
                    labelStyle={'display': 'block'}),
     html.Label('Виберіть стиль графіку:', ),
     dcc.RadioItems(id='chart-type',
                    options=[
                        {
                            'label':
                            'Лінійний графік',
                            'value': 'lines'
                        },
                        {
                            'label':
                            'Точкова діаграма',
                            'value': 'markers'
                        },
                        {
                            'label':
                            'Стовпчикова діаграма',
                            'value': 'bar'
                        },
                        {
                            'label': 'Гістограма',
                            'value': 'histogram'
                        },
                        {
                            'label': 'Ящик з вусами',
                            'value': 'box'
                        },
                    ],
                    value='lines',
                    labelStyle={'display': 'block'}),
     html.Label('Виберіть спосіб агрегування:', ),
     dcc.RadioItems(id='aggregation-type',
                    options=[
                        {
                            'label': 'Мінімум',
                            'value': 'min'
                        },
                        {
                            'label': 'Максимум',
                            'value': 'max'
                        },
                        {
                            'label': 'Середнє',
                            'value': 'avg'
                        },
                        {
                            'label': 'Медіана',
                            'value': 'median'
                        },
                        {
                            'label': 'Кількість',
                            'value': 'count'
                        },
                        {
                            'label':
                            'Без агрегування',
                            'value': 'none'
                        },
                    ],
                    value='none',
                    labelStyle={'display': 'block'})
 ]),
コード例 #8
0
def get_traceroute_content(batfish_df):
    options = [str(x) for x in batfish_df["Interface"]]
    interfaces = [{
        'label': interface,
        'value': interface
    } for interface in options]

    return html.Div(children=[
        dbc.Card(
            dbc.CardBody(children=[
                dbc.Row(
                    id="traceroute_src_dst_row",
                    children=[
                        dbc.Col(children=[
                            html.Fieldset(
                                id="traceroute_source_fieldset",
                                children=[
                                    html.Legend("Source"),
                                    dbc.InputGroup([
                                        dcc.Dropdown(
                                            id="traceroute_src_interface",
                                            placeholder='Select Source',
                                            options=interfaces,
                                        )
                                    ]),
                                ],
                            ),
                        ], ),
                        dbc.Col(children=[
                            html.Fieldset(
                                id="traceroute_dst_fieldset",
                                children=[
                                    html.Legend("Destination"),
                                    dbc.InputGroup([
                                        html.Div(
                                            id=
                                            "traceroute_dst_type_dropdown_div",
                                            children=[
                                                dcc.Dropdown(
                                                    id=
                                                    "traceroute_dst_type_dropdown",
                                                    options=[{
                                                        'label': 'IP',
                                                        'value': 'IP'
                                                    }, {
                                                        'label':
                                                        'Interface',
                                                        'value':
                                                        'Interface'
                                                    }],
                                                    value="Interface",
                                                )
                                            ],
                                        ),
                                        html.Div(
                                            id="traceroute_dst_input",
                                            children=[
                                                dcc.Dropdown(
                                                    id="traceroute_dst",
                                                    placeholder=
                                                    'Select Destination',
                                                    options=interfaces,
                                                )
                                            ],
                                        ),
                                    ]),
                                ],
                            ),
                        ], ),
                        dbc.Col(
                            width=1,
                            children=[
                                html.Div(
                                    className="bidir_switch",
                                    children=[
                                        daq.BooleanSwitch(
                                            id=
                                            'main_page_traceroute_bidir_switch',
                                            on=False,
                                            label="Bidir",
                                            labelPosition="left",
                                        ),
                                        daq.BooleanSwitch(
                                            id=
                                            'traceroute_advanced_options_switch',
                                            on=False,
                                            label="Advanced?",
                                            labelPosition="left",
                                        ),
                                        daq.BooleanSwitch(
                                            id='traceroute_chaos_switch',
                                            on=False,
                                            label="Chaos?",
                                            labelPosition="left",
                                        ),
                                    ]),
                            ],
                        ),
                        dbc.Col(
                            html.Div(
                                dbc.Button("Trace!",
                                           id="main_page_traceroute_submit",
                                           disabled=True)), ),
                    ]),
                dbc.Row(id="traceroute-advanced_options_row"),
                dbc.Row(id="traceroute-alter-node"),
            ], ), ),
        html.Fieldset([
            html.Legend("Forward Trace Route"),
            html.Div(id="main_page_forward_traceroute_graph"),
            html.Div(style={"width": "1000px"},
                     children=[dcc.Tabs(id="forward_traceroute_tabs")]),
        ]),
        html.Fieldset([
            html.Legend("Reverse Trace Route"),
            html.Div(id="main_page_reverse_traceroute_graph"),
            html.Div(style={"width": "1000px"},
                     children=[dcc.Tabs(id="reverse_traceroute_tabs")]),
        ]),
        html.Fieldset(id="chaos_traceroute_fieldset"),
    ], ),
コード例 #9
0
def build_layout():
    min_date = db.min_timestamp().isoformat()
    max_date = db.max_timestamp().isoformat()
    safe_start_date = (datetime.now() -
                       timedelta(days=1)).replace(microsecond=0).isoformat()
    return html.Div([
        html.H1(children='BitShares Feed Tracker',
                style={'text-align': 'center'}),
        html.Div(
            className='pure-g',
            children=[
                html.Div(
                    className='pure-u-1-5',
                    children=[
                        html.Form(
                            className="pure-form-stacked",
                            children=[
                                html.Fieldset(children=[
                                    html.Label('Asset:'),
                                    dcc.Dropdown(id='asset-dropdown',
                                                 options=[{
                                                     'label': asset,
                                                     'value': asset
                                                 } for asset in
                                                          db.list_assets()],
                                                 value='CNY'),
                                    html.Label(children='Publishers:'),
                                    dcc.Dropdown(id='publisher-dropdown',
                                                 multi=True),
                                    dcc.Checklist(
                                        id='publisher-option',
                                        options=[{
                                            'label': 'All',
                                            'value': 'publishers-all'
                                        }],
                                        labelClassName='pure-checkbox',
                                        labelStyle={'text-align': 'right'},
                                        values=[]),
                                    html.Label(children='From:'),
                                    dcc.Input(id='from-date',
                                              type='datetime-local',
                                              min=min_date,
                                              max=max_date,
                                              value=safe_start_date),
                                    html.Label(children='To:'),
                                    dcc.Input(id='to-date',
                                              type='datetime-local',
                                              min=min_date,
                                              max=max_date,
                                              value=None),
                                    html.Label(children='Additional feeds:'),
                                    dcc.Checklist(
                                        id='options',
                                        options=[{
                                            'label': 'Feed median',
                                            'value': 'median'
                                        }, {
                                            'label': 'DEX price',
                                            'value': 'internal'
                                        }, {
                                            'label': 'External price',
                                            'value': 'external'
                                        }],
                                        labelClassName='pure-checkbox',
                                        values=[]),
                                ])
                            ])
                    ]),
                html.Div(className='pure-u-4-5',
                         children=[dcc.Graph(id='price-graph')])
            ])
    ])
コード例 #10
0
def create_layout(app):
    """Create the Dash application components and configure them into a layout

    Arguments:
        app {Dash} -- Dash application that will receive the layout
    """
    logger.info('Creating application components')

    logger.debug('Creating top level DIV')
    page = html.Div(children=[])

    logger.debug('Creating application title')
    page_title = html.H1(id='app-title',
                         children='COVID-19 Global Data Plotter')

    logger.debug('Creating appliaction description DIV')
    app_description = html.Div(
        children='''This COVID-19 data visualization tool allow you to simply
        browse available global data on those that are infected, recovered,
        or have died.''')

    logger.debug('Creating search Dropdown')
    search_field = dcc.Dropdown(id='search-field',
                                multi=True,
                                clearable=True,
                                options=[],
                                searchable=True,
                                placeholder='Select country data to plot')
    _populate_search(search_field)

    logger.debug('Creating main-plot Graph')
    main_plot = dcc.Graph(id='main-plot',
                          figure={
                              'data': [],
                              'layout': {
                                  'title': 'Dash Data Visualization'
                              }
                          },
                          config={
                              'editable': True,
                              'showTips': True
                          })

    logger.debug('Creating normalization radio buttons')
    normalization_rb = dcc.RadioItems(
        id='normalization-rb',
        labelStyle={'display': 'block'},
        options=[{
            'label': 'None',
            'value': 'none'
        }, {
            'label': 'Per 1000 people',
            'value': 'per-1000'
        }, {
            'label': 'Per capita',
            'value': 'per-capita'
        }],
        value='none',
    )
    normalization_fs = html.Fieldset(
        style={'display': 'inline-block'},
        children=[html.Legend(children='Normalization'), normalization_rb],
        draggable=True,
    )

    logger.debug('Creating infected chart type radio buttons')
    chart_option_elems = []
    for data_type in ('infected', 'dead', 'recovered'):
        chart_type_rb = dcc.RadioItems(
            id=f'chart-{data_type}-rb',
            labelStyle={'display': 'block'},
            options=[
                {
                    'label': 'Line',
                    'value': 'line'
                },
                {
                    'label': 'Bar',
                    'value': 'bar'
                },
            ],
            value='line',
        )
        chart_option_elems.append(
            html.Fieldset(style={'display': 'inline-block'},
                          children=[
                              html.Legend(children=f'Plot Type ({data_type})'),
                              chart_type_rb
                          ],
                          draggable=True))
    logger.debug('Adding sub-components to top-level DIV')
    page.children.append(page_title)
    page.children.append(app_description)
    page.children.append(search_field)
    page.children.append(normalization_fs)
    page.children.extend(chart_option_elems)
    page.children.append(main_plot)

    logger.info('Setting application layout')
    app.layout = page
コード例 #11
0
ファイル: app.py プロジェクト: mcbridejc/core-mem-dashboard
app = dash.Dash("Core Mem")

app.layout = html.Div([
    html.H1('Magnetic Core Memory Dashboard'),
    html.Div([
        html.Div([
            Svg(id='diagram', value=svg_data(), classMap=get_class_map())
        ], className='box diagram-box'),
        html.Div([memory_value_table()], id='mem-table-div', className='box mem-table-box'),
        html.Fieldset([
            html.Legend(['Write to Memory']),
            html.Span([
                'Addr: ',
                dcc.Input(id='addrInput', value='0', type='number', min=0, max=7, placeholder="Write Addr"),
            ]),
            html.Span([
                'Value: ',
                dcc.Input(id='wrValInput', value='0', type='number', min=0, max=255, placeholder="Value"),
            ]),
            html.Button('Write', id='writeButton'),
        ], className='box write-box'),
        html.Fieldset([
            html.Legend('Read memory'),
            html.Button('Read', id='readButton'),
        ], className='box read-box'),
        html.Fieldset([
            html.Legend('Digital Pot Control'),
            html.Div([
                "VDRIVE: ",
                dcc.Slider(id='vdriveInput', value=1000, updatemode='drag', min=0, max=30000),
                html.Span(id='vdriveDisplay'),
コード例 #12
0
def defineDownItemFieldset(dash_instance):
    """Method to create a fieldset containing all down items"""

    down_nodes = getDownNodes()
    down_groups = getDownGroups()
    down_nodes = [node['Caption'] for node in down_nodes]
    down_groups = [group['Name'] for group in down_groups]

    node_mappings = resolveEntitiesToUrls(down_nodes, "node")
    group_mappings = resolveEntitiesToUrls(down_groups, "group")

    # Create Navigation pane for both nodes and groups
    down_nodes_nav_label = html.Label("Down Nodes",
                                      style=dict(margin="25px auto",
                                                 fontWeight="bold",
                                                 textDecoration="underline",
                                                 fontSize=24))
    down_nodes_nav_list = html.Ul(children=[
        html.Li(html.A(key, href=value, target="_blank"))
        for key, value, in node_mappings.items()
    ])
    down_groups_nav_label = html.Label("Down Groups",
                                       style=dict(margin="25px auto",
                                                  fontWeight="bold",
                                                  textDecoration="underline",
                                                  fontSize=24))
    down_groups_nav_list = html.Ul(children=[
        html.Li(
            html.A(key,
                   href=value,
                   target="_blank",
                   style=dict(wordBreak="break-all")))
        for key, value, in group_mappings.items()
    ])

    # Create containers for nav menus
    down_nodes_nav = html.Div(
        children=[down_nodes_nav_label, down_nodes_nav_list],
        style=dict(display="inline-block",
                   textAlign="center",
                   float="left",
                   marginRight="50px"))
    down_groups_nav = html.Div(
        children=[down_groups_nav_label, down_groups_nav_list],
        style=dict(display="inline-block",
                   textAlign="center",
                   float="left",
                   width="200px"))
    down_nav = html.Div(children=[down_nodes_nav, down_groups_nav],
                        style=dict(maxWidth="600px", margin="0 auto"))

    # Add the containers to a fieldset
    field_legend = html.Legend("Down Items",
                               style=dict(fontSize=36,
                                          fontWeight="bold",
                                          position="relative",
                                          top="8px"))
    fieldset = html.Fieldset([field_legend, down_nav],
                             title="Down Items",
                             style=dict(width="60%",
                                        backgroundColor="white",
                                        border="1px solid black",
                                        marginLeft="auto",
                                        marginRight="auto"))
    return fieldset
コード例 #13
0
def defineStatisticsFieldset(dash_instance):
    """Method to create a fieldset for all statistics data"""

    # create search props
    searchLabel, \
    searchRadio, \
    searchBar = createSearchOption(dash_instance)

    # create group props
    groupLabel, \
    groupDropDown = createGroupMenu(dash_instance)

    # create node props
    nodeLabel, \
    nodeDropDown = createNodeMenu(dash_instance)

    # create radio for days of data
    dayLabel, \
    dayRadio, \
    custDay = createDayRadio(dash_instance)

    # create search button and updating area
    searchButton, updatingLabel = createSearchButton(dash_instance)

    # components list and styles
    components = [{
        'elements': [{
            'element': searchLabel
        }, {
            'element': searchRadio,
            'colSpan': '2'
        }]
    }, {
        'elements': [{
            'element': searchBar,
            'colSpan': '3'
        }]
    }, {
        'elements': [{
            'element': groupLabel
        }, {
            'element': groupDropDown,
            'colSpan': '2'
        }]
    }, {
        'elements': [{
            'element': nodeLabel
        }, {
            'element': nodeDropDown,
            'colSpan': '2'
        }]
    }, {
        'elements': [{
            'element': dayLabel
        }, {
            'element': dayRadio
        }, {
            'element': custDay
        }]
    }, {
        'elements': [{
            'element': searchButton,
            'colSpan': '3'
        }]
    }, {
        'elements': [{
            'element': updatingLabel,
            'colSpan': '3'
        }]
    }]

    #create the table and return it
    selection_table = Table(children=components,
                            id="DashTable",
                            style=dict(align='center',
                                       marginLeft='auto',
                                       marginRight='auto',
                                       marginBottom='30',
                                       marginTop='30',
                                       paddingBottom='20',
                                       textAlign='left',
                                       border='1px solid black',
                                       width='30%')).getComponent()

    # create space for updated dash
    avlayout = buildGraphLayout(title="Percent Availability")
    availabilityGraph = html.Div(children=[],
                                 style=dict(marginBottom=100,
                                            height=500,
                                            width=900),
                                 id='Availability Graph')

    cpulayout = buildGraphLayout(title='CPU Load')
    cpuGraph = html.Div(children=[],
                        style=dict(marginBottom=100, height=500, width=900),
                        id='CPU Load Graph')

    graphsPlaced = [{
        'elements': [{
            'element': cpuGraph
        }, {
            'element': availabilityGraph
        }]
    }]
    av_cpu_table = Table(children=graphsPlaced,
                         id='DashGraphs',
                         style=dict(textAlign='center')).getComponent()

    # create legend for fieldset
    field_legend = html.Legend("Node Statistics",
                               style=dict(fontSize=36,
                                          fontWeight="bold",
                                          position="relative",
                                          top="8px"))

    # Create fieldset for all tables and stats
    fieldset = html.Fieldset([
        field_legend, selection_table, av_cpu_table,
        html.Div(id="interfaceTable", style=dict(marginBottom=200))
    ],
                             title="Down Items",
                             style=dict(backgroundColor="white",
                                        border="1px solid black",
                                        marginLeft="30px",
                                        marginBottom="30px"))

    return fieldset
コード例 #14
0
 className="layout_box",
 children=[
     html.Div(
         id='data_tab_body',
         className="control_bar dashbox",
         children=[
             html.Fieldset([
                 html.Div([
                     html.Label(htmlFor='transactions_url',
                                children='Transaction Source URL'),
                     dcc.Input(id='transactions_url',
                               type='url',
                               value='http://localhost/transactions.csv',
                               placeholder='URL for transaction csv file')
                 ]),
                 html.Div([
                     html.Label(htmlFor='eras_url',
                                children='Eras source URL (optional)'),
                     dcc.Input(id='eras_url',
                               type='url',
                               value='http://localhost/eras.csv',
                               placeholder='URL for eras csv file')
                 ]),
                 html.Div([html.Button('Reload', id='data_load_button')]),
             ]),
         ]),
     html.Div(id='meta_data_box',
              children=[
                  html.H4("Files Loaded"),
                  html.Div(id='meta_data', children=[]),
              ]),
コード例 #15
0
						html.Fieldset(
							className='controls__createTest',
							children=[
								html.Legend('CREATE A TEST'),
								html.Div(
									id = 'createTest__start',
									children=[
										dcc.Input(
											id='input__testID',
											type='text',
											placeholder='Test ID'
										),
										dcc.Input(
											id='input__sampleWeight',
											type='number',
											placeholder='Weight of Sample (Kg)'
										),
										dcc.Input(
											id='input__time',
											type='number',
											placeholder='Minutes'
										),
										html.Button('START', id='btn__startTest')
									]
								),
								html.Div(
									id='createTest__stop',
									style={'display': 'none'},
									children=[
										html.Div(
											html.H3('12:00', id='timer')
										),
										html.Button('STOP', id='btn__stopTest')
									]
								),
								html.Div(
									id='createTest__again',
									style={'display':'none'},
									children=[
										html.A(html.Button('CREATE ANOTHER TEST?', id='btn__againTest'), href='/')
									]
								)
							]
						),
コード例 #16
0
 className="layout_box",
 children=[
     html.Div(
         className='master_time_series dashbox',
         id='bs_time_series_box',
         children=[
             html.Fieldset(className='control_bar',
                           children=[
                               html.Span(children='Group By ', ),
                               dcc.RadioItems(id='bs_period',
                                              options=[
                                                  x
                                                  for x in TIME_RES_OPTIONS
                                                  if x['label'] != 'Era'
                                              ],
                                              value=3,
                                              style={
                                                  'height':
                                                  '1.2rem',
                                                  'color':
                                                  'var(--fg)',
                                                  'backgroundColor':
                                                  'var(--bg-more)'
                                              }),
                           ]),
             dcc.Graph(id='bsa_master_time_series'),
             dcc.Graph(id='bsl_master_time_series'),
             dcc.Graph(id='bse_master_time_series'),
         ]),
     html.Div(id='bs_trans_table_box',
              children=[
コード例 #17
0
 dcc.Graph(id='master_time_series'),
 html.Div(className="control_bar",
          children=[
              dcc.Store(id='time_series_selection_info',
                        storage_type='memory'),
              html.Div(id='selected_trans_display',
                       children=None),
              html.Fieldset(
                  className='control_bar',
                  children=[
                      html.Span(children='Group By ', ),
                      dcc.RadioItems(
                          id='time_series_resolution',
                          options=TIME_RES_OPTIONS,
                          value=3,
                          style={
                              'height':
                              '1.2rem',
                              'color':
                              'var(--fg)',
                              'backgroundColor':
                              'var(--bg-more)'
                          }),
                  ]),
              html.Fieldset(
                  className="control_bar",
                  children=[
                      html.Span(children='Monthly', ),
                      daq.ToggleSwitch(
                          id='time_series_span',
                          value=False,
コード例 #18
0
 html.Fieldset(
     className="field_grid field_grid3",
     children=[
         html.Div(),
         html.Label(htmlFor="ds_delimiter",
                    children="Account Delimiter"),
         dcc.Input(
             id="ds_delimiter",
             type="text",
             persistence=True,
             persistence_type="memory",
             placeholder=CONST["delim"],
             debounce=True,
         ),
         html.H4("Required Field"),
         html.H4("Column Name"),
         html.H4(id="first_row", children="First Row"),
         html.Label(htmlFor="account_name_col",
                    children="Account"),
         dcc.Input(
             id="account_name_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder="Account",
             debounce=True,
         ),
         html.Div(className="code", id="account_row_1"),
         html.Label(htmlFor="amount_col", children=" Amount"),
         dcc.Input(
             id="amount_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder="Amount Num.",
             debounce=True,
         ),
         html.Div(className="code", id="amount_row_1"),
         html.Label(htmlFor="date_col", children=" Date"),
         dcc.Input(
             id="date_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder="Date",
             debounce=True,
         ),
         html.Div(className="code", id="date_row_1"),
         html.Label(htmlFor="desc_col",
                    children=" Description"),
         dcc.Input(
             id="desc_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder="Description",
             debounce=True,
         ),
         html.Div(className="code", id="desc_row_1"),
         html.Label(
             htmlFor="full_account_name_col",
             children="Full Account Name",
         ),
         dcc.Input(
             id="full_account_name_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder=CONST["fan_col"],
             debounce=True,
         ),
         html.Div(className="code", id="fan_row_1"),
         html.Label(htmlFor="parent_col",
                    children=" Parent Account"),
         dcc.Input(
             id="parent_col",
             type="text",
             size="15",
             persistence=True,
             persistence_type="memory",
             placeholder=CONST["parent_col"],
             debounce=True,
         ),
         html.Div(className="code", id="parent_row_1"),
     ],
 ),
コード例 #19
0
def build_layout():
    min_date = db.min_timestamp().isoformat()
    max_date = db.max_timestamp().isoformat()
    safe_start_date = (datetime.now() -
                       timedelta(days=1)).replace(microsecond=0).isoformat()
    return html.Div([
        html.Div(className='header',
                 children=[
                     html.H1(children='BitShares Feed Tracker',
                             style={'text-align': 'center'})
                 ]),
        html.Div(
            className='container pure-g',
            children=[
                html.Div(
                    className='pure-u-1-5',
                    children=[
                        html.Form(
                            className="pure-form-stacked",
                            children=[
                                html.Fieldset(children=[
                                    html.Label('Asset:'),
                                    dcc.Dropdown(id='asset-dropdown',
                                                 options=[{
                                                     'label': asset,
                                                     'value': asset
                                                 } for asset in
                                                          db.list_assets()],
                                                 value='CNY'),
                                    html.Label(children='Publishers:'),
                                    dcc.Dropdown(id='publisher-dropdown',
                                                 multi=True),
                                    dcc.Checklist(
                                        id='publisher-option',
                                        options=[{
                                            'label': 'All',
                                            'value': 'publishers-all'
                                        }],
                                        labelClassName='pure-checkbox',
                                        labelStyle={'text-align': 'right'},
                                        values=[]),
                                    html.Label(children='From:'),
                                    dcc.Input(id='from-date',
                                              type='datetime-local',
                                              min=min_date,
                                              max=max_date,
                                              value=safe_start_date),
                                    html.Label(children='To:'),
                                    dcc.Input(id='to-date',
                                              type='datetime-local',
                                              min=min_date,
                                              max=max_date,
                                              value=None),
                                    html.Label(children='Additional feeds:'),
                                    dcc.Checklist(
                                        id='feeds-options',
                                        # options = see configure_feeds_options()
                                        labelClassName='pure-checkbox',
                                        values=[]),
                                ])
                            ])
                    ]),
                html.Div(id="graph-container",
                         className='pure-u-4-5',
                         children=[dcc.Graph(id='price-graph')])
            ]),
        html.Div([
            'Made by ',
            html.A(href='https://bitsharestalk.org/index.php?topic=26881.0',
                   title='Please vote to support!',
                   children=[
                       html.Code('zapata42-witness'),
                   ]), ' ',
            html.
            A(href='https://github.com/Zapata/bitshares-pricefeed-tracker',
              title='Edit on Github!',
              children=[
                  html.Img(
                      height=16,
                      width=16,
                      src=
                      "https://unpkg.com/simple-icons@latest/icons/github.svg")
              ])
        ],
                 className='footer')
    ])
コード例 #20
0
from atree import ATree
from params import CONST, Params
from utils import layouts, make_cum_area, preventupdate_if_empty
from datastore import Datastore

layout: html = html.Div(
    className="layout_box",
    children=[
        html.Div(
            className="time_series_box",
            children=[
                html.Fieldset(
                    className="flex_forward radio",
                    children=[
                        html.Span(children="Group By "),
                        dcc.RadioItems(
                            id="cu_time_series_resolution",
                            options=CONST["time_res_options"],
                        ),
                    ],
                ),
                html.Div(id="time_serieses", className="flex_down"),
            ],
        ),
    ],
)


@app.callback([Output("cu_time_series_resolution", "value")],
              [Input("param_store", "children")])
def load_cu_params(param_store: str):
    """Load time series resolution from the store; this also starts the
コード例 #21
0
ファイル: layout.py プロジェクト: ebmdatalab/openpath-dash
def layout(tests_df, ccgs_list, labs_list, practices_list):
    state_components = html.Div([
        # Hidden div inside the app that stores the page state
        # XXX possibly use https://dash.plot.ly/dash-core-components/store
        html.Div(children=[
            html.Button(
                "show state",
                style={"display": "block" if settings.DEBUG else "none"},
                **{
                    "data-toggle": "collapse",
                    "data-target": "#page-state"
                }),
            html.Pre(id="page-state", className="collapse"),
        ]),
        # Two "locations" with the same function, to allow two
        # different callbacks to use them without cycles in the
        # graph.  This one represents URLs from the user,
        # i.e. bookmarked or directly edited
        dcc.Location(id="url-from-user", refresh=False),
        # This one represents the URL that was want to change to
        # reflect the current page state
        dcc.Location(id="url-for-update", refresh=False),
    ])
    numerators_form = dbc.FormGroup(
        [
            dbc.Label("Select tests"),
            dcc.Dropdown(
                id="numerators-dropdown",
                multi=True,
                value=[],
                # XXX use clientside javascript to make "all tests"
                # disappear if you select just one:
                # https://community.plot.ly/t/dash-0-41-0-released/22131
                options=tests_df.to_dict("records"),
                placeholder="Start typing",
            ),
        ],
        id="numerators-form",
    )

    denominators_form = dbc.FormGroup(
        [
            dbc.Label("Showing"),
            dcc.Dropdown(
                id="denominators-dropdown",
                options=[
                    {
                        "value": "per1000",
                        "label": "Number of tests per 1000 patients"
                    },
                    {
                        "value": "raw",
                        "label": "Number of tests"
                    },
                    OPTION_SEPARATOR,
                    {
                        "value":
                        "within_range",
                        "label":
                        "Proportion of numeric results within reference range",
                    },
                    {
                        "value":
                        "under_range",
                        "label":
                        "Proportion of numeric results under reference range",
                    },
                    {
                        "value":
                        "over_range",
                        "label":
                        "Proportion of numeric results over reference range",
                    },
                    OPTION_SEPARATOR,
                    {
                        "value": "other",
                        "label": "Compared with other test numbers"
                    },
                ],
            ),
            dcc.Dropdown(
                id="denominator-tests-dropdown",
                multi=True,
                placeholder="Start typing",
                options=tests_df.to_dict("records"),
                style={"display": "none"},
            ),
        ],
        id="denominators-form",
    )
    groupby_form = dbc.FormGroup([
        dbc.Label("Compare by", id="groupby-label"),
        dcc.Dropdown(
            id="groupby-dropdown",
            options=settings.ANALYSE_DROPDOWN_OPTIONS,
            clearable=False,
        ),
        dcc.Link(
            "Filter practices used for comparison...",
            href="#show-org-filter",
            id="org-filter-link",
        ),
    ])
    ccg_filter_form = dbc.FormGroup(
        [
            dbc.Label("Only use data from practices in these CCGs",
                      id="ccg-focus-label"),
            dcc.Dropdown(id="ccg-dropdown", multi=True, options=ccgs_list),
        ],
        id="ccg-filter-form",
    )
    lab_filter_form = dbc.FormGroup(
        [
            dbc.Label(
                "Only use data from practices serviced by these labs",
                id="lab-focus-label",
            ),
            dcc.Dropdown(id="lab-dropdown", multi=True, options=labs_list),
        ],
        id="lab-filter-form",
    )
    practice_filter_form = dbc.FormGroup(
        [
            dbc.Label("Only use data from these practices",
                      id="practice-focus-label"),
            dcc.Dropdown(
                id="practice-dropdown", multi=True, options=practices_list),
        ],
        id="practice-filter-form",
        style={"display": "none"},
    )
    org_filter_form = dbc.FormGroup(
        children=[ccg_filter_form, lab_filter_form, practice_filter_form],
        id="org-filter-form",
        style={"display": "none"},
    )
    org_focus_form = dbc.FormGroup(
        [
            dbc.Label("Higlight specific organisation", id="org-focus-label"),
            dcc.Dropdown(
                id="org-focus-dropdown",
                multi=True,
                options=practices_list + labs_list + ccgs_list,
                placeholder="Start typing",
            ),
        ],
        id="org-focus-form",
    )
    tweak_form = dbc.FormGroup([
        dbc.Checklist(
            id="tweak-form",
            options=[
                {
                    "label": "Hide organisations with low numbers",
                    "value": "suppress_sparse_data",
                },
                {
                    "label": "Increase heatmap contrast",
                    "value": "equalise_colours"
                },
            ],
            value=[],
        )
    ])
    sort_order_form = dbc.FormGroup(
        [dcc.Dropdown(id="sort-order-dropdown", clearable=False)])

    chart_selector_tabs = dbc.Tabs(
        id="chart-selector-tabs",
        active_tab="measure",
        children=[
            dbc.Tab(label="All predefined measures", tab_id="measure"),
            dbc.Tab(label="Custom measure (+ heatmap)",
                    tab_id="chart",
                    id="org-tab-label"),
            dbc.Tab(label="Download data", tab_id="datatable"),
        ],
    )
    result_category_hint = html.Div(
        [
            "This chart uses reference ranges. Reference ranges need to be treated ",
            "with caution: for example, they may change over time. See our ",
            html.A("FAQ", href="/faq#result-categories"),
            " for more details",
        ],
        id="result-category-hint",
        className="alert alert-info",
        style={"display": "none"},
    )
    header = dbc.Row(
        dbc.Col(
            html.Div([
                html.Div(id="description-container"),
                html.Div(id="error-container"),
                chart_selector_tabs,
            ])))

    form = dbc.Container([
        dbc.Row([
            dbc.Col(
                html.Fieldset(
                    children=[
                        html.Legend("Comparisons", className="w-auto"),
                        groupby_form,
                        org_filter_form,
                        org_focus_form,
                    ],
                    className="border p-2",
                )),
            dbc.Col(
                html.Fieldset(
                    children=[
                        html.Legend("Measurements", className="w-auto"),
                        numerators_form,
                        denominators_form,
                    ],
                    className="border p-2",
                    id="measurements-fieldset",
                    style={"display": "none"},
                )),
        ]),
        result_category_hint,
    ])
    body = dbc.Container([
        dbc.Row(
            dbc.Col(
                html.Div(
                    id="chart-container",
                    style={"display": "none"},
                    children=[
                        html.Div(
                            dcc.Loading(
                                id="loading-deciles",
                                style={"height": "350px"},
                                children=[
                                    html.Div(
                                        id="deciles-container",
                                        children=[
                                            dcc.Graph(
                                                id="deciles-graph",
                                                config=COMMON_GRAPH_CONFIG,
                                            )
                                        ],
                                    )
                                ],
                            )),
                        html.Div(
                            dcc.Loading(
                                id="loading-heatmap",
                                children=[
                                    html.Div(
                                        id="heatmap-container",
                                        children=[
                                            dcc.Graph(
                                                id="heatmap-graph",
                                                config=COMMON_GRAPH_CONFIG,
                                            )
                                        ],
                                    ),
                                    dbc.Row(
                                        children=html.H2("Heatmap options")),
                                    dbc.Row(
                                        id="sort-order-dropdown-container",
                                        children=[
                                            dbc.Col(tweak_form,
                                                    width={"size": 3}),
                                            dbc.Col(
                                                sort_order_form,
                                                width={
                                                    "size": 6,
                                                    "offset": 3
                                                },
                                            ),
                                        ],
                                    ),
                                ],
                            )),
                    ],
                ))),
        dbc.Row(
            dbc.Col(
                dcc.Loading(
                    id="loading-measures",
                    children=[
                        html.Div(
                            id="measure-container",
                            style={"display": "none"},
                            children=[],
                        )
                    ],
                ))),
        dbc.Row(
            dbc.Col(
                dcc.Loading(
                    id="loading-datatable",
                    children=[
                        html.Div(
                            id="datatable-container",
                            style={"display": "none"},
                            children=[
                                html.Div(
                                    className="download-link-container",
                                    children=[
                                        html.A(
                                            "Download as CSV",
                                            id="datatable-download-link",
                                            href="#",
                                            className="btn btn-outline-primary",
                                        )
                                    ],
                                ),
                                html.Hr(),
                                dash_table.DataTable(
                                    id="datatable",
                                    sort_action="custom",
                                    sort_mode="multi",
                                    page_action="custom",
                                    page_current=0,
                                    page_size=50,
                                ),
                            ],
                        )
                    ],
                ))),
    ])
    dash_app = html.Div([state_components, header, form, body])
    return dash_app
コード例 #22
0
         options=wdata.get_list_dict_countrys(),
         value=['BR','AR','US'],
         id='world_dropdown',
         multi=True,
         style=dict(width='100%'))
     ],
     style=dict(width='30%'),
     className='div-opcoes'),
 html.Fieldset(
     [
         html.Legend('Normalizações'),
         html.Button('Por mi hab',
             id='btn_milhao',
             className='div-opcoes',
             style={'float':'left'}),
         html.Button('1º caso',
             id='btn_primeiro_caso',
             className='div-opcoes',
             style={'float':'left'}),
     ],
     className="div-opcoesdiv_horizontal",
     style={'padding':'3px'},
 ),
 html.Div([
     html.Div(
         "Periodo",
         className='texto-opcao opcao-item'
     ),
     dcc.DatePickerRange(
         id='world_dataRange',
         start_date=datetime(2020, 3, 1),
コード例 #23
0
def get_acl_content():

    options = [{
        'label': 'Cisco IOS',
        'value': 'cisco'
    }, {
        'label': 'Cisco NX-OS',
        'value': 'cisco-nx'
    }, {
        'label': 'Cisco XR',
        'value': 'cisco-xr'
    }, {
        'label': 'Juniper',
        'value': 'juniper'
    }]
    return html.Div(
        id="acl_content_container",
        children=[
            html.Div(
                id="acl_content",
                children=[
                    html.Div(children=[
                        html.Fieldset(
                            id="acl_original_fieldset",
                            children=[
                                html.Legend("Original ACL"),
                                dbc.InputGroup(
                                    id="acl_original_input_group",
                                    children=[
                                        html.Div([
                                            dbc.Button(
                                                "Get Configuration",
                                                id="acl_get_config_button")
                                        ]),
                                        html.Div(children=[
                                            dbc.InputGroup([
                                                dbc.InputGroupAddon(
                                                    "Choose Platform",
                                                    addon_type="prepend"),
                                                dbc.Select(
                                                    id=
                                                    "acl_original_choose_platform",
                                                    options=options,
                                                    value='cisco',
                                                ),
                                            ]),
                                        ]),
                                    ]),
                                html.Div(
                                    id="acl_original_text_area_container",
                                    children=[
                                        dcc.Textarea(
                                            id='acl_original_textarea',
                                            value='',
                                            placeholder=
                                            "Please Copy and Paste an ACL",
                                            required=True,
                                        ),
                                    ]),
                            ]),
                    ]),
                    html.Div([dbc.Button("Analyze", id="acl_analyze_button")]),
                    html.Div(children=[
                        html.Fieldset(
                            id="acl_refractored_fieldset",
                            children=[
                                html.Legend("Refractored ACL"),
                                html.Div(
                                    id=
                                    "acl_refractored_choose_platform_container",
                                    children=[
                                        dbc.InputGroup([
                                            dbc.InputGroupAddon(
                                                "Choose Platform",
                                                addon_type="prepend"),
                                            dbc.Select(
                                                id=
                                                "acl_refractored_choose_platform",
                                                options=options,
                                                value='',
                                            ),
                                        ]),
                                    ]),
                                html.Div(
                                    id="acl_refractored_text_area_container",
                                    children=[
                                        dcc.Textarea(
                                            id='acl_refractored_textarea',
                                            value='',
                                            placeholder=
                                            "Please Copy and Paste an ACL",
                                            required=True,
                                        ),
                                    ]),
                            ]),
                    ]),
                ]),
            html.Div(id="acl_result_fieldset_container",
                     children=[
                         html.Fieldset(id="acl_result_fieldset",
                                       children=[
                                           html.Legend("Results"),
                                           html.Div(id="acl_result_table", ),
                                       ]),
                     ]),
        ])
コード例 #24
0
ファイル: index.py プロジェクト: avc2120/hermione
 html.Fieldset(
     [
         html_utils.form_group(
             "Company Name",
             "Enter Company Name",
             "wit_company"),
         html_utils.form_group(
             "Number of Women in Tech",
             "Enter Number of Women in Tech",
             "wit"),
         html_utils.form_group(
             "Number of Men in Tech",
             "Enter Number of Men in Tech",
             "mit"),
         html_utils.form_group(
             "Number of Women in Tech Leadership",
             "Enter Number of Women in Tech Leadership",
             "wit_lead"),
         html_utils.form_group(
             "Number of Men in Tech Leadership",
             "Enter Number of Men in Tech Leadership",
             "mit_lead"),
         html_utils.upload(),
         html_utils.facilities(
             "Days of Maternity Leave",
             "maternity_weeks"),
         html_utils.facilities(
             "Days of Paternity Leave",
             "paternity_weeks"),
         html.Div([], id="positions-list"),
         # html.Button("Add Position Salary", className="btn btn-outline-primary", id="add-position")
     ],
     id="hermione-fieldset")