mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
move network share path out of directory browser component
This commit is contained in:
parent
74eabd2af9
commit
f3e07e1531
3 changed files with 38 additions and 33 deletions
|
@ -18,18 +18,18 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
if (path && typeof path !== 'string') {
|
if (path && typeof path !== 'string') {
|
||||||
throw new Error("invalid path");
|
throw new Error("invalid path");
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
if ("Network" === path) {
|
if ("Network" === path) {
|
||||||
promises.push(ApiClient.getNetworkDevices())
|
promises.push(ApiClient.getNetworkDevices())
|
||||||
} else {
|
} else {
|
||||||
if (path) {
|
if (path) {
|
||||||
promises.push(ApiClient.getDirectoryContents(path, fileOptions));
|
promises.push(ApiClient.getDirectoryContents(path, fileOptions));
|
||||||
promises.push(ApiClient.getParentPath(path));
|
promises.push(ApiClient.getParentPath(path));
|
||||||
} else {
|
} else {
|
||||||
promises.push(ApiClient.getDrives());
|
promises.push(ApiClient.getDrives());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
|
|
||||||
page.querySelector(".results").scrollTop = 0;
|
page.querySelector(".results").scrollTop = 0;
|
||||||
page.querySelector("#txtDirectoryPickerPath").value = path || "";
|
page.querySelector("#txtDirectoryPickerPath").value = path || "";
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
html += getItem("lnkPath lnkDirectory", "", parentPath, "...");
|
html += getItem("lnkPath lnkDirectory", "", parentPath, "...");
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
var cssClass = "File" === folder.Type ? "lnkPath lnkFile" : "lnkPath lnkDirectory";
|
var cssClass = "File" === folder.Type ? "lnkPath lnkFile" : "lnkPath lnkDirectory";
|
||||||
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
html += getItem("lnkPath lnkDirectory", "", "Network", Globalize.translate("ButtonNetwork"));
|
html += getItem("lnkPath lnkDirectory", "", "Network", Globalize.translate("ButtonNetwork"));
|
||||||
}
|
}
|
||||||
|
@ -128,17 +128,9 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="' + Globalize.translate("ButtonRefresh") + '"><i class="md-icon">search</i></button>';
|
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="' + Globalize.translate("ButtonRefresh") + '"><i class="md-icon">search</i></button>';
|
||||||
}
|
}
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
if (!readOnlyAttribute) {
|
if (!readOnlyAttribute) {
|
||||||
html += '<div class="results paperList" style="max-height: 200px; overflow-y: auto;"></div>';
|
html += '<div class="results paperList" style="max-height: 200px; overflow-y: auto;"></div>';
|
||||||
}
|
}
|
||||||
if (options.enableNetworkSharePath) {
|
|
||||||
html += '<div class="inputContainer" style="margin-top:2em;">';
|
|
||||||
html += '<input is="emby-input" id="txtNetworkPath" type="text" label="' + Globalize.translate("LabelOptionalNetworkPath") + '"/>';
|
|
||||||
html += '<div class="fieldDescription">';
|
|
||||||
html += Globalize.translate("LabelOptionalNetworkPathHelp");
|
|
||||||
html += "</div>";
|
|
||||||
html += "</div>";
|
|
||||||
}
|
|
||||||
html += '<div class="formDialogFooter">';
|
html += '<div class="formDialogFooter">';
|
||||||
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + Globalize.translate("ButtonOk") + "</button>";
|
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + Globalize.translate("ButtonOk") + "</button>";
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
|
@ -219,14 +211,8 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
|
|
||||||
content.querySelector("form").addEventListener("submit", function(e) {
|
content.querySelector("form").addEventListener("submit", function(e) {
|
||||||
if (options.callback) {
|
if (options.callback) {
|
||||||
var networkSharePath = this.querySelector("#txtNetworkPath");
|
|
||||||
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
|
||||||
var path = this.querySelector("#txtDirectoryPickerPath").value;
|
var path = this.querySelector("#txtDirectoryPickerPath").value;
|
||||||
validatePath(path, options.validateWriteable, ApiClient).then(
|
validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path));
|
||||||
function() {
|
|
||||||
options.callback(path, networkSharePath);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -293,10 +279,6 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-b
|
||||||
});
|
});
|
||||||
currentDialog = dlg;
|
currentDialog = dlg;
|
||||||
dlg.querySelector("#txtDirectoryPickerPath").value = initialPath;
|
dlg.querySelector("#txtDirectoryPickerPath").value = initialPath;
|
||||||
var txtNetworkPath = dlg.querySelector("#txtNetworkPath");
|
|
||||||
if (txtNetworkPath) {
|
|
||||||
txtNetworkPath.value = options.networkSharePath || "";
|
|
||||||
}
|
|
||||||
if (!options.pathReadOnly) {
|
if (!options.pathReadOnly) {
|
||||||
refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
|
refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,16 +74,29 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
var picker = new directoryBrowser;
|
var picker = new directoryBrowser;
|
||||||
picker.show({
|
picker.show({
|
||||||
path: $("#txtMetadataPath", view).val(),
|
path: $("#txtMetadataPath", view).val(),
|
||||||
networkSharePath: $("#txtMetadataNetworkPath", view).val(),
|
callback: function(path) {
|
||||||
callback: function(path, networkPath) {
|
|
||||||
path && $("#txtMetadataPath", view).val(path);
|
path && $("#txtMetadataPath", view).val(path);
|
||||||
networkPath && $("#txtMetadataNetworkPath", view).val(networkPath);
|
|
||||||
picker.close();
|
picker.close();
|
||||||
},
|
},
|
||||||
validateWriteable: true,
|
validateWriteable: true,
|
||||||
header: Globalize.translate("HeaderSelectMetadataPath"),
|
header: Globalize.translate("HeaderSelectMetadataPath"),
|
||||||
instruction: Globalize.translate("HeaderSelectMetadataPathHelp"),
|
instruction: Globalize.translate("HeaderSelectMetadataPathHelp")
|
||||||
enableNetworkSharePath: true
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#btnSelectMetadataNetworkPath", view).on("click.selectDirectory", function() {
|
||||||
|
require(["directorybrowser"], function(directoryBrowser) {
|
||||||
|
var picker = new directoryBrowser;
|
||||||
|
picker.show({
|
||||||
|
path: $("#txtMetadataNetworkPath", view).val(),
|
||||||
|
callback: function(path) {
|
||||||
|
path && $("#txtMetadataNetworkPath", view).val(path);
|
||||||
|
picker.close();
|
||||||
|
},
|
||||||
|
validateWriteable: true,
|
||||||
|
header: Globalize.translate("LabelOptionalNetworkPath"),
|
||||||
|
instruction: Globalize.translate("LabelOptionalNetworkPathHelp")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="fieldDescription">${LabelCachePathHelp}</div>
|
<div class="fieldDescription">${LabelCachePathHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<div style="flex-grow:1;">
|
<div style="flex-grow:1;">
|
||||||
|
@ -52,7 +53,16 @@
|
||||||
<button type="button" is="paper-icon-button-light" id="btnSelectMetadataPath" title="${ButtonSelectDirectory}" class="emby-input-iconbutton"><i class="md-icon">search</i></button>
|
<button type="button" is="paper-icon-button-light" id="btnSelectMetadataPath" title="${ButtonSelectDirectory}" class="emby-input-iconbutton"><i class="md-icon">search</i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="fieldDescription">${LabelMetadataPathHelp}</div>
|
<div class="fieldDescription">${LabelMetadataPathHelp}</div>
|
||||||
<input type="hidden" id="txtMetadataNetworkPath" />
|
</div>
|
||||||
|
|
||||||
|
<div class="inputContainer">
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<div style="flex-grow:1;">
|
||||||
|
<input is="emby-input" id="txtMetadataNetworkPath" label="${LabelOptionalNetworkPath}" autocomplete="off" />
|
||||||
|
</div>
|
||||||
|
<button type="button" is="paper-icon-button-light" id="btnSelectMetadataNetworkPath" title="${ButtonSelectDirectory}" class="emby-input-iconbutton"><i class="md-icon">search</i></button>
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription">${LabelOptionalNetworkPathHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -72,7 +82,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="verticalSection">
|
<div class="verticalSection">
|
||||||
<h2>${TabOther}</h2>
|
<h2>${HeaderBranding}</h2>
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<input is="emby-input" type="text" id="txtLoginDisclaimer" label="${LabelLoginDisclaimer}" />
|
<input is="emby-input" type="text" id="txtLoginDisclaimer" label="${LabelLoginDisclaimer}" />
|
||||||
<div class="fieldDescription">${LabelLoginDisclaimerHelp}</div>
|
<div class="fieldDescription">${LabelLoginDisclaimerHelp}</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue