mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
reimplement page to add server
This commit is contained in:
parent
9222f8b15b
commit
1967d248a7
4 changed files with 80 additions and 3 deletions
22
src/addserver.html
Normal file
22
src/addserver.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<div data-role="page" class="page standalonePage">
|
||||||
|
<div class="padded-left padded-right padded-bottom-page">
|
||||||
|
<form class="manualServerForm" style="margin: 0 auto;">
|
||||||
|
<h1 style="text-align: left;">${HeaderConnectToServer}</h1>
|
||||||
|
<div class="inputContainer">
|
||||||
|
<input is="emby-input" type="text" id="txtServerHost" required="required" label="${LabelServerHost}" />
|
||||||
|
<div class="fieldDescription" style="text-align: left;">${LabelServerHostHelp}</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="inputContainer">
|
||||||
|
<input is="emby-input" type="number" id="txtServerPort" step="1" min="0" value="8096" label="${LabelServerPort}" />
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
|
<span>${ButtonConnect}</span>
|
||||||
|
</button>
|
||||||
|
<button is="emby-button" type="button" class="raised button-cancel block">
|
||||||
|
<span>${ButtonCancel}</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
55
src/scripts/addserver.js
Normal file
55
src/scripts/addserver.js
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
define(["appSettings", "loading", "browser", "emby-linkbutton"], function(appSettings, loading, browser) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function handleConnectionResult(page, result) {
|
||||||
|
switch (loading.hide(), result.State) {
|
||||||
|
case "SignedIn":
|
||||||
|
var apiClient = result.ApiClient;
|
||||||
|
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient), Dashboard.navigate("home.html");
|
||||||
|
break;
|
||||||
|
case "ServerSignIn":
|
||||||
|
Dashboard.navigate("login.html?serverid=" + result.Servers[0].Id, !1, "none");
|
||||||
|
break;
|
||||||
|
case "ServerSelection":
|
||||||
|
Dashboard.navigate("selectserver.html", !1, "none");
|
||||||
|
break;
|
||||||
|
case "ServerUpdateNeeded":
|
||||||
|
Dashboard.alert({
|
||||||
|
message: Globalize.translate("ServerUpdateNeeded", '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "Unavailable":
|
||||||
|
Dashboard.alert({
|
||||||
|
message: Globalize.translate("MessageUnableToConnectToServer"),
|
||||||
|
title: Globalize.translate("HeaderConnectionFailure")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitManualServer(page) {
|
||||||
|
var host = page.querySelector("#txtServerHost").value,
|
||||||
|
port = page.querySelector("#txtServerPort").value;
|
||||||
|
port && (host += ":" + port), loading.show(), ConnectionManager.connectToAddress(host, {
|
||||||
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
|
}).then(function(result) {
|
||||||
|
handleConnectionResult(page, result)
|
||||||
|
}, function() {
|
||||||
|
handleConnectionResult(page, {
|
||||||
|
State: "Unavailable"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(view, params) {
|
||||||
|
view.querySelector(".manualServerForm").addEventListener("submit", onManualServerSubmit)
|
||||||
|
function onManualServerSubmit(e) {
|
||||||
|
return submitManualServer(view), e.preventDefault(), !1
|
||||||
|
}
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
require(["appRouter"], function(appRouter) {
|
||||||
|
appRouter.back()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -375,12 +375,12 @@ var Dashboard = {
|
||||||
autoFocus: !1,
|
autoFocus: !1,
|
||||||
roles: "admin"
|
roles: "admin"
|
||||||
}), defineRoute({
|
}), defineRoute({
|
||||||
path: "/connectlogin.html",
|
path: "/addserver.html",
|
||||||
dependencies: ["emby-button", "emby-input"],
|
dependencies: ["emby-button", "emby-input"],
|
||||||
autoFocus: !1,
|
autoFocus: !1,
|
||||||
anonymous: !0,
|
anonymous: !0,
|
||||||
startup: !0,
|
startup: !0,
|
||||||
controller: "scripts/connectlogin"
|
controller: "scripts/addserver"
|
||||||
}), defineRoute({
|
}), defineRoute({
|
||||||
path: "/dashboard.html",
|
path: "/dashboard.html",
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="padded-top padded-left padded-right flex flex-shrink-zero justify-content-center verticalSection flex-wrap-wrap" style="margin-left:auto;margin-right:auto;">
|
<div class="padded-top padded-left padded-right flex flex-shrink-zero justify-content-center verticalSection flex-wrap-wrap" style="margin-left:auto;margin-right:auto;">
|
||||||
<a is="emby-linkbutton" href="connectlogin.html?mode=manualserver" class="raised block cancel btnAddServer flex-shrink-zero" style="margin: .25em;">
|
<a is="emby-linkbutton" href="addserver.html" class="raised block cancel btnAddServer flex-shrink-zero" style="margin: .25em;">
|
||||||
<span>${ButtonAddServer}</span>
|
<span>${ButtonAddServer}</span>
|
||||||
</a>
|
</a>
|
||||||
<button is="emby-button" type="button" class="raised block cancel btnOffline hide flex-shrink-zero" style="margin: .25em;">
|
<button is="emby-button" type="button" class="raised block cancel btnOffline hide flex-shrink-zero" style="margin: .25em;">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue