Refactor confirmation messages for consistency across components
This commit is contained in:
parent
347f99adb6
commit
a8b318b40e
7 changed files with 30 additions and 11 deletions
18
ui/@types/item.d.ts
vendored
Normal file
18
ui/@types/item.d.ts
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
export type item_request = {
|
||||
/** URL of the item to download */
|
||||
url: string,
|
||||
/** Preset to use for the download */
|
||||
preset?: string,
|
||||
/** Where to save the downloaded item */
|
||||
folder?: string,
|
||||
/** Output template for the downloaded item */
|
||||
template?: string,
|
||||
/** Additional command line options for yt-dlp */
|
||||
cli?: string,
|
||||
/** Cookies file for the download */
|
||||
cookies?: string,
|
||||
/** Auto start the download */
|
||||
auto_start?: boolean,
|
||||
/** Extras data for the item */
|
||||
extras?: Record<string, any>,
|
||||
}
|
||||
|
|
@ -330,7 +330,7 @@ const importItem = async () => {
|
|||
return
|
||||
}
|
||||
|
||||
if ((form.filter || form.cli) && false === box.confirm('This will overwrite the current data. Are you sure?', true)) {
|
||||
if ((form.filter || form.cli) && false === box.confirm('Overwrite the current form fields?', true)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ const importItem = async () => {
|
|||
}
|
||||
|
||||
if (form.target) {
|
||||
if (false === box.confirm('This will overwrite the current form fields. Are you sure?', true)) {
|
||||
if (false === box.confirm('Overwrite the current form fields?', true)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ const updateProgress = (item) => {
|
|||
}
|
||||
|
||||
const confirmCancel = item => {
|
||||
if (true !== box.confirm(`Are you sure you want to cancel (${item.title})?`)) {
|
||||
if (true !== box.confirm(`Cancel '${item.title}'?`)) {
|
||||
return false
|
||||
}
|
||||
cancelItems(item._id)
|
||||
|
|
@ -531,7 +531,7 @@ const confirmCancel = item => {
|
|||
}
|
||||
|
||||
const cancelSelected = () => {
|
||||
if (true !== box.confirm('Are you sure you want to cancel selected items?')) {
|
||||
if (true !== box.confirm(`Cancel '${selectedElms.value.length}' selected items?`)) {
|
||||
return false;
|
||||
}
|
||||
cancelItems(selectedElms.value)
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ const importItem = async () => {
|
|||
}
|
||||
|
||||
if (form.url || form.timer) {
|
||||
if (false === box.confirm('This will overwrite the current form fields. Are you sure?', true)) {
|
||||
if (false === box.confirm('Overwrite the current form fields?', true)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<Queue @getInfo="(url: string, preset: string = '') => view_info(url, false, preset)" :thumbnails="show_thumbnail"
|
||||
:query="query" @getItemInfo="(id: string) => view_info(`/api/history/${id}`, true)" @clear_search="query = ''" />
|
||||
<History @getInfo="(url: string, preset: string = '') => view_info(url, false, preset)"
|
||||
@add_new="item => toNewDownload(item)" :query="query" :thumbnails="show_thumbnail"
|
||||
@add_new="(item: item_request) => toNewDownload(item)" :query="query" :thumbnails="show_thumbnail"
|
||||
@getItemInfo="(id: string) => view_info(`/api/history/${id}`, true)" @clear_search="query = ''" />
|
||||
<GetInfo v-if="info_view.url" :link="info_view.url" :preset="info_view.preset" :useUrl="info_view.useUrl"
|
||||
@closeModel="close_info()" />
|
||||
|
|
@ -75,6 +75,7 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import type { item_request } from '~/@types/item'
|
||||
|
||||
const config = useConfigStore()
|
||||
const stateStore = useStateStore()
|
||||
|
|
@ -90,7 +91,7 @@ const info_view = ref({
|
|||
preset: '',
|
||||
useUrl: false,
|
||||
}) as Ref<{ url: string, preset: string, useUrl: boolean }>
|
||||
const item_form = ref({})
|
||||
const item_form = ref<item_request|object>({})
|
||||
const query = ref()
|
||||
const toggleFilter = ref(false)
|
||||
|
||||
|
|
@ -123,7 +124,7 @@ watch(() => stateStore.queue, () => {
|
|||
}, { deep: true })
|
||||
|
||||
const pauseDownload = () => {
|
||||
if (false === box.confirm('Are you sure you want to pause all non-active downloads?')) {
|
||||
if (false === box.confirm('Pause all non-active downloads?')) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +153,7 @@ watch(() => info_view.value.url, v => {
|
|||
|
||||
const changeDisplay = () => display_style.value = display_style.value === 'cards' ? 'list' : 'cards'
|
||||
|
||||
const toNewDownload = async (item: any) => {
|
||||
const toNewDownload = async (item: item_request) => {
|
||||
if (!item) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ const updateData = async notifications => {
|
|||
}
|
||||
|
||||
const deleteItem = async item => {
|
||||
if (true !== box.confirm(`Are you sure you want to delete notification target (${item.name})?`)) {
|
||||
if (true !== box.confirm(`Delete '${item.name}'?`)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ const editItem = item => {
|
|||
const join_events = events => (!events || events.length < 1) ? 'ALL' : events.map(e => ucFirst(e)).join(', ')
|
||||
|
||||
const sendTest = async () => {
|
||||
if (true !== box.confirm('Are you sure you want to send a test notification?')) {
|
||||
if (true !== box.confirm('Send test notification?')) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue