From 3f43ebcc0e31db523fa82a163374cebf2f577cde Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 27 Oct 2017 21:10:36 -0400 Subject: fix issues with subdomain routing in log UI (#358) --- src/SMAPI.Web/ViewModels/LogParserModel.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/SMAPI.Web/ViewModels/LogParserModel.cs (limited to 'src/SMAPI.Web/ViewModels') diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs new file mode 100644 index 00000000..ba31db87 --- /dev/null +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -0,0 +1,26 @@ +namespace StardewModdingAPI.Web.ViewModels +{ + /// The view model for the log parser page. + public class LogParserModel + { + /********* + ** Accessors + *********/ + /// The root URL for the log parser controller. + public string SectionUrl { get; set; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + public LogParserModel() { } + + /// Construct an instance. + /// The root URL for the log parser controller. + public LogParserModel(string sectionUrl) + { + this.SectionUrl = sectionUrl; + } + } +} -- cgit From fe5b2f62da27ac0e2ddf60240f2b19cf2a404f69 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 28 Oct 2017 12:38:30 -0400 Subject: prettify log URL, read paste ID serverside (#358) --- src/SMAPI.Web/Controllers/LogParserController.cs | 6 +++-- src/SMAPI.Web/ViewModels/LogParserModel.cs | 7 +++++- src/SMAPI.Web/Views/LogParser/Index.cshtml | 28 +++++++++++++----------- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 21 +++++++----------- 4 files changed, 33 insertions(+), 29 deletions(-) (limited to 'src/SMAPI.Web/ViewModels') diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs index ee1d51cd..f9943707 100644 --- a/src/SMAPI.Web/Controllers/LogParserController.cs +++ b/src/SMAPI.Web/Controllers/LogParserController.cs @@ -42,11 +42,13 @@ namespace StardewModdingAPI.Web.Controllers ** Web UI ***/ /// Render the log parser UI. + /// The paste ID. [HttpGet] [Route("log")] - public ViewResult Index() + [Route("log/{id}")] + public ViewResult Index(string id = null) { - return this.View("Index", new LogParserModel(this.Config.SectionUrl)); + return this.View("Index", new LogParserModel(this.Config.SectionUrl, id)); } /*** diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index ba31db87..b5b3b14c 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -9,6 +9,9 @@ namespace StardewModdingAPI.Web.ViewModels /// The root URL for the log parser controller. public string SectionUrl { get; set; } + /// The paste ID. + public string PasteID { get; set; } + /********* ** Public methods @@ -18,9 +21,11 @@ namespace StardewModdingAPI.Web.ViewModels /// Construct an instance. /// The root URL for the log parser controller. - public LogParserModel(string sectionUrl) + /// The paste ID. + public LogParserModel(string sectionUrl, string pasteID) { this.SectionUrl = sectionUrl; + this.PasteID = pasteID; } } } diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index bd47f2ff..a84866c8 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -10,7 +10,7 @@ } @@ -21,17 +21,19 @@

This page lets you upload, view, and share a SMAPI log to help troubleshoot mod issues.

-

Parsed log

- - +@if (Model.PasteID != null) +{ +

Parsed log

+ +}