Add page to list all flask endpoints with filter
This commit is contained in:
94
templates/partials/endpoints_table.html
Normal file
94
templates/partials/endpoints_table.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<div class="overflow-x-auto">
|
||||
<!-- Column Toggle Checkboxes -->
|
||||
<div class="mb-4 flex flex-wrap items-center space-x-4">
|
||||
<label class="inline-flex items-center">
|
||||
<input type="checkbox" checked class="form-checkbox h-5 w-5 text-blue-600" hx-target=".col-endpoint"
|
||||
hx-trigger="change" _="
|
||||
on change if me.checked then
|
||||
remove .hidden from .col-endpoint
|
||||
else
|
||||
add .hidden to .col-endpoint
|
||||
">
|
||||
<span class="ml-2 text-gray-700">Endpoint</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<input type="checkbox" checked class="form-checkbox h-5 w-5 text-blue-600" hx-target=".col-url"
|
||||
hx-trigger="change" _="
|
||||
on change if me.checked then
|
||||
remove .hidden from .col-url
|
||||
else
|
||||
add .hidden to .col-url
|
||||
">
|
||||
<span class="ml-2 text-gray-700">URL</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<input type="checkbox" checked class="form-checkbox h-5 w-5 text-blue-600" hx-target=".col-methods"
|
||||
hx-trigger="change" _="
|
||||
on change if me.checked then
|
||||
remove .hidden from .col-methods
|
||||
else
|
||||
add .hidden to .col-methods
|
||||
">
|
||||
<span class="ml-2 text-gray-700">Methods</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<input type="checkbox" checked class="form-checkbox h-5 w-5 text-blue-600" hx-target=".col-view_func"
|
||||
hx-trigger="change" _="
|
||||
on change if me.checked then
|
||||
remove .hidden from .col-view_func
|
||||
else
|
||||
add .hidden to .col-view_func
|
||||
">
|
||||
<span class="ml-2 text-gray-700">View Function</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center">
|
||||
<input type="checkbox" checked class="form-checkbox h-5 w-5 text-blue-600" hx-target=".col-description"
|
||||
hx-trigger="change" _="
|
||||
on change if me.checked then
|
||||
remove .hidden from .col-description
|
||||
else
|
||||
add .hidden to .col-description
|
||||
">
|
||||
<span class="ml-2 text-gray-700">Description</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Endpoints Table -->
|
||||
<table class="min-w-full bg-white rounded-lg shadow">
|
||||
<thead class="bg-gray-200">
|
||||
<tr>
|
||||
<th class="py-2 px-4 border-b text-left text-sm font-medium text-gray-700 col-endpoint">Endpoint</th>
|
||||
<th class="py-2 px-4 border-b text-left text-sm font-medium text-gray-700 col-url">URL</th>
|
||||
<th class="py-2 px-4 border-b text-left text-sm font-medium text-gray-700 col-methods">Methods</th>
|
||||
<th class="py-2 px-4 border-b text-left text-sm font-medium text-gray-700 col-view_func">View Function
|
||||
</th>
|
||||
<th class="py-2 px-4 border-b text-left text-sm font-medium text-gray-700 col-description">Description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for route in routes %}
|
||||
<tr class="hover:bg-gray-100 even:bg-gray-50">
|
||||
<td class="py-2 px-4 border-b text-sm text-gray-800 col-endpoint">{{ route.endpoint }}</td>
|
||||
<td class="py-2 px-4 border-b text-sm text-gray-800 col-url">{{ route.url }}</td>
|
||||
<td class="py-2 px-4 border-b text-sm text-gray-800 col-methods">{{ route.methods }}</td>
|
||||
<td class="py-2 px-4 border-b text-sm text-gray-800 col-view_func">{{ route.view_func }}</td>
|
||||
<td class="py-2 px-4 border-b text-sm text-gray-800 col-description">
|
||||
{% if route.doc %}
|
||||
<details class="group">
|
||||
<summary class="cursor-pointer text-blue-600 hover:underline">
|
||||
{{ route.doc.split('\n')[0] }}{% if route.doc.count('\n') > 0 %}...{% endif %}
|
||||
</summary>
|
||||
<div class="mt-2 text-gray-700">
|
||||
{{ route.doc }}
|
||||
</div>
|
||||
</details>
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user