diff options
Diffstat (limited to 'src/SMAPI.Web/Views/LogParser')
-rw-r--r-- | src/SMAPI.Web/Views/LogParser/Index.cshtml | 53 |
1 files changed, 33 insertions, 20 deletions
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<string, LogModInfo[]> contentPacks = Model.GetContentPacksByMod(); IDictionary<string, bool> defaultFilters = Enum .GetValues(typeof(LogLevel)) @@ -15,7 +18,7 @@ string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true); - ISet<int> screenIds = new HashSet<int>(Model.ParsedLog?.Messages?.Select(p => p.ScreenId) ?? Array.Empty<int>()); + ISet<int> screenIds = new HashSet<int>(log?.Messages?.Select(p => p.ScreenId) ?? Array.Empty<int>()); } @section Head { @@ -35,9 +38,9 @@ <script> $(function() { smapi.logParser({ - logStarted: new Date(@this.ForJson(Model.ParsedLog?.Timestamp)), - showPopup: @this.ForJson(Model.ParsedLog == null), - showMods: @this.ForJson(Model.ParsedLog?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, slug => true)), + logStarted: new Date(@this.ForJson(log?.Timestamp)), + showPopup: @this.ForJson(log == null), + showMods: @this.ForJson(log?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, slug => true)), showSections: @this.ForJson(Enum.GetNames(typeof(LogSection)).ToDictionary(section => section, section => false)), showLevels: @this.ForJson(defaultFilters), enableFilters: @this.ForJson(!Model.ShowRaw), @@ -67,7 +70,7 @@ else if (Model.ParseError != null) <small v-pre>Error details: @Model.ParseError</small> </div> } -else if (Model.ParsedLog?.IsValid == true) +else if (log?.IsValid == true) { <div class="banner success" v-pre> <strong>Share this link to let someone else see the log:</strong> <code>@curPageUrl</code><br /> @@ -92,7 +95,7 @@ else if (Model.ParsedLog?.IsValid == true) } @* upload new log *@ -@if (Model.ParsedLog == null) +@if (log == null) { <h2>Where do I find my SMAPI log?</h2> <div id="os-instructions"> @@ -157,7 +160,7 @@ else if (Model.ParsedLog?.IsValid == true) </div> <h2>How do I share my log?</h2> - <form action="@this.Url.PlainAction("PostAsync", "LogParser")" method="post"> + <form action="@this.Url.PlainAction("Post", "LogParser")" method="post"> <input id="inputFile" type="file" /> <ol> <li> @@ -174,10 +177,10 @@ else if (Model.ParsedLog?.IsValid == true) } @* parsed log *@ -@if (Model.ParsedLog?.IsValid == true) +@if (log?.IsValid == true) { <div id="output"> - @if (Model.ParsedLog.Mods.Any(mod => mod.HasUpdate)) + @if (log.Mods.Any(mod => mod.HasUpdate)) { <h2>Suggested fixes</h2> <ul id="fix-list"> @@ -185,7 +188,7 @@ else if (Model.ParsedLog?.IsValid == true) Consider updating these mods to fix problems: <table id="updates" class="table"> - @foreach (LogModInfo mod in Model.ParsedLog.Mods.Where(mod => (mod.HasUpdate && mod.ContentPackFor == null) || (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList) && contentPackList.Any(pack => pack.HasUpdate)))) + @foreach (LogModInfo mod in log.Mods.Where(mod => (mod.HasUpdate && !mod.IsContentPack) || (contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList) && contentPackList.Any(pack => pack.HasUpdate)))) { <tr class="mod-entry"> <td> @@ -230,23 +233,33 @@ else if (Model.ParsedLog?.IsValid == true) } <h2>Log info</h2> - <table id="metadata" class="table"> + <table + id="metadata" + class="table" + data-code-mods="@log.Mods.Count(p => !p.IsContentPack)" + data-content-packs="@log.Mods.Count(p => p.IsContentPack)" + data-os="@log.OperatingSystem" + data-game-version="@log.GameVersion" + data-game-path="@log.GamePath" + data-smapi-version="@log.ApiVersion" + data-log-started="@log.Timestamp.UtcDateTime.ToString("O")" + > <caption>Game info:</caption> <tr> <th>Stardew Valley:</th> - <td v-pre>@Model.ParsedLog.GameVersion on @Model.ParsedLog.OperatingSystem</td> + <td v-pre>@log.GameVersion on @log.OperatingSystem</td> </tr> <tr> <th>SMAPI:</th> - <td v-pre>@Model.ParsedLog.ApiVersion</td> + <td v-pre>@log.ApiVersion</td> </tr> <tr> <th>Folder:</th> - <td v-pre>@Model.ParsedLog.GamePath</td> + <td v-pre>@log.GamePath</td> </tr> <tr> <th>Log started:</th> - <td>@Model.ParsedLog.Timestamp.UtcDateTime.ToString("yyyy-MM-dd HH:mm") UTC ({{localTimeStarted}} your time)</td> + <td>@log.Timestamp.UtcDateTime.ToString("yyyy-MM-dd HH:mm") UTC ({{localTimeStarted}} your time)</td> </tr> </table> <br /> @@ -260,7 +273,7 @@ else if (Model.ParsedLog?.IsValid == true) <span class="notice btn txt" v-on:click="hideAllMods" v-bind:class="{ invisible: !anyModsShown || !anyModsHidden }">hide all</span> } </caption> - @foreach (var mod in Model.ParsedLog.Mods.Where(p => p.Loaded && p.ContentPackFor == null)) + @foreach (var mod in log.Mods.Where(p => p.Loaded && !p.IsContentPack)) { <tr v-on:click="toggleMod('@Model.GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@Model.GetSlug(mod.Name)'] }"> <td><input type="checkbox" v-bind:checked="showMods['@Model.GetSlug(mod.Name)']" v-bind:class="{ invisible: !anyModsHidden }" /></td> @@ -317,7 +330,7 @@ else if (Model.ParsedLog?.IsValid == true) </div> <table id="log"> - @foreach (var message in Model.ParsedLog.Messages) + @foreach (var message in log.Messages) { string levelStr = message.Level.ToString().ToLower(); string sectionStartClass = message.IsStartOfSection ? "section-start" : null; @@ -360,7 +373,7 @@ else if (Model.ParsedLog?.IsValid == true) } else { - <pre v-pre>@Model.ParsedLog.RawText</pre> + <pre v-pre>@log.RawText</pre> } <small> @@ -377,8 +390,8 @@ else if (Model.ParsedLog?.IsValid == true) </small> </div> } -else if (Model.ParsedLog?.IsValid == false) +else if (log?.IsValid == false) { <h3>Raw log</h3> - <pre v-pre>@Model.ParsedLog.RawText</pre> + <pre v-pre>@log.RawText</pre> } |