diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 09:47:31 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-27 09:47:31 -0400 |
commit | 3e5c109df1f90904c2dcb177e35b35f003e90fd9 (patch) | |
tree | 7c06948b4dd20bacda354e67b81070804eb65ac1 /src/SMAPI.Web/Views | |
parent | cf3728562771b20b66c3f9307a72ae3b19b10bdf (diff) | |
download | SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.tar.gz SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.tar.bz2 SMAPI-3e5c109df1f90904c2dcb177e35b35f003e90fd9.zip |
add log parser option to view raw log
Diffstat (limited to 'src/SMAPI.Web/Views')
-rw-r--r-- | src/SMAPI.Web/Views/LogParser/Index.cshtml | 79 |
1 files changed, 47 insertions, 32 deletions
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 8151c502..f5501fed 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -17,17 +17,18 @@ { <meta name="robots" content="noindex" /> } - <link rel="stylesheet" href="~/Content/css/log-parser.css?r=20180611" /> + <link rel="stylesheet" href="~/Content/css/log-parser.css?r=20180627" /> <script src="https://cdn.jsdelivr.net/npm/vue"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" crossorigin="anonymous"></script> - <script src="~/Content/js/log-parser.js?r=20180611"></script> + <script src="~/Content/js/log-parser.js?r=20180627"></script> <script> $(function() { smapi.logParser({ 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), - showLevels: @Json.Serialize(defaultFilters, noFormatting) + showLevels: @Json.Serialize(defaultFilters, noFormatting), + enableFilters: @Json.Serialize(!Model.ShowRaw) }, '@Model.SectionUrl'); }); </script> @@ -138,12 +139,15 @@ else if (Model.ParsedLog?.IsValid == true) </tr> </table> <br /> - <table id="mods"> + <table id="mods" class="@(Model.ShowRaw ? "filters-disabled" : null)"> <caption> Installed mods: - <span class="notice txt"><i>click any mod to filter</i></span> - <span class="notice btn txt" v-on:click="showAllMods" v-show="stats.modsHidden > 0">show all</span> - <span class="notice btn txt" v-on:click="hideAllMods" v-show="stats.modsShown > 0 && stats.modsHidden > 0">hide all</span> + @if (!Model.ShowRaw) + { + <span class="notice txt"><i>click any mod to filter</i></span> + <span class="notice btn txt" v-on:click="showAllMods" v-show="stats.modsHidden > 0">show all</span> + <span class="notice btn txt" v-on:click="hideAllMods" v-show="stats.modsShown > 0 && stats.modsHidden > 0">hide all</span> + } </caption> @foreach (var mod in Model.ParsedLog.Mods.Where(p => p.ContentPackFor == null)) { @@ -177,36 +181,47 @@ else if (Model.ParsedLog?.IsValid == true) </tr> } </table> - <div id="filters"> - Filter messages: - <span v-bind:class="{ active: showLevels['trace'] }" v-on:click="toggleLevel('trace')">TRACE</span> | - <span v-bind:class="{ active: showLevels['debug'] }" v-on:click="toggleLevel('debug')">DEBUG</span> | - <span v-bind:class="{ active: showLevels['info'] }" v-on:click="toggleLevel('info')">INFO</span> | - <span v-bind:class="{ active: showLevels['alert'] }" v-on:click="toggleLevel('alert')">ALERT</span> | - <span v-bind:class="{ active: showLevels['warn'] }" v-on:click="toggleLevel('warn')">WARN</span> | - <span v-bind:class="{ active: showLevels['error'] }" v-on:click="toggleLevel('error')">ERROR</span> - </div> - <table id="log"> - @foreach (var message in Model.ParsedLog.Messages) - { - string levelStr = message.Level.ToString().ToLower(); + @if (!Model.ShowRaw) + { + <div id="filters"> + Filter messages: + <span v-bind:class="{ active: showLevels['trace'] }" v-on:click="toggleLevel('trace')">TRACE</span> | + <span v-bind:class="{ active: showLevels['debug'] }" v-on:click="toggleLevel('debug')">DEBUG</span> | + <span v-bind:class="{ active: showLevels['info'] }" v-on:click="toggleLevel('info')">INFO</span> | + <span v-bind:class="{ active: showLevels['alert'] }" v-on:click="toggleLevel('alert')">ALERT</span> | + <span v-bind:class="{ active: showLevels['warn'] }" v-on:click="toggleLevel('warn')">WARN</span> | + <span v-bind:class="{ active: showLevels['error'] }" v-on:click="toggleLevel('error')">ERROR</span> + </div> - <tr class="@levelStr mod" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> - <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> - </tr> - if (message.Repeated > 0) + <table id="log"> + @foreach (var message in Model.ParsedLog.Messages) { - <tr class="@levelStr mod mod-repeat" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> - <td colspan="3"></td> - <td v-pre><i>repeats [@message.Repeated] times.</i></td> + string levelStr = message.Level.ToString().ToLower(); + + <tr class="@levelStr mod" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> + <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> </tr> + if (message.Repeated > 0) + { + <tr class="@levelStr mod mod-repeat" v-show="filtersAllow('@Model.GetSlug(message.Mod)', '@levelStr')"> + <td colspan="3"></td> + <td v-pre><i>repeats [@message.Repeated] times.</i></td> + </tr> + } } - } - </table> + </table> + + <small><a href="@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))?raw=true">view raw log</a></small> + } + else + { + <pre v-pre>@Model.ParsedLog.RawText</pre> + <small><a href="@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))">view parsed log</a></small> + } </div> } else if (Model.ParsedLog?.IsValid == false) |