Exemple #1
0
def layout():
    return dbc.Row(
        dbc.Col(
            [
                dcc.Location(id='login-url', refresh=True, pathname='/login'),
                html.Div(id='login-trigger', style=dict(display='none')),
                html.Div(id='login-alert'),
                dbc.FormGroup([
                    dbc.Alert('Try [email protected] / test',
                              color='info',
                              dismissable=True),
                    html.Br(),
                    dbc.Input(id='login-email', autoFocus=True),
                    dbc.FormText('Email'),
                    html.Br(),
                    dbc.Input(id='login-password', type='password'),
                    dbc.FormText('Password'),
                    html.Br(),
                    dbc.Button('Submit', color='primary', id='login-button'),
                    #dbc.FormText(id='output-state')
                    html.Br(),
                    html.Br(),
                    dcc.Link('Register', href='/register'),
                    html.Br(),
                    dcc.Link('Forgot Password', href='/forgot')
                ])
            ],
            width=6))
def layout():
    return dbc.Row(
        dbc.Col(
            [
                dcc.Location(id='login-url', refresh=True, pathname='/login'),
                html.Div(id='login-trigger', style=dict(display='none')),
                html.Div(id='login-alert'),
                dbc.FormGroup([
                    dbc.Alert('Try [email protected] / oooo',
                              color="success",
                              dismissable=True),
                    html.Br(),
                    dbc.Input(id='login-email', autoFocus=True),
                    dbc.FormText('Email'),
                    html.Br(),
                    dbc.Input(id='login-password', type='password'),
                    dbc.FormText('Password'),
                    html.Br(),
                    dbc.Button('Submit', color="success", id='login-button'),
                    #dbc.FormText(id='output-state')
                    html.Br(),
                    html.Br(),
                    html.H5(dcc.Link('Signup', href='/register')),
                ])
            ],
            width=6))
Exemple #3
0
 def _generate_dash_input(self, col, cats, cats_dict):
     if col in cats:
         col_values = [
             col_val[len(col) + 1:] if col_val.startswith(col +
                                                          "_") else col_val
             for col_val in cats_dict[col]
         ]
         return dbc.FormGroup([
             dbc.Label(col),
             dcc.Dropdown(id='feature-input-' + col + '-input-' + self.name,
                          options=[
                              dict(label=col_val, value=col_val)
                              for col_val in col_values
                          ],
                          clearable=False),
             dbc.FormText(f"Select any {col}")
             if not self.hide_range else None,
         ])
     else:
         min_range = np.round(
             self.explainer.X[col]
             [lambda x: x != self.explainer.na_fill].min(), 2)
         max_range = np.round(
             self.explainer.X[col]
             [lambda x: x != self.explainer.na_fill].max(), 2)
         return dbc.FormGroup([
             dbc.Label(col),
             dbc.Input(id='feature-input-' + col + '-input-' + self.name,
                       type="number"),
             dbc.FormText(f"Range: {min_range}-{max_range}")
             if not self.hide_range else None
         ])
def layout():
    return dbc.Row(
        dbc.Col([
            dcc.Location(id='register-url', refresh=True),
            html.Div(1, id='register-trigger', style=dict(display='none')),
            html.Div(id='register-alert'),
            dbc.FormGroup([
                dbc.Input(id='register-username'),
                dbc.FormText(id='register-formtext-username'),
                html.Br(),
                dbc.Input(id='register-email'),
                dbc.FormText(id='register-formtext-email'),
                html.Br(),
                dbc.Input(id='register-password', type='password'),
                dbc.FormText(id='register-formtext-password'),
                html.Br(),
                dbc.Input(id='register-confirm', type='password'),
                dbc.FormText('Confirm password',
                             id='register-formtext-confirm'),
                html.Br(),
                dbc.Button('Registration',
                           id='register-button',
                           color='primary',
                           disabled=True),
                html.Br(),
                html.Br(),
                dcc.Link('Login', href='/login'),
            ])
        ],
                id='row_registration',
                style=dict(visibility='hidden'),
                width=6))
Exemple #5
0
def layout():
    return dbc.Row(
        dbc.Col([
            html.H3('Change Password'),
            dcc.Location(id='change-url', refresh=True),
            html.Div(id='change-trigger', style=dict(display='none')),
            dbc.FormGroup([
                html.Div(id='change-alert'),
                html.Br(),
                dbc.Input(id='change-email', autoFocus=True),
                dbc.FormText('Email'),
                html.Br(),
                dbc.Input(id='change-key', type='password'),
                dbc.FormText('Code'),
                html.Br(),
                dbc.Input(id='change-password', type='password'),
                dbc.FormText('New password'),
                html.Br(),
                dbc.Input(id='change-confirm', type='password'),
                dbc.FormText('Confirm new password'),
                html.Br(),
                dbc.Button('Submit password change',
                           id='change-button',
                           color='primary'),
            ])
        ],
                width=6))
Exemple #6
0
def layout():
    return dbc.Row(
        dbc.Col([
            dcc.Location(
                id='register-url',
                refresh=True,
            ),
            html.Div(id='register-trigger', style=dict(display='none')),
            html.Div(id='register-alert'),
            dbc.FormGroup([
                dbc.Input(id='register-first', autoFocus=True),
                dbc.FormText('First'),
                html.Br(),
                dbc.Input(id='register-last'),
                dbc.FormText('Last'),
                html.Br(),
                dbc.Input(id='register-email'),
                dbc.FormText(
                    'Email', id='register-email-formtext', color='secondary'),
                html.Br(),
                dbc.Input(id='register-password', type='password'),
                dbc.FormText('Password'),
                html.Br(),
                dbc.Input(id='register-confirm', type='password'),
                dbc.FormText('Confirm password'),
                html.Br(),
                dbc.Button('Submit', color='primary', id='register-button'),
            ])
        ],
                width=6))
def layout():
    return dbc.Row(
        dbc.Col([
            html.Div(1, id='profile-trigger', style=dict(display='none')),
            html.H3('Profile', id='profile-title'),
            html.Div(id='profile-alert'),
            html.Div(id='profile-alert-login'),
            html.Div(id='profile-login-trigger', style=dict(display='none')),
            html.Br(),

            dbc.FormGroup([
                dbc.Label(id='profile-label-username'),
                dbc.Input(placeholder='Change username...', id='profile-username'),
                dbc.FormText(id='profile-formtext-username'),
                html.Br(),

                dbc.Label(id='profile-label-email'),
                dbc.FormText('Cannot change email'),
                html.Hr(),

                dbc.Label('Change password', id='profile-label-password'),
                dbc.Input(placeholder='Change password...', id='profile-password', type='password'),
                dbc.FormText('Change password', id='profile-formtext-password'),
                html.Br(),
                dbc.Input(placeholder='Confirm password...', id='profile-confirm', type='password'),
                dbc.FormText('Confirm password', id='profile-formtext-confirm'),
                html.Hr(),
                html.Br(),

                dbc.Button('Save changes', color='primary', id='profile-button', disabled=True),
            ])
        ], id='row_admin', style=dict(visibility='hidden'), width=6)
    )
