From 746b49021608649644e822bb6a7fb05f94fe2b9b Mon Sep 17 00:00:00 2001 From: arabcoders Date: Thu, 19 Jun 2025 12:31:19 +0300 Subject: [PATCH] Added filter displayed items in tasks page. --- README.md | 2 +- ui/pages/tasks.vue | 44 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 11670832..f43e96aa 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,6 @@ Certain configuration values can be set via environment variables, using the `-e | YTP_YTDLP_AUTO_UPDATE | Whether to enable the auto update for yt-dlp | `true` | | YTP_BASE_PATH | Set this if you are serving YTPTube from sub-folder | `/` | | YTP_PREVENT_LIVE_PREMIERE | Prevents the initial youtube premiere stream from being downloaded | `false` | -| YTP_TASKS_HANDLER_TIMER | The cron expression for the tasks handler timer. | `*15 */1 * * *` | +| YTP_TASKS_HANDLER_TIMER | The cron expression for the tasks handler timer. | `15 */1 * * *` | | YTP_PLAYLIST_ITEMS_CONCURRENCY | The number of playlist items be to processed at same time. | `1` | diff --git a/ui/pages/tasks.vue b/ui/pages/tasks.vue index 77e317d2..bc5d7785 100644 --- a/ui/pages/tasks.vue +++ b/ui/pages/tasks.vue @@ -20,6 +20,19 @@ div.is-centered {
+

+ + +

+ +

+ +

+

-
+
-
+
+ +

No results found for the query: {{ query }}.

+

Please try a different search term.

+
@@ -241,6 +259,15 @@ const initialLoad = ref(true) const addInProgress = ref(false) const display_style = useStorage("tasks_display_style", "cards") const remove_keys = ['in_progress'] +const query = ref() +const toggleFilter = ref(false) + +watch(toggleFilter, () => { + if (!toggleFilter.value) { + query.value = '' + } +}); + watch(() => config.app.basic_mode, async () => { if (!config.app.basic_mode) { @@ -257,6 +284,15 @@ watch(() => socket.isConnected, async () => { } }) +const filteredTasks = computed(() => { + const q = query.value?.toLowerCase(); + if (!q) return tasks.value; + + return tasks.value.filter( + task => Object.values(task).some(value => typeof value === 'string' && value.toLowerCase().includes(q)) + ); +}); + const reloadContent = async (fromMounted: boolean = false) => { try { isLoading.value = true