|
2f13242…
|
ragelink
|
1 |
<div class="rounded-lg bg-gray-800 border border-gray-700 overflow-hidden shadow-sm"> |
|
c588255…
|
ragelink
|
2 |
<!-- Header --> |
|
c588255…
|
ragelink
|
3 |
<div class="px-4 py-3 border-b border-gray-700 flex items-center justify-between"> |
|
c588255…
|
ragelink
|
4 |
<div> |
|
c588255…
|
ragelink
|
5 |
<h3 class="text-base font-mono font-semibold text-gray-100">{{ table_name }}</h3> |
|
c588255…
|
ragelink
|
6 |
<p class="text-xs text-gray-500 mt-0.5">{{ total|default:"0" }} row{{ total|pluralize }} · {{ columns|length }} column{{ columns|length|pluralize }}</p> |
|
c588255…
|
ragelink
|
7 |
</div> |
|
c588255…
|
ragelink
|
8 |
<a href="{% url 'fossil:explorer_query' slug=project.slug %}?sql=SELECT+*+FROM+{{ table_name }}+LIMIT+25" |
|
c588255…
|
ragelink
|
9 |
class="text-xs text-brand-light hover:text-brand"> |
|
c588255…
|
ragelink
|
10 |
Query this table |
|
c588255…
|
ragelink
|
11 |
</a> |
|
c588255…
|
ragelink
|
12 |
</div> |
|
c588255…
|
ragelink
|
13 |
|
|
c588255…
|
ragelink
|
14 |
<!-- Column definitions --> |
|
c588255…
|
ragelink
|
15 |
<div class="px-4 py-3 border-b border-gray-700"> |
|
c588255…
|
ragelink
|
16 |
<h4 class="text-xs font-medium text-gray-400 uppercase mb-2">Columns</h4> |
|
c588255…
|
ragelink
|
17 |
<div class="overflow-x-auto"> |
|
c588255…
|
ragelink
|
18 |
<table class="min-w-full text-xs"> |
|
c588255…
|
ragelink
|
19 |
<thead> |
|
c588255…
|
ragelink
|
20 |
<tr class="text-gray-500"> |
|
c588255…
|
ragelink
|
21 |
<th class="text-left pr-4 pb-1 font-medium">#</th> |
|
c588255…
|
ragelink
|
22 |
<th class="text-left pr-4 pb-1 font-medium">Name</th> |
|
c588255…
|
ragelink
|
23 |
<th class="text-left pr-4 pb-1 font-medium">Type</th> |
|
c588255…
|
ragelink
|
24 |
<th class="text-left pr-4 pb-1 font-medium">Not Null</th> |
|
c588255…
|
ragelink
|
25 |
<th class="text-left pb-1 font-medium">PK</th> |
|
c588255…
|
ragelink
|
26 |
</tr> |
|
c588255…
|
ragelink
|
27 |
</thead> |
|
c588255…
|
ragelink
|
28 |
<tbody class="font-mono"> |
|
c588255…
|
ragelink
|
29 |
{% for col in columns %} |
|
c588255…
|
ragelink
|
30 |
<tr class="{% if col.pk %}text-yellow-400{% else %}text-gray-300{% endif %}"> |
|
c588255…
|
ragelink
|
31 |
<td class="pr-4 py-0.5 text-gray-600">{{ col.cid }}</td> |
|
c588255…
|
ragelink
|
32 |
<td class="pr-4 py-0.5 font-medium">{{ col.name }}</td> |
|
c588255…
|
ragelink
|
33 |
<td class="pr-4 py-0.5 text-gray-400">{{ col.type }}</td> |
|
c588255…
|
ragelink
|
34 |
<td class="pr-4 py-0.5 text-gray-500">{% if col.notnull %}YES{% else %}{% endif %}</td> |
|
c588255…
|
ragelink
|
35 |
<td class="py-0.5">{% if col.pk %}<span class="text-yellow-500 font-bold">PK</span>{% endif %}</td> |
|
c588255…
|
ragelink
|
36 |
</tr> |
|
c588255…
|
ragelink
|
37 |
{% endfor %} |
|
c588255…
|
ragelink
|
38 |
</tbody> |
|
c588255…
|
ragelink
|
39 |
</table> |
|
c588255…
|
ragelink
|
40 |
</div> |
|
c588255…
|
ragelink
|
41 |
</div> |
|
c588255…
|
ragelink
|
42 |
|
|
c588255…
|
ragelink
|
43 |
<!-- Sample data --> |
|
c588255…
|
ragelink
|
44 |
<div class="px-4 py-3"> |
|
c588255…
|
ragelink
|
45 |
<h4 class="text-xs font-medium text-gray-400 uppercase mb-2"> |
|
c588255…
|
ragelink
|
46 |
Data |
|
c588255…
|
ragelink
|
47 |
{% if total > 0 %} |
|
c588255…
|
ragelink
|
48 |
<span class="text-gray-600 font-normal normal-case"> |
|
c588255…
|
ragelink
|
49 |
(rows {{ page|add:"-1"|default:"0" }}{% widthratio per_page 1 1 %} - showing page {{ page }}) |
|
c588255…
|
ragelink
|
50 |
</span> |
|
c588255…
|
ragelink
|
51 |
{% endif %} |
|
c588255…
|
ragelink
|
52 |
</h4> |
|
c588255…
|
ragelink
|
53 |
|
|
c588255…
|
ragelink
|
54 |
{% if rows %} |
|
c588255…
|
ragelink
|
55 |
<div class="overflow-x-auto"> |
|
c588255…
|
ragelink
|
56 |
<table class="min-w-full divide-y divide-gray-700 text-xs"> |
|
c588255…
|
ragelink
|
57 |
<thead> |
|
c588255…
|
ragelink
|
58 |
<tr> |
|
c588255…
|
ragelink
|
59 |
{% for name in col_names %} |
|
c588255…
|
ragelink
|
60 |
<th class="px-3 py-2 text-left font-medium text-gray-400 whitespace-nowrap">{{ name }}</th> |
|
c588255…
|
ragelink
|
61 |
{% endfor %} |
|
c588255…
|
ragelink
|
62 |
</tr> |
|
c588255…
|
ragelink
|
63 |
</thead> |
|
c588255…
|
ragelink
|
64 |
<tbody class="divide-y divide-gray-700 font-mono"> |
|
c588255…
|
ragelink
|
65 |
{% for row in rows %} |
|
2f13242…
|
ragelink
|
66 |
<tr class="hover:bg-gray-700/40 transition-colors"> |
|
c588255…
|
ragelink
|
67 |
{% for cell in row %} |
|
c588255…
|
ragelink
|
68 |
<td class="px-3 py-1.5 text-gray-300 whitespace-nowrap max-w-xs truncate">{{ cell|default:"NULL" }}</td> |
|
c588255…
|
ragelink
|
69 |
{% endfor %} |
|
c588255…
|
ragelink
|
70 |
</tr> |
|
c588255…
|
ragelink
|
71 |
{% endfor %} |
|
c588255…
|
ragelink
|
72 |
</tbody> |
|
c588255…
|
ragelink
|
73 |
</table> |
|
c588255…
|
ragelink
|
74 |
</div> |
|
c588255…
|
ragelink
|
75 |
|
|
c588255…
|
ragelink
|
76 |
<!-- Pagination --> |
|
c588255…
|
ragelink
|
77 |
{% if has_prev or has_next %} |
|
c588255…
|
ragelink
|
78 |
<div class="flex items-center justify-between mt-3 pt-3 border-t border-gray-700"> |
|
c588255…
|
ragelink
|
79 |
{% if has_prev %} |
|
c588255…
|
ragelink
|
80 |
<button |
|
c588255…
|
ragelink
|
81 |
hx-get="{% url 'fossil:explorer_table' slug=project.slug table_name=table_name %}?page={{ page|add:"-1" }}" |
|
c588255…
|
ragelink
|
82 |
hx-target="#table-detail" |
|
c588255…
|
ragelink
|
83 |
hx-swap="innerHTML" |
|
c588255…
|
ragelink
|
84 |
class="text-xs text-brand-light hover:text-brand"> |
|
c588255…
|
ragelink
|
85 |
Previous |
|
c588255…
|
ragelink
|
86 |
</button> |
|
c588255…
|
ragelink
|
87 |
{% else %} |
|
c588255…
|
ragelink
|
88 |
<span></span> |
|
c588255…
|
ragelink
|
89 |
{% endif %} |
|
c588255…
|
ragelink
|
90 |
|
|
c588255…
|
ragelink
|
91 |
<span class="text-xs text-gray-500">Page {{ page }}</span> |
|
c588255…
|
ragelink
|
92 |
|
|
c588255…
|
ragelink
|
93 |
{% if has_next %} |
|
c588255…
|
ragelink
|
94 |
<button |
|
c588255…
|
ragelink
|
95 |
hx-get="{% url 'fossil:explorer_table' slug=project.slug table_name=table_name %}?page={{ page|add:"1" }}" |
|
c588255…
|
ragelink
|
96 |
hx-target="#table-detail" |
|
c588255…
|
ragelink
|
97 |
hx-swap="innerHTML" |
|
c588255…
|
ragelink
|
98 |
class="text-xs text-brand-light hover:text-brand"> |
|
c588255…
|
ragelink
|
99 |
Next |
|
c588255…
|
ragelink
|
100 |
</button> |
|
c588255…
|
ragelink
|
101 |
{% else %} |
|
c588255…
|
ragelink
|
102 |
<span></span> |
|
c588255…
|
ragelink
|
103 |
{% endif %} |
|
c588255…
|
ragelink
|
104 |
</div> |
|
c588255…
|
ragelink
|
105 |
{% endif %} |
|
c588255…
|
ragelink
|
106 |
|
|
c588255…
|
ragelink
|
107 |
{% else %} |
|
c588255…
|
ragelink
|
108 |
<p class="text-sm text-gray-500 text-center py-4">Table is empty.</p> |
|
c588255…
|
ragelink
|
109 |
{% endif %} |
|
c588255…
|
ragelink
|
110 |
</div> |
|
c588255…
|
ragelink
|
111 |
</div> |