Load the log viewer script from the path it is actually served on
The admin panel sets StaticWebAssetBasePath to _content/<assembly>, so the colocated module is served as /_content/MUnique.OpenMU.Web.AdminPanel/Pages/LogFiles.razor.js. The import asked for "./Pages/LogFiles.razor.js", which resolves against the page url /logfiles and answers 404. The failure is caught and logged, so the viewer still renders - it just never scrolls itself. Build the path from the assembly name the way ThemeSelector and MapEditor already do.
This commit is contained in:
@@ -143,6 +143,11 @@
|
||||
private const int LiveUpdateIntervalMs = 2000;
|
||||
private const string TerminalElementId = "log-terminal";
|
||||
|
||||
// The admin panel publishes its static web assets under _content/<assembly>, so a path relative
|
||||
// to the page url ("./Pages/...") does not resolve. Mirrors ThemeSelector and MapEditor.
|
||||
private static readonly string JsModulePath =
|
||||
$"./_content/{typeof(LogFiles).Assembly.GetName().Name}/Pages/{nameof(LogFiles)}.razor.js";
|
||||
|
||||
private readonly List<FileInfo> _files = new();
|
||||
private FileInfo? _selectedFile;
|
||||
private long _lastFileLength;
|
||||
@@ -187,7 +192,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
this._jsModule = await this.JSRuntime.InvokeAsync<IJSObjectReference>("import", "./Pages/LogFiles.razor.js");
|
||||
this._jsModule = await this.JSRuntime.InvokeAsync<IJSObjectReference>("import", JsModulePath);
|
||||
}
|
||||
catch (JSException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user