FossilRepo

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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button