mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-20 07:54:19 +02:00
feature: delete files and torrents.
This commit is contained in:
12
web/src/lib/api/api.d.ts
vendored
12
web/src/lib/api/api.d.ts
vendored
@@ -1309,6 +1309,8 @@ export interface components {
|
||||
added: boolean;
|
||||
/** Vote Average */
|
||||
vote_average?: number | null;
|
||||
/** Id */
|
||||
id?: string | null;
|
||||
};
|
||||
/** Movie */
|
||||
Movie: {
|
||||
@@ -2645,7 +2647,10 @@ export interface operations {
|
||||
};
|
||||
delete_a_show_api_v1_tv_shows__show_id__delete: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
query?: {
|
||||
delete_files_on_disk?: boolean;
|
||||
delete_torrents?: boolean;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The ID of the show */
|
||||
@@ -3473,7 +3478,10 @@ export interface operations {
|
||||
};
|
||||
delete_a_movie_api_v1_movies__movie_id__delete: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
query?: {
|
||||
delete_files_on_disk?: boolean;
|
||||
delete_torrents?: boolean;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The ID of the movie */
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
let email = $state('');
|
||||
let password = $state('');
|
||||
let errorMessage = $state('');
|
||||
let successMessage = $state('');
|
||||
let isLoading = $state(false);
|
||||
|
||||
async function handleLogin(event: Event) {
|
||||
@@ -29,6 +30,7 @@
|
||||
|
||||
isLoading = true;
|
||||
errorMessage = '';
|
||||
successMessage = '';
|
||||
|
||||
const { error, response } = await client.POST('/api/v1/auth/cookie/login', {
|
||||
body: {
|
||||
@@ -45,8 +47,8 @@
|
||||
if (!error) {
|
||||
console.log('Login successful!');
|
||||
console.log('Received User Data: ', response);
|
||||
errorMessage = 'Login successful! Redirecting...';
|
||||
toast.success(errorMessage);
|
||||
successMessage = 'Login successful! Redirecting...';
|
||||
toast.success(successMessage);
|
||||
goto(resolve('/dashboard', {}));
|
||||
} else {
|
||||
toast.error('Login failed!');
|
||||
@@ -100,6 +102,13 @@
|
||||
</Alert.Root>
|
||||
{/if}
|
||||
|
||||
{#if successMessage}
|
||||
<Alert.Root variant="default">
|
||||
<Alert.Title>Success</Alert.Title>
|
||||
<Alert.Description>{successMessage}</Alert.Description>
|
||||
</Alert.Root>
|
||||
{/if}
|
||||
|
||||
{#if isLoading}
|
||||
<LoadingBar />
|
||||
{/if}
|
||||
|
||||
@@ -27,17 +27,17 @@
|
||||
let user: () => components['schemas']['UserRead'] = getContext('user');
|
||||
let deleteDialogOpen = $state(false);
|
||||
let deleteFilesOnDisk = $state(false);
|
||||
let deleteTorrents = $state(false);
|
||||
|
||||
async function delete_movie() {
|
||||
if (!movie.id) {
|
||||
toast.error('Movie ID is missing');
|
||||
return;
|
||||
}
|
||||
// TODO: Implement delete_files_on_disk parameter in backend API
|
||||
const { response } = await client.DELETE('/api/v1/movies/{movie_id}', {
|
||||
params: {
|
||||
path: { movie_id: movie.id }
|
||||
// query: { delete_files_on_disk: deleteFilesOnDisk } // Not yet implemented
|
||||
path: { movie_id: movie.id },
|
||||
query: { delete_files_on_disk: deleteFilesOnDisk, delete_torrents: deleteTorrents }
|
||||
}
|
||||
});
|
||||
if (!response.ok) {
|
||||
@@ -130,7 +130,9 @@
|
||||
</AlertDialog.Trigger>
|
||||
<AlertDialog.Content>
|
||||
<AlertDialog.Header>
|
||||
<AlertDialog.Title>Delete {getFullyQualifiedMediaName(movie)}?</AlertDialog.Title>
|
||||
<AlertDialog.Title
|
||||
>Delete - {getFullyQualifiedMediaName(movie)}?</AlertDialog.Title
|
||||
>
|
||||
<AlertDialog.Description>
|
||||
This action cannot be undone. This will permanently delete
|
||||
<strong>{getFullyQualifiedMediaName(movie)}</strong> from the database.
|
||||
@@ -142,7 +144,14 @@
|
||||
for="delete-files"
|
||||
class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Also delete files on disk (not yet implemented)
|
||||
Also delete files on disk
|
||||
</Label>
|
||||
<Checkbox bind:checked={deleteTorrents} id="delete-torrents" />
|
||||
<Label
|
||||
for="delete-torrents"
|
||||
class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Also delete torrents
|
||||
</Label>
|
||||
</div>
|
||||
<AlertDialog.Footer>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
let continuousDownloadEnabled = $state(show().continuous_download);
|
||||
let deleteDialogOpen = $state(false);
|
||||
let deleteFilesOnDisk = $state(false);
|
||||
let deleteTorrents = $state(false);
|
||||
|
||||
async function toggle_continuous_download() {
|
||||
const { response } = await client.POST('/api/v1/tv/shows/{show_id}/continuousDownload', {
|
||||
@@ -56,11 +57,10 @@
|
||||
}
|
||||
|
||||
async function delete_show() {
|
||||
// TODO: Implement delete_files_on_disk parameter in backend API
|
||||
const { response } = await client.DELETE('/api/v1/tv/shows/{show_id}', {
|
||||
params: {
|
||||
path: { show_id: show().id }
|
||||
// query: { delete_files_on_disk: deleteFilesOnDisk } // Not yet implemented
|
||||
path: { show_id: show().id },
|
||||
query: { delete_files_on_disk: deleteFilesOnDisk, delete_torrents: deleteTorrents }
|
||||
}
|
||||
});
|
||||
if (!response.ok) {
|
||||
@@ -164,21 +164,33 @@
|
||||
</AlertDialog.Trigger>
|
||||
<AlertDialog.Content>
|
||||
<AlertDialog.Header>
|
||||
<AlertDialog.Title>Delete {getFullyQualifiedMediaName(show())}?</AlertDialog.Title
|
||||
<AlertDialog.Title
|
||||
>Delete - {getFullyQualifiedMediaName(show())}?</AlertDialog.Title
|
||||
>
|
||||
<AlertDialog.Description>
|
||||
This action cannot be undone. This will permanently delete
|
||||
<strong>{getFullyQualifiedMediaName(show())}</strong> from the database.
|
||||
</AlertDialog.Description>
|
||||
</AlertDialog.Header>
|
||||
<div class="flex items-center space-x-2 py-4">
|
||||
<Checkbox bind:checked={deleteFilesOnDisk} id="delete-files" />
|
||||
<Label
|
||||
for="delete-files"
|
||||
class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Also delete files on disk (not yet implemented)
|
||||
</Label>
|
||||
<div class="flex flex-col gap-3 py-4">
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox bind:checked={deleteFilesOnDisk} id="delete-files" />
|
||||
<Label
|
||||
for="delete-files"
|
||||
class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Also delete files on disk
|
||||
</Label>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Checkbox bind:checked={deleteTorrents} id="delete-torrents" />
|
||||
<Label
|
||||
for="delete-torrents"
|
||||
class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Also delete torrents
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
<AlertDialog.Footer>
|
||||
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
|
||||
|
||||
Reference in New Issue
Block a user