Exemple #8
0
    def roi_content(self):
        return [
            dcc.Markdown("""
Most SpectroChemPy's processing and analysis methods operate only on a region of interest (roi).
By default, it is set to the whole range of data.

This set up is done on the ``Original`` data. The limit are automatically visualized on the graph and applied in the
``Processed`` graph.
If an offset is defined then the actual roi below is displayed accordingly (*see actual roi values below*).            
                                      """,
                         className='markdown'),  # roi x limits
            dbc.InputGroup([
                dbc.InputGroupAddon(id='x-roi', addon_type="prepend"),
                dbc.InputGroupAddon(id='x-roi-units', addon_type="append"),
            ],
                           size='sm'),
            dbc.InputGroup(
                [
                    numeric_input(id='x-roi-lower', placeholder='Lower limit'),
                    numeric_input(id='x-roi-upper', placeholder="Upper limit"),
                ],
                size='sm',
            ),
            # x axis offset (default = 0)
            dbc.InputGroup(
                [
                    dbc.InputGroupAddon('offset', addon_type="prepend"),
                    numeric_input(id='x-offset',
                                  placeholder="Offset value, default=0"),
                ],
                size='sm',
            ),
            dbc.FormText(id='actual-x-roi'),
            html.Hr(),
            # roi y limits
            dbc.InputGroup([
                dbc.InputGroupAddon(id='y-roi', addon_type="prepend"),
                dbc.InputGroupAddon(id='y-roi-units', addon_type="append"),
            ],
                           size='sm'),
            dbc.InputGroup(
                [
                    numeric_input(id='y-roi-lower', placeholder="Lower limit"),
                    numeric_input(id='y-roi-upper', placeholder="Upper limit"),
                ],
                size='sm',
            ),
            # y axis offset (default = 0)
            dbc.InputGroup(
                [
                    dbc.InputGroupAddon('Offset', addon_type="prepend"),
                    numeric_input(id='y-offset',
                                  placeholder="Offset value, default=0"),
                ],
                size='sm',
            ),
            dbc.FormText(id='actual-y-roi'),
            html.Hr(),
        ]
def layout():
    return dbc.Row(
        dbc.Col(
            [
                dcc.Location(id='profile-url', refresh=True,    ),
                html.Div(1,id='profile-trigger',style=dict(display='none')),
                
                html.H3('Profile',id='profile-title'),
                html.Div(id='profile-alert'),
                html.Div(id='profile-alert-login'),
                html.Div(id='profile-login-trigger',style=dict(display='none')),
                html.Br(),

                dbc.FormGroup(
                    [
                        # First, first input, and formtext
                        dbc.Label('First:',id='profile-first'),
                        dbc.Input(placeholder='Change first name...',id='profile-first-input'),
                        dbc.FormText(id='profile-first-formtext',color='secondary'),
                        html.Br(),

                        # last, last input, and formtext
                        dbc.Label('Last:',id='profile-last'),
                        dbc.Input(placeholder='Change last name...',id='profile-last-input'),
                        dbc.FormText(id='profile-last-formtext',color='secondary'),
                        html.Br(),

                        # email, formtext
                        dbc.Label('Email:',id='profile-email'),
                        dbc.FormText('Cannot change email',color='secondary'),
                        html.Br(),

                        html.Hr(),
                        html.Br(),

                        # password, input, confirm input
                        dbc.Label('Change password',id='profile-password'),
                        dbc.Input(placeholder='Change password...',id='profile-password-input',type='password'),
                        dbc.FormText('Change password',color='secondary',id='profile-password-input-formtext'),
                        html.Br(),
                        dbc.Input(placeholder='Confirm password...',id='profile-password-confirm',type='password'),
                        dbc.FormText('Confirm password',color='secondary',id='profile-password-confirm-formtext'),
                        html.Br(),
                        
                        html.Hr(),
                        html.Br(),

                        dbc.Button('Save changes',color='primary',id='profile-submit',disabled=True),
                        
                    ] # end formgroup
                )
            ], # end col
            width=6
        )

    )
