mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add show method for PlaylistEditor Class
This commit is contained in:
parent
675a59adc4
commit
d702ad938a
7 changed files with 37 additions and 11 deletions
|
@ -339,7 +339,8 @@ function executeCommand(item, id, options) {
|
|||
break;
|
||||
case 'addtoplaylist':
|
||||
import('./playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
new PlaylistEditor({
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: [itemId],
|
||||
serverId: serverId
|
||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
|
|
|
@ -6,7 +6,6 @@ import dom from '../../scripts/dom';
|
|||
import './multiSelect.scss';
|
||||
import ServerConnections from '../ServerConnections';
|
||||
import alert from '../alert';
|
||||
import PlaylistEditor from '../playlisteditor/playlisteditor';
|
||||
import confirm from '../confirm/confirm';
|
||||
import itemHelper from '../itemHelper';
|
||||
import datetime from '../../scripts/datetime';
|
||||
|
@ -269,9 +268,16 @@ function showMenuForSelectedItems(e) {
|
|||
dispatchNeedsRefresh();
|
||||
break;
|
||||
case 'playlist':
|
||||
new PlaylistEditor({
|
||||
import('../playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: items,
|
||||
serverId: serverId
|
||||
}).catch(() => {
|
||||
// Dialog closed
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[AddToPlaylist] failed to load playlist editor', err);
|
||||
});
|
||||
hideSelections();
|
||||
dispatchNeedsRefresh();
|
||||
|
|
|
@ -222,7 +222,7 @@ function centerFocus(elem, horiz, on) {
|
|||
}
|
||||
|
||||
export class PlaylistEditor {
|
||||
constructor(options) {
|
||||
show(options) {
|
||||
const items = options.items || {};
|
||||
currentServerId = options.serverId;
|
||||
|
||||
|
|
|
@ -704,15 +704,20 @@ export default function () {
|
|||
import('../playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
getSaveablePlaylistItems().then(function (items) {
|
||||
const serverId = items.length ? items[0].ServerId : ApiClient.serverId();
|
||||
new PlaylistEditor({
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: items.map(function (i) {
|
||||
return i.Id;
|
||||
}),
|
||||
serverId: serverId,
|
||||
enableAddToPlayQueue: false,
|
||||
defaultValue: 'new'
|
||||
}).catch(() => {
|
||||
// Dialog closed
|
||||
});
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[savePlaylist] failed to load playlist editor', err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -282,11 +282,15 @@ function executeAction(card, target, action) {
|
|||
|
||||
function addToPlaylist(item) {
|
||||
import('./playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
new PlaylistEditor().show({
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: [item.Id],
|
||||
serverId: item.ServerId
|
||||
|
||||
}).catch(() => {
|
||||
// Dialog closed
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[addToPlaylist] failed to load playlist editor', err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -401,10 +401,15 @@ function onNewItemClick() {
|
|||
const instance = this;
|
||||
|
||||
import('../components/playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
new PlaylistEditor({
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: [],
|
||||
serverId: instance.params.serverId
|
||||
}).catch(() => {
|
||||
// Dialog closed
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[onNewItemClick] failed to load playlist editor', err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -187,10 +187,15 @@ export default function (view) {
|
|||
view.querySelector('.btnNewPlaylist').addEventListener('click', function () {
|
||||
import('../components/playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => {
|
||||
const serverId = ApiClient.serverInfo().Id;
|
||||
new PlaylistEditor({
|
||||
const playlistEditor = new PlaylistEditor();
|
||||
playlistEditor.show({
|
||||
items: [],
|
||||
serverId: serverId
|
||||
}).catch(() => {
|
||||
// Dialog closed
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error('[btnNewPlaylist] failed to load playlist editor', err);
|
||||
});
|
||||
});
|
||||
onViewStyleChange();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue