From b0cc403098161ad82b858008e2523e1d2496fc41 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 12 Feb 2022 12:07:13 -0500 Subject: add data-* attributes to log parser for external tools --- .../Framework/LogParsing/Models/LogModInfo.cs | 3 ++ src/SMAPI.Web/ViewModels/LogParserModel.cs | 2 +- src/SMAPI.Web/Views/LogParser/Index.cshtml | 53 ++++++++++++++-------- 3 files changed, 37 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs index 067e4df4..92bfe5c7 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs @@ -35,5 +35,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models /// Whether the mod has an update available. public bool HasUpdate => this.UpdateVersion != null && this.Version != this.UpdateVersion; + + /// Whether the mod is a content pack for another mod. + public bool IsContentPack => !string.IsNullOrWhiteSpace(this.ContentPackFor); } } diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index bea79eae..0b6d7722 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -83,7 +83,7 @@ namespace StardewModdingAPI.Web.ViewModels // group by mod return mods - .Where(mod => mod.ContentPackFor != null) + .Where(mod => mod.IsContentPack) .GroupBy(mod => mod.ContentPackFor) .ToDictionary(group => group.Key, group => group.ToArray()); } diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 993e7244..b54867b1 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -7,6 +7,9 @@ @{ ViewData["Title"] = "SMAPI log parser"; + + ParsedLog log = Model!.ParsedLog; + IDictionary contentPacks = Model.GetContentPacksByMod(); IDictionary defaultFilters = Enum .GetValues(typeof(LogLevel)) @@ -15,7 +18,7 @@ string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true); - ISet screenIds = new HashSet(Model.ParsedLog?.Messages?.Select(p => p.ScreenId) ?? Array.Empty()); + ISet screenIds = new HashSet(log?.Messages?.Select(p => p.ScreenId) ?? Array.Empty()); } @section Head { @@ -35,9 +38,9 @@