Exemple #10
0
 def _generate_dash_input(self, col, onehot_cols, onehot_dict, cat_dict):
     if col in cat_dict:
         col_values = cat_dict[col]
         return dbc.FormGroup([
             dbc.Label(col),
             dcc.Dropdown(id='feature-input-' + col + '-input-' + self.name,
                          options=[
                              dict(label=col_val, value=col_val)
                              for col_val in col_values
                          ],
                          clearable=False),
             dbc.FormText(f"Select any {col}")
             if not self.hide_range else None,
         ])
     elif col in onehot_cols:
         col_values = [c for c in onehot_dict[col]]
         display_values = [
             col_val[len(col) + 1:] if col_val.startswith(col +
                                                          "_") else col_val
             for col_val in col_values
         ]
         if any(self.explainer.X[self.explainer.onehot_dict[col]].sum(
                 axis=1) == 0):
             col_values.append(self.explainer.onehot_notencoded[col])
             display_values.append(self.explainer.onehot_notencoded[col])
         return dbc.FormGroup([
             dbc.Label(col),
             dcc.Dropdown(
                 id='feature-input-' + col + '-input-' + self.name,
                 options=[
                     dict(label=display, value=col_val)
                     for display, col_val in zip(display_values, col_values)
                 ],
                 clearable=False),
             dbc.FormText(f"Select any {col}")
             if not self.hide_range else None,
         ])
     else:
         min_range = np.round(
             self.explainer.X[col]
             [lambda x: x != self.explainer.na_fill].min(), 2)
         max_range = np.round(
             self.explainer.X[col]
             [lambda x: x != self.explainer.na_fill].max(), 2)
         return dbc.FormGroup([
             dbc.Label(col),
             dbc.Input(id='feature-input-' + col + '-input-' + self.name,
                       type="number"),
             dbc.FormText(f"Range: {min_range}-{max_range}")
             if not self.hide_range else None
         ])
def custom_slider(label="", return_function=None, **kwargs):
    """
    A custom dash bootstrap component slider with added components-
    slider-label, slider-bar, and a slider-text reflecting the current value
    of the slider.

    Args:
        label: A string with the label.
        return_function: This function will be applied to the current
            value of the slider before updating the slider-text.
        kwargs: additional keyward arguments for dash-bootstrap-component Input.
    """
    id_label = kwargs["id"] + "_label"
    slider = html.Div([
        html.Div(
            [label, dbc.FormText(id=id_label)],
            className="d-flex justify-content-between",
        ),
        dcc.Slider(**kwargs, className="slider-custom"),
    ])

    @app.callback(
        Output(id_label, "children"),
        Input(kwargs["id"], "value"),
        prevent_initial_call=True,
    )
    def update_label(value):
        return [value] if return_function is None else [return_function(value)]

    return slider
Exemple #12
0
def title():
    """Sample Title"""
    label = dbc.FormText("Title")
    field = dbc.Input(type="text",
                      placeholder="Add title",
                      id="info-name-edit")
    return [label, field]
def render_modal(button_clicked, df):
    print(df)
    if df is None or button_clicked is None:
        bucket_id = "TEST"
    else:
        bucket_id = df['bucket id'][button_clicked]

    return [
        dbc.ModalHeader(f"Merge '{bucket_id}'"),
        dbc.ModalBody([
            dbc.Row([
                dbc.Col(
                    dbc.FormGroup([
                        dbc.Label("Old Bucket ID"),
                        dbc.Input(type="text", disabled=True, value=bucket_id)
                    ])),
                dbc.Col(
                    dbc.FormGroup([
                        dbc.Label("Merge Into"), new_bucket_id,
                        dbc.FormText(
                            "Press Enter to validate that this is a Bucket ID."
                        )
                    ]))
            ])
        ]), modal_footer, state, database_update
    ]
Exemple #14
0
def wrap_augen_div(spieler_nichtspieler_id: str,
                   augen_id: str,
                   schwarz_id: str) -> html.Div:
    return html.Div([
        dbc.FormGroup([
            dbc.FormText('Augen'),
            dbc.RadioItems(
                id=spieler_nichtspieler_id,
                options=[{'label': l, 'value': v} for (l, v) in [('Spieler', 1), ('Nicht-Spieler', 0)]],
                switch=True,
                inline=True,
                value=1
            ),
            html.Div(
                [
                    dbc.Input(
                        id=augen_id,
                        type='number', min=0, max=120, step=1,
                        value=120
                    )
                ],
                id='styled-numeric-input',
            ),
            html.Div(
                dbc.RadioItems(
                    id=schwarz_id,
                    options=[{'label': 'Schwarz gespielt', 'value': 1},
                             {'label': 'Nicht Schwarz gespielt', 'value': 0}],
                    value=0,
                    switch=True
                )
            )
        ])
    ])
