Refactor HTTP functions overview and logs pages with improved UI and responsiveness

- Modernize the design of HTTP functions overview and logs pages
- Add more detailed styling with Tailwind CSS
- Improve layout and readability with better typography and spacing
- Add empty state handling for both logs and functions lists
- Enhance visual hierarchy and interaction states
This commit is contained in:
Peter Stockings
2025-02-14 22:22:27 +11:00
parent 5ec8bba9e8
commit 9d48bbd285
2 changed files with 170 additions and 135 deletions

View File

@@ -11,47 +11,75 @@ show_history=True,
edit_url=url_for('http_function_editor', function_id=function_id),
cancel_url=url_for('dashboard_http_functions')) }}
<div class="block md:grid md:grid-cols-4 md:gap-4 p-4">
<!-- Headers -->
<div class="font-medium text-muted-foreground md:block hidden">Timestamp</div>
<div class="font-medium text-muted-foreground md:block hidden">Request</div>
<div class="font-medium text-muted-foreground md:block hidden">Response</div>
<div class="font-medium text-muted-foreground md:block hidden">Logs</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
<!-- Headers -->
<div class="grid md:grid-cols-4 gap-4 bg-gray-50 p-4 border-b border-gray-200">
<div class="font-semibold text-gray-600 md:block hidden">Timestamp</div>
<div class="font-semibold text-gray-600 md:block hidden">Request</div>
<div class="font-semibold text-gray-600 md:block hidden">Response</div>
<div class="font-semibold text-gray-600 md:block hidden">Logs</div>
</div>
<!-- Data Rows -->
{% for invocation in http_function_invocations %}
<!-- Timestamp and Status for Mobile and Desktop -->
<div class="flex items-center md:col-span-1 py-2 border-b">
<button
class="{{ 'bg-green-400' if invocation.status == 'SUCCESS' else 'bg-red-400' }} hover:bg-opacity-75 text-white font-bold rounded-full h-fit p-2 mr-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="{{ 'M5 13l4 4L19 7' if invocation.status == 'SUCCESS' else 'M6 18L18 6M6 6l12 12' }}"></path>
</svg>
</button>
<span>{{ invocation.invocation_time.strftime('%Y-%m-%d %H:%M:%S') }}</span>
<span class="bg-blue-500 text-white text-xs font-semibold px-2 py-1 rounded">
v{{ invocation.version_number }}
</span>
</div>
<!-- Data Rows -->
{% for invocation in http_function_invocations %}
<div
class="grid md:grid-cols-4 gap-4 p-4 hover:bg-gray-50 transition-colors duration-150 border-b border-gray-200">
<!-- Timestamp and Status -->
<div class="flex items-center space-x-2">
<div
class="{{ 'bg-green-100 text-green-700' if invocation.status == 'SUCCESS' else 'bg-red-100 text-red-700' }} p-2 rounded-full">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="{{ 'M5 13l4 4L19 7' if invocation.status == 'SUCCESS' else 'M6 18L18 6M6 6l12 12' }}">
</path>
</svg>
</div>
<div class="flex flex-col">
<span class="text-sm text-gray-900">{{ invocation.invocation_time.strftime('%Y-%m-%d %H:%M:%S')
}}</span>
<span
class="inline-flex items-center w-fit px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 rounded-full">
v{{ invocation.version_number }}
</span>
</div>
</div>
<!-- Request Data for Mobile and Desktop -->
<div class="font-mono text-gray-400 overflow-auto md:col-span-1 py-2 border-b">
{{ invocation.request_data }}
</div>
<!-- Request Data -->
<div class="bg-gray-50 rounded-lg p-3 overflow-auto max-h-40">
<pre class="text-sm font-mono text-gray-600 whitespace-pre-wrap">{{ invocation.request_data }}</pre>
</div>
<!-- Response Data for Mobile and Desktop -->
<div class="font-mono text-gray-400 overflow-auto md:col-span-1 py-2 border-b">
{{ invocation.response_data }}
</div>
<!-- Response Data -->
<div class="bg-gray-50 rounded-lg p-3 overflow-auto max-h-40">
<pre class="text-sm font-mono text-gray-600 whitespace-pre-wrap">{{ invocation.response_data }}</pre>
</div>
<!-- Logs for Mobile and Desktop -->
<div class="space-y-1 md:col-span-1 py-2 border-b">
{% for log in invocation.logs %}
<div class="font-mono text-gray-400">{{ log[0] }}</div>
<!-- Logs -->
<div class="bg-gray-50 rounded-lg p-3 overflow-auto max-h-40">
{% for log in invocation.logs %}
<div class="text-sm font-mono text-gray-600 py-0.5">{{ log[0] }}</div>
{% endfor %}
{% if not invocation.logs %}
<div class="text-sm text-gray-400 italic">No logs available</div>
{% endif %}
</div>
</div>
{% endfor %}
{% if not http_function_invocations %}
<div class="p-8 text-center">
<div class="text-gray-400">
<svg class="mx-auto h-12 w-12" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
<h3 class="mt-2 text-sm font-medium text-gray-900">No logs found</h3>
<p class="mt-1 text-sm text-gray-500">No function invocations have been recorded yet.</p>
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endblock %}