added HybridEnabled field to Site table to indicate if .NET MAUI hybrid applications can be integrated
This commit is contained in:
parent
08f691ee0d
commit
2e4656ae8b
|
@ -311,7 +311,7 @@
|
||||||
<Section Name="Hosting" Heading="Hosting Model" ResourceKey="Hosting">
|
<Section Name="Hosting" Heading="Hosting Model" ResourceKey="Hosting">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="runtime" HelpText="The Blazor runtime hosting model" ResourceKey="Runtime">Runtime: </Label>
|
<Label Class="col-sm-3" For="runtime" HelpText="The Blazor runtime hosting model for the site" ResourceKey="Runtime">Runtime: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select id="runtime" class="form-select" @bind="@_runtime" required>
|
<select id="runtime" class="form-select" @bind="@_runtime" required>
|
||||||
<option value="Server">@SharedLocalizer["BlazorServer"]</option>
|
<option value="Server">@SharedLocalizer["BlazorServer"]</option>
|
||||||
|
@ -328,6 +328,15 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="hybridenabled" HelpText="Specifies if the site can be integrated with an external .NET MAUI hybrid application" ResourceKey="HybridEnabled">Hybrid Enabled? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="hybridenabled" class="form-select" @bind="@_hybridenabled" required>
|
||||||
|
<option value="True">@SharedLocalizer["Yes"]</option>
|
||||||
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
<Section Name="TenantInformation" Heading="Database" ResourceKey="TenantInformation">
|
<Section Name="TenantInformation" Heading="Database" ResourceKey="TenantInformation">
|
||||||
|
@ -407,6 +416,7 @@
|
||||||
private string _defaultalias;
|
private string _defaultalias;
|
||||||
private string _runtime = "";
|
private string _runtime = "";
|
||||||
private string _prerender = "";
|
private string _prerender = "";
|
||||||
|
private string _hybridenabled = "";
|
||||||
private string _tenant = string.Empty;
|
private string _tenant = string.Empty;
|
||||||
private string _database = string.Empty;
|
private string _database = string.Empty;
|
||||||
private string _connectionstring = string.Empty;
|
private string _connectionstring = string.Empty;
|
||||||
|
@ -490,6 +500,7 @@
|
||||||
// hosting model
|
// hosting model
|
||||||
_runtime = site.Runtime;
|
_runtime = site.Runtime;
|
||||||
_prerender = site.RenderMode.Replace(_runtime, "");
|
_prerender = site.RenderMode.Replace(_runtime, "");
|
||||||
|
_hybridenabled = site.HybridEnabled.ToString();
|
||||||
|
|
||||||
// database
|
// database
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||||
|
@ -622,11 +633,12 @@
|
||||||
// hosting model
|
// hosting model
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||||
{
|
{
|
||||||
if (site.Runtime != _runtime || site.RenderMode != _runtime + _prerender)
|
if (site.Runtime != _runtime || site.RenderMode != _runtime + _prerender || site.HybridEnabled != bool.Parse(_hybridenabled))
|
||||||
{
|
{
|
||||||
site.Runtime = _runtime;
|
site.Runtime = _runtime;
|
||||||
site.RenderMode = _runtime + _prerender;
|
site.RenderMode = _runtime + _prerender;
|
||||||
reload = true; // needs to be reloaded on server
|
site.HybridEnabled = bool.Parse(_hybridenabled);
|
||||||
|
reload = true; // needs to be reloaded on serve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@
|
||||||
<value>Prerender? </value>
|
<value>Prerender? </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Runtime.HelpText" xml:space="preserve">
|
<data name="Runtime.HelpText" xml:space="preserve">
|
||||||
<value>The Blazor runtime hosting model</value>
|
<value>The Blazor runtime hosting model for the site</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Runtime.Text" xml:space="preserve">
|
<data name="Runtime.Text" xml:space="preserve">
|
||||||
<value>Runtime: </value>
|
<value>Runtime: </value>
|
||||||
|
@ -417,4 +417,10 @@
|
||||||
<data name="UploadableFileExtensions.Text" xml:space="preserve">
|
<data name="UploadableFileExtensions.Text" xml:space="preserve">
|
||||||
<value>Uploadable File Extensions:</value>
|
<value>Uploadable File Extensions:</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="HybridEnabled.HelpText" xml:space="preserve">
|
||||||
|
<value>Specifies if the site can be integrated with an external .NET MAUI hybrid application</value>
|
||||||
|
</data>
|
||||||
|
<data name="HybridEnabled.Text" xml:space="preserve">
|
||||||
|
<value>Hybrid Enabled?</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -119,7 +119,7 @@ namespace Oqtane.Controllers
|
||||||
var assemblyList = new List<ClientAssembly>();
|
var assemblyList = new List<ClientAssembly>();
|
||||||
|
|
||||||
var site = _sites.GetSite(alias.SiteId);
|
var site = _sites.GetSite(alias.SiteId);
|
||||||
if (site != null && site.Runtime == "WebAssembly")
|
if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled))
|
||||||
{
|
{
|
||||||
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ namespace Oqtane.Controllers
|
||||||
private byte[] GetZIP(string list, Alias alias)
|
private byte[] GetZIP(string list, Alias alias)
|
||||||
{
|
{
|
||||||
var site = _sites.GetSite(alias.SiteId);
|
var site = _sites.GetSite(alias.SiteId);
|
||||||
if (site != null && site.Runtime == "WebAssembly")
|
if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled))
|
||||||
{
|
{
|
||||||
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
|
||||||
|
|
|
@ -555,6 +555,7 @@ namespace Oqtane.Infrastructure
|
||||||
SiteTemplateType = install.SiteTemplate,
|
SiteTemplateType = install.SiteTemplate,
|
||||||
Runtime = (!string.IsNullOrEmpty(install.Runtime)) ? install.Runtime : _configManager.GetSection("Runtime").Value,
|
Runtime = (!string.IsNullOrEmpty(install.Runtime)) ? install.Runtime : _configManager.GetSection("Runtime").Value,
|
||||||
RenderMode = (!string.IsNullOrEmpty(install.RenderMode)) ? install.RenderMode : _configManager.GetSection("RenderMode").Value,
|
RenderMode = (!string.IsNullOrEmpty(install.RenderMode)) ? install.RenderMode : _configManager.GetSection("RenderMode").Value,
|
||||||
|
HybridEnabled = false
|
||||||
};
|
};
|
||||||
site = sites.AddSite(site);
|
site = sites.AddSite(site);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Oqtane.Databases.Interfaces;
|
||||||
|
using Oqtane.Migrations.EntityBuilders;
|
||||||
|
using Oqtane.Repository;
|
||||||
|
|
||||||
|
namespace Oqtane.Migrations.Tenant
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TenantDBContext))]
|
||||||
|
[Migration("Tenant.05.00.01.00")]
|
||||||
|
public class AddSiteHybridEnabled : MultiDatabaseMigration
|
||||||
|
{
|
||||||
|
public AddSiteHybridEnabled(IDatabase database) : base(database)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
siteEntityBuilder.AddBooleanColumn("HybridEnabled", true);
|
||||||
|
siteEntityBuilder.UpdateColumn("HybridEnabled", "0", "bool", ""); // default to false
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
|
siteEntityBuilder.DropColumn("HybridEnabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,6 +78,11 @@ namespace Oqtane.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RenderMode { get; set; }
|
public string RenderMode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if a site can be integrated with an external .NET MAUI hybrid application
|
||||||
|
/// </summary>
|
||||||
|
public bool HybridEnabled { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keeps track of site configuration changes and is used by the ISiteMigration interface
|
/// Keeps track of site configuration changes and is used by the ISiteMigration interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user