From 23c74d8447a45d1eead81e4c3e7e6f0d1a92bc7f Mon Sep 17 00:00:00 2001 From: arabcoders Date: Tue, 3 Jun 2025 18:32:13 +0300 Subject: [PATCH] improve task page information display. --- ui/components/TaskForm.vue | 34 +++++++++++++++++++++++++--------- ui/pages/tasks.vue | 18 ++++++++++++++---- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ui/components/TaskForm.vue b/ui/components/TaskForm.vue index a6d1e183..7f93eac1 100644 --- a/ui/components/TaskForm.vue +++ b/ui/components/TaskForm.vue @@ -111,8 +111,9 @@ Select the preset to use for this URL. If the - -f, --format argument is present in the command line options, the preset and all - it's options will be ignored. + -f, --format + argument is present in the command line options, the preset and all + it's options will be ignored. @@ -152,8 +153,8 @@ - Paths are relative to global download path, defaults to preset download path if set otherwise, - fallback root path if not set. + Current download folder: {{ get_download_folder() }}. All folders are + sub-folders of {{ config.app.download_path }}. @@ -170,11 +171,7 @@ - Use this output template if non are given with URL. if not set, it will defaults to - {{ config.app.output_template }}. - For more information visit this url. - + Current output format: {{ get_output_template() }}. @@ -405,4 +402,23 @@ const hasFormatInConfig = computed(() => { const filter_presets = (flag = true) => config.presets.filter(item => item.default === flag) +const get_download_folder = () => { + if (form.preset && !hasFormatInConfig.value) { + const preset = config.presets.find(p => p.name === form.preset) + if (preset && preset.folder) { + return preset.folder.replace(config.app.download_path, '') + } + } + return '/' +} + +const get_output_template = () => { + if (form.preset && !hasFormatInConfig.value) { + const preset = config.presets.find(p => p.name === form.preset) + if (preset && preset.template) { + return preset.template + } + } + return config.app.output_template || '%(title)s.%(ext)s' +} diff --git a/ui/pages/tasks.vue b/ui/pages/tasks.vue index 1d3171b5..849f3c0f 100644 --- a/ui/pages/tasks.vue +++ b/ui/pages/tasks.vue @@ -101,8 +101,9 @@ div.is-centered { @@ -134,6 +135,7 @@ const toggleForm = ref(false) const isLoading = ref(false) const initialLoad = ref(true) const addInProgress = ref(false) +const runNowInProgress = ref(false) watch(() => config.app.basic_mode, async () => { if (!config.app.basic_mode) { @@ -217,7 +219,7 @@ const updateTasks = async items => { } const deleteItem = async item => { - if (true !== box.confirm(`Are you sure you want to delete (${item.name})?`, true)) { + if (true !== box.confirm(`Delete '${item.name}' task?`, true)) { return } @@ -290,11 +292,13 @@ const tryParse = expression => { } } -const runNow = item => { +const runNow = async item => { if (true !== box.confirm(`Run '${item.name}' now? it will also run at the scheduled time.`)) { return } + runNowInProgress.value = true + let data = { url: item.url, preset: item.preset, @@ -313,6 +317,11 @@ const runNow = item => { } socket.emit('add_url', data) + + setTimeout(async () => { + await nextTick() + runNowInProgress.value = false + }, 500) } onUnmounted(() => socket.off('status', statusHandler)) @@ -350,4 +359,5 @@ const exportItem = async item => { return copyText(base64UrlEncode(JSON.stringify(data))); } +