Exemple #15
0
def get_filter_and_search_row():
    return dbc.Row(
        [
            dbc.Col(
                dbc.FormGroup([
                    dbc.Input(
                        id="search",
                        type="text",
                        placeholder="Enter a search string",
                    ),
                    dbc.FormText(
                        "Search on cities, DPS location names, zip codes, etc."
                    ),
                ]),
                width=3,
            ),
            dbc.Col(
                dbc.FormGroup([
                    dbc.Input(
                        id="zip",
                        type="number",
                        placeholder="Enter your zip code",
                    ),
                    dbc.FormText(
                        "Enter your zip code to estimate distance to DPS locations"
                    ),
                ]),
                width=3,
            ),
            dbc.Col(
                dbc.FormGroup([
                    dcc.RangeSlider(
                        id="distance-range",
                        min=0,
                        max=800,
                        value=[0, 800],
                        allowCross=False,
                        marks=get_slider_marks(),
                    ),
                    dbc.FormText("Select a distance range (miles)"),
                ]),
                width=6,
            ),
        ],
        style={"margin-top": "1rem"},
    )
def modal_add():
    return dbc.Modal(
        [
            dbc.ModalHeader("Add samples to collection"),
            dbc.ModalBody([
                dbc.Form([
                    dbc.FormGroup([
                        dbc.Label("Existing virtual run ",
                                  html_for="virtual-run-selector"),
                        dcc.Dropdown(id="virtual-run-selector",
                                     value="_new",
                                     options=[{
                                         "value":
                                         "_new",
                                         "label":
                                         "New virtual run (enter name below)"
                                     }] + virtual_run_options()),
                        dbc.Label("New virtual run ",
                                  html_for="virtual_run_name",
                                  className="mt-1"),
                        dbc.Input(type="text",
                                  id="virtual_run_name",
                                  pattern="^[a-zA-Z0-9_-]+$"),
                        dbc.FormText(["Only accepts 'A-Za-z0-9-_'"],
                                     color="secondary"),
                        dbc.FormText([
                            "Full name will be: ",
                            html.Span(id="virtual_run_full_name")
                        ],
                                     color="secondary")
                    ])
                ]),
                html.Div([], id="selection-modal-status")
            ]),
            dbc.ModalFooter([
                dbc.Button("Close",
                           id="add-collection-modal-close",
                           className="ml-auto"),
                dbc.Button("Create virtual run",
                           id="selection-modal-create",
                           color="primary",
                           n_clicks=0)
            ]),
        ],
        id="add-collection-modal",
    )
Exemple #17
0
        def update_progress(n_intervals):
            progress = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_progress')
            progress_fraction = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_progress_fraction')
            label_text = rds.get_value(
                f'{OPLSModel.redis_prefix}_image_save_label')
            job_id = rds.get_value(f'{OPLSModel.redis_prefix}_job_id').decode(
                'utf-8')
            job = Job.fetch(job_id, rds.get_redis())
            job_status = job.get_status()
            if isinstance(label_text, bytes):
                label_text = label_text.decode('utf-8')
            if isinstance(progress, bytes):
                progress = int(float(progress))
            if isinstance(progress_fraction, bytes):
                progress_fraction = progress_fraction.decode('utf-8')

            if job_status == 'finished':
                message = dbc.Alert(f'Prepared plots file as {job.result}.',
                                    color='success',
                                    dismissable=True)
                class_name = 'btn btn-success'
                path = job.result
                progress_label = dbc.FormText(label_text, color='success')
                animated = False
            elif job.get_status() == 'failed':
                message = dbc.Alert(
                    [f'Error occurred.',
                     html.Pre(job.exc_info)],
                    color='danger',
                    dismissable=True)
                class_name = 'btn btn-secondary disabled'
                path = ''
                progress_label = dbc.FormText(label_text, color='danger')
                animated = False
            else:
                message = []
                class_name = 'btn btn-secondary disabled'
                path = ''
                progress_label = dbc.FormText(label_text)
                animated = True
            return progress, animated, progress_fraction, progress_label, url_for(
                'api.download_temporary_file', path=path), class_name, message
