mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 12:56:24 -05:00
Models like Archive/Video/Doc can be deleted, even if they are tagged. User is shown a warning and must confirm deletion of tagged files.
This commit is contained in:
parent
513ae52a6e
commit
09a967535b
23 changed files with 689 additions and 109 deletions
|
|
@ -26,6 +26,7 @@ import {Button, darkTheme, Header, Icon, Loader, Segment, Tab} from "./Theme";
|
|||
import {VideoCard} from "./Videos";
|
||||
import {TagsSelector} from "../Tags";
|
||||
import {Comment, CommentGroup, Input, Label, Transition} from "semantic-ui-react";
|
||||
import {TaggedDeleteConfirmModal} from "./TaggedDeleteConfirmModal";
|
||||
|
||||
const MEDIA_PATH = '/media';
|
||||
|
||||
|
|
@ -171,6 +172,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
|
||||
const navigate = useNavigate();
|
||||
const videoRef = React.useRef();
|
||||
const [taggedFileGroups, setTaggedFileGroups] = useState(null);
|
||||
|
||||
useTitle(videoFile ? videoFile.title ? videoFile.title : videoFile.name : null);
|
||||
let video;
|
||||
|
|
@ -276,8 +278,12 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
return <PageContainer><Header as='h4'>Could not find video</Header></PageContainer>;
|
||||
}
|
||||
|
||||
const handleDeleteVideo = async (video_id) => {
|
||||
await deleteVideos([video_id])
|
||||
const handleDeleteVideo = async (video_id, force = false) => {
|
||||
const result = await deleteVideos([video_id], force);
|
||||
if (result && result.tagged) {
|
||||
setTaggedFileGroups(result.file_groups);
|
||||
return;
|
||||
}
|
||||
navigate(-1);
|
||||
}
|
||||
|
||||
|
|
@ -575,6 +581,15 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
|
||||
{prevNextVideosSegment}
|
||||
</Container>
|
||||
<TaggedDeleteConfirmModal
|
||||
open={taggedFileGroups !== null}
|
||||
taggedFileGroups={taggedFileGroups}
|
||||
onCancel={() => setTaggedFileGroups(null)}
|
||||
onConfirm={async () => {
|
||||
setTaggedFileGroups(null);
|
||||
await handleDeleteVideo(videoFile.id, true);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue