mud_server.admin_tui.screens.dashboard ====================================== .. py:module:: mud_server.admin_tui.screens.dashboard .. autoapi-nested-parse:: Dashboard screen for PipeWorks Admin TUI. This module provides the main admin dashboard that displays server status and provides quick access to administrative actions. The DashboardScreen shows: - Current server connection status - Active player count - Quick action buttons - User session information - User creation entry point (admin/superuser) Classes ------- .. autoapisummary:: mud_server.admin_tui.screens.dashboard.DashboardScreen Module Contents --------------- .. py:class:: DashboardScreen Bases: :py:obj:`textual.screen.Screen` Main admin dashboard screen. Displays server status and provides administrative actions. Automatically refreshes status periodically. Key Bindings: r: Refresh server status d: View database tables (superuser only) u: Create user (admin or superuser) c: View characters (admin or superuser) l: Logout ctrl+q: Quit application CSS Classes: .dashboard-container: Main content container. .status-panel: Server status display panel. .actions-panel: Quick actions button panel. .info-label: Status information labels. .info-value: Status information values. .. py:attribute:: BINDINGS .. py:attribute:: CSS :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ DashboardScreen { layout: vertical; } .dashboard-container { padding: 1 2; } .status-panel { border: solid green; padding: 1 2; height: auto; margin-bottom: 1; } .status-title { text-style: bold; color: $accent; padding-bottom: 1; } .status-row { height: 1; } .info-label { width: 20; color: $text-muted; } .info-value { color: $text; } .actions-panel { border: solid $primary; padding: 1 2; height: auto; } .actions-title { text-style: bold; color: $accent; padding-bottom: 1; } .action-buttons { height: 3; } .action-button { margin-right: 1; } .user-info { dock: bottom; height: 3; padding: 1 2; background: $surface; border-top: solid $primary-darken-2; } .user-label { color: $text-muted; } .user-value { color: $success; text-style: bold; } """ .. raw:: html
.. py:method:: compose() Create the dashboard layout. Layout consists of: - Header with app title - Status panel showing server info - Actions panel with quick action buttons - User info bar at bottom - Footer with key bindings .. py:method:: on_mount() Initialize dashboard when mounted. .. py:method:: on_key(event) Handle user-configured keybindings for dashboard actions. If a key is configured for an action, invoke the matching action method and stop further propagation. .. py:method:: refresh_status() :async: Refresh server status from API. This is a background worker that fetches server health and updates the display. Uses @work decorator for async execution. .. py:method:: handle_refresh_button() Handle refresh button press. .. py:method:: handle_database_button() Handle database button press. .. py:method:: handle_logout_button() :async: Handle logout button press. .. py:method:: handle_characters_button() Handle characters button press. .. py:method:: handle_create_user_button() Handle create user button press. .. py:method:: action_refresh() Refresh server status (key: r). .. py:method:: action_view_database() View database tables (key: d). Requires superuser privileges. .. py:method:: action_create_user() Create a new user account (key: u). Requires admin or superuser. .. py:method:: action_view_characters() View all characters (key: c). Requires admin or superuser. .. py:method:: action_logout() :async: Logout and return to login screen (key: l). .. py:method:: action_quit() Quit the application (key: q).