diff --git a/apps/home/static/home/js/index.js b/apps/home/static/home/js/index.js index 748f61e..923c2b3 100644 --- a/apps/home/static/home/js/index.js +++ b/apps/home/static/home/js/index.js @@ -4,6 +4,7 @@ $(document).ready(async function() { // await initContentTable(); initSubscriptionsModule(); + initFiltersModule(); initContentModule(); initMessageStylesModule(); diff --git a/apps/home/static/home/js/tabs/filters.js b/apps/home/static/home/js/tabs/filters.js index e69de29..6bbd76d 100644 --- a/apps/home/static/home/js/tabs/filters.js +++ b/apps/home/static/home/js/tabs/filters.js @@ -0,0 +1,52 @@ +const filterTableId = "#filterTable"; + + +// region Init Module + +function initFiltersModule() { + initializeDataTable( + filterTableId, + [ + { + title: "Name", + data: "name" + }, + { + title: "Match", + data: "match" + }, + { + title: "Algorithm", + data: "matching_algorithm" + }, + { + title: "Case Insensitive", + data: "is_insensitive" + }, + { + title: "Type", + data: "is_whitelist" + } + ] + ) +} + + +// region Load Data + +$(document).on("selectedServerChange", async function() { + await loadFilterData(); +}); + +$(filterTableId).on("doDataLoad", async function() { + await loadFilterData(); +}); + +async function loadFilterData() { + if (!selectedServer) { + return; + } + + setTableFilter(filterTableId, "server", selectedServer.id); + await loadTableData(filterTableId, "/api/filters/", "GET"); +} diff --git a/apps/home/templates/home/tabs/filters.html b/apps/home/templates/home/tabs/filters.html index 4e9ac6c..b8611f0 100644 --- a/apps/home/templates/home/tabs/filters.html +++ b/apps/home/templates/home/tabs/filters.html @@ -1 +1,80 @@ -filters \ No newline at end of file +