diff --git a/airlock/templates/activity.html b/airlock/templates/activity.html index 4a1e5ff1..78a68c0d 100644 --- a/airlock/templates/activity.html +++ b/airlock/templates/activity.html @@ -1,81 +1,64 @@ {% load airlock %} {% load django_vite %} -{% load static %} - - -{% #card title="Recent activity" %} +{% #card title="Recent activity" class="mt-5" %} {% if activity %} -
-

Loading table data...

- - +

Loading table data...

+ {% #datatable class="hidden" paging per_page="25" column_filter searchable sortable %} + + + + + + + + + + {% for log in activity %} - - - - + + + + - - - {% for log in activity %} - - - - - - - {% endfor %} - - - - - -
+ {% endfor %} + + {% /datatable %} {% else %} {% #list_group %} {% list_group_empty title="No activity" description="There has been no recent activity on this workspace" %} @@ -83,6 +66,4 @@ {% endif %} {% /card %} -{% vite_asset "assets/src/scripts/components.js" app="job_server" %} - - +{% vite_asset "assets/src/datatable.js" %} diff --git a/airlock/templates/file_browser/file_content/csv.html b/airlock/templates/file_browser/file_content/csv.html index 0e9759dc..7ff96251 100644 --- a/airlock/templates/file_browser/file_content/csv.html +++ b/airlock/templates/file_browser/file_content/csv.html @@ -18,7 +18,7 @@
{% if use_datatables %} -

Loading table data...

+

Loading table data...

{% #datatable class="hidden" column_filter searchable sortable %} diff --git a/assets/src/datatable.js b/assets/src/datatable.js index f12e8343..3cb01f9b 100644 --- a/assets/src/datatable.js +++ b/assets/src/datatable.js @@ -35,6 +35,14 @@ datatableEls?.forEach((table) => { [&_tr]:border-t [&_tr]:border-slate-200 first:[&_tr]:border-t-0 [&_tr]:bg-white even:[&_tr]:bg-slate-50 `, top: "hidden", + bottom: "datatable-bottom flex flex-col items-center gap-1 py-3 px-4 border-t border-slate-200 w-full text-sm", + pagination: "datatable-pagination", + paginationList: "datatable-pagination-list flex flex-row gap-4 mx-auto", + paginationListItemLink: ` + font-semibold text-oxford-600 underline underline-offset-2 decoration-oxford-300 transition-colors duration-200 + hover:decoration-transparent hover:text-oxford + focus:decoration-transparent focus:text-oxford focus:bg-bn-sun-300 + `, }, paging, perPage, @@ -74,14 +82,14 @@ datatableEls?.forEach((table) => { tHead?.childNodes?.push(filterHeaders); return table; } - : false, + : (_data, table) => table, }); dataTable.on("datatable.init", () => { - const spinner = document.querySelector("#airlock-table .spinner"); + const spinner = document.querySelector("[data-datatable-spinner]"); spinner?.classList.toggle("hidden"); - const table = document.querySelector("#airlock-table [data-datatable]"); + const table = document.querySelector("[data-datatable]"); table?.classList.toggle("hidden"); }); });