diff --git a/ApiClient.js b/ApiClient.js index e9679c3f04..af785eb3e8 100644 --- a/ApiClient.js +++ b/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 */ diff --git a/dashboard-ui/scripts/directorybrowser.js b/dashboard-ui/scripts/directorybrowser.js index 5715c62013..d08f2e6555 100644 --- a/dashboard-ui/scripts/directorybrowser.js +++ b/dashboard-ui/scripts/directorybrowser.js @@ -1,12 +1,21 @@ (function (window, document, $) { function refreshDirectoryBrowser(page, path) { - + Dashboard.showLoadingMsg(); + if (path) { + $('.networkHeadline').hide(); + } else { + $('.networkHeadline').show(); + } + var promise; - if (path) { + if (path === "Network") { + promise = ApiClient.getNetworkDevices(); + } + else if (path) { promise = ApiClient.getDirectoryContents(path, { includeDirectories: true }); } else { promise = ApiClient.getDrives(); @@ -32,9 +41,9 @@ if (parentPath.endsWith(':')) { parentPath += "\\"; } - + if (parentPath == '\\') { - parentPath = ""; + parentPath = "Network"; } html += '
';
html += '';
@@ -102,13 +118,13 @@
$(page).append(html);
var popup = $('#popupDirectoryPicker').popup().trigger('create').on("popupafteropen", function () {
-
+
$('#popupDirectoryPicker input:first', this).focus();
-
+
}).popup("open").on("popupafterclose", function () {
$('form', this).off("submit");
-
+
$(this).off("click").off("change").off("popupafterclose").remove();
}).on("click", ".lnkDirectory", function () {
@@ -116,7 +132,7 @@
var path = this.getAttribute('data-path');
refreshDirectoryBrowser(page, path);
-
+
}).on("change", "#txtDirectoryPickerPath", function () {
refreshDirectoryBrowser(page, this.value);
@@ -141,7 +157,7 @@
};
- self.close = function() {
+ self.close = function () {
$('#popupDirectoryPicker', page).popup("close");
};
};
diff --git a/packages.config b/packages.config
index 2e19e0a123..395c46b566 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,6 @@