chore(release): 0.5.0 #13
31
src/judas_server/web/routes/client_details.py
Normal file
31
src/judas_server/web/routes/client_details.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
import flask
|
||||
import flask_login
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from judas_server.backend import BackendServer
|
||||
from judas_server.backend.client import Client
|
||||
|
||||
bp: flask.Blueprint = flask.Blueprint(
|
||||
"client_details", __name__, url_prefix="/client"
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/<client_id>")
|
||||
@flask_login.login_required
|
||||
def client_details(client_id: str) -> str:
|
||||
"""Renders the client details page for a specific client.
|
||||
|
||||
Args:
|
||||
client_id: The ID of the client to display details for.
|
||||
"""
|
||||
backend: BackendServer = flask.current_app.config["BACKEND"]
|
||||
client: Client | None = backend.clients.get(client_id)
|
||||
|
||||
if not client:
|
||||
flask.abort(404, description="Client not found")
|
||||
|
||||
return flask.render_template("client_details.html", client=client)
|
||||
Reference in New Issue
Block a user