diff --git a/Oqtane.Client/Modules/Admin/Login/Index.razor b/Oqtane.Client/Modules/Admin/Login/Index.razor index 71667d96..106ee57f 100644 --- a/Oqtane.Client/Modules/Admin/Login/Index.razor +++ b/Oqtane.Client/Modules/Admin/Login/Index.razor @@ -99,7 +99,7 @@ var interop = new Interop(JsRuntime); string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken"); var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl }; - await interop.SubmitForm("/pages/login/", fields); + await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields); } else { diff --git a/Oqtane.Client/Modules/Admin/Logs/Detail.razor b/Oqtane.Client/Modules/Admin/Logs/Detail.razor index fd484889..1baac265 100644 --- a/Oqtane.Client/Modules/Admin/Logs/Detail.razor +++ b/Oqtane.Client/Modules/Admin/Logs/Detail.razor @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -45,7 +45,7 @@ - + @if (_pageName != string.Empty) @@ -55,7 +55,7 @@ - + } @@ -66,7 +66,7 @@ - + } @@ -77,7 +77,7 @@ - + } @@ -86,7 +86,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -102,7 +102,7 @@ - + @if (!string.IsNullOrEmpty(_exception)) @@ -112,7 +112,7 @@ - + } @@ -121,7 +121,7 @@ - + @@ -129,7 +129,7 @@ - + diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Edit.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Edit.razor index d23ab2e0..84e83aae 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Edit.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Edit.razor @@ -43,7 +43,7 @@ { try { - [Module]Service = new [Module]Service(http, sitestate, NavigationManager); + [Module]Service = new [Module]Service(http, sitestate); if (PageState.Action == "Edit") { _id = Int32.Parse(PageState.QueryString["id"]); diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Index.razor index 15d660be..78e7c079 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Index.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Index.razor @@ -78,7 +78,7 @@ else { try { - [Module]Service = new [Module]Service(http, sitestate, NavigationManager); + [Module]Service = new [Module]Service(http, sitestate); _[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId); } catch (Exception ex) diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Services/[Module]Service.cs b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Services/[Module]Service.cs index 5e559c3b..f95c41b9 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Services/[Module]Service.cs +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Client/Services/[Module]Service.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; using Oqtane.Modules; using Oqtane.Services; using Oqtane.Shared; @@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services { public class [Module]Service : ServiceBase, I[Module]Service, IService { - private readonly NavigationManager _navigationManager; private readonly SiteState _siteState; - public [Module]Service(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http) + public [Module]Service(HttpClient http, SiteState siteState) : base(http) { _siteState = siteState; - _navigationManager = navigationManager; } - private string Apiurl - { - get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); } - } + private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]"); public async Task> Get[Module]sAsync(int ModuleId) { - List<[Module]> [Module]s = await GetJsonAsync>(Apiurl + "?moduleid=" + ModuleId.ToString()); + List<[Module]> [Module]s = await GetJsonAsync>($"{Apiurl}?moduleid={ModuleId}"); return [Module]s.OrderBy(item => item.Name).ToList(); } public async Task<[Module]> Get[Module]Async(int [Module]Id) { - return await GetJsonAsync<[Module]>(Apiurl + "/" + [Module]Id.ToString()); + return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}"); } public async Task<[Module]> Add[Module]Async([Module] [Module]) { - return await PostJsonAsync<[Module]>(Apiurl + "?entityid=" + [Module].ModuleId, [Module]); + return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]); } public async Task<[Module]> Update[Module]Async([Module] [Module]) { - return await PutJsonAsync<[Module]>(Apiurl + "/" + [Module].[Module]Id + "?entityid=" + [Module].ModuleId, [Module]); + return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]); } public async Task Delete[Module]Async(int [Module]Id) { - await DeleteAsync(Apiurl + "/" + [Module]Id.ToString()); + await DeleteAsync($"{Apiurl}/{[Module]Id}"); } } } diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Edit.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Edit.razor index d23ab2e0..84e83aae 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Edit.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Edit.razor @@ -43,7 +43,7 @@ { try { - [Module]Service = new [Module]Service(http, sitestate, NavigationManager); + [Module]Service = new [Module]Service(http, sitestate); if (PageState.Action == "Edit") { _id = Int32.Parse(PageState.QueryString["id"]); diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Index.razor index 2c9f1764..fdb11b98 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Index.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Index.razor @@ -69,7 +69,7 @@ else { try { - [Module]Service = new [Module]Service(http, sitestate, NavigationManager); + [Module]Service = new [Module]Service(http, sitestate); _[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId); } catch (Exception ex) diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Services/[Module]Service.cs b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Services/[Module]Service.cs index 5e559c3b..f95c41b9 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Services/[Module]Service.cs +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/Internal/Oqtane.Client/Modules/[Module]/Services/[Module]Service.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; using Oqtane.Modules; using Oqtane.Services; using Oqtane.Shared; @@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services { public class [Module]Service : ServiceBase, I[Module]Service, IService { - private readonly NavigationManager _navigationManager; private readonly SiteState _siteState; - public [Module]Service(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http) + public [Module]Service(HttpClient http, SiteState siteState) : base(http) { _siteState = siteState; - _navigationManager = navigationManager; } - private string Apiurl - { - get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); } - } + private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]"); public async Task> Get[Module]sAsync(int ModuleId) { - List<[Module]> [Module]s = await GetJsonAsync>(Apiurl + "?moduleid=" + ModuleId.ToString()); + List<[Module]> [Module]s = await GetJsonAsync>($"{Apiurl}?moduleid={ModuleId}"); return [Module]s.OrderBy(item => item.Name).ToList(); } public async Task<[Module]> Get[Module]Async(int [Module]Id) { - return await GetJsonAsync<[Module]>(Apiurl + "/" + [Module]Id.ToString()); + return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}"); } public async Task<[Module]> Add[Module]Async([Module] [Module]) { - return await PostJsonAsync<[Module]>(Apiurl + "?entityid=" + [Module].ModuleId, [Module]); + return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]); } public async Task<[Module]> Update[Module]Async([Module] [Module]) { - return await PutJsonAsync<[Module]>(Apiurl + "/" + [Module].[Module]Id + "?entityid=" + [Module].ModuleId, [Module]); + return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]); } public async Task Delete[Module]Async(int [Module]Id) { - await DeleteAsync(Apiurl + "/" + [Module]Id.ToString()); + await DeleteAsync($"{Apiurl}/{[Module]Id}"); } } } diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor index 7c53755a..f7e3c20f 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Add.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor @@ -101,7 +101,7 @@ - + @foreach (KeyValuePair panelayout in _panelayouts) { if (panelayout.Key == _layouttype) @@ -200,8 +200,8 @@ private string _url; private string _ispersonalizable = "False"; private string _mode = "view"; - private string _themetype = string.Empty; - private string _layouttype = string.Empty; + private string _themetype = "-"; + private string _layouttype = "-"; private string _icon = string.Empty; private string _permissions = string.Empty; private PermissionGrid _permissionGrid; @@ -271,7 +271,7 @@ try { _themetype = (string)e.Value; - if (_themetype != string.Empty) + if (_themetype != "-") { _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); } @@ -350,11 +350,8 @@ page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation)); page.Url = _url; page.EditMode = (_mode == "edit" ? true : false); - page.ThemeType = _themetype; - page.LayoutType = (_layouttype == null ? string.Empty : _layouttype); - page.Icon = (_icon == null ? string.Empty : _icon); - page.Permissions = _permissionGrid.GetPermissions(); - + page.ThemeType = (_themetype != "-") ? _themetype : string.Empty; + page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty; if (page.ThemeType == PageState.Site.DefaultThemeType) { page.ThemeType = string.Empty; @@ -364,7 +361,8 @@ { page.LayoutType = string.Empty; } - + page.Icon = (_icon == null ? string.Empty : _icon); + page.Permissions = _permissionGrid.GetPermissions(); page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable)); page.UserId = null; diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor index 9be6c14b..8132696d 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor @@ -112,7 +112,7 @@ - + @foreach (KeyValuePair panelayout in _panelayouts) { if (panelayout.Key == _layouttype) @@ -215,8 +215,8 @@ private string _url; private string _ispersonalizable; private string _mode; - private string _themetype; - private string _layouttype; + private string _themetype = "-"; + private string _layouttype = "-"; private string _icon; private string _permissions; private string _createdby; @@ -272,6 +272,14 @@ _themetype = page.ThemeType; _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _layouttype = page.LayoutType; + if (_themetype == PageState.Site.DefaultThemeType) + { + _themetype = "-"; + } + if (_layouttype == PageState.Site.DefaultLayoutType) + { + _layouttype = "-"; + } _icon = page.Icon; _permissions = page.Permissions; _createdby = page.CreatedBy; @@ -337,7 +345,7 @@ try { _themetype = (string)e.Value; - if (_themetype != string.Empty) + if (_themetype != "-") { _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); } @@ -417,11 +425,8 @@ page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation)); page.Url = _url; page.EditMode = (_mode == "edit"); - page.ThemeType = _themetype; - page.LayoutType = _layouttype ?? string.Empty; - page.Icon = _icon ?? string.Empty; - page.Permissions = _permissionGrid.GetPermissions(); - + page.ThemeType = (_themetype != "-") ? _themetype : string.Empty; + page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty; if (page.ThemeType == PageState.Site.DefaultThemeType) { page.ThemeType = string.Empty; @@ -430,6 +435,8 @@ { page.LayoutType = string.Empty; } + page.Icon = _icon ?? string.Empty; + page.Permissions = _permissionGrid.GetPermissions(); page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable)); page.UserId = null; diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor index a4069b67..e4bae61e 100644 --- a/Oqtane.Client/Modules/Admin/Site/Index.razor +++ b/Oqtane.Client/Modules/Admin/Site/Index.razor @@ -171,7 +171,7 @@
- +
- + @@ -190,7 +190,7 @@
- + @@ -251,7 +251,7 @@ { _themeList = await ThemeService.GetThemesAsync(); _aliasList = await AliasService.GetAliasesAsync(); - Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias); + Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId); if (site != null) { _name = site.Name; @@ -364,7 +364,7 @@ if (unique) { - var site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias); + var site = await SiteService.GetSiteAsync(PageState.Site.SiteId); if (site != null) { site.Name = _name; @@ -395,7 +395,7 @@ site.PwaSplashIconFileId = pwasplashiconfileid; } - site = await SiteService.UpdateSiteAsync(site, PageState.Alias); + site = await SiteService.UpdateSiteAsync(site); _urls = _urls.Replace("\n", ","); var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); diff --git a/Oqtane.Client/Modules/Admin/Sites/Edit.razor b/Oqtane.Client/Modules/Admin/Sites/Edit.razor index 2eb3110d..698892a7 100644 --- a/Oqtane.Client/Modules/Admin/Sites/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Sites/Edit.razor @@ -134,18 +134,19 @@ _aliasList = await AliasService.GetAliasesAsync(); _alias = _aliasList.Find(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])); - var site = await SiteService.GetSiteAsync(_alias.SiteId, _alias); + SiteService.SetAlias(_alias); + var site = await SiteService.GetSiteAsync(_alias.SiteId); if (site != null) { _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()) { _urls += alias.Name + "\n"; } - + _themetype = site.DefaultThemeType; _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _layouttype = site.DefaultLayoutType; @@ -182,7 +183,7 @@ { _panelayouts = new Dictionary(); } - + StateHasChanged(); } catch (Exception ex) @@ -206,10 +207,11 @@ unique = false; } } - + if (unique) { - var site = await SiteService.GetSiteAsync(_alias.SiteId, _alias); + SiteService.SetAlias(_alias); + var site = await SiteService.GetSiteAsync(_alias.SiteId); if (site != null) { site.Name = _name; @@ -219,11 +221,11 @@ site.DefaultContainerType = _containertype; site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted)); - site = await SiteService.UpdateSiteAsync(site, _alias); + site = await SiteService.UpdateSiteAsync(site); _urls = _urls.Replace("\n", ","); var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - + foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList()) { if (!names.Contains(alias.Name)) @@ -231,7 +233,7 @@ await AliasService.DeleteAliasAsync(alias.AliasId); } } - + foreach (string name in names) { if (!_aliasList.Exists(item => item.Name == name)) diff --git a/Oqtane.Client/Modules/Admin/Sites/Index.razor b/Oqtane.Client/Modules/Admin/Sites/Index.razor index 978f7ad3..d8b79632 100644 --- a/Oqtane.Client/Modules/Admin/Sites/Index.razor +++ b/Oqtane.Client/Modules/Admin/Sites/Index.razor @@ -54,7 +54,8 @@ else { if (alias.SiteId != PageState.Site.SiteId || alias.TenantId != PageState.Site.TenantId) { - await SiteService.DeleteSiteAsync(alias.SiteId, alias); + SiteService.SetAlias(alias); + await SiteService.DeleteSiteAsync(alias.SiteId); await Log(alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", alias.SiteId); var aliases = await AliasService.GetAliasesAsync(); diff --git a/Oqtane.Client/Modules/HtmlText/Edit.razor b/Oqtane.Client/Modules/HtmlText/Edit.razor index 41c55192..ab0f1feb 100644 --- a/Oqtane.Client/Modules/HtmlText/Edit.razor +++ b/Oqtane.Client/Modules/HtmlText/Edit.razor @@ -16,7 +16,7 @@