- Add new Mithril components for editor (editor.js), response view (responseView.js), and alerts (alert.js) - Create new API endpoints for creating, updating, and deleting HTTP functions - Update templates to use new Mithril editor component - Improve header navigation with more consistent styling and active state indicators - Remove old edit form route and template - Add new dedicated editor route and template cursor.ai
108 lines
6.7 KiB
HTML
108 lines
6.7 KiB
HTML
<div class="bg-white dark:bg-gray-800 border-b">
|
|
|
|
<!-- Action Buttons Row -->
|
|
<div class="flex items-center justify-between pb-2">
|
|
<!-- Action Buttons (left side) -->
|
|
<div class="flex items-center space-x-4">
|
|
<h1 class="font-semibold text-lg md:text-2xl" data-id="52">
|
|
{{ title }}
|
|
</h1>
|
|
{% if show_edit_form|default(false, true) %}
|
|
<button
|
|
class="group flex flex-col items-center {% if active_tab == 'edit' %}text-blue-600{% else %}text-gray-500 hover:text-blue-600{% endif %}"
|
|
hx-get="{{ edit_url }}" hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
|
|
<div
|
|
class="p-2 rounded-lg {% if active_tab == 'edit' %}bg-blue-50{% else %}group-hover:bg-blue-50{% endif %}">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
|
|
stroke="currentColor" data-slot="icon" class="w-6 h-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">Edit</span>
|
|
</button>
|
|
{% endif %}
|
|
|
|
{% 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">
|
|
<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"
|
|
stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">Logs</span>
|
|
</button>
|
|
{% endif %}
|
|
|
|
{% 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">
|
|
<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"
|
|
stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z" />
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">Client</span>
|
|
</button>
|
|
{% endif %}
|
|
|
|
{% if show_history|default(false, true) %}
|
|
<button
|
|
class="group flex flex-col items-center {% if active_tab == 'history' %}text-blue-600{% else %}text-gray-500 hover:text-blue-600{% endif %}"
|
|
hx-get="{{ url_for('get_http_function_history', function_id=function_id) }}" hx-target="#container"
|
|
hx-swap="innerHTML" hx-push-url="true">
|
|
<div
|
|
class="p-2 rounded-lg {% if active_tab == 'history' %}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 512 512"
|
|
stroke-width="25" stroke="currentColor">
|
|
<path
|
|
d="M416,160a64,64,0,1,0-96.27,55.24c-2.29,29.08-20.08,37-75,48.42-17.76,3.68-35.93,7.45-52.71,13.93V151.39a64,64,0,1,0-64,0V360.61a64,64,0,1,0,64.42.24c2.39-18,16-24.33,65.26-34.52,27.43-5.67,55.78-11.54,79.78-26.95,29-18.58,44.53-46.78,46.36-83.89A64,64,0,0,0,416,160ZM160,64a32,32,0,1,1-32,32A32,32,0,0,1,160,64Zm0,384a32,32,0,1,1,32-32A32,32,0,0,1,160,448ZM352,192a32,32,0,1,1,32-32A32,32,0,0,1,352,192Z">
|
|
</path>
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">History</span>
|
|
</button>
|
|
{% endif %}
|
|
|
|
{% if show_new|default(false, true) %}
|
|
<button
|
|
class="group flex flex-col items-center {% if active_tab == 'new' %}text-blue-600{% else %}text-gray-500 hover:text-blue-600{% endif %}"
|
|
hx-get="{{ new_url }}" hx-target="#container" hx-swap="innerHTML" hx-push-url="true">
|
|
<div
|
|
class="p-2 rounded-lg {% if active_tab == 'new' %}bg-blue-50{% else %}group-hover:bg-blue-50{% endif %}">
|
|
<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">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">New</span>
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Cancel Button (right side) -->
|
|
<button class="group flex flex-col items-center text-gray-500 hover:text-blue-600"
|
|
hx-get="{{ cancel_url|default(url_for('dashboard_http_functions')) }}" hx-target="#container"
|
|
hx-swap="innerHTML" hx-push-url="true">
|
|
<div class="p-2 rounded-lg group-hover:bg-blue-50">
|
|
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path>
|
|
</svg>
|
|
</div>
|
|
<span class="text-xs font-medium">Cancel</span>
|
|
</button>
|
|
</div>
|
|
|
|
</div> |