Show model version on dashboard
This commit is contained in:
parent
9e183bbfc0
commit
c5012e43a4
4 changed files with 22 additions and 9 deletions
|
|
@ -12,7 +12,7 @@ PATH = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
def bootstrap_dashboard(app: FastAPI, function_name: str, documentation: str) -> None:
|
def bootstrap_dashboard(app: FastAPI, function_name: str, documentation: str) -> None:
|
||||||
dash_app = create_dash_app(function_name, documentation)
|
dash_app = create_dash_app(function_name, app.version, documentation)
|
||||||
|
|
||||||
app.mount(DASHBOARD_PATH, WSGIMiddleware(dash_app))
|
app.mount(DASHBOARD_PATH, WSGIMiddleware(dash_app))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,15 @@ main > header > div > h1 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.version-tag {
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
background: #ddd;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 3px 6px;
|
||||||
|
margin-left: var(--small-padding)
|
||||||
|
}
|
||||||
|
|
||||||
main > header > *:nth-child(2) {
|
main > header > *:nth-child(2) {
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
max-width: 550px;
|
max-width: 550px;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from .get_footer import get_footer
|
||||||
from .get_traces_table import get_traces_table
|
from .get_traces_table import get_traces_table
|
||||||
|
|
||||||
|
|
||||||
def create_dash_app(function_name: str, function_docs: str) -> Flask:
|
def create_dash_app(function_name: str, version: str, function_docs: str) -> Flask:
|
||||||
accent_color = text_to_hex_color(function_name)
|
accent_color = text_to_hex_color(function_name)
|
||||||
|
|
||||||
app = Dash(
|
app = Dash(
|
||||||
|
|
@ -44,6 +44,7 @@ def create_dash_app(function_name: str, function_docs: str) -> Flask:
|
||||||
[
|
[
|
||||||
get_description(
|
get_description(
|
||||||
function_name=function_name,
|
function_name=function_name,
|
||||||
|
version=version,
|
||||||
function_docs=function_docs,
|
function_docs=function_docs,
|
||||||
accent_color=accent_color,
|
accent_color=accent_color,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,29 @@ from ....helper import snake_case_to_text, strip_lines
|
||||||
|
|
||||||
|
|
||||||
def get_description(
|
def get_description(
|
||||||
function_name: str, function_docs: str, accent_color: str
|
function_name: str, version: str, function_docs: str, accent_color: str
|
||||||
) -> html.Div:
|
) -> html.Div:
|
||||||
return html.Div(
|
return html.Div(
|
||||||
[
|
[
|
||||||
html.H1(
|
html.H1(
|
||||||
f"{snake_case_to_text(function_name)} - dashboard",
|
[
|
||||||
|
f"{snake_case_to_text(function_name)} - dashboard",
|
||||||
|
html.Span(version, className="version-tag"),
|
||||||
|
],
|
||||||
style={"color": accent_color},
|
style={"color": accent_color},
|
||||||
),
|
),
|
||||||
dcc.Markdown(
|
dcc.Markdown(
|
||||||
strip_lines(
|
strip_lines(
|
||||||
f"""
|
f"""
|
||||||
> View the live data of your deployment here.
|
> View the live data of your deployment here.
|
||||||
|
|
||||||
## Using the API
|
## Using the API
|
||||||
|
|
||||||
You can find the available endpoints at [/docs](/docs).
|
You can find the available endpoints at [/docs](/docs).
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
{function_docs}
|
{function_docs}
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
className="description",
|
className="description",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue