1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5232 from nizans/master

Delete series confirmation to be different to delete episode
This commit is contained in:
Bill Thornton 2024-03-24 04:06:10 -04:00 committed by GitHub
commit dea57d87ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 21 deletions

View file

@ -10,6 +10,24 @@ import { playbackManager } from './playback/playbackmanager';
import ServerConnections from './ServerConnections'; import ServerConnections from './ServerConnections';
import toast from './toast/toast'; import toast from './toast/toast';
import * as userSettings from '../scripts/settings/userSettings'; import * as userSettings from '../scripts/settings/userSettings';
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
function getDeleteLabel(type) {
switch (type) {
case BaseItemKind.Series:
return globalize.translate('DeleteSeries');
case BaseItemKind.Episode:
return globalize.translate('DeleteEpisode');
case BaseItemKind.Playlist:
case BaseItemKind.BoxSet:
return globalize.translate('Delete');
default:
return globalize.translate('DeleteMedia');
}
}
export function getCommands(options) { export function getCommands(options) {
const item = options.item; const item = options.item;
@ -160,19 +178,11 @@ export function getCommands(options) {
} }
if (item.CanDelete && options.deleteItem !== false) { if (item.CanDelete && options.deleteItem !== false) {
if (item.Type === 'Playlist' || item.Type === 'BoxSet') { commands.push({
commands.push({ name: getDeleteLabel(item.Type),
name: globalize.translate('Delete'), id: 'delete',
id: 'delete', icon: 'delete'
icon: 'delete' });
});
} else {
commands.push({
name: globalize.translate('DeleteMedia'),
id: 'delete',
icon: 'delete'
});
}
} }
// Books are promoted to major download Button and therefor excluded in the context menu // Books are promoted to major download Button and therefor excluded in the context menu

View file

@ -4,25 +4,38 @@ import { appRouter } from '../components/router/appRouter';
import globalize from './globalize'; import globalize from './globalize';
import ServerConnections from '../components/ServerConnections'; import ServerConnections from '../components/ServerConnections';
import alert from '../components/alert'; import alert from '../components/alert';
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
function alertText(options) { function alertText(options) {
return alert(options); return alert(options);
} }
function getDeletionConfirmContent(item) {
if (item.Type === BaseItemKind.Series) {
const totalEpisodes = item.RecursiveItemCount;
return {
title: globalize.translate('HeaderDeleteSeries'),
text: globalize.translate('ConfirmDeleteSeries', totalEpisodes),
confirmText: globalize.translate('DeleteEntireSeries', totalEpisodes),
primary: 'delete'
};
}
return {
title: globalize.translate('HeaderDeleteItem'),
text: globalize.translate('ConfirmDeleteItem'),
confirmText: globalize.translate('Delete'),
primary: 'delete'
};
}
export function deleteItem(options) { export function deleteItem(options) {
const item = options.item; const item = options.item;
const parentId = item.SeasonId || item.SeriesId || item.ParentId; const parentId = item.SeasonId || item.SeriesId || item.ParentId;
const apiClient = ServerConnections.getApiClient(item.ServerId); const apiClient = ServerConnections.getApiClient(item.ServerId);
return confirm({ return confirm(getDeletionConfirmContent(item)).then(function () {
title: globalize.translate('HeaderDeleteItem'),
text: globalize.translate('ConfirmDeleteItem'),
confirmText: globalize.translate('Delete'),
primary: 'delete'
}).then(function () {
return apiClient.deleteItem(item.Id).then(function () { return apiClient.deleteItem(item.Id).then(function () {
if (options.navigate) { if (options.navigate) {
if (parentId) { if (parentId) {

View file

@ -157,6 +157,7 @@
"ConfigureDateAdded": "Set up how metadata for 'Date added' is determined in the Dashboard > Libraries > NFO Settings", "ConfigureDateAdded": "Set up how metadata for 'Date added' is determined in the Dashboard > Libraries > NFO Settings",
"ConfirmDeleteImage": "Delete image?", "ConfirmDeleteImage": "Delete image?",
"ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?", "ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?",
"ConfirmDeleteSeries": "Deleting this series will delete ALL {0} episodes from both the file system and your media library. Are you sure you wish to continue?",
"ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?", "ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?",
"ConfirmDeletion": "Confirm Deletion", "ConfirmDeletion": "Confirm Deletion",
"ConfirmEndPlayerSession": "Would you like to shutdown Jellyfin on {0}?", "ConfirmEndPlayerSession": "Would you like to shutdown Jellyfin on {0}?",
@ -181,12 +182,15 @@
"DefaultSubtitlesHelp": "Subtitles are loaded based on the default and forced flags in the embedded metadata. Language preferences are considered when multiple options are available.", "DefaultSubtitlesHelp": "Subtitles are loaded based on the default and forced flags in the embedded metadata. Language preferences are considered when multiple options are available.",
"DeinterlaceMethodHelp": "Select the deinterlacing method to use when software transcoding interlaced content. When hardware acceleration supporting hardware deinterlacing is enabled the hardware deinterlacer will be used instead of this setting.", "DeinterlaceMethodHelp": "Select the deinterlacing method to use when software transcoding interlaced content. When hardware acceleration supporting hardware deinterlacing is enabled the hardware deinterlacer will be used instead of this setting.",
"Delete": "Delete", "Delete": "Delete",
"DeleteEntireSeries": "Delete {0} Episodes",
"DeleteAll": "Delete All", "DeleteAll": "Delete All",
"DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.", "DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.",
"DeleteDevicesConfirmation": "Are you sure you wish to delete all devices? All other sessions will be logged out. Devices will reappear the next time a user signs in.", "DeleteDevicesConfirmation": "Are you sure you wish to delete all devices? All other sessions will be logged out. Devices will reappear the next time a user signs in.",
"DeleteImage": "Delete Image", "DeleteImage": "Delete Image",
"DeleteImageConfirmation": "Are you sure you wish to delete this image?", "DeleteImageConfirmation": "Are you sure you wish to delete this image?",
"DeleteMedia": "Delete media", "DeleteMedia": "Delete media",
"DeleteSeries": "Delete Series",
"DeleteEpisode": "Delete Episode",
"DeleteName": "Delete {0}", "DeleteName": "Delete {0}",
"DeleteUser": "Delete User", "DeleteUser": "Delete User",
"DeleteUserConfirmation": "Are you sure you wish to delete this user?", "DeleteUserConfirmation": "Are you sure you wish to delete this user?",
@ -359,6 +363,7 @@
"HeaderDeleteDevice": "Delete Device", "HeaderDeleteDevice": "Delete Device",
"HeaderDeleteDevices": "Delete All Devices", "HeaderDeleteDevices": "Delete All Devices",
"HeaderDeleteItem": "Delete Item", "HeaderDeleteItem": "Delete Item",
"HeaderDeleteSeries": "Delete Series",
"HeaderDeleteItems": "Delete Items", "HeaderDeleteItems": "Delete Items",
"HeaderDeleteProvider": "Delete Provider", "HeaderDeleteProvider": "Delete Provider",
"HeaderDeleteTaskTrigger": "Delete Task Trigger", "HeaderDeleteTaskTrigger": "Delete Task Trigger",