summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Views
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-09 13:08:38 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-09 13:08:38 -0400
commitccf760452d64e1965c92c5cf8af399a5e80d5a3a (patch)
tree206df941f3d88d882387e8cfd66833d0338f5c38 /src/SMAPI.Web/Views
parent260dbbf205bfa86c76a999ccd00e01941e9ce469 (diff)
downloadSMAPI-ccf760452d64e1965c92c5cf8af399a5e80d5a3a.tar.gz
SMAPI-ccf760452d64e1965c92c5cf8af399a5e80d5a3a.tar.bz2
SMAPI-ccf760452d64e1965c92c5cf8af399a5e80d5a3a.zip
pass data directly to script instead of serializing & deserializing it
Diffstat (limited to 'src/SMAPI.Web/Views')
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index 8f44b4a2..ff8aa003 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -44,13 +44,6 @@
<link rel="stylesheet" href="~/Content/css/log-parser.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3/dist/css/tabby-ui-vertical.min.css" />
- @if (!Model.ShowRaw)
- {
- <script id="logSections" type="application/json">@this.ForJson(logSections)</script>
- <script id="logLevels" type="application/json">@this.ForJson(logLevels)</script>
- <script id="parsedMessages" type="application/json">@this.ForJson(log?.Messages)</script>
- <script id="modSlugs" type="application/json">@this.ForJson(log?.Mods?.DistinctBy(m => m.Name).ToDictionary(m => m.Name, m => Model.GetSlug(m.Name)))</script>
- }
<script src="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1" crossorigin="anonymous"></script>
@@ -58,15 +51,33 @@
<script src="~/Content/js/log-parser.js"></script>
<script>
$(function() {
- smapi.logParser({
- 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, _ => true)),
- showSections: @this.ForJson(Enum.GetNames(typeof(LogSection)).ToDictionary(section => section, _ => false)),
- showLevels: @this.ForJson(defaultFilters),
- enableFilters: @this.ForJson(!Model.ShowRaw),
- screenIds: @this.ForJson(screenIds)
- }, '@this.Url.PlainAction("Index", "LogParser", values: null)');
+ smapi.logParser(
+ {
+ logStarted: new Date(@this.ForJson(log?.Timestamp)),
+ @if (!Model.ShowRaw)
+ {
+ <text>
+ data: {
+ messages: @this.ForJson(log?.Messages),
+ sections: @this.ForJson(logSections),
+ logLevels: @this.ForJson(logLevels),
+ modSlugs: @this.ForJson(log?.Mods?.DistinctBy(p => p.Name).Select(p => new { p.Name, Slug = Model.GetSlug(p.Name) }).Where(p => p.Name != p.Slug).ToDictionary(p => p.Name, p => p.Slug)),
+ screenIds: @this.ForJson(screenIds)
+ },
+ </text>
+ }
+ else
+ {
+ <text>data: null,</text>
+ }
+ showPopup: @this.ForJson(log == null),
+ showMods: @this.ForJson(log?.Mods?.Select(p => Model.GetSlug(p.Name)).Distinct().ToDictionary(slug => slug, _ => true)),
+ showSections: @this.ForJson(Enum.GetNames(typeof(LogSection)).ToDictionary(section => section, _ => false)),
+ showLevels: @this.ForJson(defaultFilters),
+ enableFilters: @this.ForJson(!Model.ShowRaw)
+ },
+ "@this.Url.PlainAction("Index", "LogParser", values: null)"
+ );
new Tabby('[data-tabs]');
});