Exemple #18
0
def description():
    """Sample Description"""
    label = dbc.FormText("Description")
    field = dbc.Textarea(
        value="",
        placeholder="Add description",
        id="info-description-edit",
        style={"height": "12rem"},
    )
    return [label, field]
def layout():
    return dbc.Row(
        dbc.Col(
            [
                dcc.Location(
                    id='profile-url',
                    refresh=True,
                ),
                html.Div(1, id='profile-trigger', style=dict(display='none')),
                html.H3('Change Password', id='profile-title'),
                html.Div(id='profile-alert'),
                html.Div(id='profile-alert-login'),
                html.Div(id='profile-login-trigger',
                         style=dict(display='none')),
                html.Br(),
                dbc.FormGroup([
                    html.Hr(),
                    html.Br(),
                    dbc.Input(placeholder='Change password...',
                              id='profile-password-input',
                              type='password'),
                    dbc.FormText('Change password',
                                 color='secondary',
                                 id='profile-password-input-formtext'),
                    html.Br(),
                    dbc.Input(placeholder='Confirm password...',
                              id='profile-password-confirm',
                              type='password'),
                    dbc.FormText('Confirm password',
                                 color='secondary',
                                 id='profile-password-confirm-formtext'),
                    html.Br(),
                    html.Hr(),
                    html.Br(),
                    dbc.Button('Save changes',
                               color='primary',
                               id='profile-submit',
                               disabled=True),
                ]  # end formgroup
                              )
            ],  # end col
            width=6))
Exemple #20
0
def wrap_select_div(form_text: str,
                    id: str,
                    options: List[Dict],
                    value: Union[None, str] = None) -> html.Div:
    return html.Div(
        dbc.FormGroup([
            dbc.FormText(form_text),
            dbc.Select(
                id=id,
                options=options,
                value=value
            ),
        ])
    )
Exemple #21
0
    def integration_info():
        """Text field displaying number of crystallite orientations."""
        app.clientside_callback(
            """function (density, vol) {
                let ori = (density + 1) * (density + 2)/2;
                if (vol === 'octant') { return `Averaging over ${ori} orientations.`; }
                return `Averaging over ${ori*4} orientations.`;
            }""",
            Output("integration_points_info", "children"),
            Input("integration_density", "value"),
            Input("integration_volume", "value"),
            prevent_initial_call=False,
        )

        return dbc.Col(dbc.FormText(id="integration_points_info"))
Exemple #22
0
def wrap_tout(tout_id: str) -> html.Div:
    return html.Div([
        dbc.FormGroup([
            dbc.FormText('Tout'),
            dbc.Checklist(
                options=[
                    {'label': 'Tout gespielt und gewonnen', 'value': 0},
                    {'label': 'Tout gespielt und verloren', 'value': 1}
                ],
                value=[],
                id=tout_id,
                switch=True,
            )
        ])
    ])
Exemple #23
0
def wrap_laufende_div(form_text: str,
                      laufende_id: str) -> html.Div:
    return html.Div([
        dbc.FormGroup([
            dbc.FormText(form_text),
            html.Div(
                [
                    dbc.Input(
                        id=laufende_id,
                        type='number', min=0, max=8, step=1, value=0),
                ],
                id='styled-numeric-input',
            )
        ])
    ])
