Performance improvements, refactoring of multi-tenant support, split Alias and Tenant entities for cleaner separation of concerns, create an additional site during installation for demonstratng multitenancy

This commit is contained in:
Shaun Walker
2019-05-24 13:33:19 -04:00
parent 0067521cd5
commit 8deb119f36
57 changed files with 880 additions and 309 deletions

View File

@ -12,7 +12,7 @@
{
if (p.IsNavigation && UserService.IsAuthorized(PageState.User, p.ViewPermissions))
{
string url = PageState.Alias + p.Path;
string url = NavigateUrl(p.Path);
<li class="list-group-item">
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
<span class="oi @p.Icon" aria-hidden="true"></span> @p.Name

View File

@ -39,7 +39,7 @@
{
var interop = new Interop(jsRuntime);
await interop.SetCookie("user", user.UserId.ToString(), 7);
UriHelper.NavigateTo(PageState.Alias, true);
UriHelper.NavigateTo(NavigateUrl(""), true);
}
else
{

View File

@ -3,7 +3,6 @@
@using Oqtane.Services
@using Oqtane.Modules
@using Oqtane.Shared
@using Oqtane.Client.Modules.Controls
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject IPageService PageService
@ -132,11 +131,10 @@
string viewpermissions = "All Users";
string editpermissions = "Administrators";
protected override async Task OnInitAsync()
protected override void OnInit()
{
var Themes = await ThemeService.GetThemesAsync();
themes = ThemeService.GetThemeTypes(Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes);
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
}
private async Task SavePage()

View File

@ -3,7 +3,6 @@
@using Oqtane.Services
@using Oqtane.Modules
@using Oqtane.Shared
@using Oqtane.Client.Modules.Controls
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject IPageService PageService
@ -133,11 +132,10 @@
string viewpermissions;
string editpermissions;
protected override async Task OnInitAsync()
protected override void OnInit()
{
List<Theme> Themes = await ThemeService.GetThemesAsync();
themes = ThemeService.GetThemeTypes(Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes);
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
PageId = Int32.Parse(PageState.QueryString["id"]);
Page p = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
@ -159,6 +157,6 @@
private async Task DeletePage()
{
await PageService.DeletePageAsync(Int32.Parse(PageState.QueryString["id"]));
UriHelper.NavigateTo(PageState.Alias);
UriHelper.NavigateTo(NavigateUrl("", true));
}
}

View File

@ -133,11 +133,10 @@
string viewpermissions;
string editpermissions;
protected override async Task OnInitAsync()
protected override void OnInit()
{
List<Theme> Themes = await ThemeService.GetThemesAsync();
themes = ThemeService.GetThemeTypes(Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(Themes);
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
PageId = Int32.Parse(PageState.QueryString["id"]);
Page p = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();

View File

@ -3,10 +3,11 @@
@using Oqtane.Client.Modules.HtmlText.Services
@using Oqtane.Shared.Modules.HtmlText.Models
@using System.Net.Http;
@using Oqtane.Client.Modules.Controls
@using Oqtane.Shared;
@inherits ModuleBase
@inject IUriHelper UriHelper
@inject HttpClient http
@inject SiteState sitestate
<form>
<table class="form-group">
@ -32,7 +33,7 @@
protected override async Task OnInitAsync()
{
HtmlTextService htmltextservice = new HtmlTextService(http, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate);
List<HtmlTextInfo> htmltextlist = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltextlist != null)
{
@ -43,7 +44,7 @@
private async Task SaveContent()
{
HtmlTextService htmltextservice = new HtmlTextService(http, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate);
if (htmltext != null)
{
htmltext.Content = content;

View File

@ -3,9 +3,10 @@
@using Oqtane.Shared.Modules.HtmlText.Models
@using System.Net.Http;
@using Oqtane.Client.Modules.Controls
@using Oqtane.Shared;
@inherits ModuleBase
@inject HttpClient http
@inject IUriHelper UriHelper
@inject SiteState sitestate
@((MarkupString)content)
@ -16,7 +17,7 @@
protected override async Task OnInitAsync()
{
HtmlTextService htmltextservice = new HtmlTextService(http, UriHelper);
HtmlTextService htmltextservice = new HtmlTextService(http, sitestate);
List<HtmlTextInfo> htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null)
{

View File

@ -5,18 +5,24 @@ using System.Net.Http;
using Microsoft.AspNetCore.Components;
using Oqtane.Services;
using Oqtane.Shared.Modules.HtmlText.Models;
using Oqtane.Shared;
namespace Oqtane.Client.Modules.HtmlText.Services
{
public class HtmlTextService : ServiceBase, IHtmlTextService
{
private readonly HttpClient http;
private readonly string apiurl;
private readonly SiteState sitestate;
public HtmlTextService(HttpClient http, IUriHelper urihelper)
public HtmlTextService(HttpClient http, SiteState sitestate)
{
this.http = http;
apiurl = CreateApiUrl(urihelper.GetAbsoluteUri(), "HtmlText");
this.sitestate = sitestate;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, "HtmlText"); }
}
public async Task<List<HtmlTextInfo>> GetHtmlTextAsync(int ModuleId)

View File

@ -20,46 +20,32 @@ namespace Oqtane.Modules
public string NavigateUrl()
{
return NavigateUrl(PageState.Page.Path, false);
return Utilities.NavigateUrl(PageState);
}
public string NavigateUrl(bool reload)
{
return NavigateUrl(PageState.Page.Path, reload);
return Utilities.NavigateUrl(PageState, reload);
}
public string NavigateUrl(string path)
{
return NavigateUrl(path, false);
return Utilities.NavigateUrl(PageState, path);
}
public string NavigateUrl(string path, bool reload)
{
string url = PageState.Alias + path;
if (reload)
{
url += "?reload=true";
}
return url;
return Utilities.NavigateUrl(PageState, path, reload);
}
public string EditUrl(string action)
{
return EditUrl(action, "");
return Utilities.EditUrl(PageState, ModuleState, action, "");
}
public string EditUrl(string action, string parameters)
{
string url = PageState.Alias + PageState.Page.Path + "?mid=" + ModuleState.ModuleId.ToString();
if (action != "")
{
url += "&ctl=" + action;
}
if (!string.IsNullOrEmpty(parameters))
{
url += "&" + parameters;
}
return url;
return Utilities.EditUrl(PageState, ModuleState, action, parameters);
}
}
}