Files
function/templates/dashboard/http_functions/logs.html

82 lines
4.6 KiB
HTML

<div>
<div class="flex items-center pb-1" data-id="51">
<div class="flex items-center">
<h1 class="font-semibold text-lg md:text-2xl" data-id="52">Logs: <span class="font-mono">{{ name }}</span>
</h1>
<div class="ml-2 cursor-pointer text-gray-500" hx-get="{{ url_for('get_http_function_logs', name=name) }}"
hx-target="#container" hx-swap="innerHTML">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6" data-darkreader-inline-stroke=""
style="--darkreader-inline-stroke: currentColor;">
<path stroke-linecap="round" stroke-linejoin="round"
d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99">
</path>
</svg>
</div>
</div>
<button
class="inline-flex items-center justify-center text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-9 rounded-md px-3 ml-auto"
hx-get="{{ url_for('dashboard_http_functions') }}" hx-target="#container" hx-swap="innerHTML">
Cancel
</button>
</div>
<div class="flex">
<a class="text-gray-300" href="{{ url_for('execute_http_function', function=name) }}">{{
url_for('execute_http_function', function=name) }}</a>
<button
class="inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground px-2 text-gray-600 dark:text-gray-400"
data-id="24"><span class="sr-only" data-id="25">Add Link</span><svg xmlns="http://www.w3.org/2000/svg"
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" class="w-4 h-4" data-id="26"
data-darkreader-inline-stroke="" style="--darkreader-inline-stroke: currentColor;">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71">
</path>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71">
</path>
</svg>
</button>
</div>
</div>
<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>
<!-- 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>
</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>
<!-- 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>
<!-- 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>
{% endfor %}
</div>
{% endfor %}
</div>