mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
restored network browser
This commit is contained in:
parent
33d21adbe3
commit
a721a6b7af
3 changed files with 43 additions and 13 deletions
14
ApiClient.js
14
ApiClient.js
|
@ -496,6 +496,20 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of network devices from the server
|
||||||
|
*/
|
||||||
|
self.getNetworkDevices = function () {
|
||||||
|
|
||||||
|
var url = self.getUrl("Environment/NetworkDevices");
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "json"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels a package installation
|
* Cancels a package installation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
(function (window, document, $) {
|
(function (window, document, $) {
|
||||||
|
|
||||||
function refreshDirectoryBrowser(page, path) {
|
function refreshDirectoryBrowser(page, path) {
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
if (path) {
|
||||||
|
$('.networkHeadline').hide();
|
||||||
|
} else {
|
||||||
|
$('.networkHeadline').show();
|
||||||
|
}
|
||||||
|
|
||||||
var promise;
|
var promise;
|
||||||
|
|
||||||
if (path) {
|
if (path === "Network") {
|
||||||
|
promise = ApiClient.getNetworkDevices();
|
||||||
|
}
|
||||||
|
else if (path) {
|
||||||
promise = ApiClient.getDirectoryContents(path, { includeDirectories: true });
|
promise = ApiClient.getDirectoryContents(path, { includeDirectories: true });
|
||||||
} else {
|
} else {
|
||||||
promise = ApiClient.getDrives();
|
promise = ApiClient.getDrives();
|
||||||
|
@ -32,9 +41,9 @@
|
||||||
if (parentPath.endsWith(':')) {
|
if (parentPath.endsWith(':')) {
|
||||||
parentPath += "\\";
|
parentPath += "\\";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentPath == '\\') {
|
if (parentPath == '\\') {
|
||||||
parentPath = "";
|
parentPath = "Network";
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<li><a class="lnkDirectory" data-path="' + parentPath + '" href="#">..</a></li>';
|
html += '<li><a class="lnkDirectory" data-path="' + parentPath + '" href="#">..</a></li>';
|
||||||
|
@ -47,6 +56,10 @@
|
||||||
html += '<li><a class="lnkDirectory" data-path="' + folder.Path + '" href="#">' + folder.Name + '</a></li>';
|
html += '<li><a class="lnkDirectory" data-path="' + folder.Path + '" href="#">' + folder.Name + '</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!path) {
|
||||||
|
html += '<li><a class="lnkDirectory" data-path="Network" href="#">Network</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
$('#ulDirectoryPickerList', page).html(html).listview('refresh');
|
$('#ulDirectoryPickerList', page).html(html).listview('refresh');
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
@ -59,8 +72,8 @@
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.DirectoryBrowser = function(page) {
|
window.DirectoryBrowser = function (page) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -84,12 +97,15 @@
|
||||||
html += '<div data-role="fieldcontain" style="margin:0;">';
|
html += '<div data-role="fieldcontain" style="margin:0;">';
|
||||||
html += '<label for="txtDirectoryPickerPath" class="lblDirectoryPickerPath">Current Folder:</label>';
|
html += '<label for="txtDirectoryPickerPath" class="lblDirectoryPickerPath">Current Folder:</label>';
|
||||||
html += '<input id="txtDirectoryPickerPath" name="txtDirectoryPickerPath" type="text" required="required" style="font-weight:bold;" />';
|
html += '<input id="txtDirectoryPickerPath" name="txtDirectoryPickerPath" type="text" required="required" style="font-weight:bold;" />';
|
||||||
html += '<div class="directoryPickerHeadline" style="margin-top:5px;padding:.5em;display:inline-block;">Network paths can be entered manually, e.g. <b>\\\\my-server</b></div>';
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<div style="height: 320px; overflow-y: auto;">';
|
html += '<div style="height: 320px; overflow-y: auto;">';
|
||||||
html += '<ul id="ulDirectoryPickerList" data-role="listview" data-inset="true" data-auto-enhanced="false"></ul>';
|
html += '<ul id="ulDirectoryPickerList" data-role="listview" data-inset="true" data-auto-enhanced="false"></ul>';
|
||||||
|
|
||||||
|
html += '<div class="directoryPickerHeadline networkHeadline" style="margin:5px 0 1em;padding:.5em;">Network paths <b>can be entered manually</b> in the event the Network button fails to locate your devices. For example, <b>\\\\my-server</b>.</div>';
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
|
|
||||||
html += '<p>';
|
html += '<p>';
|
||||||
html += '<button type="submit" data-theme="b" data-icon="ok">OK</button>';
|
html += '<button type="submit" data-theme="b" data-icon="ok">OK</button>';
|
||||||
|
@ -102,13 +118,13 @@
|
||||||
$(page).append(html);
|
$(page).append(html);
|
||||||
|
|
||||||
var popup = $('#popupDirectoryPicker').popup().trigger('create').on("popupafteropen", function () {
|
var popup = $('#popupDirectoryPicker').popup().trigger('create').on("popupafteropen", function () {
|
||||||
|
|
||||||
$('#popupDirectoryPicker input:first', this).focus();
|
$('#popupDirectoryPicker input:first', this).focus();
|
||||||
|
|
||||||
}).popup("open").on("popupafterclose", function () {
|
}).popup("open").on("popupafterclose", function () {
|
||||||
|
|
||||||
$('form', this).off("submit");
|
$('form', this).off("submit");
|
||||||
|
|
||||||
$(this).off("click").off("change").off("popupafterclose").remove();
|
$(this).off("click").off("change").off("popupafterclose").remove();
|
||||||
|
|
||||||
}).on("click", ".lnkDirectory", function () {
|
}).on("click", ".lnkDirectory", function () {
|
||||||
|
@ -116,7 +132,7 @@
|
||||||
var path = this.getAttribute('data-path');
|
var path = this.getAttribute('data-path');
|
||||||
|
|
||||||
refreshDirectoryBrowser(page, path);
|
refreshDirectoryBrowser(page, path);
|
||||||
|
|
||||||
}).on("change", "#txtDirectoryPickerPath", function () {
|
}).on("change", "#txtDirectoryPickerPath", function () {
|
||||||
|
|
||||||
refreshDirectoryBrowser(page, this.value);
|
refreshDirectoryBrowser(page, this.value);
|
||||||
|
@ -141,7 +157,7 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.close = function() {
|
self.close = function () {
|
||||||
$('#popupDirectoryPicker', page).popup("close");
|
$('#popupDirectoryPicker', page).popup("close");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.169" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.170" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.58" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.58" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.58" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.58" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue