Move http endpoints into seperate route

This commit is contained in:
Peter Stockings
2025-07-21 22:05:58 +10:00
parent 917189b3d9
commit 2ec44252bb
12 changed files with 552 additions and 304 deletions

View File

@@ -270,7 +270,7 @@
class="inline-flex items-center justify-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors duration-200">
View Timer Functions
</a>
<a href="{{ url_for('dashboard_http_functions') }}"
<a href="{{ url_for('http.dashboard_http_functions') }}"
class="inline-flex items-center justify-center px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-lg transition-colors duration-200">
View HTTP Functions
</a>

View File

@@ -8,10 +8,10 @@ show_edit_form=True,
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'),
logs_url=url_for('get_http_function_logs', function_id=function_id),
history_url=url_for('get_http_function_history', function_id=function_id)) }}
edit_url=url_for('http.http_function_editor', function_id=function_id),
cancel_url=url_for('http.dashboard_http_functions'),
logs_url=url_for('http.get_http_function_logs', function_id=function_id),
history_url=url_for('http.get_http_function_history', function_id=function_id)) }}
<div class="mx-auto w-full pt-4" id="client-u{{ user_id }}-f{{ function_id }}">
</div>

View File

@@ -10,8 +10,8 @@ show_client=True,
show_history=True,
edit_url=edit_url,
cancel_url=cancel_url,
logs_url=url_for('get_http_function_logs', function_id=function_id),
history_url=url_for('get_http_function_history', function_id=function_id)) }}
logs_url=url_for('http.get_http_function_logs', function_id=function_id),
history_url=url_for('http.get_http_function_history', function_id=function_id)) }}
<div id="app" class="p-1">
@@ -33,8 +33,8 @@ history_url=url_for('get_http_function_history', function_id=function_id)) }}
logResponse: {{ log_response | tojson }},
versionNumber: {{ version_number }},
executeUrl: "{{ url_for('execute_code', playground='true') }}",
saveUrl: "{{ url_for('api_update_http_function', function_id=id) if id else url_for('api_create_http_function') }}",
deleteUrl: "{{ url_for('api_delete_http_function', function_id=id) if id else '' }}",
saveUrl: "{{ url_for('http.api_update_http_function', function_id=id) if id else url_for('http.api_create_http_function') }}",
deleteUrl: "{{ url_for('http.api_delete_http_function', function_id=id) if id else '' }}",
showDeleteButton: true
})
})

View File

@@ -42,8 +42,8 @@
{% if show_client|default(false, true) %}
<button
class="group flex flex-col items-center {% if active_tab == 'client' %}text-blue-600{% else %}text-gray-500 hover:text-blue-600{% endif %}"
hx-get="{{ url_for('client', function_id=function_id) }}" hx-target="#container" hx-swap="innerHTML"
hx-push-url="true">
hx-get="{{ url_for('http.client', function_id=function_id) }}" hx-target="#container"
hx-swap="innerHTML" hx-push-url="true">
<div
class="p-2 rounded-lg {% if active_tab == 'client' %}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

@@ -8,10 +8,10 @@ show_edit_form=True,
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'),
logs_url=url_for('get_http_function_logs', function_id=function_id),
history_url=url_for('get_http_function_history', function_id=function_id)) }}
edit_url=url_for('http.http_function_editor', function_id=function_id),
cancel_url=url_for('http.dashboard_http_functions'),
logs_url=url_for('http.get_http_function_logs', function_id=function_id),
history_url=url_for('http.get_http_function_history', function_id=function_id)) }}
<!-- Timeline -->
<div>

View File

@@ -8,10 +8,10 @@ show_edit_form=True,
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'),
logs_url=url_for('get_http_function_logs', function_id=function_id),
history_url=url_for('get_http_function_history', function_id=function_id)) }}
edit_url=url_for('http.http_function_editor', function_id=function_id),
cancel_url=url_for('http.dashboard_http_functions'),
logs_url=url_for('http.get_http_function_logs', function_id=function_id),
history_url=url_for('http.get_http_function_history', 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">

View File

@@ -9,8 +9,8 @@ show_refresh=False,
show_logs=False,
show_client=False,
show_link=False,
dashboardUrl=url_for('dashboard_http_functions'),
cancel_url=url_for('dashboard_http_functions'),
dashboardUrl=url_for('http.dashboard_http_functions'),
cancel_url=url_for('http.dashboard_http_functions'),
title='New HTTP Function')
}}
@@ -32,9 +32,9 @@ title='New HTTP Function')
logRequest: {{ log_request | tojson }},
logResponse: {{ log_response | tojson }},
executeUrl: "{{ url_for('execute_code', playground='true') }}",
saveUrl: "{{ url_for('api_create_http_function') }}",
saveUrl: "{{ url_for('http.api_create_http_function') }}",
showDeleteButton: false,
dashboardUrl: "{{ url_for('dashboard_http_functions') }}"
dashboardUrl: "{{ url_for('http.dashboard_http_functions') }}"
})
})
</script>

View File

@@ -7,7 +7,7 @@
<h1 class="text-2xl font-bold text-gray-900">HTTP Functions</h1>
<button
class="inline-flex items-center px-4 py-2 ml-auto bg-green-600 hover:bg-green-700 text-white font-medium rounded-lg transition-colors duration-200"
hx-get="{{ url_for('get_http_function_add_form') }}" hx-target="#container" hx-swap="innerHTML"
hx-get="{{ url_for('http.get_http_function_add_form') }}" hx-target="#container" hx-swap="innerHTML"
hx-push-url="true">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5 mr-2">
@@ -34,7 +34,7 @@
<tr class="hover:bg-gray-50">
<td class="px-6 py-4">
<div class="flex items-center gap-2 cursor-pointer"
hx-get="{{ url_for('http_function_editor', function_id=function.id) }}"
hx-get="{{ url_for('http.http_function_editor', function_id=function.id) }}"
hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
<span class="font-medium text-gray-900">{{ function.name }}</span>
<span
@@ -76,7 +76,7 @@
<div class="flex gap-3">
<button
class="inline-flex items-center px-3 py-1.5 text-sm font-medium text-indigo-700 bg-indigo-50 rounded-md hover:bg-indigo-100 transition-colors duration-200"
hx-get="{{ url_for('get_http_function_logs', function_id=function.id) }}"
hx-get="{{ url_for('http.get_http_function_logs', function_id=function.id) }}"
hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-1.5" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
@@ -87,8 +87,8 @@
</button>
<button
class="inline-flex items-center px-3 py-1.5 text-sm font-medium text-indigo-700 bg-indigo-50 rounded-md hover:bg-indigo-100 transition-colors duration-200"
hx-get="{{ url_for('client', function_id=function.id) }}" hx-target="#container"
hx-swap="innerHTML" hx-push-url="true">
hx-get="{{ url_for('http.client', function_id=function.id) }}"
hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-1.5" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"