improved file upload, enhanced module installation from Nuget to support upgrades, added ability to upgrade the framework from Nuget, completed isolated multitenancy and site alias management, created IPortable interface for importing data into modules, added default content to initial installation
This commit is contained in:
@ -19,7 +19,7 @@ else
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@tenantid">
|
||||
<option value=""><Select Tenant></option>
|
||||
<option value="-1"><Select Tenant></option>
|
||||
@foreach (Tenant tenant in tenants)
|
||||
{
|
||||
<option value="@tenant.TenantId">@tenant.Name</option>
|
||||
@ -37,10 +37,10 @@ else
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Alias: </label>
|
||||
<label for="Name" class="control-label">Aliases: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@url" />
|
||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -91,9 +91,9 @@ else
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
|
||||
List<Tenant> tenants;
|
||||
string tenantid = "";
|
||||
string tenantid = "-1";
|
||||
string name = "";
|
||||
string url = "";
|
||||
string urls = "";
|
||||
string logo = "";
|
||||
string themetype;
|
||||
string layouttype;
|
||||
@ -101,7 +101,7 @@ else
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
tenants = await TenantService.GetTenantsAsync();
|
||||
url = PageState.Alias.Name;
|
||||
urls = PageState.Alias.Name;
|
||||
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
||||
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
||||
}
|
||||
@ -115,12 +115,16 @@ else
|
||||
site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
|
||||
site = await SiteService.AddSiteAsync(site);
|
||||
|
||||
Alias alias = new Alias();
|
||||
alias.Name = url;
|
||||
alias.TenantId = int.Parse(tenantid);
|
||||
alias.SiteId = site.SiteId;
|
||||
await AliasService.AddAliasAsync(alias);
|
||||
urls = urls.Replace("\n", ",");
|
||||
foreach(string name in urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
Alias alias = new Alias();
|
||||
alias.Name = name;
|
||||
alias.TenantId = int.Parse(tenantid);
|
||||
alias.SiteId = site.SiteId;
|
||||
await AliasService.AddAliasAsync(alias);
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo("http://" + url, true);
|
||||
NavigationManager.NavigateTo("http://" + urls[0], true);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ISiteService SiteService
|
||||
@inject IAliasService AliasService
|
||||
@inject IThemeService ThemeService
|
||||
|
||||
@if (themes == null)
|
||||
@ -19,6 +20,14 @@ else
|
||||
<input class="form-control" @bind="@name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Aliases: </label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Logo: </label>
|
||||
@ -80,7 +89,9 @@ else
|
||||
Dictionary<string, string> themes = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
|
||||
List<Alias> aliases;
|
||||
string name = "";
|
||||
string urls = "";
|
||||
string logo = "";
|
||||
string themetype;
|
||||
string layouttype;
|
||||
@ -95,9 +106,14 @@ else
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
aliases = PageState.Aliases.Where(item => item.TenantId == PageState.Alias.TenantId && item.SiteId == PageState.Site.SiteId).ToList();
|
||||
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
||||
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
||||
name = PageState.Site.Name;
|
||||
foreach (Alias alias in aliases)
|
||||
{
|
||||
urls += alias.Name + "\n";
|
||||
}
|
||||
logo = PageState.Site.Logo;
|
||||
themetype = PageState.Site.DefaultThemeType;
|
||||
layouttype = PageState.Site.DefaultLayoutType;
|
||||
@ -122,6 +138,27 @@ else
|
||||
|
||||
site = await SiteService.UpdateSiteAsync(site);
|
||||
|
||||
urls = urls.Replace("\n", ",");
|
||||
string[] names = urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (Alias alias in aliases)
|
||||
{
|
||||
if (!names.Contains(alias.Name))
|
||||
{
|
||||
await AliasService.DeleteAliasAsync(alias.AliasId);
|
||||
}
|
||||
}
|
||||
foreach (string name in names)
|
||||
{
|
||||
if (!aliases.Exists(item => item.Name == name))
|
||||
{
|
||||
Alias alias = new Alias();
|
||||
alias.Name = name;
|
||||
alias.TenantId = PageState.Alias.TenantId;
|
||||
alias.SiteId = site.SiteId;
|
||||
await AliasService.AddAliasAsync(alias);
|
||||
}
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user