Merge pull request #1667 from sbwalker/dev
improved method for determining Runtime in SiteRouter
This commit is contained in:
commit
9065bad2bb
|
@ -15,7 +15,7 @@
|
||||||
{
|
{
|
||||||
<CascadingAuthenticationState>
|
<CascadingAuthenticationState>
|
||||||
<CascadingValue Value="@PageState">
|
<CascadingValue Value="@PageState">
|
||||||
<SiteRouter OnStateChange="@ChangeState" />
|
<SiteRouter Runtime="@Runtime" OnStateChange="@ChangeState" />
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
</CascadingAuthenticationState>
|
</CascadingAuthenticationState>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
@using System.Diagnostics.CodeAnalysis
|
@using System.Diagnostics.CodeAnalysis
|
||||||
@using System.Runtime.InteropServices
|
|
||||||
@namespace Oqtane.UI
|
@namespace Oqtane.UI
|
||||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@inject SiteState SiteState
|
@inject SiteState SiteState
|
||||||
|
@ -16,11 +15,13 @@
|
||||||
@DynamicComponent
|
@DynamicComponent
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
private string _absoluteUri;
|
private string _absoluteUri;
|
||||||
private bool _navigationInterceptionEnabled;
|
private bool _navigationInterceptionEnabled;
|
||||||
private PageState _pagestate;
|
private PageState _pagestate;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Runtime { get; set; }
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
PageState PageState { get; set; }
|
PageState PageState { get; set; }
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
var editmode = false;
|
var editmode = false;
|
||||||
var refresh = UI.Refresh.None;
|
var refresh = UI.Refresh.None;
|
||||||
var lastsyncdate = DateTime.UtcNow.AddHours(-1);
|
var lastsyncdate = DateTime.UtcNow.AddHours(-1);
|
||||||
var runtime = GetRuntime();
|
var runtime = (Shared.Runtime)Enum.Parse(typeof(Shared.Runtime), Runtime);
|
||||||
|
|
||||||
Uri uri = new Uri(_absoluteUri);
|
Uri uri = new Uri(_absoluteUri);
|
||||||
|
|
||||||
|
@ -426,7 +427,7 @@
|
||||||
if ((module.PageId == page.PageId || module.ModuleId == moduleid))
|
if ((module.PageId == page.PageId || module.ModuleId == moduleid))
|
||||||
{
|
{
|
||||||
var typename = Constants.ErrorModule;
|
var typename = Constants.ErrorModule;
|
||||||
if (module.ModuleDefinition != null && (module.ModuleDefinition.Runtimes == "" || module.ModuleDefinition.Runtimes.Contains(GetRuntime().ToString())))
|
if (module.ModuleDefinition != null && (module.ModuleDefinition.Runtimes == "" || module.ModuleDefinition.Runtimes.Contains(Runtime)))
|
||||||
{
|
{
|
||||||
typename = module.ModuleDefinition.ControlTypeTemplate;
|
typename = module.ModuleDefinition.ControlTypeTemplate;
|
||||||
|
|
||||||
|
@ -544,10 +545,4 @@
|
||||||
}
|
}
|
||||||
return pageresources;
|
return pageresources;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Oqtane.Shared.Runtime GetRuntime()
|
|
||||||
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
|
|
||||||
? Oqtane.Shared.Runtime.WebAssembly
|
|
||||||
: Oqtane.Shared.Runtime.Server;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user