mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
commit
e33a589a27
14 changed files with 326 additions and 303 deletions
|
@ -100,6 +100,7 @@ module.exports = {
|
|||
'jQuery': 'readonly',
|
||||
// Jellyfin globals
|
||||
'ApiClient': 'writable',
|
||||
'Events': 'writable',
|
||||
'chrome': 'writable',
|
||||
'DlnaProfilePage': 'writable',
|
||||
'DashboardPage': 'writable',
|
||||
|
@ -115,6 +116,8 @@ module.exports = {
|
|||
'Loading': 'writable',
|
||||
'MetadataEditor': 'writable',
|
||||
'PlaylistViewer': 'writable',
|
||||
'ServerNotifications': 'writable',
|
||||
'TaskButton': 'writable',
|
||||
'UserParentalControlPage': 'writable',
|
||||
'Windows': 'readonly'
|
||||
},
|
||||
|
|
|
@ -10,22 +10,20 @@ import '../formdialog.scss';
|
|||
import '../../elements/emby-button/emby-button';
|
||||
import alert from '../alert';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getSystemInfo() {
|
||||
function getSystemInfo() {
|
||||
return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
|
||||
info => {
|
||||
systemInfo = info;
|
||||
return info;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function onDialogClosed() {
|
||||
function onDialogClosed() {
|
||||
loading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
|
||||
function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
|
||||
if (path && typeof path !== 'string') {
|
||||
throw new Error('invalid path');
|
||||
}
|
||||
|
@ -77,9 +75,9 @@ import alert from '../alert';
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getItem(cssClass, type, path, name) {
|
||||
function getItem(cssClass, type, path, name) {
|
||||
let html = '';
|
||||
html += `<div class="listItem listItem-border ${cssClass}" data-type="${type}" data-path="${path}">`;
|
||||
html += '<div class="listItemBody" style="padding-left:0;padding-top:.5em;padding-bottom:.5em;">';
|
||||
|
@ -90,9 +88,9 @@ import alert from '../alert';
|
|||
html += '<span class="material-icons arrow_forward" style="font-size:inherit;"></span>';
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
function getEditorHtml(options, systemInfo) {
|
||||
function getEditorHtml(options, systemInfo) {
|
||||
let html = '';
|
||||
html += '<div class="formDialogContent scrollY">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered" style="padding-top:2em;">';
|
||||
|
@ -149,19 +147,19 @@ import alert from '../alert';
|
|||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
function alertText(text) {
|
||||
function alertText(text) {
|
||||
alertTextWithOptions({
|
||||
text: text
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function alertTextWithOptions(options) {
|
||||
function alertTextWithOptions(options) {
|
||||
alert(options);
|
||||
}
|
||||
}
|
||||
|
||||
function validatePath(path, validateWriteable, apiClient) {
|
||||
function validatePath(path, validateWriteable, apiClient) {
|
||||
return apiClient.ajax({
|
||||
type: 'POST',
|
||||
url: apiClient.getUrl('Environment/ValidatePath'),
|
||||
|
@ -187,9 +185,9 @@ import alert from '../alert';
|
|||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initEditor(content, options, fileOptions) {
|
||||
function initEditor(content, options, fileOptions) {
|
||||
content.addEventListener('click', e => {
|
||||
const lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||
if (lnkPath) {
|
||||
|
@ -227,9 +225,9 @@ import alert from '../alert';
|
|||
e.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultPath(options) {
|
||||
function getDefaultPath(options) {
|
||||
if (options.path) {
|
||||
return Promise.resolve(options.path);
|
||||
} else {
|
||||
|
@ -241,12 +239,13 @@ import alert from '../alert';
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class directoryBrowser {
|
||||
constructor() {
|
||||
let currentDialog;
|
||||
this.show = options => {
|
||||
let systemInfo;
|
||||
class DirectoryBrowser {
|
||||
currentDialog;
|
||||
|
||||
show = options => {
|
||||
options = options || {};
|
||||
const fileOptions = {
|
||||
includeDirectories: true
|
||||
|
@ -286,7 +285,7 @@ import alert from '../alert';
|
|||
dlg.querySelector('.btnCloseDialog').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
currentDialog = dlg;
|
||||
this.currentDialog = dlg;
|
||||
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
|
||||
const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||
if (txtNetworkPath) {
|
||||
|
@ -298,15 +297,12 @@ import alert from '../alert';
|
|||
}
|
||||
);
|
||||
};
|
||||
this.close = () => {
|
||||
if (currentDialog) {
|
||||
dialogHelper.close(currentDialog);
|
||||
|
||||
close = () => {
|
||||
if (this.currentDialog) {
|
||||
dialogHelper.close(this.currentDialog);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let systemInfo;
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default directoryBrowser;
|
||||
export default DirectoryBrowser;
|
||||
|
|
|
@ -102,8 +102,8 @@ import template from './mediaLibraryCreator.template.html';
|
|||
function onAddButtonClick() {
|
||||
const page = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
|
||||
import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
enableNetworkSharePath: true,
|
||||
callback: function (path, networkSharePath) {
|
||||
|
|
|
@ -162,8 +162,8 @@ import template from './mediaLibraryEditor.template.html';
|
|||
}
|
||||
|
||||
function showDirectoryBrowser(context, originalPath, networkPath) {
|
||||
import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
enableNetworkSharePath: true,
|
||||
pathReadOnly: originalPath != null,
|
||||
|
|
|
@ -145,8 +145,8 @@ export default function (page, providerId, options) {
|
|||
function onSelectPathClick(e) {
|
||||
const page = $(e.target).parents('.xmltvForm')[0];
|
||||
|
||||
import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
|
|
|
@ -217,8 +217,8 @@ import alert from '../../components/alert';
|
|||
setDecodingCodecsVisible(page, this.value);
|
||||
});
|
||||
$('#btnSelectEncoderPath', page).on('click.selectDirectory', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
|
@ -232,8 +232,8 @@ import alert from '../../components/alert';
|
|||
});
|
||||
});
|
||||
$('#btnSelectTranscodingTempPath', page).on('click.selectDirectory', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
|
@ -249,8 +249,8 @@ import alert from '../../components/alert';
|
|||
});
|
||||
});
|
||||
$('#btnSelectFallbackFontPath', page).on('click.selectDirectory', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeDirectories: true,
|
||||
callback: function (path) {
|
||||
|
|
|
@ -55,8 +55,8 @@ import alert from '../../components/alert';
|
|||
const brandingConfigKey = 'branding';
|
||||
export default function (view) {
|
||||
$('#btnSelectCachePath', view).on('click.selectDirectory', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
|
@ -72,8 +72,8 @@ import alert from '../../components/alert';
|
|||
});
|
||||
});
|
||||
$('#btnSelectMetadataPath', view).on('click.selectDirectory', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
path: $('#txtMetadataPath', view).val(),
|
||||
networkSharePath: $('#txtMetadataNetworkPath', view).val(),
|
||||
|
|
|
@ -181,8 +181,8 @@ import alert from '../../components/alert';
|
|||
}
|
||||
});
|
||||
view.querySelector('#btnSelectCertPath').addEventListener('click', function () {
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
includeDirectories: true,
|
||||
|
|
|
@ -60,8 +60,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
|
|||
const page = this;
|
||||
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
$('#btnSelectRecordingPath', page).on('click.selectDirectory', function () {
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
|
@ -75,8 +75,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
|
|||
});
|
||||
});
|
||||
$('#btnSelectMovieRecordingPath', page).on('click.selectDirectory', function () {
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
|
@ -90,8 +90,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
|
|||
});
|
||||
});
|
||||
$('#btnSelectSeriesRecordingPath', page).on('click.selectDirectory', function () {
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
|
@ -105,8 +105,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
|
|||
});
|
||||
});
|
||||
$('#btnSelectPostProcessorPath', page).on('click.selectDirectory', function () {
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
|
|
|
@ -212,8 +212,8 @@ export default function (view, params) {
|
|||
});
|
||||
});
|
||||
view.querySelector('.btnSelectPath').addEventListener('click', function () {
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: directorybrowser}) => {
|
||||
const picker = new directorybrowser();
|
||||
import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
|
||||
const picker = new DirectoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
|
|
|
@ -6,6 +6,10 @@ import baseAlert from '../components/alert';
|
|||
import baseConfirm from '../components/confirm/confirm';
|
||||
import globalize from '../scripts/globalize';
|
||||
import * as webSettings from './settings/webSettings';
|
||||
import datetime from '../scripts/datetime';
|
||||
import DirectoryBrowser from '../components/directorybrowser/directorybrowser';
|
||||
import dialogHelper from '../components/dialogHelper/dialogHelper';
|
||||
import itemIdentifier from '../components/itemidentifier/itemidentifier';
|
||||
|
||||
export function getCurrentUser() {
|
||||
return window.ApiClient.getCurrentUser(false);
|
||||
|
@ -94,6 +98,12 @@ export function getPluginUrl(name) {
|
|||
return 'configurationpage?name=' + encodeURIComponent(name);
|
||||
}
|
||||
|
||||
export function getConfigurationResourceUrl(name) {
|
||||
return ApiClient.getUrl('web/ConfigurationPage', {
|
||||
name: name
|
||||
});
|
||||
}
|
||||
|
||||
export function navigate(url, preserveQueryString) {
|
||||
if (!url) {
|
||||
throw new Error('url cannot be null or empty');
|
||||
|
@ -204,6 +214,7 @@ const Dashboard = {
|
|||
capabilities,
|
||||
confirm,
|
||||
getPluginUrl,
|
||||
getConfigurationResourceUrl,
|
||||
getCurrentUser,
|
||||
getCurrentUserId,
|
||||
hideLoadingMsg,
|
||||
|
@ -215,7 +226,11 @@ const Dashboard = {
|
|||
processServerConfigurationUpdateResult,
|
||||
selectServer,
|
||||
serverAddress,
|
||||
showLoadingMsg
|
||||
showLoadingMsg,
|
||||
datetime,
|
||||
DirectoryBrowser,
|
||||
dialogHelper,
|
||||
itemIdentifier
|
||||
};
|
||||
|
||||
// This is used in plugins and templates, so keep it defined for now.
|
||||
|
|
|
@ -211,4 +211,6 @@ Events.on(ServerConnections, 'apiclientcreated', function (e, newApiClient) {
|
|||
bindEvents(newApiClient);
|
||||
});
|
||||
|
||||
window.ServerNotifications = serverNotifications;
|
||||
|
||||
export default serverNotifications;
|
||||
|
|
|
@ -37,6 +37,7 @@ import SyncPlayNoActivePlayer from '../components/syncPlay/ui/players/NoActivePl
|
|||
import SyncPlayHtmlVideoPlayer from '../components/syncPlay/ui/players/HtmlVideoPlayer';
|
||||
import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudioPlayer';
|
||||
import { currentSettings } from './settings/userSettings';
|
||||
import taskButton from '../scripts/taskbutton';
|
||||
|
||||
// TODO: Move this elsewhere
|
||||
window.getWindowLocationSearch = function(win) {
|
||||
|
@ -83,6 +84,10 @@ function loadCoreDictionary() {
|
|||
}
|
||||
|
||||
function init() {
|
||||
// This is used in plugins
|
||||
window.Events = Events;
|
||||
window.TaskButton = taskButton;
|
||||
|
||||
serverAddress().then(server => {
|
||||
if (server) {
|
||||
ServerConnections.initApiClient(server);
|
||||
|
|
|
@ -5,7 +5,7 @@ import globalize from '../scripts/globalize';
|
|||
import '../elements/emby-button/emby-button';
|
||||
import ServerConnections from '../components/ServerConnections';
|
||||
|
||||
export default function (options) {
|
||||
function taskbutton(options) {
|
||||
function pollTasks() {
|
||||
ServerConnections.getApiClient(serverId).getScheduledTasks({
|
||||
IsEnabled: true
|
||||
|
@ -120,3 +120,5 @@ export default function (options) {
|
|||
Events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
export default taskbutton;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue