mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 21:39:49 +00:00
add delete and ignore, #891
This commit is contained in:
@@ -56,7 +56,7 @@ class AddDownloadItemSerializer(serializers.Serializer):
|
|||||||
"""serialize single item to add"""
|
"""serialize single item to add"""
|
||||||
|
|
||||||
youtube_id = serializers.CharField()
|
youtube_id = serializers.CharField()
|
||||||
status = serializers.ChoiceField(choices=["pending"])
|
status = serializers.ChoiceField(choices=["pending", "ignore-force"])
|
||||||
|
|
||||||
|
|
||||||
class AddToDownloadListSerializer(serializers.Serializer):
|
class AddToDownloadListSerializer(serializers.Serializer):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import APIClient from '../../functions/APIClient';
|
import APIClient from '../../functions/APIClient';
|
||||||
|
|
||||||
export type DownloadQueueStatus = 'ignore' | 'pending' | 'priority';
|
export type DownloadQueueStatus = 'ignore' | 'ignore-force' | 'pending' | 'priority';
|
||||||
|
|
||||||
const updateDownloadQueueStatusById = async (youtubeId: string, status: DownloadQueueStatus) => {
|
const updateDownloadQueueStatusById = async (youtubeId: string, status: DownloadQueueStatus) => {
|
||||||
return APIClient(`/api/download/${youtubeId}/`, {
|
return APIClient(`/api/download/${youtubeId}/`, {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import useIsAdmin from '../functions/useIsAdmin';
|
|||||||
import ToggleConfig from '../components/ToggleConfig';
|
import ToggleConfig from '../components/ToggleConfig';
|
||||||
import { PlaylistType } from '../api/loader/loadPlaylistById';
|
import { PlaylistType } from '../api/loader/loadPlaylistById';
|
||||||
import { useAppSettingsStore } from '../stores/AppSettingsStore';
|
import { useAppSettingsStore } from '../stores/AppSettingsStore';
|
||||||
|
import updateDownloadQueueStatusById from '../api/actions/updateDownloadQueueStatusById';
|
||||||
|
|
||||||
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
||||||
return playlist.playlist_entries.some(entry => {
|
return playlist.playlist_entries.some(entry => {
|
||||||
@@ -358,7 +359,15 @@ const Video = () => {
|
|||||||
navigate(Routes.Channel(video.channel.channel_id));
|
navigate(Routes.Channel(video.channel.channel_id));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
label="Delete and Ignore"
|
||||||
|
className="danger-button"
|
||||||
|
onClick={async () => {
|
||||||
|
await deleteVideo(videoId);
|
||||||
|
await updateDownloadQueueStatusById(videoId, 'ignore-force');
|
||||||
|
navigate(Routes.Channel(video.channel.channel_id));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
label="Cancel"
|
label="Cancel"
|
||||||
onClick={() => setShowDeleteConfirm(!showDeleteConfirm)}
|
onClick={() => setShowDeleteConfirm(!showDeleteConfirm)}
|
||||||
|
|||||||
Reference in New Issue
Block a user