From 1c7fb2e93e4c19b0dff12f9e6bae249f027e1b03 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Tue, 8 Nov 2016 13:35:35 +0000 Subject: [PATCH] Finished #659 #236 has been modified slightly. Needs testing on Different systems --- PlexRequests.Core/Models/StatusModel.cs | 3 +- PlexRequests.Core/PlexRequests.Core.csproj | 1 + .../SettingModels/SystemSettings.cs | 26 +++++++++- .../StatusChecker/StatusChecker.cs | 48 +++++++++++++----- PlexRequests.UI/Content/base.css | 17 +++++++ PlexRequests.UI/Content/base.min.css | 2 +- PlexRequests.UI/Content/base.scss | 22 +++++++-- .../Modules/Admin/SystemStatusModule.cs | 29 ++++++++++- PlexRequests.UI/Views/Admin/Status.cshtml | 49 +++++++++++++------ 9 files changed, 160 insertions(+), 37 deletions(-) diff --git a/PlexRequests.Core/Models/StatusModel.cs b/PlexRequests.Core/Models/StatusModel.cs index 9cbcf644d..ee55ab373 100644 --- a/PlexRequests.Core/Models/StatusModel.cs +++ b/PlexRequests.Core/Models/StatusModel.cs @@ -28,7 +28,8 @@ namespace PlexRequests.Core.Models { public class StatusModel { - public string Version { get; set; } + public string CurrentVersion { get; set; } + public string NewVersion { get; set; } public bool UpdateAvailable { get; set; } public string UpdateUri { get; set; } public string DownloadUri { get; set; } diff --git a/PlexRequests.Core/PlexRequests.Core.csproj b/PlexRequests.Core/PlexRequests.Core.csproj index 064f319e3..2800771ca 100644 --- a/PlexRequests.Core/PlexRequests.Core.csproj +++ b/PlexRequests.Core/PlexRequests.Core.csproj @@ -59,6 +59,7 @@ True + diff --git a/PlexRequests.Core/SettingModels/SystemSettings.cs b/PlexRequests.Core/SettingModels/SystemSettings.cs index fe60baabc..883c32ba8 100644 --- a/PlexRequests.Core/SettingModels/SystemSettings.cs +++ b/PlexRequests.Core/SettingModels/SystemSettings.cs @@ -25,14 +25,38 @@ // ************************************************************************/ #endregion +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using PlexRequests.Core.Models; namespace PlexRequests.Core.SettingModels { public class SystemSettings : Settings { - public bool UseEarlyAccessPreviewBuilds { get; set; } + public Branches Branch { get; set; } public StatusModel Status { get; set; } + + public List BranchDropdown { get; set; } + } + + public class BranchDropdown + { + public bool Selected { get; set; } + public string Name { get; set; } + public Branches Value { get; set; } + } + + public enum Branches + { + [Display(Name = "Stable")] + Stable, + + [Display(Name = "Early Access Preview")] + EarlyAccessPreview, + + [Display(Name = "Development")] + Dev, } } \ No newline at end of file diff --git a/PlexRequests.Core/StatusChecker/StatusChecker.cs b/PlexRequests.Core/StatusChecker/StatusChecker.cs index fcf41f65b..cf009464b 100644 --- a/PlexRequests.Core/StatusChecker/StatusChecker.cs +++ b/PlexRequests.Core/StatusChecker/StatusChecker.cs @@ -59,12 +59,12 @@ namespace PlexRequests.Core.StatusChecker public async Task GetStatus() { var settings = await SystemSettings.GetSettingsAsync(); - var isEap = settings.UseEarlyAccessPreviewBuilds; + var stable = settings.Branch == Branches.Stable; - if (isEap) + if (!stable) { // Early Access Preview Releases - return GetLatestEapRelease(); + return GetAppveyorRelease(settings.Branch); } // Stable releases @@ -76,7 +76,7 @@ namespace PlexRequests.Core.StatusChecker var assemblyVersion = AssemblyHelper.GetProductVersion(); var model = new StatusModel { - Version = assemblyVersion, + CurrentVersion = assemblyVersion, }; var releases = await Git.Repository.Release.GetAll(Owner, RepoName); @@ -84,7 +84,7 @@ namespace PlexRequests.Core.StatusChecker if (latestRelease == null) { - return new StatusModel { Version = "Unknown" }; + return new StatusModel { NewVersion = "Unknown" }; } var latestVersionArray = latestRelease.Name.Split(new[] { 'v' }, StringSplitOptions.RemoveEmptyEntries); var latestVersion = latestVersionArray.Length > 1 ? latestVersionArray[1] : string.Empty; @@ -93,6 +93,7 @@ namespace PlexRequests.Core.StatusChecker { model.UpdateAvailable = true; model.UpdateUri = latestRelease.HtmlUrl; + model.NewVersion = latestVersion; } model.ReleaseNotes = latestRelease.Body; @@ -102,17 +103,27 @@ namespace PlexRequests.Core.StatusChecker return model; } - private StatusModel GetLatestEapRelease() + private StatusModel GetAppveyorRelease(Branches branch) { var request = new ApiRequest(); // Get latest EAP Build var eapBranchRequest = new RestRequest { - Resource = "/projects/tidusjar/requestplex/branch/EAP", Method = Method.GET }; + + switch (branch) + { + case Branches.Dev: + eapBranchRequest.Resource = "/projects/tidusjar/requestplex/branch/dev"; + break; + case Branches.EarlyAccessPreview: + eapBranchRequest.Resource = "/projects/tidusjar/requestplex/branch/EAP"; + break; + } + var api = StringCipher.Decrypt(Api,"Appveyor"); eapBranchRequest.AddHeader("Authorization", $"Bearer {api}"); eapBranchRequest.AddHeader("Content-Type", "application/json"); @@ -139,15 +150,26 @@ namespace PlexRequests.Core.StatusChecker var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}"; - return new StatusModel + var branchDisplay = EnumHelper.GetDisplayValue(branch); + var localVersion = AssemblyHelper.GetProductVersion(); + var localVersionExtended = $"{localVersion.Remove(localVersion.Length - 2, 2)}00"; + + var model = new StatusModel { DownloadUri = downloadLink, - ReleaseNotes = "Early Access Preview (See recent commits for details)", - ReleaseTitle = "Plex Requests Early Access Preview", - Version = branchResult.build.version, - UpdateAvailable = true, - UpdateUri = downloadLink + ReleaseNotes = $"{branchDisplay} (See recent commits for details)", + ReleaseTitle = $"Plex Requests {branchDisplay}", + NewVersion = branchResult.build.version, + UpdateUri = downloadLink, + CurrentVersion = localVersionExtended }; + + if (!localVersionExtended.Equals(branchResult.build.version, StringComparison.CurrentCultureIgnoreCase)) + { + model.UpdateAvailable = true; + } + + return model; } } } \ No newline at end of file diff --git a/PlexRequests.UI/Content/base.css b/PlexRequests.UI/Content/base.css index 7a9495d25..602ee6369 100644 --- a/PlexRequests.UI/Content/base.css +++ b/PlexRequests.UI/Content/base.css @@ -436,3 +436,20 @@ label { position: relative; margin-right: 0; } } +#lightbox { + background-color: grey; + filter: alpha(opacity=50); + /* IE */ + opacity: 0.5; + /* Safari, Opera */ + -moz-opacity: 0.50; + /* FireFox */ + top: 0px; + left: 0px; + z-index: 20; + height: 100%; + width: 100%; + background-repeat: no-repeat; + background-position: center; + position: absolute; } + diff --git a/PlexRequests.UI/Content/base.min.css b/PlexRequests.UI/Content/base.min.css index 583daf53d..5cd192ff8 100644 --- a/PlexRequests.UI/Content/base.min.css +++ b/PlexRequests.UI/Content/base.min.css @@ -1 +1 @@ -@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:15px;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}} \ No newline at end of file +@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:15px;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}}#lightbox{background-color:#808080;filter:alpha(opacity=50);opacity:.5;-moz-opacity:.5;top:0;left:0;z-index:20;height:100%;width:100%;background-repeat:no-repeat;background-position:center;position:absolute;} \ No newline at end of file diff --git a/PlexRequests.UI/Content/base.scss b/PlexRequests.UI/Content/base.scss index e293c9e44..64dd1b83e 100644 --- a/PlexRequests.UI/Content/base.scss +++ b/PlexRequests.UI/Content/base.scss @@ -6,9 +6,7 @@ $info-colour: #5bc0de; $warning-colour: #f0ad4e; $danger-colour: #d9534f; $success-colour: #5cb85c; -$i: -!important -; +$i:!important; @media (min-width: 768px ) { .row { @@ -551,4 +549,20 @@ $border-radius: 10px; position: relative; margin-right: 0; } -} \ No newline at end of file +} + +#lightbox { + + background-color: grey; + filter:alpha(opacity=50); /* IE */ + opacity: 0.5; /* Safari, Opera */ + -moz-opacity:0.50; /* FireFox */ + top: 0px; + left: 0px; + z-index: 20; + height: 100%; + width: 100%; + background-repeat:no-repeat; + background-position:center; + position:absolute; +} diff --git a/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs b/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs index e3a04e39d..05ae0f125 100644 --- a/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs +++ b/PlexRequests.UI/Modules/Admin/SystemStatusModule.cs @@ -26,6 +26,7 @@ #endregion using System; +using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; using MarkdownSharp; @@ -49,8 +50,7 @@ namespace PlexRequests.UI.Modules.Admin SystemSettings = ss; Security.HasPermissionsResponse(Permissions.Administrator); - - + Get["/status", true] = async (x, ct) => await Status(); Post["/save", true] = async (x, ct) => await Save(); @@ -70,6 +70,28 @@ namespace PlexRequests.UI.Modules.Admin settings.Status = status; + settings.BranchDropdown = new List + { + new BranchDropdown + { + Name = EnumHelper.GetDisplayValue(Branches.Stable), + Value = Branches.Stable, + Selected = settings.Branch == Branches.Stable + }, + new BranchDropdown + { + Name = EnumHelper.GetDisplayValue(Branches.EarlyAccessPreview), + Value = Branches.EarlyAccessPreview, + Selected = settings.Branch == Branches.EarlyAccessPreview + }, + new BranchDropdown + { + Name = EnumHelper.GetDisplayValue(Branches.Dev), + Value = Branches.Dev, + Selected = settings.Branch == Branches.Dev + }, + }; + return View["Status", settings]; } @@ -79,6 +101,9 @@ namespace PlexRequests.UI.Modules.Admin await SystemSettings.SaveSettingsAsync(settings); + // Clear the cache + Cache.Remove(CacheKeys.LastestProductVersion); + return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully Saved your settings"}); } diff --git a/PlexRequests.UI/Views/Admin/Status.cshtml b/PlexRequests.UI/Views/Admin/Status.cshtml index 2051ea385..93760a064 100644 --- a/PlexRequests.UI/Views/Admin/Status.cshtml +++ b/PlexRequests.UI/Views/Admin/Status.cshtml @@ -1,30 +1,43 @@ @using PlexRequests.UI.Helpers @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase @Html.Partial("_Sidebar") - +
Status
- - + +
- -
+ + @if (Model.Status.UpdateAvailable) + {
-
+ + +
+ } - @if (Model.UseEarlyAccessPreviewBuilds) - { - - } - else - { - - } + +
+ +
+
@@ -68,6 +81,7 @@ e.preventDefault(); $('body').append(""); $('#autoUpdate').prop("disabled", "disabled"); + document.getElementById("lightbox").style.display = ""; var count = 0; setInterval(function () { count++; @@ -92,10 +106,15 @@ $('#saveSettings').click(function (e) { e.preventDefault(); var $form = $("#mainForm"); + + var branches = $("#branches option:selected").val(); + + var data = $form.serialize(); + data = data + "&branch=" + branches; $.ajax({ type: $form.prop("method"), url: $form.prop("action"), - data: $form.serialize(), + data: data, dataType: "json", success: function (response) { if (response.result === true) {