mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
set default directory picker path for qnap
This commit is contained in:
parent
812cbb19a4
commit
3309bc33da
1 changed files with 24 additions and 11 deletions
|
@ -19,13 +19,12 @@
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
||||||
$(this).remove();
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshDirectoryBrowser(page, path, fileOptions) {
|
function refreshDirectoryBrowser(page, path, fileOptions) {
|
||||||
|
|
||||||
if (path && typeof(path) !== 'string') {
|
if (path && typeof (path) !== 'string') {
|
||||||
throw new Error('invalid path');
|
throw new Error('invalid path');
|
||||||
}
|
}
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
@ -185,6 +184,20 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultPath(options) {
|
||||||
|
if (options.path) {
|
||||||
|
return Promise.resolve(options.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ApiClient.getJSON(ApiClient.getUrl("Environment/DefaultDirectoryBrowser")).then(function (result) {
|
||||||
|
|
||||||
|
return result.Path || '';
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function directoryBrowser() {
|
function directoryBrowser() {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -206,10 +219,14 @@
|
||||||
fileOptions.includeFiles = options.includeFiles;
|
fileOptions.includeFiles = options.includeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSystemInfo().then(function (systemInfo) {
|
Promise.all([getSystemInfo(), getDefaultPath(options)]).then(function (responses) {
|
||||||
|
|
||||||
|
var systemInfo = responses[0];
|
||||||
|
var initialPath = responses[1];
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog({
|
var dlg = dialogHelper.createDialog({
|
||||||
size: 'medium'
|
size: 'medium',
|
||||||
|
removeOnClose: true
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.classList.add('ui-body-a');
|
dlg.classList.add('ui-body-a');
|
||||||
|
@ -249,13 +266,9 @@
|
||||||
|
|
||||||
currentDialog = dlg;
|
currentDialog = dlg;
|
||||||
|
|
||||||
var txtCurrentPath = $('#txtDirectoryPickerPath', editorContent);
|
var txtCurrentPath = editorContent.querySelector('#txtDirectoryPickerPath');
|
||||||
|
txtCurrentPath.value = initialPath;
|
||||||
if (options.path) {
|
refreshDirectoryBrowser(editorContent, txtCurrentPath.value);
|
||||||
txtCurrentPath.val(options.path);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshDirectoryBrowser(editorContent, txtCurrentPath.val());
|
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue