1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

module resolution for appRouter and moved controllers to dir

This commit is contained in:
vitorsemeano 2019-02-24 20:07:41 +00:00
parent d49fee2a29
commit 9c758a8d85
49 changed files with 464 additions and 530 deletions

View file

@ -1,65 +0,0 @@
define(["appSettings", "loading", "browser", "emby-linkbutton"], function(appSettings, loading, browser) {
"use strict";
function handleConnectionResult(page, result) {
loading.hide();
switch (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, false, "none");
break;
case "ServerSelection":
Dashboard.navigate("selectserver.html", false, "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;
var port = page.querySelector("#txtServerPort").value;
if (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);
view.querySelector(".btnCancelManualServer").addEventListener("click", goBack);
function onManualServerSubmit(e) {
submitManualServer(view);
e.preventDefault();
return false;
}
function goBack() {
require(["appRouter"], function(appRouter) {
appRouter.back();
});
}
}
});