Done the auth, cp, logs and sidebar for #72

This commit is contained in:
tidusjar 2016-04-14 23:03:33 +01:00
commit 7c7142c8b5
7 changed files with 124 additions and 134 deletions

View file

@ -1,7 +1,16 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
var baseUrl = Html.GetBaseUrl();
var formAction = "/admin/authentication";
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
formAction = "/" + baseUrl.ToHtmlString() + formAction;
}
}
<div class="col-sm-8 col-sm-push-1">
<form class="form-horizontal" method="POST" action="/admin/authentication" id="mainForm">
<form class="form-horizontal" method="POST" action="@formAction" id="mainForm">
<fieldset>
<legend>Authentication Settings</legend>
@ -100,21 +109,24 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
if ($('#PlexAuthToken')) {
loadUserList();
}
$('#refreshUsers').click(function () {
$('#refreshUsers').click(function (e) {
e.preventDefault();
loadUserList();
});
$('#requestToken').click(function (e) {
e.preventDefault();
var url = createBaseUrl(base, "admin/requestauth");
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
url: "requestauth",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {
@ -136,9 +148,12 @@
function loadUserList() {
$('#users').html("");
var url = "admin/getusers";
url = createBaseUrl(base, url);
$.ajax({
type: "Get",
url: "getusers",
url: url,
dataType: "json",
success: function (response) {
if (response.length > 1) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -108,15 +109,19 @@
<script>
$(function() {
var baseUrl = '@Html.GetBaseUrl()';
@if (!string.IsNullOrEmpty(Model.ProfileId))
{
<text>
var qualitySelected = '@Model.ProfileId';
var $form = $("#mainForm");
var url = 'cpprofiles';
url = createBaseUrl(baseUrl, url);
$.ajax({
type: $form.prop("method"),
data: $form.serialize(),
url: "cpprofiles",
url: url,
dataType: "json",
success: function(response) {
response.list.forEach(function(result) {
@ -139,10 +144,12 @@
$('#getProfiles').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var url = "admin/cpprofiles";
url = createBaseUrl(baseUrl, url);
$.ajax({
type: $form.prop("method"),
data: $form.serialize(),
url: "cpprofiles",
url: url,
dataType: "json",
success: function (response) {
response.list.forEach(function (result) {
@ -159,10 +166,11 @@
$('#testCp').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var url = createBaseUrl(baseUrl,"/test/cp");
url = createBaseUrl(baseUrl, url);
$.ajax({
type: $form.prop("method"),
url: "/test/cp",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {

View file

@ -2,11 +2,19 @@
@Html.Partial("_Sidebar")
@Html.LoadLogsAssets()
@{
var baseUrl = Html.GetBaseUrl();
var formAction = "/admin/loglevel";
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
formAction = "/" + baseUrl.ToHtmlString() + formAction;
}
}
<div class="col-sm-8 col-sm-push-1">
<fieldset>
<legend>Logs</legend>
<form method="post" id="mainForm" action="/admin/loglevel">
<form method="post" id="mainForm" action="@formAction">
<div class="form-group">
<label for="logLevel" class="control-label">Log Level</label>
<div id="logLevel">
@ -45,9 +53,12 @@
<script>
$(function () {
var baseUrl = '@Html.GetBaseUrl()';
var logsUrl = "/admin/loadlogs";
var url = createBaseUrl(baseUrl, logsUrl);
$('#example').DataTable({
"ajax": "/admin/loadlogs",
"ajax": url,
"columns": [
{ "data": "message" },
{ "data": "logger" },
@ -58,9 +69,11 @@
});
var logUrl = "/admin/loglevel";
logUrl = createBaseUrl(baseUrl, logUrl);
$.ajax({
type: "get",
url: "/admin/loglevel",
url: logUrl,
dataType: "json",
success: function (response) {
$("#select > option").each(function (level) {

View file

@ -1,108 +1,17 @@
<div class="col-lg-3 col-md-3 col-sm-4">
@using PlexRequests.UI.Helpers
<div class="col-lg-3 col-md-3 col-sm-4">
<div class="list-group table-of-contents">
@if (Context.Request.Path == "/admin")
{
<a class="list-group-item active" href="/admin">Plex Request</a>
}
else
{
<a class="list-group-item" href="/admin">Plex Request</a>
}
@if (Context.Request.Path == "/admin/authentication")
{
<a class="list-group-item active" href="/admin/authentication">Authentication</a>
}
else
{
<a class="list-group-item" href="/admin/authentication">Authentication</a>
}
@if (Context.Request.Path == "/admin/plex")
{
<a class="list-group-item active" href="/admin/plex">Plex</a>
}
else
{
<a class="list-group-item" href="/admin/plex">Plex</a>
}
@if (Context.Request.Path == "/admin/couchpotato")
{
<a class="list-group-item active" href="/admin/couchpotato">CouchPotato</a>
}
else
{
<a class="list-group-item" href="/admin/couchpotato">CouchPotato</a>
}
@if (Context.Request.Path == "/admin/sonarr")
{
<a class="list-group-item active" href="/admin/sonarr">Sonarr</a>
}
else
{
<a class="list-group-item" href="/admin/sonarr">Sonarr</a>
}
@if (Context.Request.Path == "/admin/sickrage")
{
<a class="list-group-item active" href="/admin/sickrage">SickRage</a>
}
else
{
<a class="list-group-item" href="/admin/sickrage">SickRage</a>
}
@if (Context.Request.Path == "/admin/headphones")
{
<a class="list-group-item active" href="/admin/headphones">Headphones (Beta)</a>
}
else
{
<a class="list-group-item" href="/admin/headphones">Headphones (Beta)</a>
}
@if (Context.Request.Path == "/admin/emailnotification")
{
<a class="list-group-item active" href="/admin/emailnotification">Email Notifications</a>
}
else
{
<a class="list-group-item" href="/admin/emailnotification">Email Notifications</a>
}
@if (Context.Request.Path == "/admin/pushbulletnotification")
{
<a class="list-group-item active" href="/admin/pushbulletnotification">Pushbullet Notifications</a>
}
else
{
<a class="list-group-item" href="/admin/pushbulletnotification">Pushbullet Notifications</a>
}
@if (Context.Request.Path == "/admin/pushovernotification")
{
<a class="list-group-item active" href="/admin/pushovernotification">Pushover Notifications</a>
}
else
{
<a class="list-group-item" href="/admin/pushovernotification">Pushover Notifications</a>
}
@if (Context.Request.Path == "/admin/logs")
{
<a class="list-group-item active" href="/admin/logs">Logs</a>
}
else
{
<a class="list-group-item" href="/admin/logs">Logs</a>
}
@if (Context.Request.Path == "/admin/status")
{
<a class="list-group-item active" href="/admin/status">Status</a>
}
else
{
<a class="list-group-item" href="/admin/status">Status</a>
}
@Html.GetSidebarUrl(Context, "/admin", "Plex Request")
@Html.GetSidebarUrl(Context, "/admin/authentication", "Authentication")
@Html.GetSidebarUrl(Context, "/admin/plex", "Plex")
@Html.GetSidebarUrl(Context, "/admin/couchpotato", "CouchPotato")
@Html.GetSidebarUrl(Context, "/admin/sonarr", "Sonarr")
@Html.GetSidebarUrl(Context, "/admin/sickrage", "SickRage")
@Html.GetSidebarUrl(Context, "/admin/headphones", "Headphones (Beta)")
@Html.GetSidebarUrl(Context, "/admin/emailnotification", "Email Notifications")
@Html.GetSidebarUrl(Context, "/admin/pushbulletnotification", "Pushbullet Notifications")
@Html.GetSidebarUrl(Context, "/admin/pushovernotification", "Pushover Notifications")
@Html.GetSidebarUrl(Context, "/admin/logs", "Logs")
@Html.GetSidebarUrl(Context, "/admin/status", "Status")
</div>
</div>