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:
commit
dea57d87ee
3 changed files with 49 additions and 21 deletions
|
@ -10,6 +10,24 @@ import { playbackManager } from './playback/playbackmanager';
|
|||
import ServerConnections from './ServerConnections';
|
||||
import toast from './toast/toast';
|
||||
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) {
|
||||
const item = options.item;
|
||||
|
@ -160,19 +178,11 @@ export function getCommands(options) {
|
|||
}
|
||||
|
||||
if (item.CanDelete && options.deleteItem !== false) {
|
||||
if (item.Type === 'Playlist' || item.Type === 'BoxSet') {
|
||||
commands.push({
|
||||
name: globalize.translate('Delete'),
|
||||
id: 'delete',
|
||||
icon: 'delete'
|
||||
});
|
||||
} else {
|
||||
commands.push({
|
||||
name: globalize.translate('DeleteMedia'),
|
||||
id: 'delete',
|
||||
icon: 'delete'
|
||||
});
|
||||
}
|
||||
commands.push({
|
||||
name: getDeleteLabel(item.Type),
|
||||
id: 'delete',
|
||||
icon: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
// Books are promoted to major download Button and therefor excluded in the context menu
|
||||
|
|
|
@ -4,25 +4,38 @@ import { appRouter } from '../components/router/appRouter';
|
|||
import globalize from './globalize';
|
||||
import ServerConnections from '../components/ServerConnections';
|
||||
import alert from '../components/alert';
|
||||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||
|
||||
function alertText(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) {
|
||||
const item = options.item;
|
||||
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
|
||||
return confirm({
|
||||
|
||||
title: globalize.translate('HeaderDeleteItem'),
|
||||
text: globalize.translate('ConfirmDeleteItem'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
return confirm(getDeletionConfirmContent(item)).then(function () {
|
||||
return apiClient.deleteItem(item.Id).then(function () {
|
||||
if (options.navigate) {
|
||||
if (parentId) {
|
||||
|
|
|
@ -157,6 +157,7 @@
|
|||
"ConfigureDateAdded": "Set up how metadata for 'Date added' is determined in the Dashboard > Libraries > NFO Settings",
|
||||
"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?",
|
||||
"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?",
|
||||
"ConfirmDeletion": "Confirm Deletion",
|
||||
"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.",
|
||||
"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",
|
||||
"DeleteEntireSeries": "Delete {0} Episodes",
|
||||
"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.",
|
||||
"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",
|
||||
"DeleteImageConfirmation": "Are you sure you wish to delete this image?",
|
||||
"DeleteMedia": "Delete media",
|
||||
"DeleteSeries": "Delete Series",
|
||||
"DeleteEpisode": "Delete Episode",
|
||||
"DeleteName": "Delete {0}",
|
||||
"DeleteUser": "Delete User",
|
||||
"DeleteUserConfirmation": "Are you sure you wish to delete this user?",
|
||||
|
@ -359,6 +363,7 @@
|
|||
"HeaderDeleteDevice": "Delete Device",
|
||||
"HeaderDeleteDevices": "Delete All Devices",
|
||||
"HeaderDeleteItem": "Delete Item",
|
||||
"HeaderDeleteSeries": "Delete Series",
|
||||
"HeaderDeleteItems": "Delete Items",
|
||||
"HeaderDeleteProvider": "Delete Provider",
|
||||
"HeaderDeleteTaskTrigger": "Delete Task Trigger",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue