updated first commit
This commit is contained in:
35
app/routes/dashboard.py
Normal file
35
app/routes/dashboard.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Dashboard routes
|
||||
"""
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
from flask_login import login_required
|
||||
from app.models.player import Player
|
||||
from app.models.group import Group
|
||||
from app.utils.logger import get_recent_logs
|
||||
import os
|
||||
|
||||
bp = Blueprint('dashboard', __name__)
|
||||
|
||||
@bp.route('/')
|
||||
@login_required
|
||||
def index():
|
||||
"""Main dashboard"""
|
||||
players = Player.query.order_by(Player.username).all()
|
||||
groups = Group.query.order_by(Group.name).all()
|
||||
|
||||
# Check if logo exists
|
||||
from flask import current_app
|
||||
logo_path = os.path.join(current_app.static_folder, 'assets', 'logo.png')
|
||||
logo_exists = os.path.exists(logo_path)
|
||||
|
||||
# Get recent server logs
|
||||
server_logs = get_recent_logs(20)
|
||||
|
||||
return render_template(
|
||||
'dashboard/index.html',
|
||||
players=players,
|
||||
groups=groups,
|
||||
logo_exists=logo_exists,
|
||||
server_logs=server_logs
|
||||
)
|
||||
Reference in New Issue
Block a user