made RenderMode configurable
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
@page "/"
|
||||
@namespace Oqtane.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using Microsoft.Extensions.Configuration
|
||||
@inject IConfiguration Configuration
|
||||
@model Oqtane.Pages.HostModel
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@ -22,14 +20,7 @@
|
||||
<body>
|
||||
@(Html.AntiForgeryToken())
|
||||
<app>
|
||||
@if (Configuration.GetSection("Runtime").Value == "WebAssembly")
|
||||
{
|
||||
<component type="typeof(Oqtane.App)" render-mode="Server" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<component type="typeof(Oqtane.App)" render-mode="ServerPrerendered" />
|
||||
}
|
||||
<component type="typeof(Oqtane.App)" render-mode="@Model.RenderMode" />
|
||||
</app>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
@ -52,7 +43,7 @@
|
||||
|
||||
<script src="js/interop.js"></script>
|
||||
|
||||
@if (Configuration.GetSection("Runtime").Value == "WebAssembly")
|
||||
@if (Model.Runtime == "WebAssembly")
|
||||
{
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using System.Reflection;
|
||||
using Oqtane.Repository;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Oqtane.Pages
|
||||
{
|
||||
@ -33,12 +34,24 @@ namespace Oqtane.Pages
|
||||
_languages = languages;
|
||||
}
|
||||
|
||||
public string Runtime = "Server";
|
||||
public RenderMode RenderMode = RenderMode.Server;
|
||||
public string HeadResources = "";
|
||||
public string BodyResources = "";
|
||||
public string Message = "";
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
if (_configuration.GetSection("Runtime").Exists())
|
||||
{
|
||||
Runtime = _configuration.GetSection("Runtime").Value;
|
||||
}
|
||||
|
||||
if (Runtime != "WebAssembly" && _configuration.GetSection("RenderMode").Exists())
|
||||
{
|
||||
RenderMode = (RenderMode)Enum.Parse(typeof(RenderMode), _configuration.GetSection("RenderMode").Value, true);
|
||||
}
|
||||
|
||||
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
||||
foreach (Assembly assembly in assemblies)
|
||||
{
|
||||
|
Reference in New Issue
Block a user