mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 20:19:30 +00:00
handle error state bulk update, add bulk clear error
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
import APIClient from '../../functions/APIClient';
|
||||
|
||||
type FilterType = 'ignore' | 'pending';
|
||||
export type DownloadQueueStatus = 'ignore' | 'pending' | 'priority';
|
||||
export type DownloadQueueStatus = 'ignore' | 'pending' | 'priority' | 'clear_error';
|
||||
|
||||
const updateDownloadQueueByFilter = async (
|
||||
filter: FilterType,
|
||||
channel: string | null,
|
||||
vid_type: string | null,
|
||||
error: string | null,
|
||||
status: DownloadQueueStatus,
|
||||
) => {
|
||||
const searchParams = new URLSearchParams();
|
||||
if (filter) searchParams.append('filter', filter);
|
||||
if (channel) searchParams.append('channel', channel);
|
||||
if (vid_type) searchParams.append('vid_type', vid_type);
|
||||
if (error) searchParams.append('error', error);
|
||||
|
||||
return APIClient(`/api/download/?${searchParams.toString()}`, {
|
||||
method: 'PATCH',
|
||||
|
||||
@@ -162,6 +162,7 @@ const Download = () => {
|
||||
showIgnoredFilter,
|
||||
channelFilterFromUrl,
|
||||
vidTypeFilterFromUrl,
|
||||
errorFilterFromUrl,
|
||||
status,
|
||||
);
|
||||
setRefresh(true);
|
||||
@@ -467,16 +468,22 @@ const Download = () => {
|
||||
<h3>Bulk actions</h3>
|
||||
<p>
|
||||
Applied filtered by status <i>'{showIgnoredFilter}'</i>
|
||||
{vidTypeFilterFromUrl && (
|
||||
<span>
|
||||
{' '}
|
||||
and by type: <i>'{vidTypeFilterFromUrl}'</i>
|
||||
</span>
|
||||
)}
|
||||
{channelFilterFromUrl && (
|
||||
<span>
|
||||
{' '}
|
||||
and by channel: <i>'{channel_filter_name}'</i>
|
||||
</span>
|
||||
)}
|
||||
{vidTypeFilterFromUrl && (
|
||||
{errorFilterFromUrl && (
|
||||
<span>
|
||||
{' '}
|
||||
and by type: <i>'{vidTypeFilterFromUrl}'</i>
|
||||
and by error state: <i>'{errorFilterFromUrl}'</i>
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
@@ -489,6 +496,9 @@ const Download = () => {
|
||||
<div className="button-box">
|
||||
<Button onClick={() => handleBulkStatusUpdate('ignore')}>Ignore</Button>
|
||||
<Button onClick={() => handleBulkStatusUpdate('priority')}>Download Now</Button>
|
||||
<Button onClick={() => handleBulkStatusUpdate('clear_error')}>
|
||||
Clear Errors
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user