from jupyter_dash import JupyterDash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output
import urllib.parse
#TODO: import for your CRUD module
from animal_shelter import AnimalShelter
app = JupyterDash(name____)
app.layout = html.Div([
html.H1("Module 5 Assignment - Bri"),
dcc.Input(
id="input_user".format("text"),
type="text",
placeholder="input type {}".format("text")),
dcc.Input(
id="input_passwd".format("password"),
type="password",
placeholder="input type {}".format("password")),
html.Button('Submit', id='submit-val', n_clicks=0),
html.Hr(),
html.Div(id="query-out", style={'whiteSpace': 'pre-line'}),
html.H2("Bri MongoDB Authentication")
])
@app.callback(
Output('query-out', 'children'),
[Input('input_user', 'value'),
Input('input_passwd', 'value'),
Input(component_id='submit-val', component_property='n_clicks')]
def update_figure(inputUser, inputPass, n_clicks):
if n_clicks > 0:
username = urllib.parse.quote_plus(inputUser)
password = urllib.parse.quote_plus(inputPass)
return f'Output: {inputUser}, {inputPass}'
#TODO: Instantiate CRUD object with above authentication username and
# password values
AnimalShelter = CRUD(inputUser, inputPass)
#TODO: Return example query results. Note: The results returned have
# to be in the format of a string in order to display properly in the
# 'query-out' element.
data = AnimalShelter.read({'animal_type': "Dog", "name": "Lucy"})
return data
app.run_server()