performance and user experience improvements
This commit is contained in:
parent
1fb58296d8
commit
531cba715e
|
@ -47,7 +47,7 @@ else
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,8 @@ else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
||||||
AddModuleMessage(Localizer["Module Deleted Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
AddModuleMessage(Localizer["Module Deleted Successfully"], MessageType.Success);
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,21 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="defaultAdminContainer" class="form-control" @bind="@_admincontainertype">
|
||||||
|
<option value="-"><@Localizer["Select Container"]></option>
|
||||||
|
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||||
|
@foreach (var container in _containers)
|
||||||
|
{
|
||||||
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="allowRegister" HelpText="Do you want the users to be able to register for an account on the site" ResourceKey="AllowRegistration">Allow User Registration? </Label>
|
<Label For="allowRegister" HelpText="Do you want the users to be able to register for an account on the site" ResourceKey="AllowRegistration">Allow User Registration? </Label>
|
||||||
|
@ -244,6 +259,7 @@
|
||||||
private string _themetype = "-";
|
private string _themetype = "-";
|
||||||
private string _layouttype = "-";
|
private string _layouttype = "-";
|
||||||
private string _containertype = "-";
|
private string _containertype = "-";
|
||||||
|
private string _admincontainertype = "-";
|
||||||
private string _allowregistration;
|
private string _allowregistration;
|
||||||
private string _smtphost = string.Empty;
|
private string _smtphost = string.Empty;
|
||||||
private string _smtpport = string.Empty;
|
private string _smtpport = string.Empty;
|
||||||
|
@ -298,6 +314,7 @@
|
||||||
_layouttype = site.DefaultLayoutType;
|
_layouttype = site.DefaultLayoutType;
|
||||||
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
_containertype = site.DefaultContainerType;
|
_containertype = site.DefaultContainerType;
|
||||||
|
_admincontainertype = site.AdminContainerType;
|
||||||
_allowregistration = site.AllowRegistration.ToString();
|
_allowregistration = site.AllowRegistration.ToString();
|
||||||
|
|
||||||
var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
|
var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
|
||||||
|
@ -365,6 +382,7 @@
|
||||||
}
|
}
|
||||||
_layouttype = "-";
|
_layouttype = "-";
|
||||||
_containertype = "-";
|
_containertype = "-";
|
||||||
|
_admincontainertype = "";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -405,6 +423,7 @@
|
||||||
site.DefaultThemeType = _themetype;
|
site.DefaultThemeType = _themetype;
|
||||||
site.DefaultLayoutType = (_layouttype == "-" ? string.Empty : _layouttype);
|
site.DefaultLayoutType = (_layouttype == "-" ? string.Empty : _layouttype);
|
||||||
site.DefaultContainerType = _containertype;
|
site.DefaultContainerType = _containertype;
|
||||||
|
site.AdminContainerType = _admincontainertype;
|
||||||
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
|
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
|
||||||
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,21 @@ else
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="adminContainer" HelpText="Select the admin container for the site" ResourceKey="AdminContainer">Admin Container: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="adminContainer" class="form-control" @bind="@_admincontainertype">
|
||||||
|
<option value="-"><@Localizer["Select Container"]></option>
|
||||||
|
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||||
|
@foreach (var container in _containers)
|
||||||
|
{
|
||||||
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="siteTemplate" HelpText="Select the site template" ResourceKey="SiteTemplate">Site Template: </Label>
|
<Label For="siteTemplate" HelpText="Select the site template" ResourceKey="SiteTemplate">Site Template: </Label>
|
||||||
|
@ -225,6 +240,7 @@ else
|
||||||
private string _themetype = "-";
|
private string _themetype = "-";
|
||||||
private string _layouttype = "-";
|
private string _layouttype = "-";
|
||||||
private string _containertype = "-";
|
private string _containertype = "-";
|
||||||
|
private string _admincontainertype = "";
|
||||||
private string _sitetemplatetype = "-";
|
private string _sitetemplatetype = "-";
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
@ -278,6 +294,7 @@ else
|
||||||
}
|
}
|
||||||
_layouttype = "-";
|
_layouttype = "-";
|
||||||
_containertype = "-";
|
_containertype = "-";
|
||||||
|
_admincontainertype = "";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -378,6 +395,7 @@ else
|
||||||
config.DefaultTheme = _themetype;
|
config.DefaultTheme = _themetype;
|
||||||
config.DefaultLayout = _layouttype;
|
config.DefaultLayout = _layouttype;
|
||||||
config.DefaultContainer = _containertype;
|
config.DefaultContainer = _containertype;
|
||||||
|
config.DefaultAdminContainer = _admincontainertype;
|
||||||
config.SiteTemplate = _sitetemplatetype;
|
config.SiteTemplate = _sitetemplatetype;
|
||||||
|
|
||||||
ShowProgressIndicator();
|
ShowProgressIndicator();
|
||||||
|
|
|
@ -18,14 +18,6 @@
|
||||||
<input id="name" class="form-control" @bind="@_name" />
|
<input id="name" class="form-control" @bind="@_name" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="tenant" HelpText="Enter the tenant for the site" ResourceKey="Tenant">Tenant: </Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="alias" HelpText="Enter the alias for the server" ResourceKey="Aliases">Aliases: </Label>
|
<Label For="alias" HelpText="Enter the alias for the server" ResourceKey="Aliases">Aliases: </Label>
|
||||||
|
@ -86,6 +78,21 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="defaultAdminContainer" class="form-control" @bind="@_admincontainertype">
|
||||||
|
<option value="-"><@Localizer["Select Container"]></option>
|
||||||
|
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||||
|
@foreach (var container in _containers)
|
||||||
|
{
|
||||||
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="isDeleted" HelpText="Has this site been deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
|
<Label For="isDeleted" HelpText="Has this site been deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
|
||||||
|
@ -97,6 +104,23 @@
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="tenant" HelpText="The tenant for the site" ResourceKey="Tenant">Tenant: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="connectionstring" HelpText="The database connection string" ResourceKey="ConnectionString">Connection String: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea id="connectionstring" class="form-control" @bind="@_connectionstring" rows="3" readonly></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveSite">@Localizer["Save"]</button>
|
<button type="button" class="btn btn-success" @onclick="SaveSite">@Localizer["Save"]</button>
|
||||||
|
@ -114,13 +138,12 @@
|
||||||
private List<ThemeControl> _containers = new List<ThemeControl>();
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private Alias _alias;
|
private Alias _alias;
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
private List<Tenant> _tenantList;
|
|
||||||
private string _tenant = string.Empty;
|
|
||||||
private List<Alias> _aliasList;
|
private List<Alias> _aliasList;
|
||||||
private string _urls = string.Empty;
|
private string _urls = string.Empty;
|
||||||
private string _themetype;
|
private string _themetype;
|
||||||
private string _layouttype;
|
private string _layouttype;
|
||||||
private string _containertype;
|
private string _containertype = "-";
|
||||||
|
private string _admincontainertype = "-";
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
|
@ -128,6 +151,8 @@
|
||||||
private string _deletedby;
|
private string _deletedby;
|
||||||
private DateTime? _deletedon;
|
private DateTime? _deletedon;
|
||||||
private string _isdeleted;
|
private string _isdeleted;
|
||||||
|
private string _tenant = string.Empty;
|
||||||
|
private string _connectionstring = string.Empty;
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
|
@ -144,8 +169,6 @@
|
||||||
if (site != null)
|
if (site != null)
|
||||||
{
|
{
|
||||||
_name = site.Name;
|
_name = site.Name;
|
||||||
_tenantList = await TenantService.GetTenantsAsync();
|
|
||||||
_tenant = _tenantList.Find(item => item.TenantId == site.TenantId).Name;
|
|
||||||
|
|
||||||
foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
|
foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
|
||||||
{
|
{
|
||||||
|
@ -158,6 +181,7 @@
|
||||||
_layouttype = site.DefaultLayoutType;
|
_layouttype = site.DefaultLayoutType;
|
||||||
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
_containertype = site.DefaultContainerType;
|
_containertype = site.DefaultContainerType;
|
||||||
|
_admincontainertype = site.AdminContainerType;
|
||||||
_createdby = site.CreatedBy;
|
_createdby = site.CreatedBy;
|
||||||
_createdon = site.CreatedOn;
|
_createdon = site.CreatedOn;
|
||||||
_modifiedby = site.ModifiedBy;
|
_modifiedby = site.ModifiedBy;
|
||||||
|
@ -166,6 +190,14 @@
|
||||||
_deletedon = site.DeletedOn;
|
_deletedon = site.DeletedOn;
|
||||||
_isdeleted = site.IsDeleted.ToString();
|
_isdeleted = site.IsDeleted.ToString();
|
||||||
|
|
||||||
|
List<Tenant> tenants = await TenantService.GetTenantsAsync();
|
||||||
|
Tenant tenant = tenants.Find(item => item.TenantId == site.TenantId);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
_tenant = tenant.Name;
|
||||||
|
_connectionstring = tenant.DBConnectionString;
|
||||||
|
}
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,6 +225,7 @@
|
||||||
}
|
}
|
||||||
_layouttype = "-";
|
_layouttype = "-";
|
||||||
_containertype = "-";
|
_containertype = "-";
|
||||||
|
_admincontainertype = "";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -228,6 +261,7 @@
|
||||||
site.DefaultThemeType = _themetype;
|
site.DefaultThemeType = _themetype;
|
||||||
site.DefaultLayoutType = _layouttype ?? string.Empty;
|
site.DefaultLayoutType = _layouttype ?? string.Empty;
|
||||||
site.DefaultContainerType = _containertype;
|
site.DefaultContainerType = _containertype;
|
||||||
|
site.AdminContainerType = _admincontainertype;
|
||||||
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
|
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
|
||||||
|
|
||||||
site = await SiteService.UpdateSiteAsync(site);
|
site = await SiteService.UpdateSiteAsync(site);
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
@namespace Oqtane.Modules.Admin.Tenants
|
|
||||||
@inherits ModuleBase
|
|
||||||
@inject NavigationManager NavigationManager
|
|
||||||
@inject ITenantService TenantService
|
|
||||||
@inject IStringLocalizer<Edit> Localizer
|
|
||||||
|
|
||||||
<table class="table table-borderless">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="name" HelpText="The name of the tenant" ResourceKey="Name">Name: </Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if (name == TenantNames.Master)
|
|
||||||
{
|
|
||||||
<input id="name" class="form-control" @bind="@name" readonly />
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<input id="name" class="form-control" @bind="@name" />
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="connectionstring" HelpText="The database connection string" ResourceKey="ConnectionString">Connection String: </Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<textarea id="connectionstring" class="form-control" @bind="@connectionstring" rows="3" readonly></textarea>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveTenant">@Localizer["Save"]</button>
|
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private int tenantid;
|
|
||||||
private string name = string.Empty;
|
|
||||||
private string connectionstring = string.Empty;
|
|
||||||
private string schema = string.Empty;
|
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
tenantid = Int32.Parse(PageState.QueryString["id"]);
|
|
||||||
var tenant = await TenantService.GetTenantAsync(tenantid);
|
|
||||||
if (tenant != null)
|
|
||||||
{
|
|
||||||
name = tenant.Name;
|
|
||||||
connectionstring = tenant.DBConnectionString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.LogError(ex, "Error Loading Tenant {TenantId} {Error}", tenantid, ex.Message);
|
|
||||||
AddModuleMessage(Localizer["Error Loading Tenant"], MessageType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SaveTenant()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
connectionstring = connectionstring.Replace("\\\\", "\\");
|
|
||||||
var tenant = await TenantService.GetTenantAsync(tenantid);
|
|
||||||
if (tenant != null)
|
|
||||||
{
|
|
||||||
tenant.Name = name;
|
|
||||||
tenant.DBConnectionString = connectionstring;
|
|
||||||
|
|
||||||
await TenantService.UpdateTenantAsync(tenant);
|
|
||||||
await logger.LogInformation("Tenant Saved {TenantId}", tenantid);
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.LogError(ex, "Error Saving Tenant {TenantId} {Error}", tenantid, ex.Message);
|
|
||||||
AddModuleMessage(Localizer["Error Saving Tenant"], MessageType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
@namespace Oqtane.Modules.Admin.Tenants
|
|
||||||
@inherits ModuleBase
|
|
||||||
@inject ITenantService TenantService
|
|
||||||
@inject IAliasService AliasService
|
|
||||||
@inject IStringLocalizer<Index> Localizer
|
|
||||||
|
|
||||||
@if (tenants == null)
|
|
||||||
{
|
|
||||||
<p><em>@Localizer["Loading..."]</em></p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<Pager Items="@tenants">
|
|
||||||
<Header>
|
|
||||||
<th style="width: 1px;"> </th>
|
|
||||||
<th style="width: 1px;"> </th>
|
|
||||||
<th>@Localizer["Name"]</th>
|
|
||||||
</Header>
|
|
||||||
<Row>
|
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.TenantId.ToString())" ResourceKey="EditTenant" /></td>
|
|
||||||
<td><ActionDialog Header="Delete Tenant" Message="@Localizer["Are You Sure You Wish To Delete The {0} Tenant?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTenant(context))" Disabled="@(context.Name == TenantNames.Master)" ResourceKey="DeleteTenant" /></td>
|
|
||||||
<td>@context.Name</td>
|
|
||||||
</Row>
|
|
||||||
</Pager>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private List<Tenant> tenants;
|
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
|
||||||
tenants = await TenantService.GetTenantsAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task DeleteTenant(Tenant Tenant)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string message = string.Empty;
|
|
||||||
var aliases = await AliasService.GetAliasesAsync();
|
|
||||||
foreach (var alias in aliases)
|
|
||||||
{
|
|
||||||
if (alias.TenantId == Tenant.TenantId)
|
|
||||||
{
|
|
||||||
message += ", " + alias.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(message))
|
|
||||||
{
|
|
||||||
await TenantService.DeleteTenantAsync(Tenant.TenantId);
|
|
||||||
await logger.LogInformation("Tenant Deleted {Tenant}", Tenant);
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddModuleMessage(Localizer["Tenant Cannot Be Deleted Until The Following Sites Are Deleted: {0}", message.Substring(2)], MessageType.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.LogError(ex, "Error Deleting Tenant {Tenant} {Error}", Tenant, ex.Message);
|
|
||||||
AddModuleMessage(Localizer["Error Deleting Tenant"], MessageType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -49,7 +49,7 @@ else
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,8 @@ else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
|
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
|
||||||
AddModuleMessage(Localizer["Theme Deleted Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
AddModuleMessage(Localizer["Theme Deleted Successfully"], MessageType.Success);
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,43 @@
|
||||||
@typeparam TableItem
|
@typeparam TableItem
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@if (Toolbar == "Top")
|
||||||
|
{
|
||||||
|
<div class="mx-auto text-center">
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(1))><span class="oi oi-media-step-backward" title="first" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_page > _maxPages)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||||
|
@for (int i = _startPage; i <= _endPage; i++)
|
||||||
|
{
|
||||||
|
var pager = i;
|
||||||
|
<button class="btn @((pager == _page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||||
|
@pager
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_endPage < _pages)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(_pages))><span class="oi oi-media-step-forward" title="last" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@if (Format == "Table")
|
@if (Format == "Table")
|
||||||
{
|
{
|
||||||
<table class="@Class">
|
<table class="@Class">
|
||||||
|
@ -35,14 +72,20 @@
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@if (Toolbar == "Bottom")
|
||||||
|
{
|
||||||
<div class="mx-auto text-center">
|
<div class="mx-auto text-center">
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(1))><span class="oi oi-media-step-backward" title="first" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
@if (_page > _maxPages)
|
@if (_page > _maxPages)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
@if (_endPage > 1)
|
@if (_endPage > 1)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||||
@for (int i = _startPage; i <= _endPage; i++)
|
@for (int i = _startPage; i <= _endPage; i++)
|
||||||
{
|
{
|
||||||
var pager = i;
|
var pager = i;
|
||||||
|
@ -50,17 +93,22 @@
|
||||||
@pager
|
@pager
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
@if (_endPage < _pages)
|
@if (_endPage < _pages)
|
||||||
{
|
{
|
||||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||||
|
}
|
||||||
|
@if (_endPage > 1)
|
||||||
|
{
|
||||||
|
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(_pages))><span class="oi oi-media-step-forward" title="last" aria-hidden="true"></span></button>
|
||||||
}
|
}
|
||||||
@if (_endPage > 1)
|
@if (_endPage > 1)
|
||||||
{
|
{
|
||||||
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
@ -74,6 +122,9 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Format { get; set; }
|
public string Format { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Toolbar { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public RenderFragment Header { get; set; }
|
public RenderFragment Header { get; set; }
|
||||||
|
|
||||||
|
@ -104,6 +155,11 @@
|
||||||
Format = "Table";
|
Format = "Table";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(Toolbar))
|
||||||
|
{
|
||||||
|
Toolbar = "Top";
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Class))
|
if (string.IsNullOrEmpty(Class))
|
||||||
{
|
{
|
||||||
if (Format == "Table")
|
if (Format == "Table")
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
|
@namespace Oqtane.Themes.Controls
|
||||||
|
@inherits ThemeControlBase
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Value))
|
@if (!string.IsNullOrWhiteSpace(Value))
|
||||||
{
|
{
|
||||||
<span class="@Value" aria-hidden="true"></span>
|
<span class="@Value" aria-hidden="true"></span>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter()]
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace Oqtane.Themes.Controls
|
|
||||||
{
|
|
||||||
public partial class FontIcon : ComponentBase
|
|
||||||
{
|
|
||||||
[Parameter()]
|
|
||||||
public string Value { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,4 @@
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
|
|
||||||
@inherits MenuItemsBase
|
@inherits MenuItemsBase
|
||||||
|
|
||||||
@if (ParentPage != null)
|
@if (ParentPage != null)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Oqtane.Themes.Controls
|
|
||||||
{
|
|
||||||
public partial class MenuItemsHorizontal : MenuItemsBase
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,4 @@
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
|
|
||||||
@inherits MenuItemsBase
|
@inherits MenuItemsBase
|
||||||
|
|
||||||
@if (ParentPage != null)
|
@if (ParentPage != null)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Oqtane.Themes.Controls
|
|
||||||
{
|
|
||||||
public partial class MenuItemsVertical : MenuItemsBase
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
@namespace Oqtane.UI
|
@namespace Oqtane.UI
|
||||||
|
|
||||||
<CascadingValue Value="@_moduleState">
|
<CascadingValue Value="@_moduleState">
|
||||||
@DynamicComponent
|
@DynamicComponent
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
string container = _moduleState.ContainerType;
|
string container = _moduleState.ContainerType;
|
||||||
if (PageState.ModuleId != -1 && _moduleState.UseAdminContainer)
|
if (PageState.ModuleId != -1 && _moduleState.UseAdminContainer)
|
||||||
{
|
{
|
||||||
container = Constants.DefaultAdminContainer;
|
container = (!string.IsNullOrEmpty(PageState.Site.AdminContainerType)) ? PageState.Site.AdminContainerType : Constants.DefaultAdminContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
|
|
|
@ -101,13 +101,12 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id, int siteid)
|
public void Delete(int id, int siteid)
|
||||||
{
|
{
|
||||||
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, siteid);
|
ModuleDefinition moduledefinition = _moduleDefinitions.GetModuleDefinition(id, siteid);
|
||||||
if (moduledefinition != null )
|
if (moduledefinition != null && Utilities.GetAssemblyName(moduledefinition.ServerManagerType) != "Oqtane.Server")
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(moduledefinition.ServerManagerType) && Utilities.GetAssemblyName(moduledefinition.ServerManagerType) != "Oqtane.Server")
|
// execute uninstall logic or scripts
|
||||||
|
if (!string.IsNullOrEmpty(moduledefinition.ServerManagerType))
|
||||||
{
|
{
|
||||||
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
||||||
|
|
||||||
// execute uninstall logic
|
|
||||||
foreach (Tenant tenant in _tenants.GetTenants())
|
foreach (Tenant tenant in _tenants.GetTenants())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -128,36 +127,47 @@ namespace Oqtane.Controllers
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Delete, "Error Uninstalling {ModuleDefinitionName} For Tenant {Tenant} {Error}", moduledefinition.ModuleDefinitionName, tenant.Name, ex.Message);
|
_logger.Log(LogLevel.Error, this, LogFunction.Delete, "Error Uninstalling {ModuleDefinitionName} For Tenant {Tenant} {Error}", moduledefinition.ModuleDefinitionName, tenant.Name, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// use assets.json to clean up file resources
|
// remove module assets
|
||||||
string assetfilepath = Path.Combine(_environment.WebRootPath, "Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName), "assets.json");
|
string assetpath = Path.Combine(_environment.WebRootPath, "Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName));
|
||||||
if (System.IO.File.Exists(assetfilepath))
|
if (System.IO.File.Exists(Path.Combine(assetpath, "assets.json")))
|
||||||
{
|
{
|
||||||
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(assetfilepath));
|
// use assets.json to clean up file resources
|
||||||
|
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(Path.Combine(assetpath, "assets.json")));
|
||||||
foreach(string asset in assets)
|
foreach(string asset in assets)
|
||||||
{
|
{
|
||||||
if (System.IO.File.Exists(asset))
|
// legacy support for assets that were stored as absolute paths
|
||||||
|
string filepath = asset.StartsWith("\\") ? Path.Combine(_environment.ContentRootPath, asset.Substring(1)) : asset;
|
||||||
|
if (System.IO.File.Exists(filepath))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete(asset);
|
System.IO.File.Delete(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Assets Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Assets Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// attempt to delete assemblies based on naming convention
|
||||||
|
foreach(string asset in Directory.GetFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Utilities.GetTypeName(moduledefinition.ModuleDefinitionName) + "*.*"))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(asset);
|
||||||
|
}
|
||||||
|
_logger.Log(LogLevel.Warning, this, LogFunction.Delete, "Module Assets Removed For {ModuleDefinitionName}. Please Note That Some Assets May Have Been Missed Due To A Missing Asset Manifest. An Asset Manifest Is Only Created If A Module Is Installed From A Nuget Package.", moduledefinition.Name);
|
||||||
|
}
|
||||||
|
|
||||||
// clean up module static resource folder
|
// clean up module static resource folder
|
||||||
string folder = Path.Combine(_environment.WebRootPath, Path.Combine("Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName)));
|
if (Directory.Exists(assetpath))
|
||||||
if (Directory.Exists(folder))
|
|
||||||
{
|
{
|
||||||
Directory.Delete(folder, true);
|
Directory.Delete(assetpath, true);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Resources Folder Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Static Resources Folder Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove module definition
|
// remove module definition
|
||||||
_moduleDefinitions.DeleteModuleDefinition(id, siteid);
|
_moduleDefinitions.DeleteModuleDefinition(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Definition {ModuleDefinitionName} Deleted", moduledefinition.Name);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Definition {ModuleDefinitionName} Deleted", moduledefinition.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// POST api/<controller>?moduleid=x
|
// POST api/<controller>?moduleid=x
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
|
@ -57,28 +57,44 @@ namespace Oqtane.Controllers
|
||||||
Theme theme = themes.Where(item => item.ThemeName == themename).FirstOrDefault();
|
Theme theme = themes.Where(item => item.ThemeName == themename).FirstOrDefault();
|
||||||
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
||||||
{
|
{
|
||||||
// use assets.json to clean up file resources
|
// remove theme assets
|
||||||
string assetfilepath = Path.Combine(_environment.WebRootPath, "Themes", Utilities.GetTypeName(theme.ThemeName), "assets.json");
|
string assetpath = Path.Combine(_environment.WebRootPath, "Themes", Utilities.GetTypeName(theme.ThemeName));
|
||||||
if (System.IO.File.Exists(assetfilepath))
|
if (System.IO.File.Exists(Path.Combine(assetpath, "assets.json")))
|
||||||
{
|
{
|
||||||
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(assetfilepath));
|
// use assets.json to clean up file resources
|
||||||
|
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(Path.Combine(assetpath, "assets.json")));
|
||||||
foreach (string asset in assets)
|
foreach (string asset in assets)
|
||||||
{
|
{
|
||||||
if (System.IO.File.Exists(asset))
|
// legacy support for assets that were stored as absolute paths
|
||||||
|
string filepath = (asset.StartsWith("\\")) ? Path.Combine(_environment.ContentRootPath, asset.Substring(1)) : asset;
|
||||||
|
if (System.IO.File.Exists(filepath))
|
||||||
{
|
{
|
||||||
System.IO.File.Delete(asset);
|
System.IO.File.Delete(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Assets Removed For {ThemeName}", theme.ThemeName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Assets Removed For {ThemeName}", theme.ThemeName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// attempt to delete assemblies based on naming convention
|
||||||
|
foreach (string asset in Directory.GetFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Utilities.GetTypeName(theme.ThemeName) + "*.*"))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(asset);
|
||||||
|
}
|
||||||
|
_logger.Log(LogLevel.Warning, this, LogFunction.Delete, "Theme Assets Removed For {ThemeName}. Please Note That Some Assets May Have Been Missed Due To A Missing Asset Manifest. An Asset Manifest Is Only Created If A Theme Is Installed From A Nuget Package.", theme.ThemeName);
|
||||||
|
}
|
||||||
|
|
||||||
// clean up theme static resource folder
|
// clean up theme static resource folder
|
||||||
string folder = Path.Combine(_environment.WebRootPath, "Themes" , Utilities.GetTypeName(theme.ThemeName));
|
string folder = Path.Combine(_environment.WebRootPath, "Themes" , Utilities.GetTypeName(theme.ThemeName));
|
||||||
if (Directory.Exists(folder))
|
if (Directory.Exists(folder))
|
||||||
{
|
{
|
||||||
Directory.Delete(folder, true);
|
Directory.Delete(folder, true);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Resource Folder Removed For {ThemeName}", theme.ThemeName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Static Resource Folder Removed For {ThemeName}", theme.ThemeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove theme
|
||||||
|
_themes.DeleteTheme(theme.ThemeName);
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Removed For {ThemeName}", theme.ThemeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
public void InstallPackages(string folders)
|
public void InstallPackages(string folders)
|
||||||
{
|
{
|
||||||
if (!InstallPackages(folders, _environment.WebRootPath))
|
if (!InstallPackages(folders, _environment.WebRootPath, _environment.ContentRootPath))
|
||||||
{
|
{
|
||||||
// error installing packages
|
// error installing packages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InstallPackages(string folders, string webRootPath)
|
public static bool InstallPackages(string folders, string webRootPath, string contentRootPath)
|
||||||
{
|
{
|
||||||
bool install = false;
|
bool install = false;
|
||||||
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||||
|
@ -79,6 +79,7 @@ namespace Oqtane.Infrastructure
|
||||||
if (frameworkversion == "" || Version.Parse(Constants.Version).CompareTo(Version.Parse(frameworkversion)) >= 0)
|
if (frameworkversion == "" || Version.Parse(Constants.Version).CompareTo(Version.Parse(frameworkversion)) >= 0)
|
||||||
{
|
{
|
||||||
List<string> assets = new List<string>();
|
List<string> assets = new List<string>();
|
||||||
|
bool manifest = false;
|
||||||
|
|
||||||
// module and theme packages must be in form of name.1.0.0.nupkg
|
// module and theme packages must be in form of name.1.0.0.nupkg
|
||||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||||
|
@ -91,36 +92,41 @@ namespace Oqtane.Infrastructure
|
||||||
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
|
string foldername = Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0];
|
||||||
string filename = Path.GetFileName(entry.FullName);
|
string filename = Path.GetFileName(entry.FullName);
|
||||||
|
|
||||||
|
if (!manifest && filename == "assets.json")
|
||||||
|
{
|
||||||
|
manifest = true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (foldername)
|
switch (foldername)
|
||||||
{
|
{
|
||||||
case "lib":
|
case "lib":
|
||||||
filename = Path.Combine(binFolder, filename);
|
filename = Path.Combine(binFolder, filename);
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
assets.Add(filename);
|
assets.Add(filename.Replace(contentRootPath, ""));
|
||||||
break;
|
break;
|
||||||
case "wwwroot":
|
case "wwwroot":
|
||||||
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("wwwroot/", "").Split('/')));
|
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("wwwroot/", "").Split('/')));
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
assets.Add(filename);
|
assets.Add(filename.Replace(contentRootPath, ""));
|
||||||
break;
|
break;
|
||||||
case "runtimes":
|
case "runtimes":
|
||||||
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
||||||
filename = Path.Combine(binFolder, destSubFolder, filename);
|
filename = Path.Combine(binFolder, destSubFolder, filename);
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
assets.Add(filename);
|
assets.Add(filename.Replace(contentRootPath, ""));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save list of assets
|
// save dynamic list of assets
|
||||||
if (assets.Count != 0)
|
if (!manifest && assets.Count != 0)
|
||||||
{
|
{
|
||||||
string assetfilepath = Path.Combine(webRootPath, folder, name, "assets.json");
|
string manifestpath = Path.Combine(webRootPath, folder, name, "assets.json");
|
||||||
if (File.Exists(assetfilepath))
|
if (File.Exists(manifestpath))
|
||||||
{
|
{
|
||||||
File.Delete(assetfilepath);
|
File.Delete(manifestpath);
|
||||||
}
|
}
|
||||||
File.WriteAllText(assetfilepath, JsonSerializer.Serialize(assets));
|
File.WriteAllText(manifestpath, JsonSerializer.Serialize(assets));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ namespace Oqtane.Infrastructure
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// auto registration
|
// auto registration - does not run on initial installation but will run after restart
|
||||||
job = new Job { JobType = jobTypeName };
|
job = new Job { JobType = jobTypeName };
|
||||||
// optional properties
|
// optional properties
|
||||||
var jobType = Type.GetType(jobTypeName);
|
var jobType = Type.GetType(jobTypeName);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.00.01.sql" />
|
<EmbeddedResource Include="Scripts\Tenant.02.00.00.01.sql" />
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.01.01.sql" />
|
<EmbeddedResource Include="Scripts\Tenant.02.00.01.01.sql" />
|
||||||
<EmbeddedResource Include="Scripts\Tenant.02.00.01.02.sql" />
|
<EmbeddedResource Include="Scripts\Tenant.02.00.01.02.sql" />
|
||||||
|
<EmbeddedResource Include="Scripts\Tenant.02.00.01.03.sql" />
|
||||||
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.1.0.0.sql" />
|
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.1.0.0.sql" />
|
||||||
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.Uninstall.sql" />
|
<EmbeddedResource Include="Modules\HtmlText\Scripts\HtmlText.Uninstall.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace Oqtane.Pages
|
||||||
ProcessThemeControls(assembly);
|
ProcessThemeControls(assembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if framework is installed
|
// if culture not specified and framework is installed
|
||||||
if (!string.IsNullOrEmpty(_configuration.GetConnectionString("DefaultConnection")))
|
if (HttpContext.Request.Cookies[CookieRequestCultureProvider.DefaultCookieName] == null && !string.IsNullOrEmpty(_configuration.GetConnectionString("DefaultConnection")))
|
||||||
{
|
{
|
||||||
Uri uri = new Uri(Request.GetDisplayUrl());
|
Uri uri = new Uri(Request.GetDisplayUrl());
|
||||||
var alias = _aliases.GetAlias(uri.Authority + "/" + uri.LocalPath.Substring(1));
|
var alias = _aliases.GetAlias(uri.Authority + "/" + uri.LocalPath.Substring(1));
|
||||||
|
@ -58,6 +58,13 @@ namespace Oqtane.Pages
|
||||||
CookieRequestCultureProvider.MakeCookieValue(
|
CookieRequestCultureProvider.MakeCookieValue(
|
||||||
new RequestCulture(language.Code)));
|
new RequestCulture(language.Code)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HttpContext.Response.Cookies.Append(
|
||||||
|
CookieRequestCultureProvider.DefaultCookieName,
|
||||||
|
CookieRequestCultureProvider.MakeCookieValue(
|
||||||
|
new RequestCulture(_configuration.GetSection("Localization").GetValue("DefaultCulture", Constants.DefaultCulture))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
|
@ -9,6 +9,6 @@ namespace Oqtane.Repository
|
||||||
IEnumerable<ModuleDefinition> GetModuleDefinitions(int sideId);
|
IEnumerable<ModuleDefinition> GetModuleDefinitions(int sideId);
|
||||||
ModuleDefinition GetModuleDefinition(int moduleDefinitionId, int sideId);
|
ModuleDefinition GetModuleDefinition(int moduleDefinitionId, int sideId);
|
||||||
void UpdateModuleDefinition(ModuleDefinition moduleDefinition);
|
void UpdateModuleDefinition(ModuleDefinition moduleDefinition);
|
||||||
void DeleteModuleDefinition(int moduleDefinitionId, int siteId);
|
void DeleteModuleDefinition(int moduleDefinitionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
|
@ -6,5 +6,6 @@ namespace Oqtane.Repository
|
||||||
public interface IThemeRepository
|
public interface IThemeRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Theme> GetThemes();
|
IEnumerable<Theme> GetThemes();
|
||||||
|
void DeleteTheme(string ThemeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -16,7 +17,6 @@ namespace Oqtane.Repository
|
||||||
private MasterDBContext _db;
|
private MasterDBContext _db;
|
||||||
private readonly IMemoryCache _cache;
|
private readonly IMemoryCache _cache;
|
||||||
private readonly IPermissionRepository _permissions;
|
private readonly IPermissionRepository _permissions;
|
||||||
private List<ModuleDefinition> _moduleDefinitions; // lazy load
|
|
||||||
|
|
||||||
public ModuleDefinitionRepository(MasterDBContext context, IMemoryCache cache, IPermissionRepository permissions)
|
public ModuleDefinitionRepository(MasterDBContext context, IMemoryCache cache, IPermissionRepository permissions)
|
||||||
{
|
{
|
||||||
|
@ -46,44 +46,71 @@ namespace Oqtane.Repository
|
||||||
_db.Entry(moduleDefinition).State = EntityState.Modified;
|
_db.Entry(moduleDefinition).State = EntityState.Modified;
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
_permissions.UpdatePermissions(moduleDefinition.SiteId, EntityNames.ModuleDefinition, moduleDefinition.ModuleDefinitionId, moduleDefinition.Permissions);
|
_permissions.UpdatePermissions(moduleDefinition.SiteId, EntityNames.ModuleDefinition, moduleDefinition.ModuleDefinitionId, moduleDefinition.Permissions);
|
||||||
_cache.Remove("moduledefinitions:" + moduleDefinition.SiteId.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteModuleDefinition(int moduleDefinitionId, int siteId)
|
public void DeleteModuleDefinition(int moduleDefinitionId)
|
||||||
{
|
{
|
||||||
ModuleDefinition moduleDefinition = _db.ModuleDefinition.Find(moduleDefinitionId);
|
ModuleDefinition moduleDefinition = _db.ModuleDefinition.Find(moduleDefinitionId);
|
||||||
_permissions.DeletePermissions(siteId, EntityNames.ModuleDefinition, moduleDefinitionId);
|
|
||||||
_db.ModuleDefinition.Remove(moduleDefinition);
|
_db.ModuleDefinition.Remove(moduleDefinition);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
|
_cache.Remove("moduledefinitions");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModuleDefinition> LoadModuleDefinitions(int siteId)
|
public List<ModuleDefinition> LoadModuleDefinitions(int siteId)
|
||||||
{
|
{
|
||||||
// get module definitions for site
|
// get module definitions
|
||||||
List<ModuleDefinition> moduleDefinitions = _cache.GetOrCreate("moduledefinitions:" + siteId.ToString(), entry =>
|
List<ModuleDefinition> moduleDefinitions;
|
||||||
|
if (siteId != -1)
|
||||||
|
{
|
||||||
|
moduleDefinitions = _cache.GetOrCreate("moduledefinitions", entry =>
|
||||||
{
|
{
|
||||||
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
||||||
return LoadSiteModuleDefinitions(siteId);
|
return LoadModuleDefinitions();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// get all module definition permissions for site
|
||||||
|
List<Permission> permissions = _permissions.GetPermissions(siteId, EntityNames.ModuleDefinition).ToList();
|
||||||
|
|
||||||
|
// populate module definition permissions
|
||||||
|
foreach (ModuleDefinition moduledefinition in moduleDefinitions)
|
||||||
|
{
|
||||||
|
moduledefinition.SiteId = siteId;
|
||||||
|
if (permissions.Count == 0)
|
||||||
|
{
|
||||||
|
_permissions.UpdatePermissions(siteId, EntityNames.ModuleDefinition, moduledefinition.ModuleDefinitionId, moduledefinition.Permissions);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (permissions.Where(item => item.EntityId == moduledefinition.ModuleDefinitionId).Any())
|
||||||
|
{
|
||||||
|
moduledefinition.Permissions = permissions.Where(item => item.EntityId == moduledefinition.ModuleDefinitionId).EncodePermissions();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_permissions.UpdatePermissions(siteId, EntityNames.ModuleDefinition, moduledefinition.ModuleDefinitionId, moduledefinition.Permissions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up any orphaned permissions
|
||||||
|
var ids = new HashSet<int>(moduleDefinitions.Select(item => item.ModuleDefinitionId));
|
||||||
|
foreach (var permission in permissions.Where(item => !ids.Contains(item.EntityId)))
|
||||||
|
{
|
||||||
|
_permissions.DeletePermission(permission.PermissionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moduleDefinitions = LoadModuleDefinitions();
|
||||||
|
}
|
||||||
|
|
||||||
return moduleDefinitions;
|
return moduleDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ModuleDefinition> LoadSiteModuleDefinitions(int siteId)
|
private List<ModuleDefinition> LoadModuleDefinitions()
|
||||||
{
|
|
||||||
if (_moduleDefinitions == null)
|
|
||||||
{
|
{
|
||||||
// get module assemblies
|
// get module assemblies
|
||||||
_moduleDefinitions = LoadModuleDefinitionsFromAssemblies();
|
List<ModuleDefinition> moduleDefinitions = LoadModuleDefinitionsFromAssemblies();
|
||||||
}
|
|
||||||
|
|
||||||
List<ModuleDefinition> moduleDefinitions = _moduleDefinitions;
|
|
||||||
|
|
||||||
List<Permission> permissions = new List<Permission>();
|
|
||||||
if (siteId != -1)
|
|
||||||
{
|
|
||||||
// get module definition permissions for site
|
|
||||||
permissions = _permissions.GetPermissions(siteId, EntityNames.ModuleDefinition).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get module definitions in database
|
// get module definitions in database
|
||||||
List<ModuleDefinition> moduledefs = _db.ModuleDefinition.ToList();
|
List<ModuleDefinition> moduledefs = _db.ModuleDefinition.ToList();
|
||||||
|
@ -98,10 +125,6 @@ namespace Oqtane.Repository
|
||||||
moduledef = new ModuleDefinition { ModuleDefinitionName = moduledefinition.ModuleDefinitionName };
|
moduledef = new ModuleDefinition { ModuleDefinitionName = moduledefinition.ModuleDefinitionName };
|
||||||
_db.ModuleDefinition.Add(moduledef);
|
_db.ModuleDefinition.Add(moduledef);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
if (siteId != -1)
|
|
||||||
{
|
|
||||||
_permissions.UpdatePermissions(siteId, EntityNames.ModuleDefinition, moduledef.ModuleDefinitionId, moduledefinition.Permissions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -126,31 +149,11 @@ namespace Oqtane.Repository
|
||||||
moduledefinition.Version = moduledef.Version;
|
moduledefinition.Version = moduledef.Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siteId != -1)
|
|
||||||
{
|
|
||||||
if (permissions.Count == 0)
|
|
||||||
{
|
|
||||||
_permissions.UpdatePermissions(siteId, EntityNames.ModuleDefinition, moduledef.ModuleDefinitionId, moduledefinition.Permissions);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (permissions.Where(item => item.EntityId == moduledef.ModuleDefinitionId).Any())
|
|
||||||
{
|
|
||||||
moduledefinition.Permissions = permissions.Where(item => item.EntityId == moduledef.ModuleDefinitionId).EncodePermissions();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_permissions.UpdatePermissions(siteId, EntityNames.ModuleDefinition, moduledef.ModuleDefinitionId, moduledefinition.Permissions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove module definition from list as it is already synced
|
// remove module definition from list as it is already synced
|
||||||
moduledefs.Remove(moduledef);
|
moduledefs.Remove(moduledef);
|
||||||
}
|
}
|
||||||
|
|
||||||
moduledefinition.ModuleDefinitionId = moduledef.ModuleDefinitionId;
|
moduledefinition.ModuleDefinitionId = moduledef.ModuleDefinitionId;
|
||||||
moduledefinition.SiteId = siteId;
|
|
||||||
moduledefinition.CreatedBy = moduledef.CreatedBy;
|
moduledefinition.CreatedBy = moduledef.CreatedBy;
|
||||||
moduledefinition.CreatedOn = moduledef.CreatedOn;
|
moduledefinition.CreatedOn = moduledef.CreatedOn;
|
||||||
moduledefinition.ModifiedBy = moduledef.ModifiedBy;
|
moduledefinition.ModifiedBy = moduledef.ModifiedBy;
|
||||||
|
@ -160,11 +163,6 @@ namespace Oqtane.Repository
|
||||||
// any remaining module definitions are orphans
|
// any remaining module definitions are orphans
|
||||||
foreach (ModuleDefinition moduledefinition in moduledefs)
|
foreach (ModuleDefinition moduledefinition in moduledefs)
|
||||||
{
|
{
|
||||||
if (siteId != -1)
|
|
||||||
{
|
|
||||||
_permissions.DeletePermissions(siteId, EntityNames.ModuleDefinition, moduledefinition.ModuleDefinitionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
_db.ModuleDefinition.Remove(moduledefinition); // delete
|
_db.ModuleDefinition.Remove(moduledefinition); // delete
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
@ -175,12 +173,16 @@ namespace Oqtane.Repository
|
||||||
private List<ModuleDefinition> LoadModuleDefinitionsFromAssemblies()
|
private List<ModuleDefinition> LoadModuleDefinitionsFromAssemblies()
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduleDefinitions = new List<ModuleDefinition>();
|
List<ModuleDefinition> moduleDefinitions = new List<ModuleDefinition>();
|
||||||
|
|
||||||
// iterate through Oqtane module assemblies
|
// iterate through Oqtane module assemblies
|
||||||
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
||||||
foreach (Assembly assembly in assemblies)
|
foreach (Assembly assembly in assemblies)
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Utilities.GetTypeName(assembly.FullName) + ".dll")))
|
||||||
{
|
{
|
||||||
moduleDefinitions = LoadModuleDefinitionsFromAssembly(moduleDefinitions, assembly);
|
moduleDefinitions = LoadModuleDefinitionsFromAssembly(moduleDefinitions, assembly);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return moduleDefinitions;
|
return moduleDefinitions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,32 +408,6 @@ namespace Oqtane.Repository
|
||||||
Content = ""
|
Content = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}); pageTemplates.Add(new PageTemplate
|
|
||||||
{
|
|
||||||
Name = "Tenant Management",
|
|
||||||
Parent = "Admin",
|
|
||||||
Path = "admin/tenants",
|
|
||||||
Icon = Icons.List,
|
|
||||||
IsNavigation = false,
|
|
||||||
IsPersonalizable = false,
|
|
||||||
PagePermissions = new List<Permission>
|
|
||||||
{
|
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
|
||||||
}.EncodePermissions(),
|
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
|
||||||
{
|
|
||||||
new PageTemplateModule
|
|
||||||
{
|
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Tenants.Index).ToModuleDefinitionName(), Title = "Tenant Management", Pane = "Content",
|
|
||||||
ModulePermissions = new List<Permission>
|
|
||||||
{
|
|
||||||
new Permission(PermissionNames.View, RoleNames.Host, true),
|
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Host, true)
|
|
||||||
}.EncodePermissions(),
|
|
||||||
Content = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
pageTemplates.Add(new PageTemplate
|
pageTemplates.Add(new PageTemplate
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Themes;
|
using Oqtane.Themes;
|
||||||
|
@ -10,7 +12,12 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public class ThemeRepository : IThemeRepository
|
public class ThemeRepository : IThemeRepository
|
||||||
{
|
{
|
||||||
private List<Theme> _themes; // lazy load
|
private readonly IMemoryCache _cache;
|
||||||
|
|
||||||
|
public ThemeRepository(IMemoryCache cache)
|
||||||
|
{
|
||||||
|
_cache = cache;
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<Theme> GetThemes()
|
public IEnumerable<Theme> GetThemes()
|
||||||
{
|
{
|
||||||
|
@ -19,12 +26,14 @@ namespace Oqtane.Repository
|
||||||
|
|
||||||
private List<Theme> LoadThemes()
|
private List<Theme> LoadThemes()
|
||||||
{
|
{
|
||||||
if (_themes == null)
|
// get module definitions
|
||||||
|
List<Theme> themes = _cache.GetOrCreate("themes", entry =>
|
||||||
{
|
{
|
||||||
// get themes
|
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
||||||
_themes = LoadThemesFromAssemblies();
|
return LoadThemesFromAssemblies();
|
||||||
}
|
});
|
||||||
return _themes;
|
|
||||||
|
return themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Theme> LoadThemesFromAssemblies()
|
private List<Theme> LoadThemesFromAssemblies()
|
||||||
|
@ -34,9 +43,12 @@ namespace Oqtane.Repository
|
||||||
// iterate through Oqtane theme assemblies
|
// iterate through Oqtane theme assemblies
|
||||||
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
||||||
foreach (Assembly assembly in assemblies)
|
foreach (Assembly assembly in assemblies)
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Utilities.GetTypeName(assembly.FullName) + ".dll")))
|
||||||
{
|
{
|
||||||
themes = LoadThemesFromAssembly(themes, assembly);
|
themes = LoadThemesFromAssembly(themes, assembly);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
@ -143,5 +155,10 @@ namespace Oqtane.Repository
|
||||||
}
|
}
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteTheme(string ThemeName)
|
||||||
|
{
|
||||||
|
_cache.Remove("themes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Version 2.0.0 Tenant migration script
|
Version 2.0.1 Tenant migration script
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
17
Oqtane.Server/Scripts/Tenant.02.00.01.03.sql
Normal file
17
Oqtane.Server/Scripts/Tenant.02.00.01.03.sql
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Version 2.0.1 Tenant migration script
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
DELETE FROM [dbo].[Page]
|
||||||
|
WHERE Path = 'admin/tenants';
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[Site] ADD
|
||||||
|
[AdminContainerType] [nvarchar](200) NULL
|
||||||
|
GO
|
||||||
|
|
||||||
|
UPDATE [dbo].[Site] SET AdminContainerType = ''
|
||||||
|
GO
|
||||||
|
|
|
@ -26,7 +26,6 @@ namespace Oqtane
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
private string _webRoot;
|
|
||||||
private Runtime _runtime;
|
private Runtime _runtime;
|
||||||
private bool _useSwagger;
|
private bool _useSwagger;
|
||||||
private IWebHostEnvironment _env;
|
private IWebHostEnvironment _env;
|
||||||
|
@ -48,7 +47,6 @@ namespace Oqtane
|
||||||
//add possibility to switch off swagger on production.
|
//add possibility to switch off swagger on production.
|
||||||
_useSwagger = Configuration.GetSection("UseSwagger").Value != "false";
|
_useSwagger = Configuration.GetSection("UseSwagger").Value != "false";
|
||||||
|
|
||||||
_webRoot = env.WebRootPath;
|
|
||||||
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data"));
|
||||||
|
|
||||||
_env = env;
|
_env = env;
|
||||||
|
@ -181,7 +179,7 @@ namespace Oqtane
|
||||||
services.AddSingleton<IDatabaseManager, DatabaseManager>();
|
services.AddSingleton<IDatabaseManager, DatabaseManager>();
|
||||||
|
|
||||||
// install any modules or themes ( this needs to occur BEFORE the assemblies are loaded into the app domain )
|
// install any modules or themes ( this needs to occur BEFORE the assemblies are loaded into the app domain )
|
||||||
InstallationManager.InstallPackages("Modules,Themes", _webRoot);
|
InstallationManager.InstallPackages("Modules,Themes", _env.WebRootPath, _env.ContentRootPath);
|
||||||
|
|
||||||
// register transient scoped core services
|
// register transient scoped core services
|
||||||
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Oqtane.Models
|
namespace Oqtane.Models
|
||||||
|
@ -13,6 +13,7 @@ namespace Oqtane.Models
|
||||||
public string DefaultThemeType { get; set; }
|
public string DefaultThemeType { get; set; }
|
||||||
public string DefaultLayoutType { get; set; }
|
public string DefaultLayoutType { get; set; }
|
||||||
public string DefaultContainerType { get; set; }
|
public string DefaultContainerType { get; set; }
|
||||||
|
public string AdminContainerType { get; set; }
|
||||||
public bool PwaIsEnabled { get; set; }
|
public bool PwaIsEnabled { get; set; }
|
||||||
public int? PwaAppIconFileId { get; set; }
|
public int? PwaAppIconFileId { get; set; }
|
||||||
public int? PwaSplashIconFileId { get; set; }
|
public int? PwaSplashIconFileId { get; set; }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Oqtane.Shared
|
namespace Oqtane.Shared
|
||||||
{
|
{
|
||||||
public class InstallConfig
|
public class InstallConfig
|
||||||
{
|
{
|
||||||
|
@ -14,5 +14,6 @@
|
||||||
public string DefaultTheme { get; set; }
|
public string DefaultTheme { get; set; }
|
||||||
public string DefaultLayout { get; set; }
|
public string DefaultLayout { get; set; }
|
||||||
public string DefaultContainer { get; set; }
|
public string DefaultContainer { get; set; }
|
||||||
|
public string DefaultAdminContainer { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user