mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
added dashboard info page
This commit is contained in:
parent
0073dc3476
commit
1fa7dcdb2b
37
ApiClient.js
37
ApiClient.js
@ -6,19 +6,14 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new api client instance
|
* Creates a new api client instance
|
||||||
* @param {String} serverProtocol
|
* @param {String} serverAddress
|
||||||
* @param {String} serverHostName
|
|
||||||
* @param {String} serverPortNumber
|
|
||||||
* @param {String} clientName
|
* @param {String} clientName
|
||||||
* @param {String} applicationVersion
|
* @param {String} applicationVersion
|
||||||
*/
|
*/
|
||||||
return function (serverProtocol, serverHostName, serverPortNumber, clientName, applicationVersion) {
|
return function (serverAddress, clientName, applicationVersion) {
|
||||||
|
|
||||||
if (!serverProtocol) {
|
if (!serverAddress) {
|
||||||
throw new Error("Must supply a serverProtocol, e.g. http:");
|
throw new Error("Must supply a serverAddress");
|
||||||
}
|
|
||||||
if (!serverHostName) {
|
|
||||||
throw new Error("Must supply serverHostName, e.g. 192.168.1.1 or myServerName");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -28,11 +23,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||||||
var webSocket;
|
var webSocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server host name.
|
* Gets the server address.
|
||||||
*/
|
*/
|
||||||
self.serverHostName = function () {
|
self.serverAddress = function () {
|
||||||
|
|
||||||
return serverHostName;
|
return serverAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,11 +128,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||||||
throw new Error("Url name cannot be empty");
|
throw new Error("Url name cannot be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = serverProtocol + "//" + serverHostName;
|
var url = serverAddress;
|
||||||
|
|
||||||
if (serverPortNumber) {
|
|
||||||
url += ":" + serverPortNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
url += "/mediabrowser/" + name;
|
url += "/mediabrowser/" + name;
|
||||||
|
|
||||||
@ -148,9 +139,9 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.openWebSocket = function (port) {
|
self.openWebSocket = function (webSocketAddress) {
|
||||||
|
|
||||||
var url = "ws://" + serverHostName + ":" + port + "/mediabrowser";
|
var url = webSocketAddress + "/mediabrowser";
|
||||||
|
|
||||||
webSocket = new WebSocket(url);
|
webSocket = new WebSocket(url);
|
||||||
|
|
||||||
@ -3998,7 +3989,13 @@ MediaBrowser.ApiClient.create = function (clientName, applicationVersion) {
|
|||||||
|
|
||||||
var loc = window.location;
|
var loc = window.location;
|
||||||
|
|
||||||
return new MediaBrowser.ApiClient(loc.protocol, loc.hostname, loc.port, clientName, applicationVersion);
|
var address = loc.protocol + '//' + loc.hostname;
|
||||||
|
|
||||||
|
if (loc.port) {
|
||||||
|
address += ':' + loc.port;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new MediaBrowser.ApiClient(address, clientName, applicationVersion);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
|
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
|
<a href="#" data-role="button" class="ui-btn-active">Home</a>
|
||||||
|
<a href="dashboardinfopage.html" data-role="button">Info</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="readOnlyContent">
|
<div class="readOnlyContent">
|
||||||
|
|
||||||
<div data-role="collapsible" data-collapsed="false" style="margin-top: 2em;">
|
<div data-role="collapsible" data-collapsed="false" style="margin-top: 2em;">
|
||||||
@ -67,25 +72,6 @@
|
|||||||
<p><a href="scheduledtasks.html">Manage Scheduled Tasks</a></p>
|
<p><a href="scheduledtasks.html">Manage Scheduled Tasks</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div data-role="collapsible" data-collapsed="true" style="margin-top: 1em;">
|
|
||||||
<h3>Links</h3>
|
|
||||||
<div>
|
|
||||||
<p>Bookmark url: <a id="bookmarkUrl" href="#" data-ajax="false"></a></p>
|
|
||||||
<p class="externalUrl"></p>
|
|
||||||
<p><a href="http://mediabrowser3.com/community" target="_blank">Community</a> - Join us!</p>
|
|
||||||
<p><a href="https://github.com/MediaBrowser/MediaBrowser" target="_blank">Github</a></p>
|
|
||||||
<p><a href="../swagger-ui/index.html" target="_blank">Api Documentation</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-role="collapsible" data-collapsed="true" style="margin-top: 1em;">
|
|
||||||
<h3>System Paths</h3>
|
|
||||||
<div>
|
|
||||||
<p><b>Logs:</b> <span id="logPath"></span></p>
|
|
||||||
<p><b>Images by name:</b> <span id="imagesByNamePath"></span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="display: none; margin-top: 4em;" id="contribute">
|
<div style="display: none; margin-top: 4em;" id="contribute">
|
||||||
<h2>Help improve Media Browser</h2>
|
<h2>Help improve Media Browser</h2>
|
||||||
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr"
|
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr"
|
||||||
|
43
dashboard-ui/dashboardinfopage.html
Normal file
43
dashboard-ui/dashboardinfopage.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dashboard</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="dashboardInfoPage" data-role="page" class="page type-interior adminPage">
|
||||||
|
|
||||||
|
<div data-role="content">
|
||||||
|
<div class="content-primary">
|
||||||
|
<div class="readOnlyContent">
|
||||||
|
|
||||||
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
|
<a href="dashboard.html" data-role="button">Home</a>
|
||||||
|
<a href="#" data-role="button" class="ui-btn-active">Info</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div data-role="collapsible" data-collapsed="false" style="margin-top: 1em;">
|
||||||
|
<h3>Links</h3>
|
||||||
|
<div>
|
||||||
|
<p>Bookmark url: <a id="bookmarkUrl" href="#" data-ajax="false"></a></p>
|
||||||
|
<p class="externalUrl"></p>
|
||||||
|
<p><a href="http://mediabrowser3.com/community" target="_blank">Community</a> - Join us!</p>
|
||||||
|
<p><a href="https://github.com/MediaBrowser/MediaBrowser" target="_blank">Github</a></p>
|
||||||
|
<p><a href="../swagger-ui/index.html" target="_blank">Api Documentation</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div data-role="collapsible" data-collapsed="false" style="margin-top: 1em;">
|
||||||
|
<h3>System Paths</h3>
|
||||||
|
<div>
|
||||||
|
<p><b>Cache:</b> <span id="cachePath"></span></p>
|
||||||
|
<p><b>Images by name:</b> <span id="imagesByNamePath"></span></p>
|
||||||
|
<p><b>Logs:</b> <span id="logPath"></span></p>
|
||||||
|
<p><b>Transcoding temporary files:</b> <span id="transcodingTemporaryPath"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
40
dashboard-ui/scripts/dashboardinfo.js
Normal file
40
dashboard-ui/scripts/dashboardinfo.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
(function ($, document, window) {
|
||||||
|
|
||||||
|
function loadPage(page, systemInfo) {
|
||||||
|
|
||||||
|
$('#cachePath', page).html(systemInfo.CachePath);
|
||||||
|
$('#logPath', page).html(systemInfo.LogPath);
|
||||||
|
$('#imagesByNamePath', page).html(systemInfo.ItemsByNamePath);
|
||||||
|
$('#transcodingTemporaryPath', page).html(systemInfo.TranscodingTempPath);
|
||||||
|
|
||||||
|
var url = ApiClient.serverAddress() + "/mediabrowser";
|
||||||
|
|
||||||
|
$('#bookmarkUrl', page).html(url).attr("href", url);
|
||||||
|
|
||||||
|
if (systemInfo.WanAddress) {
|
||||||
|
|
||||||
|
var externalUrl = systemInfo.WanAddress + "/mediabrowser";
|
||||||
|
|
||||||
|
$('.externalUrl', page).html('External url: <a href="' + externalUrl + '" target="_blank">' + externalUrl + '</a>').show().trigger('create');
|
||||||
|
} else {
|
||||||
|
$('.externalUrl', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('pageshow', "#dashboardInfoPage", function () {
|
||||||
|
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
ApiClient.getSystemInfo().done(function (systemInfo) {
|
||||||
|
|
||||||
|
loadPage(page, systemInfo);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
})(jQuery, document, window);
|
@ -347,15 +347,6 @@
|
|||||||
$('#ports', page).html('Running on ports <b>' + port + '</b> and <b>' + dashboardInfo.SystemInfo.WebSocketPortNumber + '</b>');
|
$('#ports', page).html('Running on ports <b>' + port + '</b> and <b>' + dashboardInfo.SystemInfo.WebSocketPortNumber + '</b>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#logPath', page).html(dashboardInfo.SystemInfo.LogPath);
|
|
||||||
$('#imagesByNamePath', page).html(dashboardInfo.SystemInfo.ItemsByNamePath);
|
|
||||||
|
|
||||||
var host = ApiClient.serverHostName();
|
|
||||||
|
|
||||||
var url = "http://" + host + ":" + port + "/mediabrowser";
|
|
||||||
|
|
||||||
$('#bookmarkUrl', page).html(url).attr("href", url);
|
|
||||||
|
|
||||||
if (dashboardInfo.RunningTasks.filter(function (task) {
|
if (dashboardInfo.RunningTasks.filter(function (task) {
|
||||||
|
|
||||||
return task.Id == dashboardInfo.ApplicationUpdateTaskId;
|
return task.Id == dashboardInfo.ApplicationUpdateTaskId;
|
||||||
@ -373,15 +364,6 @@
|
|||||||
$('.btnRestartContainer', page).addClass('hide');
|
$('.btnRestartContainer', page).addClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dashboardInfo.SystemInfo.WanAddress) {
|
|
||||||
|
|
||||||
var externalUrl = dashboardInfo.SystemInfo.WanAddress + "/mediabrowser";
|
|
||||||
|
|
||||||
$('.externalUrl', page).html('External url: <a href="' + externalUrl + '" target="_blank">' + externalUrl + '</a>').show().trigger('create');
|
|
||||||
} else {
|
|
||||||
$('.externalUrl', page).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
DashboardPage.renderApplicationUpdateInfo(dashboardInfo);
|
DashboardPage.renderApplicationUpdateInfo(dashboardInfo);
|
||||||
DashboardPage.renderPluginUpdateInfo(dashboardInfo);
|
DashboardPage.renderPluginUpdateInfo(dashboardInfo);
|
||||||
DashboardPage.renderPendingInstallations(dashboardInfo.SystemInfo);
|
DashboardPage.renderPendingInstallations(dashboardInfo.SystemInfo);
|
||||||
|
@ -888,16 +888,16 @@
|
|||||||
|
|
||||||
var attributes = [];
|
var attributes = [];
|
||||||
|
|
||||||
if (stream.Language) {
|
if (stream.Language && stream.Type != "Video") {
|
||||||
attributes.push('<span class="mediaInfoAttribute">' + stream.Language + '</span>');
|
attributes.push('<span class="mediaInfoAttribute">' + stream.Language + '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.Codec && stream.Codec != "dca") {
|
if (stream.Codec && stream.Codec != "dca") {
|
||||||
attributes.push('<span class="mediaInfoAttribute">' + stream.Codec + '</span>');
|
attributes.push('<span class="mediaInfoAttribute">' + stream.Codec.toUpperCase() + '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.Profile && stream.Codec == "dca") {
|
if (stream.Profile && stream.Codec == "dca") {
|
||||||
attributes.push('<span class="mediaInfoAttribute">' + stream.Profile + '</span>');
|
attributes.push('<span class="mediaInfoAttribute">' + stream.Profile.toUpperCase() + '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.Width || stream.Height) {
|
if (stream.Width || stream.Height) {
|
||||||
@ -919,7 +919,7 @@
|
|||||||
attributes.push('<span class="mediaInfoAttribute">' + (parseInt(stream.BitRate / 1000)) + ' kbps</span>');
|
attributes.push('<span class="mediaInfoAttribute">' + (parseInt(stream.BitRate / 1000)) + ' kbps</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.IsDefault) {
|
if (stream.IsDefault && stream.Type != "Video") {
|
||||||
attributes.push('<span class="mediaInfoAttribute">Default</span>');
|
attributes.push('<span class="mediaInfoAttribute">Default</span>');
|
||||||
}
|
}
|
||||||
if (stream.IsForced) {
|
if (stream.IsForced) {
|
||||||
|
@ -797,7 +797,21 @@ var Dashboard = {
|
|||||||
|
|
||||||
systemInfo = systemInfo || Dashboard.lastSystemInfo;
|
systemInfo = systemInfo || Dashboard.lastSystemInfo;
|
||||||
|
|
||||||
ApiClient.openWebSocket(systemInfo.WebSocketPortNumber);
|
var location = window.location;
|
||||||
|
|
||||||
|
var webSocketUrl = "ws://" + location.hostname;
|
||||||
|
|
||||||
|
if (systemInfo.HttpServerPortNumber != systemInfo.WebSocketPortNumber) {
|
||||||
|
|
||||||
|
if (location.port) {
|
||||||
|
webSocketUrl += ':' + location.port;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
webSocketUrl += ':' + systemInfo.WebSocketPortNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiClient.openWebSocket(webSocketUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
onWebSocketMessageReceived: function (e, data) {
|
onWebSocketMessageReceived: function (e, data) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.230" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.237" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in New Issue
Block a user