113 lines
4.6 KiB
Twig
113 lines
4.6 KiB
Twig
|
|
{% extends 'base.html.twig' %}
|
||
|
|
|
||
|
|
{% block title %}Jormun Admin — Dashboard{% endblock %}
|
||
|
|
|
||
|
|
{% block breadcrumbs %}
|
||
|
|
<a href="{{ path('dashboard') }}"><i class="bi bi-house-fill"></i> Home</a>
|
||
|
|
<span class="sep">/</span>
|
||
|
|
<span class="current">Dashboard</span>
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
{% block sidebar_tables %}
|
||
|
|
{% for table in tables %}
|
||
|
|
<a
|
||
|
|
href="{{ path('table_browse', {name: table.name}) }}"
|
||
|
|
class="sidebar-table-link"
|
||
|
|
x-show="filterMatches('{{ table.name }}')"
|
||
|
|
>
|
||
|
|
<i class="bi bi-table"></i>
|
||
|
|
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ table.name }}</span>
|
||
|
|
</a>
|
||
|
|
{% endfor %}
|
||
|
|
{% endblock %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="d-flex align-items-center justify-content-between mb-3">
|
||
|
|
<div>
|
||
|
|
<h5 class="font-display mb-0" style="font-weight:700;font-size:1rem;">Dashboard</h5>
|
||
|
|
<div style="font-size:0.72rem;color:#64748b;">{{ tables|length }} table{{ tables|length != 1 ? 's' : '' }} in instance</div>
|
||
|
|
</div>
|
||
|
|
<a href="{{ path('table_create') }}" class="btn-jormun">
|
||
|
|
<i class="bi bi-plus-lg"></i> New Table
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{% if error %}
|
||
|
|
<div style="background:#fef2f2;border:1px solid #fca5a5;color:#991b1b;border-radius:6px;padding:0.75rem 1rem;margin-bottom:1rem;font-size:0.8rem;">
|
||
|
|
<i class="bi bi-exclamation-triangle-fill me-2"></i>{{ error }}
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
|
||
|
|
{% if tables is empty and not error %}
|
||
|
|
<div class="content-card">
|
||
|
|
<div class="empty-state">
|
||
|
|
<i class="bi bi-database-slash"></i>
|
||
|
|
<div style="font-family:'Syne',sans-serif;font-weight:700;font-size:0.9rem;color:#374151;margin-bottom:0.4rem;">No tables yet</div>
|
||
|
|
<div style="font-size:0.75rem;margin-bottom:1rem;">Create your first JormunDB table to get started.</div>
|
||
|
|
<a href="{{ path('table_create') }}" class="btn-jormun">
|
||
|
|
<i class="bi bi-plus-lg"></i> Create Table
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% else %}
|
||
|
|
<div class="content-card">
|
||
|
|
<div class="content-card-header">
|
||
|
|
<h6><i class="bi bi-database me-1" style="color:var(--jormun-teal);"></i> Tables</h6>
|
||
|
|
<span class="stat-pill"><i class="bi bi-layers"></i> {{ tables|length }} total</span>
|
||
|
|
</div>
|
||
|
|
<div style="overflow-x:auto;">
|
||
|
|
<table class="data-table">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>Table Name</th>
|
||
|
|
<th>Status</th>
|
||
|
|
<th>Item Count</th>
|
||
|
|
<th>Size</th>
|
||
|
|
<th>Partition Key</th>
|
||
|
|
<th>Sort Key</th>
|
||
|
|
<th style="width:120px;">Actions</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
{% for table in tables %}
|
||
|
|
{% set pk = null %}
|
||
|
|
{% set sk = null %}
|
||
|
|
{% for k in table.keySchema %}
|
||
|
|
{% if k.KeyType == 'HASH' %}{% set pk = k.AttributeName %}{% endif %}
|
||
|
|
{% if k.KeyType == 'RANGE' %}{% set sk = k.AttributeName %}{% endif %}
|
||
|
|
{% endfor %}
|
||
|
|
<tr>
|
||
|
|
<td>
|
||
|
|
<a href="{{ path('table_browse', {name: table.name}) }}" style="color:var(--jormun-teal);text-decoration:none;font-weight:500;">
|
||
|
|
<i class="bi bi-table me-1" style="opacity:0.5;"></i>{{ table.name }}
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
<td>
|
||
|
|
<span class="status-badge {{ table.status|lower }}">{{ table.status }}</span>
|
||
|
|
</td>
|
||
|
|
<td>{{ table.itemCount|number_format }}</td>
|
||
|
|
<td>
|
||
|
|
{% if table.sizeBytes >= 1048576 %}
|
||
|
|
{{ (table.sizeBytes / 1048576)|number_format(1) }} MB
|
||
|
|
{% elseif table.sizeBytes >= 1024 %}
|
||
|
|
{{ (table.sizeBytes / 1024)|number_format(1) }} KB
|
||
|
|
{% else %}
|
||
|
|
{{ table.sizeBytes }} B
|
||
|
|
{% endif %}
|
||
|
|
</td>
|
||
|
|
<td><span class="type-badge">{{ pk ?? '—' }}</span></td>
|
||
|
|
<td><span class="{% if sk %}type-badge{% else %}null-val{% endif %}">{{ sk ?? 'none' }}</span></td>
|
||
|
|
<td class="action-cell">
|
||
|
|
<a href="{{ path('table_browse', {name: table.name}) }}" class="btn-sm-edit">
|
||
|
|
<i class="bi bi-eye"></i> Browse
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endfor %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
{% endblock %}
|