Update function history view
This commit is contained in:
88
templates/dashboard/timer_functions/header.html
Normal file
88
templates/dashboard/timer_functions/header.html
Normal file
@@ -0,0 +1,88 @@
|
||||
<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="{{ 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"
|
||||
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_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="{{ history_url }}" 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 }}"
|
||||
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>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{% block page %}
|
||||
|
||||
{{ render_partial('dashboard/http_functions/header.html',
|
||||
{{ render_partial('dashboard/timer_functions/header.html',
|
||||
user_id=user_id,
|
||||
function_id=function_id,
|
||||
active_tab='history',
|
||||
@@ -15,12 +15,12 @@ logs_url=url_for('timer.logs', function_id=function_id),
|
||||
history_url=url_for('timer.history', function_id=function_id))
|
||||
}}
|
||||
|
||||
<div id="version-diff"></div>
|
||||
<div id="history-view"></div>
|
||||
|
||||
<script>
|
||||
// Mount the Mithril component with versions as an attribute
|
||||
m.mount(document.getElementById("version-diff"), {
|
||||
view: () => m(DiffView, { versions: {{ versions| tojson }} })
|
||||
m.mount(document.getElementById("history-view"), {
|
||||
view: () => m(FunctionHistory, { versions: {{ versions| tojson | safe }} })
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user