modified: web/blueprints/panel.py

modified:   web/static/css/style.css
	modified:   web/templates/base.html
	modified:   web/templates/panel/dashboard.html
This commit is contained in:
SimolZimol
2026-04-02 00:09:31 +02:00
parent df8a0590b9
commit 486aa2ff18
4 changed files with 56 additions and 23 deletions

View File

@@ -139,13 +139,23 @@ def dashboard():
WHERE timestamp >= NOW() - INTERVAL 24 HOUR
ORDER BY timestamp DESC LIMIT 20
""")
block_chart = query("""
SELECT DATE(timestamp) AS day, COUNT(*) AS cnt
FROM block_events
WHERE timestamp >= NOW() - INTERVAL 7 DAY
GROUP BY DATE(timestamp) ORDER BY day
""")
recent = query("""
SELECT * FROM v_recent_activity LIMIT 50
""")
except Exception as e:
flash(f"Database error: {e}", "danger")
return render_template("panel/no_db.html")
return render_template("panel/dashboard.html",
stats=stats, online=online, top_players=top_players,
death_causes=death_causes, server_events=server_events)
death_causes=death_causes, server_events=server_events,
block_chart=block_chart, recent=recent)
# ─────────────────────────────────────────────────────────────

View File

@@ -44,14 +44,37 @@ html, body {
#sidebar.collapsed {
width: 64px;
min-width: 64px;
padding: .75rem .5rem !important;
}
#sidebar.collapsed .sidebar-brand div,
#sidebar.collapsed .sidebar-brand small,
#sidebar.collapsed .nav-link span {
#sidebar.collapsed .sidebar-brand .badge,
#sidebar.collapsed .nav-link span,
#sidebar.collapsed .sidebar-hide-collapsed,
#sidebar.collapsed .btn span {
display: none;
}
#sidebar.collapsed .nav-link {
justify-content: center;
padding: .55rem;
}
#sidebar.collapsed .nav-link i {
font-size: 1.15rem;
margin: 0;
}
#sidebar.collapsed .btn {
padding: .35rem;
text-align: center;
}
#sidebar.collapsed .btn i {
margin: 0;
}
.sidebar-brand {
padding: .25rem 0;
}
@@ -143,11 +166,11 @@ main {
/* ── Tabellen ────────────────────────────────────────────── */
.table {
color: #d1d5db;
font-size: .8rem;
font-size: .875rem;
}
.table > thead {
font-size: .75rem;
font-size: .8rem;
letter-spacing: .03em;
color: #9ca3af;
}

View File

@@ -27,80 +27,80 @@
{% if perms.get('view_dashboard', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.dashboard' }}" href="{{ url_for('panel.dashboard') }}">
<i class="bi bi-speedometer2"></i> Dashboard
<i class="bi bi-speedometer2"></i> <span>Dashboard</span>
</a>
</li>
{% endif %}
{% if perms.get('view_players', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint in ['panel.players','panel.player_detail'] }}" href="{{ url_for('panel.players') }}">
<i class="bi bi-people-fill"></i> Players
<i class="bi bi-people-fill"></i> <span>Players</span>
</a>
</li>
{% endif %}
{% if perms.get('view_sessions', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.sessions' }}" href="{{ url_for('panel.sessions') }}">
<i class="bi bi-clock-history"></i> Sessions
<i class="bi bi-clock-history"></i> <span>Sessions</span>
</a>
</li>
{% endif %}
{% if perms.get('view_chat', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.chat' }}" href="{{ url_for('panel.chat') }}">
<i class="bi bi-chat-dots-fill"></i> Chat
<i class="bi bi-chat-dots-fill"></i> <span>Chat</span>
</a>
</li>
{% endif %}
{% if perms.get('view_commands', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.commands' }}" href="{{ url_for('panel.commands') }}">
<i class="bi bi-terminal-fill"></i> Commands
<i class="bi bi-terminal-fill"></i> <span>Commands</span>
</a>
</li>
{% endif %}
{% if perms.get('view_deaths', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.deaths' }}" href="{{ url_for('panel.deaths') }}">
<i class="bi bi-heartbreak-fill"></i> Deaths
<i class="bi bi-heartbreak-fill"></i> <span>Deaths</span>
</a>
</li>
{% endif %}
{% if perms.get('view_blocks', True) or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.blocks' }}" href="{{ url_for('panel.blocks') }}">
<i class="bi bi-bricks"></i> Block Events
<i class="bi bi-bricks"></i> <span>Block Events</span>
</a>
</li>
{% endif %}
{% if perms.get('view_proxy') or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.proxy' }}" href="{{ url_for('panel.proxy') }}">
<i class="bi bi-diagram-3-fill"></i> Proxy Events
<i class="bi bi-diagram-3-fill"></i> <span>Proxy Events</span>
</a>
</li>
{% endif %}
{% if perms.get('view_server_events') or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.server_events' }}" href="{{ url_for('panel.server_events') }}">
<i class="bi bi-server"></i> Server Events
<i class="bi bi-server"></i> <span>Server Events</span>
</a>
</li>
{% endif %}
{% if perms.get('view_perms') or is_admin %}
<li class="nav-item">
<a class="nav-link {{ 'active' if request.endpoint == 'panel.perms' }}" href="{{ url_for('panel.perms') }}">
<i class="bi bi-shield-lock-fill"></i> Permissions
<i class="bi bi-shield-lock-fill"></i> <span>Permissions</span>
</a>
</li>
{% endif %}
</ul>
<hr class="my-2">
<hr class="my-2 sidebar-hide-collapsed">
<!-- Gruppen-Switcher -->
{% if not session.get('is_site_admin') and user_groups and user_groups|length > 1 %}
<div class="mb-2">
<div class="mb-2 sidebar-hide-collapsed">
<small class="text-muted">Switch group:</small>
{% for g in user_groups %}
<a href="{{ url_for('auth.switch_group', group_id=g.id) }}"
@@ -114,17 +114,17 @@
<!-- Admin-Links -->
{% if session.get('role') == 'admin' and not session.get('is_site_admin') %}
<a href="{{ url_for('group_admin.dashboard') }}" class="btn btn-outline-warning btn-sm mb-1">
<i class="bi bi-gear-fill"></i> Manage Group
<i class="bi bi-gear-fill"></i> <span>Manage Group</span>
</a>
{% endif %}
{% if session.get('is_site_admin') %}
{% if session.get('admin_viewing') %}
<a href="{{ url_for('site_admin.stop_view') }}" class="btn btn-warning btn-sm mb-1">
<i class="bi bi-arrow-left"></i> Back to Admin
<i class="bi bi-arrow-left"></i> <span>Back to Admin</span>
</a>
{% else %}
<a href="{{ url_for('site_admin.dashboard') }}" class="btn btn-outline-danger btn-sm mb-1">
<i class="bi bi-shield-fill"></i> Site Admin
<i class="bi bi-shield-fill"></i> <span>Site Admin</span>
</a>
{% endif %}
{% endif %}
@@ -132,11 +132,11 @@
<div class="mt-auto">
<div class="small text-muted mb-1">
<i class="bi bi-circle-fill text-success me-1" style="font-size:.5rem"></i>
<span id="online-count"></span> Online
<span id="online-count"></span> <span class="sidebar-hide-collapsed">Online</span>
</div>
<small class="text-muted d-block mb-1">{{ session.get('username', '') }}</small>
<small class="text-muted d-block mb-1 sidebar-hide-collapsed">{{ session.get('username', '') }}</small>
<a href="{{ url_for('auth.logout') }}" class="btn btn-outline-danger btn-sm w-100">
<i class="bi bi-box-arrow-right"></i> Logout
<i class="bi bi-box-arrow-right"></i> <span>Logout</span>
</a>
</div>
</nav>

View File

@@ -13,7 +13,7 @@
('Blocks Today', stats.blocks_today, 'bi-bricks', 'secondary'),
('Deaths Today', stats.deaths_today, 'bi-heartbreak-fill', 'danger'),
('Entity Events', stats.entity_events_today, 'bi-bug-fill', 'light'),
('Proxy Events', stats.proxy_events_today, 'bi-diagram-3-fill', 'dark'),
('Proxy Events', stats.proxy_events_today, 'bi-diagram-3-fill', 'info'),
] %}
{% for label, value, icon, color in cards %}
<div class="col-6 col-md-3 col-xl-3">