File size: 4,636 Bytes
5d1a8d2
0c1a3e2
5d1a8d2
0c1a3e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d1a8d2
cfcea40
0c1a3e2
 
5d1a8d2
 
0c1a3e2
5d1a8d2
 
0c1a3e2
5d1a8d2
 
 
 
 
 
 
 
0c1a3e2
5d1a8d2
0c1a3e2
 
 
5d1a8d2
 
 
 
 
0c1a3e2
 
 
 
 
 
 
 
 
 
 
 
 
cfcea40
0c1a3e2
 
5d1a8d2
 
 
 
 
 
 
 
 
 
0c1a3e2
 
5d1a8d2
 
 
 
 
 
0c1a3e2
 
 
 
 
 
 
 
5d1a8d2
0c1a3e2
 
 
5d1a8d2
0c1a3e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d1a8d2
0c1a3e2
 
 
 
 
 
 
5d1a8d2
 
0c1a3e2
 
 
 
 
 
 
 
 
5d1a8d2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{% extends "base.html" %}
{% block title %}{{ table_name }} - SQLite DBaaS{% endblock %}
{% block content %}
<div class="page-header">
    <div>
        <h1 class="page-title">{{ table_name }}</h1>
        <p class="page-subtitle">{{ total }} rows</p>
    </div>
    <a href="/admin/dashboard" class="m3-button m3-button--text">
        <span class="material-symbols-outlined">arrow_back</span>
        Dashboard
    </a>
</div>

<!-- Columns -->
<div class="m3-card">
    <div class="m3-card-header">
        <div class="m3-card-icon">
            <span class="material-symbols-outlined">view_column</span>
        </div>
        <div>
            <div class="m3-card-title">Columns</div>
            <div class="m3-card-subtitle">{{ columns|length }} columns</div>
        </div>
    </div>
    
    <div class="m3-table-container">
        <table class="m3-table">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Name</th>
                    <th>Type</th>
                    <th>Nullable</th>
                    <th>Default</th>
                    <th>PK</th>
                </tr>
            </thead>
            <tbody>
                {% for col in columns %}
                <tr>
                    <td>{{ col.cid }}</td>
                    <td class="mono">{{ col.name }}</td>
                    <td>{{ col.type }}</td>
                    <td>{% if col.notnull %}No{% else %}Yes{% endif %}</td>
                    <td class="mono">{{ col.dflt_value or '-' }}</td>
                    <td>{% if col.pk %}✓{% else %}-{% endif %}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>

<!-- Indexes -->
{% if indexes %}
<div class="m3-card">
    <div class="m3-card-header">
        <div class="m3-card-icon">
            <span class="material-symbols-outlined">key</span>
        </div>
        <div>
            <div class="m3-card-title">Indexes</div>
        </div>
    </div>
    
    <div class="m3-table-container">
        <table class="m3-table">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Unique</th>
                    <th>Origin</th>
                </tr>
            </thead>
            <tbody>
                {% for idx in indexes %}
                <tr>
                    <td class="mono">{{ idx.name }}</td>
                    <td>{% if idx.unique %}Yes{% else %}No{% endif %}</td>
                    <td>{{ idx.origin }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}

<!-- Data -->
<div class="m3-card">
    <div class="m3-card-header">
        <div class="m3-card-icon">
            <span class="material-symbols-outlined">table_rows</span>
        </div>
        <div>
            <div class="m3-card-title">Data</div>
            <div class="m3-card-subtitle">Page {{ page }} of {{ total_pages }}</div>
        </div>
    </div>
    
    {% if rows %}
    <div class="m3-table-container" style="max-height: 500px; overflow: auto;">
        <table class="m3-table">
            <thead>
                <tr>
                    {% for col in columns %}
                    <th>{{ col.name }}</th>
                    {% endfor %}
                </tr>
            </thead>
            <tbody>
                {% for row in rows %}
                <tr>
                    {% for col in columns %}
                    <td class="mono">{{ (row[col.name] or 'NULL')|truncate(100) }}</td>
                    {% endfor %}
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    
    <!-- Pagination -->
    {% if total_pages > 1 %}
    <div class="m3-pagination">
        {% if page > 1 %}
        <a href="?page={{ page - 1 }}" class="m3-button m3-button--outlined">
            <span class="material-symbols-outlined">chevron_left</span>
        </a>
        {% endif %}
        
        <span class="m3-pagination-info">Page {{ page }} of {{ total_pages }}</span>
        
        {% if page < total_pages %}
        <a href="?page={{ page + 1 }}" class="m3-button m3-button--outlined">
            <span class="material-symbols-outlined">chevron_right</span>
        </a>
        {% endif %}
    </div>
    {% endif %}
    
    {% else %}
    <div class="empty-state">
        <span class="material-symbols-outlined empty-icon">table_rows</span>
        <div class="empty-title">No data</div>
        <div class="empty-description">This table is empty</div>
    </div>
    {% endif %}
</div>
{% endblock %}