Refactoring DbEngine Fixing unit tests Fixing unit tests Fixing unit tests Refactored DbManager for datagrid Improving front end performance I can add new table Fixed sidebar closing when clicking on it Fix drag event rebinding, improve listener options, and add debug Prevent duplicate drag event bindings with a dataset flag and ensure consistent scrollbar functionality. Change wheel event listener to passive mode for better performance. Refactor function naming for consistency, and add debug logs for event handling. Refactor Datagrid bindings and default state handling. Updated Javascript to conditionally rebind Datagrid on specific events. Improved Python components by handling empty DataFrame cases and removing redundant code. Revised default state initialization in settings for better handling of mutable fields. Added Rowindex visualisation support Working on Debugger with own implementation of JsonViewer Working on JsonViewer.py Fixed unit tests Adding unit tests I can fold and unfold fixed unit tests Adding css for debugger Added tooltip management Adding debugger functionalities Refactor serializers and improve error handling in DB engine Fixed error where tables were overwritten I can display footer menu Working on footer. Refactoring how heights are managed Refactored scrollbars management Working on footer menu I can display footer menu + fixed unit tests Fixed unit tests Updated click management I can display aggregations in footers Added docker management Refactor input handling and improve config defaults Fixed scrollbars colors Refactored tooltip management Improved tooltip management Improving FilterAll
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
import logging
|
|
|
|
from fasthtml.fastapp import fast_app
|
|
from starlette.responses import RedirectResponse
|
|
|
|
from auth.auth_manager import AuthManager
|
|
from auth.email_auth import EmailAuth
|
|
from components.login.constants import Routes, LOGIN_INSTANCE_ID
|
|
from components.page_layout_new import page_layout_new
|
|
from core.instance_manager import InstanceManager
|
|
|
|
logger = logging.getLogger("LoggingApp")
|
|
|
|
login_app, rt = fast_app()
|
|
|
|
|
|
@rt(Routes.Login)
|
|
def get(error_message: str = None, success_message: str = None):
|
|
"""Handler for the login page route."""
|
|
instance = InstanceManager.get(None, LOGIN_INSTANCE_ID)
|
|
return page_layout_new(None,
|
|
instance.settings_manager,
|
|
instance.login_page(error_message, success_message))
|
|
|
|
|
|
@rt(Routes.Logout)
|
|
def get(session):
|
|
"""Handler for logout."""
|
|
# Clear session data
|
|
AuthManager.logout_user(session)
|
|
|
|
# Redirect to login page
|
|
return RedirectResponse('/login', status_code=303)
|
|
|
|
|
|
@rt(Routes.LoginByEmail)
|
|
def post(session, email: str, password: str):
|
|
"""Handler for email login."""
|
|
# Authenticate user
|
|
success, message, user_data = EmailAuth.authenticate(
|
|
email=email,
|
|
password=password
|
|
)
|
|
|
|
instance = InstanceManager.get(None, LOGIN_INSTANCE_ID)
|
|
|
|
if not success:
|
|
return page_layout_new(
|
|
session,
|
|
instance.settings_manager,
|
|
instance.login_page(error_message=message),
|
|
)
|
|
|
|
# Log in user by setting session data
|
|
AuthManager.login_user(session, user_data)
|
|
|
|
# Redirect to home page
|
|
return RedirectResponse('/', status_code=303)
|