Exemple #24
0
def layout():
    return dbc.Row(
        dbc.Col([
            dcc.Location(id='login-url', refresh=True, pathname='/login'),
            html.Div(id='login-alert'),
            dbc.FormGroup([
                dbc.Alert(
                    f'Try admin or {ADMIN_DEFAULT_EMAIL} / {ADMIN_DEFAULT_PASSWORD}',
                    color='info',
                    dismissable=True),
                html.Br(),
                dbc.Input(id='login-email', autoFocus=True),
                dbc.FormText('Username or Email'),
                html.Br(),
                dbc.Input(id='login-password', type='password'),
                dbc.FormText('Password'),
                html.Br(),
                dbc.Button('Submit', color='primary', id='login-button'),
                html.Br(),
                html.Br(),
                dcc.Link('Registration', href='/register'),
            ])
        ],
                width=6))
Exemple #25
0
def wrap_radioitem_div(form_text: str,
                       id: str,
                       options: List[Dict],
                       switch: bool = True,
                       value: Union[int, str] = None) -> html.Div:
    return html.Div(
        dbc.FormGroup([
            dbc.FormText(form_text),
            dbc.RadioItems(
                id=id,
                options=options,
                value=value,
                switch=switch
            )
        ])
    )
Exemple #26
0
def wrap_checklist_div(form_text: str,
                       id: str,
                       options: List[Dict],
                       switch: bool = True,
                       value: List[int] = []) -> html.Div:
    return html.Div(
        dbc.FormGroup([
            dbc.FormText(form_text),
            dbc.Checklist(
                id=id,
                options=options,
                value=value,
                switch=switch
            )
        ])
    )
Exemple #27
0
def wrap_ramsch_augen_div(augen_id: str, teilnehmer_name: str) -> html.Div:
    return html.Div([
        dbc.FormGroup([
            dbc.FormText(f'Augen von {teilnehmer_name}'),
            html.Div(
                [
                    dbc.Input(
                        id=augen_id,
                        type='number', min=0, max=120, step=1,
                        value=30
                    )
                ],
                id='styled-numeric-input',
            )
        ])
    ])
Exemple #28
0
def card_creator(row):
    card = dbc.Card(dbc.CardBody([
        html.H5(row['name'], className="card-title"),
        html.P([row.address], className='card-text'),
        dbc.FormText([row.categories]),
        html.Br(),
        html.P([f'Rating: {row.stars:.1f} / Reviews: {row.review_count:,.0f}'],
               className='card-text'),
        dbc.Button("More info",
                   color='primary',
                   className="mt-auto",
                   href=f'/deep-dive?id={row.name}',
                   id=f'btn-{row.name}'),
    ]),
                    id=f'homepage-card-{row.name}')
    return card
Exemple #29
0
    def body(self):

        return [
            dbc.Row(dbc.Col(html.H1("Cluster Diagnostics"), lg=12)),
            dbc.Row([
                dbc.Col(
                    dbc.FormGroup([
                        dbc.Label("Direction of Skill Flow"),
                        dbc.RadioItems(
                            id="direction-select",
                            options=[
                                {
                                    "label": "Upwards Skills",
                                    "value": "up",
                                },
                                {
                                    "label": "Downwards Skills",
                                    "value": "down",
                                },
                            ],
                            value="up",
                            inline=True,
                        ),
                        dbc.FormText("Transitions are only considered if the "
                                     "difference in skill is <= 1 level"),
                        html.Div(
                            id="direction-firstload-flag",
                            hidden=True,
                            children="True",
                        ),
                    ]),
                    lg=12,
                )
            ]),
            dbc.Row([
                dbc.Col(
                    dcc.Graph(
                        id="ncluster-graph",
                        figure={
                            "data": [],
                            "layout": go.Layout(height=800),
                        },
                    ),
                    lg=12,
                )
            ]),
        ]
Exemple #30
0
 def _add_funtion_group(self):
     return dbc.FormGroup([
         dbc.Label('Add function to trace'),
         dbc.Row([
             dbc.Col(
                 dcc.Dropdown(
                     id='functions-not-traced-select',
                     placeholder='Select function to set it traced',
                     optionHeight=40)),
             dbc.Col(dbc.Button('Add',
                                id='add-function-button',
                                color='primary',
                                className='mr-1'),
                     width=2)
         ]),
         dbc.FormText('Write name of the function and click add')
     ])