diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-03-10 01:51:13 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-03-10 01:51:13 -0500 |
commit | 563eb26487113d69421e16ad08d115c0e41c00a7 (patch) | |
tree | 9a0657231e20f1c4270d0645b2f50c1f3002cce4 /src/SMAPI.Web/Views/LogParser/Index.cshtml | |
parent | 810be1fbc71c7808dbdfc5210eb8816d0ad21110 (diff) | |
parent | f836caec3391d1f2e583ee1df6fcaafd284c796d (diff) | |
download | SMAPI-563eb26487113d69421e16ad08d115c0e41c00a7.tar.gz SMAPI-563eb26487113d69421e16ad08d115c0e41c00a7.tar.bz2 SMAPI-563eb26487113d69421e16ad08d115c0e41c00a7.zip |
Merge pull request #626 from danvolchek/log-parser-sections
Add sections to the log parser
Diffstat (limited to 'src/SMAPI.Web/Views/LogParser/Index.cshtml')
-rw-r--r-- | src/SMAPI.Web/Views/LogParser/Index.cshtml | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 21adf35b..aa37fef2 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -27,6 +27,7 @@ logStarted: new Date(@Json.Serialize(Model.ParsedLog?.Timestamp)), showPopup: @Json.Serialize(Model.ParsedLog == null), showMods: @Json.Serialize(Model.ParsedLog?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, slug => true), noFormatting), + showSections: @Json.Serialize(Enum.GetNames(typeof(LogSection)).ToDictionary(section => section, section => false), noFormatting), showLevels: @Json.Serialize(defaultFilters, noFormatting), enableFilters: @Json.Serialize(!Model.ShowRaw) }, '@Model.SectionUrl'); @@ -261,16 +262,34 @@ else if (Model.ParsedLog?.IsValid == true) @foreach (var message in Model.ParsedLog.Messages) { string levelStr = message.Level.ToString().ToLower(); + string sectionStartClass = message.IsStartOfSection ? "section-start" : null; - <tr class="@levelStr mod" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> + // filter the message by section if it has one + string sectionFilter = message.Section != null ? $"&& sectionsAllow('{message.Section}')" : null; + // always show the first message in the section regardless of section filters + string sectionsAllow = message.IsStartOfSection ? null : sectionFilter; + + <tr class="@levelStr mod @sectionStartClass" + @if (message.IsStartOfSection) + { + <text>v-on:click="toggleSection('@message.Section')"</text> + } + v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr') @sectionsAllow"> <td v-pre>@message.Time</td> <td v-pre>@message.Level.ToString().ToUpper()</td> <td v-pre data-title="@message.Mod">@message.Mod</td> - <td v-pre>@message.Text</td> + <td> + <span v-pre class="log-message-text">@message.Text</span> + @if (message.IsStartOfSection) + { + <span class="section-toggle-message" v-show="!sectionsAllow('@message.Section')">This section is hidden. Click here to show it.</span> + <span class="section-toggle-message" v-show="sectionsAllow('@message.Section')">This section is shown. Click here to hide it.</span> + } + </td> </tr> if (message.Repeated > 0) { - <tr class="@levelStr mod mod-repeat" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> + <tr class="@levelStr mod mod-repeat" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr') @sectionsAllow"> <td colspan="3"></td> <td v-pre><i>repeats [@message.Repeated] times.</i></td> </tr> |