fix blank page when uploading a log in some cases
This commit is contained in:
parent
d70d449c5c
commit
f65e618cd9
|
@ -3,6 +3,9 @@
|
||||||
* For modders:
|
* For modders:
|
||||||
* Fixed issue where replacing an asset through `asset.AsImage()` or `asset.AsDictionary()` didn't take effect.
|
* Fixed issue where replacing an asset through `asset.AsImage()` or `asset.AsDictionary()` didn't take effect.
|
||||||
|
|
||||||
|
* For the [log parser][]:
|
||||||
|
* Fixed blank page after uploading a log in some cases.
|
||||||
|
|
||||||
## 2.5.1
|
## 2.5.1
|
||||||
* For players:
|
* For players:
|
||||||
* Fixed event error in rare cases.
|
* Fixed event error in rare cases.
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "SMAPI log parser";
|
ViewData["Title"] = "SMAPI log parser";
|
||||||
|
|
||||||
Dictionary<string, LogModInfo[]> contentPacks = Model.ParsedLog?.Mods
|
IDictionary<string, LogModInfo[]> contentPacks = Model.ParsedLog?.Mods
|
||||||
?.GroupBy(mod => mod.ContentPackFor)
|
?.GroupBy(mod => mod.ContentPackFor)
|
||||||
.Where(group => group.Key != null)
|
.Where(group => group.Key != null)
|
||||||
.ToDictionary(group => group.Key, group => group.ToArray());
|
.ToDictionary(group => group.Key, group => group.ToArray());
|
||||||
|
|
||||||
|
Regex slugInvalidCharPattern = new Regex("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
string GetSlug(string modName)
|
||||||
|
{
|
||||||
|
return slugInvalidCharPattern.Replace(modName, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@using System.Text.RegularExpressions
|
||||||
@using Newtonsoft.Json
|
@using Newtonsoft.Json
|
||||||
@using StardewModdingAPI.Web.Framework.LogParsing.Models
|
@using StardewModdingAPI.Web.Framework.LogParsing.Models
|
||||||
@model StardewModdingAPI.Web.ViewModels.LogParserModel
|
@model StardewModdingAPI.Web.ViewModels.LogParserModel
|
||||||
|
@ -19,7 +26,7 @@
|
||||||
smapi.logParser({
|
smapi.logParser({
|
||||||
logStarted: new Date(@Json.Serialize(Model.ParsedLog?.Timestamp)),
|
logStarted: new Date(@Json.Serialize(Model.ParsedLog?.Timestamp)),
|
||||||
showPopup: @Json.Serialize(Model.ParsedLog == null),
|
showPopup: @Json.Serialize(Model.ParsedLog == null),
|
||||||
showMods: @Json.Serialize(Model.ParsedLog?.Mods?.ToDictionary(p => p.Name, p => true), new JsonSerializerSettings { Formatting = Formatting.None }),
|
showMods: @Json.Serialize(Model.ParsedLog?.Mods?.ToDictionary(p => GetSlug(p.Name), p => true), new JsonSerializerSettings { Formatting = Formatting.None }),
|
||||||
showLevels: {
|
showLevels: {
|
||||||
trace: false,
|
trace: false,
|
||||||
debug: false,
|
debug: false,
|
||||||
|
@ -76,8 +83,8 @@
|
||||||
</caption>
|
</caption>
|
||||||
@foreach (var mod in Model.ParsedLog.Mods.Where(p => p.ContentPackFor == null))
|
@foreach (var mod in Model.ParsedLog.Mods.Where(p => p.ContentPackFor == null))
|
||||||
{
|
{
|
||||||
<tr v-on:click="toggleMod('@mod.Name')" class="mod-entry" v-bind:class="{ hidden: !showMods['@mod.Name'] }">
|
<tr v-on:click="toggleMod('@GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@GetSlug(mod.Name)'] }">
|
||||||
<td><input type="checkbox" v-bind:checked="showMods['@mod.Name']" v-if="anyModsHidden" /></td>
|
<td><input type="checkbox" v-bind:checked="showMods['@GetSlug(mod.Name)']" v-if="anyModsHidden" /></td>
|
||||||
<td>
|
<td>
|
||||||
@mod.Name
|
@mod.Name
|
||||||
@if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList))
|
@if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList))
|
||||||
|
|
Loading…
Reference in New Issue