Add logs view for timer functions

- Create new database table `timer_function_invocations` to track function executions
- Implement `/logs/<function_id>` route in timer routes to fetch and display invocation logs
- Add new logs template for timer functions with detailed invocation information
- Update header templates to include logs URL for timer functions
This commit is contained in:
Peter Stockings
2025-02-17 00:24:49 +11:00
parent 29da93a9f8
commit 77957a61a3
8 changed files with 132 additions and 7 deletions

View File

@@ -9,7 +9,8 @@ show_logs=True,
show_client=True,
show_history=True,
edit_url=url_for('http_function_editor', function_id=function_id),
cancel_url=url_for('dashboard_http_functions')) }}
cancel_url=url_for('dashboard_http_functions',
logs_url=url_for('get_http_function_logs', function_id=function_id))) }}
<div class="mx-auto w-full pt-4" id="client-u{{ user_id }}-f{{ function_id }}">
</div>

View File

@@ -9,7 +9,8 @@ show_logs=True,
show_client=True,
show_history=True,
edit_url=edit_url,
cancel_url=cancel_url) }}
cancel_url=cancel_url,
logs_url=url_for('get_http_function_logs', function_id=function_id)) }}
<div id="app" class="p-1">

View File

@@ -26,8 +26,7 @@
{% if show_logs|default(false, true) %}
<button
class="group flex flex-col items-center {% if active_tab == 'logs' %}text-blue-600{% else %}text-gray-500 hover:text-blue-600{% endif %}"
hx-get="{{ url_for('get_http_function_logs', function_id=function_id) }}" hx-target="#container"
hx-swap="innerHTML" hx-push-url="true">
hx-get="{{ logs_url }}" hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
<div
class="p-2 rounded-lg {% if active_tab == 'logs' %}bg-blue-50{% else %}group-hover:bg-blue-50{% endif %}">
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"

View File

@@ -9,7 +9,8 @@ show_logs=True,
show_client=True,
show_history=True,
edit_url=url_for('http_function_editor', function_id=function_id),
cancel_url=url_for('dashboard_http_functions')) }}
cancel_url=url_for('dashboard_http_functions'),
logs_url=url_for('get_http_function_logs', function_id=function_id)) }}
<!-- Timeline -->
<div>

View File

@@ -9,7 +9,8 @@ show_logs=True,
show_client=True,
show_history=True,
edit_url=url_for('http_function_editor', function_id=function_id),
cancel_url=url_for('dashboard_http_functions')) }}
cancel_url=url_for('dashboard_http_functions',
logs_url=url_for('get_http_function_logs', function_id=function_id))) }}
<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">