add multiselect bulk reindex
This commit is contained in:
parent
5b1cd24a23
commit
d8e35d2d52
|
|
@ -8,7 +8,7 @@ export const ReindexTypeEnum = {
|
||||||
playlist: 'playlist',
|
playlist: 'playlist',
|
||||||
};
|
};
|
||||||
|
|
||||||
const queueReindex = async (id: string, type: ReindexType, reindexVideos = false) => {
|
const queueReindex = async (id: string[], type: ReindexType, reindexVideos = false) => {
|
||||||
let params = '';
|
let params = '';
|
||||||
if (reindexVideos) {
|
if (reindexVideos) {
|
||||||
params = '?extract_videos=true';
|
params = '?extract_videos=true';
|
||||||
|
|
@ -16,7 +16,7 @@ const queueReindex = async (id: string, type: ReindexType, reindexVideos = false
|
||||||
|
|
||||||
return APIClient(`/api/refresh/${params}`, {
|
return APIClient(`/api/refresh/${params}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { [type]: [id] },
|
body: { [type]: id },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ import { useVideoSelectionStore } from '../stores/VideoSelectionStore';
|
||||||
import Button from './Button';
|
import Button from './Button';
|
||||||
import updateDownloadQueue from '../api/actions/updateDownloadQueue';
|
import updateDownloadQueue from '../api/actions/updateDownloadQueue';
|
||||||
import { HideWatchedType } from '../configuration/constants/HideWatched';
|
import { HideWatchedType } from '../configuration/constants/HideWatched';
|
||||||
|
import queueReindex from '../api/actions/queueReindex';
|
||||||
|
import { useOutletContext } from 'react-router-dom';
|
||||||
|
import { ChannelBaseOutletContextType } from '../pages/ChannelAbout';
|
||||||
|
|
||||||
type FilterbarProps = {
|
type FilterbarProps = {
|
||||||
viewStyle: ViewStyleNamesType;
|
viewStyle: ViewStyleNamesType;
|
||||||
|
|
@ -49,6 +52,7 @@ const Filterbar = ({
|
||||||
const [showHidden, setShowHidden] = useState(false);
|
const [showHidden, setShowHidden] = useState(false);
|
||||||
const { filterHeight, setFilterHeight, showFilterItems, setShowFilterItems } =
|
const { filterHeight, setFilterHeight, showFilterItems, setShowFilterItems } =
|
||||||
useFilterBarTempConf();
|
useFilterBarTempConf();
|
||||||
|
const { setStartNotification } = useOutletContext() as ChannelBaseOutletContextType;
|
||||||
|
|
||||||
const currentViewStyle = userConfig[viewStyle];
|
const currentViewStyle = userConfig[viewStyle];
|
||||||
const currentHideWatched = userConfig[hideWatched];
|
const currentHideWatched = userConfig[hideWatched];
|
||||||
|
|
@ -84,11 +88,20 @@ const Filterbar = ({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const reindexSelected = async (ids: string[]) => {
|
||||||
|
queueReindex(ids, 'video');
|
||||||
|
if (setStartNotification !== undefined) setStartNotification(true);
|
||||||
|
};
|
||||||
|
|
||||||
const actionList = [
|
const actionList = [
|
||||||
{
|
{
|
||||||
label: 'Redownload',
|
label: 'Redownload',
|
||||||
handler: redownloadSelected,
|
handler: redownloadSelected,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Reindex',
|
||||||
|
handler: reindexSelected,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleActionSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleActionSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ const ChannelAbout = () => {
|
||||||
label="Reindex"
|
label="Reindex"
|
||||||
title={`Reindex Channel ${channel.channel_name}`}
|
title={`Reindex Channel ${channel.channel_name}`}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await queueReindex(channelId, ReindexTypeEnum.channel as ReindexType);
|
await queueReindex([channelId], ReindexTypeEnum.channel as ReindexType);
|
||||||
|
|
||||||
setReindex(true);
|
setReindex(true);
|
||||||
setStartNotification(true);
|
setStartNotification(true);
|
||||||
|
|
@ -194,7 +194,7 @@ const ChannelAbout = () => {
|
||||||
title={`Reindex Videos of ${channel.channel_name}`}
|
title={`Reindex Videos of ${channel.channel_name}`}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await queueReindex(
|
await queueReindex(
|
||||||
channelId,
|
[channelId],
|
||||||
ReindexTypeEnum.channel as ReindexType,
|
ReindexTypeEnum.channel as ReindexType,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ const Playlist = () => {
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setReindex(true);
|
setReindex(true);
|
||||||
|
|
||||||
await queueReindex(playlist.playlist_id, 'playlist');
|
await queueReindex([playlist.playlist_id], 'playlist');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
|
|
@ -294,7 +294,7 @@ const Playlist = () => {
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setReindex(true);
|
setReindex(true);
|
||||||
|
|
||||||
await queueReindex(playlist.playlist_id, 'playlist', true);
|
await queueReindex([playlist.playlist_id], 'playlist', true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ const Video = () => {
|
||||||
label="Reindex"
|
label="Reindex"
|
||||||
title={`Reindex ${video.title}`}
|
title={`Reindex ${video.title}`}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await queueReindex(video.youtube_id, 'video');
|
await queueReindex([video.youtube_id], 'video');
|
||||||
setReindex(true);
|
setReindex(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue