Split search actions and improve download options
This commit is contained in:
@@ -484,7 +484,8 @@ export default function RequestTimelinePage({ params }: { params: { id: string }
|
||||
}
|
||||
const baseUrl = getApiBase()
|
||||
const actionMap: Record<string, string> = {
|
||||
search: 'actions/search',
|
||||
search_releases: 'actions/search',
|
||||
search_auto: 'actions/search_auto',
|
||||
resume_torrent: 'actions/qbit/resume',
|
||||
readd_to_arr: 'actions/readd',
|
||||
}
|
||||
@@ -493,7 +494,7 @@ export default function RequestTimelinePage({ params }: { params: { id: string }
|
||||
setActionMessage('This action is not wired yet.')
|
||||
return
|
||||
}
|
||||
if (action.id === 'search') {
|
||||
if (action.id === 'search_releases') {
|
||||
setActionMessage(null)
|
||||
setReleaseOptions([])
|
||||
setSearchRan(false)
|
||||
@@ -513,7 +514,7 @@ export default function RequestTimelinePage({ params }: { params: { id: string }
|
||||
throw new Error(text || `Request failed: ${response.status}`)
|
||||
}
|
||||
const data = await response.json()
|
||||
if (action.id === 'search') {
|
||||
if (action.id === 'search_releases') {
|
||||
if (Array.isArray(data.releases)) {
|
||||
setReleaseOptions(data.releases)
|
||||
}
|
||||
@@ -526,6 +527,10 @@ export default function RequestTimelinePage({ params }: { params: { id: string }
|
||||
setModalMessage('Search complete. Pick an option below if you want to download.')
|
||||
}
|
||||
setActionMessage(`${action.label} started.`)
|
||||
} else if (action.id === 'search_auto') {
|
||||
const message = data?.message ?? 'Search sent to Sonarr/Radarr.'
|
||||
setActionMessage(message)
|
||||
setModalMessage(message)
|
||||
} else {
|
||||
const message = data?.message ?? `${action.label} started.`
|
||||
setActionMessage(message)
|
||||
@@ -565,6 +570,7 @@ export default function RequestTimelinePage({ params }: { params: { id: string }
|
||||
<span>{release.seeders ?? 0} seeders · {formatBytes(release.size)}</span>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!release.guid || !release.indexerId}
|
||||
onClick={async () => {
|
||||
if (!snapshot || !release.guid || !release.indexerId) {
|
||||
setActionMessage('Missing details to start the download.')
|
||||
|
||||
Reference in New Issue
Block a user