From d3257d731d8383cfa23dcd97017428d0c3364778 Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 24 Feb 2021 08:28:13 +0100 Subject: [PATCH] Refactorings --- framework/Volo.Abp.sln | 13 +- .../FodyWeavers.xml | 3 + .../FodyWeavers.xsd | 30 +++ .../Hosting/AbpServerHostBuilderExtensions.cs | 13 ++ ...lo.Abp.AspNetCore.Components.Server.csproj | 29 +++ .../wwwroot/libs/abp/js/abp.js | 185 ++++++++++++++++++ .../Pages/Authentication.razor | 7 + .../BasicThemeBundleContributor.cs | 4 +- .../Hosting/AbpComponentsBuilderExtensions.cs | 90 +++++++++ .../Volo.Abp.AspNetCore.Components.UI.csproj | 4 + ...AbpAspNetCoreApplicationCreationOptions.cs | 13 ++ .../UI/AbpAspNetCoreComponentsUIModule.cs | 76 +++---- .../UI/ApplicationConfigurationCache.cs | 2 +- .../AbpWebAssemblyHostBuilderExtensions.cs | 5 +- ...p.AspNetCore.Components.WebAssembly.csproj | 1 + ...bpAspNetCoreComponentsWebAssemblyModule.cs | 3 +- .../AbpBlazorClientHttpMessageHandler.cs | 98 ---------- .../AbpBlazorMessageLocalizerHelper.cs | 48 ----- .../Components/WebAssembly/AbpUtilsService.cs | 51 ----- .../WebAssembly/Alerts/AlertManager.cs | 15 -- .../ApplicationConfigurationCache.cs | 20 -- .../ComponentsWebAssemblyBundleContributor.cs | 17 -- .../Components/WebAssembly/CookieOptions.cs | 11 -- .../Components/WebAssembly/CookieService.cs | 32 --- ...emblyClientScopeServiceProviderAccessor.cs | 12 -- .../AbpExceptionHandlingLogger.cs | 65 ------ .../AbpExceptionHandlingLoggerProvider.cs | 38 ---- .../IUserExceptionInformer.cs | 7 - .../UserExceptionInformer.cs | 52 ----- .../UserExceptionInformerContext.cs | 16 -- .../WebAssembly/IAbpUtilsService.cs | 21 -- .../Components/WebAssembly/ICookieService.cs | 12 -- .../Messages/SimpleUiMessageService.cs | 43 ---- .../WebAssemblyCurrentTenantAccessor.cs | 11 -- .../WebAssemblyRemoteTenantStore.cs | 70 ------- .../WebAssemblyRemoteTenantStoreCache.cs | 35 ---- .../Security/AbpWebAssemblyClaimsCache.cs | 29 --- ...blyCachedApplicationConfigurationClient.cs | 1 + .../WebAssemblyCurrentPrincipalAccessor.cs | 6 +- .../AbpBlazoriseModule.cs | 3 +- .../AbpIdentityBlazorModule.cs | 2 +- .../Pages/Identity/RoleManagement.razor | 3 +- .../Pages/Identity/UserManagement.razor | 19 +- .../Volo.Abp.Identity.Blazor/_Imports.razor | 1 - .../AbpPermissionManagementBlazorModule.cs | 2 +- ...olo.Abp.PermissionManagement.Blazor.csproj | 4 +- .../TenantManagement/TenantManagement.razor | 13 +- 47 files changed, 459 insertions(+), 776 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xml create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xsd create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Server/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpServerHostBuilderExtensions.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Server/Volo.Abp.AspNetCore.Components.Server.csproj create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.Server/wwwroot/libs/abp/js/abp.js create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/Pages/Authentication.razor rename framework/src/{Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly => Volo.Abp.AspNetCore.Components.UI.BasicTheme}/BasicThemeBundleContributor.cs (73%) create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.UI/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpComponentsBuilderExtensions.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreApplicationCreationOptions.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Alerts/AlertManager.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ApplicationConfigurationCache.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/DependencyInjection/WebAssemblyClientScopeServiceProviderAccessor.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLogger.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/IUserExceptionInformer.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformer.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformerContext.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Messages/SimpleUiMessageService.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyCurrentTenantAccessor.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStore.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStoreCache.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Security/AbpWebAssemblyClaimsCache.cs diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index bef083d7f1..d0068f26fc 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -365,11 +365,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Compone EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Components.UI.Theming", "src\Volo.Abp.AspNetCore.Components.UI.Theming\Volo.Abp.AspNetCore.Components.UI.Theming.csproj", "{B9133C38-AC24-4E2F-B581-D124CF410CDF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly", "src\Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly\Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly.csproj", "{FFA80CA2-3DEE-4EFE-8120-80342A0BEA52}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly", "src\Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly\Volo.Abp.AspNetCore.Components.UI.Theming.WebAssembly.csproj", "{FFA80CA2-3DEE-4EFE-8120-80342A0BEA52}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly", "src\Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly\Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly.csproj", "{616282F9-6901-4098-B515-EBDF41C57C4F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly", "src\Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly\Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly.csproj", "{616282F9-6901-4098-B515-EBDF41C57C4F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.EventBus.Abstractions", "src\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj", "{8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.EventBus.Abstractions", "src\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj", "{8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.Server", "src\Volo.Abp.AspNetCore.Components.Server\Volo.Abp.AspNetCore.Components.Server.csproj", "{41743609-6CDC-46F7-8C83-BCFBA5555AC0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1105,6 +1107,10 @@ Global {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Debug|Any CPU.Build.0 = Debug|Any CPU {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.ActiveCfg = Release|Any CPU {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.Build.0 = Release|Any CPU + {41743609-6CDC-46F7-8C83-BCFBA5555AC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41743609-6CDC-46F7-8C83-BCFBA5555AC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41743609-6CDC-46F7-8C83-BCFBA5555AC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {41743609-6CDC-46F7-8C83-BCFBA5555AC0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1292,6 +1298,7 @@ Global {FFA80CA2-3DEE-4EFE-8120-80342A0BEA52} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {616282F9-6901-4098-B515-EBDF41C57C4F} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {41743609-6CDC-46F7-8C83-BCFBA5555AC0} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xml new file mode 100644 index 0000000000..bc5a74a236 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpServerHostBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.Server/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpServerHostBuilderExtensions.cs new file mode 100644 index 0000000000..d3b9eb89e8 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpServerHostBuilderExtensions.cs @@ -0,0 +1,13 @@ +using System; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; + +namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting +{ + public static class AbpServerHostBuilderExtensions + { + + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo.Abp.AspNetCore.Components.Server.csproj b/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo.Abp.AspNetCore.Components.Server.csproj new file mode 100644 index 0000000000..6c4e1faa2d --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo.Abp.AspNetCore.Components.Server.csproj @@ -0,0 +1,29 @@ + + + + + + + net5.0 + Volo.Abp.AspNetCore.Components.Server + Volo.Abp.AspNetCore.Components.Server + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/wwwroot/libs/abp/js/abp.js b/framework/src/Volo.Abp.AspNetCore.Components.Server/wwwroot/libs/abp/js/abp.js new file mode 100644 index 0000000000..f22ee88c97 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/wwwroot/libs/abp/js/abp.js @@ -0,0 +1,185 @@ +var abp = abp || {}; +(function () { + abp.utils = abp.utils || {}; + + // DOM READY ///////////////////////////////////////////////////// + + abp.domReady = function (fn) { + if (document.readyState === "complete" || document.readyState === "interactive") { + setTimeout(fn, 1); + } else { + document.addEventListener("DOMContentLoaded", fn); + } + }; + + // COOKIES /////////////////////////////////////////////////////// + + /** + * Sets a cookie value for given key. + * This is a simple implementation created to be used by ABP. + * Please use a complete cookie library if you need. + * @param {string} key + * @param {string} value + * @param {string} expireDate (optional). If not specified the cookie will expire at the end of session. + * @param {string} path (optional) + * @param {bool} secure (optional) + */ + abp.utils.setCookieValue = function (key, value, expireDate, path, secure) { + var cookieValue = encodeURIComponent(key) + '='; + if (value) { + cookieValue = cookieValue + encodeURIComponent(value); + } + + if (expireDate) { + cookieValue = cookieValue + "; expires=" + expireDate; + } + + if (path) { + cookieValue = cookieValue + "; path=" + path; + } + + if (secure) { + cookieValue = cookieValue + "; secure"; + } + + document.cookie = cookieValue; + }; + + /** + * Gets a cookie with given key. + * This is a simple implementation created to be used by ABP. + * Please use a complete cookie library if you need. + * @param {string} key + * @returns {string} Cookie value or null + */ + abp.utils.getCookieValue = function (key) { + var equalities = document.cookie.split('; '); + for (var i = 0; i < equalities.length; i++) { + if (!equalities[i]) { + continue; + } + + var splitted = equalities[i].split('='); + if (splitted.length != 2) { + continue; + } + + if (decodeURIComponent(splitted[0]) === key) { + return decodeURIComponent(splitted[1] || ''); + } + } + + return null; + }; + + /** + * Deletes cookie for given key. + * This is a simple implementation created to be used by ABP. + * Please use a complete cookie library if you need. + * @param {string} key + * @param {string} path (optional) + */ + abp.utils.deleteCookie = function (key, path) { + var cookieValue = encodeURIComponent(key) + '='; + + cookieValue = cookieValue + "; expires=" + (new Date(new Date().getTime() - 86400000)).toUTCString(); + + if (path) { + cookieValue = cookieValue + "; path=" + path; + } + + document.cookie = cookieValue; + } + + // DOM MANIPULATION + + abp.utils.addClassToTag = function (tagName, className) { + var tags = document.getElementsByTagName(tagName); + for (var i = 0; i < tags.length; i++) { + tags[i].classList.add(className); + } + }; + + abp.utils.removeClassFromTag = function (tagName, className) { + var tags = document.getElementsByTagName(tagName); + for (var i = 0; i < tags.length; i++) { + tags[i].classList.remove(className); + } + }; + + abp.utils.hasClassOnTag = function (tagName, className) { + var tags = document.getElementsByTagName(tagName); + if (tags.length) { + return tags[0].classList.contains(className); + } + + return false; + }; + + abp.utils.replaceLinkHrefById = function (linkId, hrefValue) { + var link = document.getElementById(linkId); + + if (link && link.href !== hrefValue) { + link.href = hrefValue; + } + }; + + // FULL SCREEN ///////////////// + + abp.utils.toggleFullscreen = function() { + var elem = document.documentElement; + if (!document.fullscreenElement && !document.mozFullScreenElement && + !document.webkitFullscreenElement && !document.msFullscreenElement) { + if (elem.requestFullscreen) { + elem.requestFullscreen(); + } else if (elem.msRequestFullscreen) { + elem.msRequestFullscreen(); + } else if (elem.mozRequestFullScreen) { + elem.mozRequestFullScreen(); + } else if (elem.webkitRequestFullscreen) { + elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); + } + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } + } + } + + abp.utils.requestFullscreen = function() { + var elem = document.documentElement; + if (!document.fullscreenElement && !document.mozFullScreenElement && + !document.webkitFullscreenElement && !document.msFullscreenElement) { + if (elem.requestFullscreen) { + elem.requestFullscreen(); + } else if (elem.msRequestFullscreen) { + elem.msRequestFullscreen(); + } else if (elem.mozRequestFullScreen) { + elem.mozRequestFullScreen(); + } else if (elem.webkitRequestFullscreen) { + elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); + } + } + } + + abp.utils.exitFullscreen = function() { + if (!(!document.fullscreenElement && !document.mozFullScreenElement && + !document.webkitFullscreenElement && !document.msFullscreenElement)) { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } + } + } +})(); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/Pages/Authentication.razor b/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/Pages/Authentication.razor new file mode 100644 index 0000000000..e237cea555 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/Pages/Authentication.razor @@ -0,0 +1,7 @@ +@page "/authentication/{action}" +@using Microsoft.AspNetCore.Components.WebAssembly.Authentication + + +@code{ + [Parameter] public string Action { get; set; } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/BasicThemeBundleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme/BasicThemeBundleContributor.cs similarity index 73% rename from framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/BasicThemeBundleContributor.cs rename to framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme/BasicThemeBundleContributor.cs index 104ec65f1a..322a54fffa 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly/BasicThemeBundleContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI.BasicTheme/BasicThemeBundleContributor.cs @@ -1,6 +1,6 @@ using Volo.Abp.Bundling; -namespace Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly +namespace Volo.Abp.AspNetCore.Components.UI.BasicTheme { public class BasicThemeBundleContributor : IBundleContributor { @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Components.UI.BasicTheme.WebAssembly public void AddStyles(BundleContext context) { - context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/libs/abp/css/theme.css"); + context.Add("_content/Volo.Abp.AspNetCore.Components.UI.BasicTheme/libs/abp/css/theme.css"); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpComponentsBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.UI/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpComponentsBuilderExtensions.cs new file mode 100644 index 0000000000..8d5512899f --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpComponentsBuilderExtensions.cs @@ -0,0 +1,90 @@ +using System; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.AspNetCore.Components.UI; +using Volo.Abp.AspNetCore.Components.UI.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc.Client; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Modularity; + +namespace Microsoft.AspNetCore.Components.UI.Hosting +{ + public static class AbpComponentsBuilderExtensions + { + //public static IAbpApplicationWithExternalServiceProvider AddApplication( + // [NotNull] this IServiceCollection services + // /*Action options*/) + // where TStartupModule : IAbpModule + //{ + // Check.NotNull(services, nameof(services)); + + // // Related this commit(https://github.com/dotnet/aspnetcore/commit/b99d805bc037fcac56afb79abeb7d5a43141c85e) + // // Microsoft.AspNetCore.Blazor.BuildTools has been removed in net 5.0. + // // This call may be removed when we find a suitable solution. + // // System.Runtime.CompilerServices.AsyncStateMachineAttribute + // Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add(); + + // services.AddSingleton(builder.Configuration); + // services.AddSingleton(builder); + + // var application = services.AddApplication(opts => + // { + // options?.Invoke(new AbpAspNetCoreApplicationCreationOptions(builder, opts)); + // }); + + // return application; + //} + + public static async Task InitializeAsync( + [NotNull] this IAbpApplicationWithExternalServiceProvider application, + [NotNull] IServiceProvider serviceProvider) + { + Check.NotNull(application, nameof(application)); + Check.NotNull(serviceProvider, nameof(serviceProvider)); + + var serviceProviderAccessor = (ComponentsClientScopeServiceProviderAccessor) + serviceProvider.GetRequiredService(); + serviceProviderAccessor.ServiceProvider = serviceProvider; + + application.Initialize(serviceProvider); + + using (var scope = serviceProvider.CreateScope()) + { + await InitializeModulesAsync(scope.ServiceProvider); + await SetCurrentLanguageAsync(scope); + } + } + + private static async Task InitializeModulesAsync(IServiceProvider serviceProvider) + { + foreach (var service in serviceProvider.GetServices()) + { + await service.InitializeAsync(); + } + } + + private static async Task SetCurrentLanguageAsync(IServiceScope scope) + { + var configurationClient = scope.ServiceProvider.GetRequiredService(); + var utilsService = scope.ServiceProvider.GetRequiredService(); + var configuration = configurationClient.Get(); + var cultureName = configuration.Localization?.CurrentCulture?.CultureName; + if (!cultureName.IsNullOrEmpty()) + { + var culture = new CultureInfo(cultureName); + CultureInfo.DefaultThreadCurrentCulture = culture; + CultureInfo.DefaultThreadCurrentUICulture = culture; + } + + if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) + { + await utilsService.AddClassToTagAsync("body", "rtl"); + } + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo.Abp.AspNetCore.Components.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo.Abp.AspNetCore.Components.UI.csproj index 8f181ff5cd..e2fad1891a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo.Abp.AspNetCore.Components.UI.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo.Abp.AspNetCore.Components.UI.csproj @@ -27,4 +27,8 @@ + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreApplicationCreationOptions.cs b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreApplicationCreationOptions.cs new file mode 100644 index 0000000000..8970564b4a --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreApplicationCreationOptions.cs @@ -0,0 +1,13 @@ +namespace Volo.Abp.AspNetCore.Components.UI +{ + public class AbpAspNetCoreApplicationCreationOptions + { + public AbpApplicationCreationOptions ApplicationCreationOptions { get; } + + public AbpAspNetCoreApplicationCreationOptions( + AbpApplicationCreationOptions applicationCreationOptions) + { + ApplicationCreationOptions = applicationCreationOptions; + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreComponentsUIModule.cs b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreComponentsUIModule.cs index 76b842fcb3..5e44d6b09e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreComponentsUIModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/AbpAspNetCoreComponentsUIModule.cs @@ -1,41 +1,41 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Logging; -using Volo.Abp.AspNetCore.Components.DependencyInjection; -using Volo.Abp.AspNetCore.Components.UI.ExceptionHandling; -using Volo.Abp.AspNetCore.Mvc.Client; -using Volo.Abp.Http.Client; -using Volo.Abp.Modularity; -using Volo.Abp.UI; +//using Microsoft.AspNetCore.Components; +//using Microsoft.Extensions.DependencyInjection; +//using Microsoft.Extensions.DependencyInjection.Extensions; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.AspNetCore.Components.DependencyInjection; +//using Volo.Abp.AspNetCore.Components.UI.ExceptionHandling; +//using Volo.Abp.AspNetCore.Mvc.Client; +//using Volo.Abp.Http.Client; +//using Volo.Abp.Modularity; +//using Volo.Abp.UI; -namespace Volo.Abp.AspNetCore.Components.UI -{ - [DependsOn( - typeof(AbpAspNetCoreMvcClientCommonModule), - typeof(AbpUiModule), - typeof(AbpAspNetCoreComponentsModule) - )] - public class AbpAspNetCoreComponentsUIModule : AbpModule - { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(options => - { - options.ProxyClientBuildActions.Add((_, builder) => - { - builder.AddHttpMessageHandler(); - }); - }); - } +//namespace Volo.Abp.AspNetCore.Components.UI +//{ +// [DependsOn( +// typeof(AbpAspNetCoreMvcClientCommonModule), +// typeof(AbpUiModule), +// typeof(AbpAspNetCoreComponentsModule) +// )] +// public class AbpAspNetCoreComponentsUIModule : AbpModule +// { +// public override void PreConfigureServices(ServiceConfigurationContext context) +// { +// PreConfigure(options => +// { +// options.ProxyClientBuildActions.Add((_, builder) => +// { +// builder.AddHttpMessageHandler(); +// }); +// }); +// } - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.Replace(ServiceDescriptor.Transient()); +// public override void ConfigureServices(ServiceConfigurationContext context) +// { +// context.Services.Replace(ServiceDescriptor.Transient()); - //context.Services - // .GetHostBuilder().Logging - // .AddProvider(new AbpExceptionHandlingLoggerProvider(context.Services)); - } - } -} +// //context.Services +// // .GetHostBuilder().Logging +// // .AddProvider(new AbpExceptionHandlingLoggerProvider(context.Services)); +// } +// } +//} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/ApplicationConfigurationCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/ApplicationConfigurationCache.cs index 2c9ae1fcae..3e83044c21 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/ApplicationConfigurationCache.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.UI/Volo/Abp/AspNetCore/Components/UI/ApplicationConfigurationCache.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Components.UI return Configuration; } - internal void Set(ApplicationConfigurationDto configuration) + public void Set(ApplicationConfigurationDto configuration) { Configuration = configuration; } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs index 9e1752ffda..e6dccb373d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/AspNetCore/Components/WebAssembly/Hosting/AbpWebAssemblyHostBuilderExtensions.cs @@ -6,8 +6,9 @@ using JetBrains.Annotations; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; +using Volo.Abp.AspNetCore.Components.UI; +using Volo.Abp.AspNetCore.Components.UI.DependencyInjection; using Volo.Abp.AspNetCore.Components.WebAssembly; -using Volo.Abp.AspNetCore.Components.WebAssembly.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; @@ -47,7 +48,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Hosting Check.NotNull(application, nameof(application)); Check.NotNull(serviceProvider, nameof(serviceProvider)); - var serviceProviderAccessor = (WebAssemblyClientScopeServiceProviderAccessor) + var serviceProviderAccessor = (ComponentsClientScopeServiceProviderAccessor) serviceProvider.GetRequiredService(); serviceProviderAccessor.ServiceProvider = serviceProvider; diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj index 608025f352..11e831d675 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj @@ -15,6 +15,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs index 40e02736d5..6367c5f484 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs @@ -3,7 +3,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Volo.Abp.AspNetCore.Components.DependencyInjection; -using Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling; +using Volo.Abp.AspNetCore.Components.UI; +using Volo.Abp.AspNetCore.Components.UI.ExceptionHandling; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.Http.Client; using Volo.Abp.Modularity; diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs deleted file mode 100644 index 7b40ca5286..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorClientHttpMessageHandler.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.JSInterop; -using Volo.Abp.AspNetCore.Components.Progression; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class AbpBlazorClientHttpMessageHandler : DelegatingHandler, ITransientDependency - { - private readonly IJSRuntime _jsRuntime; - - private readonly ICookieService _cookieService; - - private readonly NavigationManager _navigationManager; - - private readonly IUiPageProgressService _uiPageProgressService; - - private const string AntiForgeryCookieName = "XSRF-TOKEN"; - - private const string AntiForgeryHeaderName = "RequestVerificationToken"; - - public AbpBlazorClientHttpMessageHandler( - IJSRuntime jsRuntime, - ICookieService cookieService, - NavigationManager navigationManager, - IClientScopeServiceProviderAccessor clientScopeServiceProviderAccessor) - { - _jsRuntime = jsRuntime; - _cookieService = cookieService; - _navigationManager = navigationManager; - _uiPageProgressService = clientScopeServiceProviderAccessor.ServiceProvider.GetRequiredService(); - } - - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - try - { - await _uiPageProgressService.Go(null, options => - { - options.Type = UiPageProgressType.Info; - }); - - await SetLanguageAsync(request, cancellationToken); - await SetAntiForgeryTokenAsync(request); - - return await base.SendAsync(request, cancellationToken); - } - finally - { - await _uiPageProgressService.Go(-1); - } - } - - private async Task SetLanguageAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - var selectedLanguage = await _jsRuntime.InvokeAsync( - "localStorage.getItem", - cancellationToken, - "Abp.SelectedLanguage" - ); - - if (!selectedLanguage.IsNullOrWhiteSpace()) - { - request.Headers.AcceptLanguage.Clear(); - request.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(selectedLanguage)); - } - } - - private async Task SetAntiForgeryTokenAsync(HttpRequestMessage request) - { - if (request.Method == HttpMethod.Get || request.Method == HttpMethod.Head || - request.Method == HttpMethod.Trace || request.Method == HttpMethod.Options) - { - return; - } - - var selfUri = new Uri(_navigationManager.Uri); - - if (request.RequestUri.Host != selfUri.Host || request.RequestUri.Port != selfUri.Port) - { - return; - } - - var token = await _cookieService.GetAsync(AntiForgeryCookieName); - - if (!token.IsNullOrWhiteSpace()) - { - request.Headers.Add(AntiForgeryHeaderName, token); - } - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs deleted file mode 100644 index 2a6fb19a11..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpBlazorMessageLocalizerHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using JetBrains.Annotations; -using Microsoft.Extensions.Localization; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class AbpBlazorMessageLocalizerHelper - { - private readonly IStringLocalizer stringLocalizer; - - public AbpBlazorMessageLocalizerHelper(IStringLocalizer stringLocalizer) - { - this.stringLocalizer = stringLocalizer; - } - - public string Localize(string message, [CanBeNull] IEnumerable arguments) - { - try - { - return arguments?.Count() > 0 - ? stringLocalizer[message, LocalizeMessageArguments(arguments)?.ToArray()] - : stringLocalizer[message]; - } - catch - { - return stringLocalizer[message]; - } - } - - private IEnumerable LocalizeMessageArguments(IEnumerable arguments) - { - foreach (var argument in arguments) - { - // first try to localize with "DisplayName:{Name}" - var localization = stringLocalizer[$"DisplayName:{argument}"]; - - if (localization.ResourceNotFound) - { - // then try to localize with just "{Name}" - localization = stringLocalizer[argument]; - } - - yield return localization; - } - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs deleted file mode 100644 index 52da586497..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.JSInterop; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class AbpUtilsService : IAbpUtilsService, ITransientDependency - { - protected IJSRuntime JsRuntime { get; } - - public AbpUtilsService(IJSRuntime jsRuntime) - { - JsRuntime = jsRuntime; - } - - public ValueTask AddClassToTagAsync(string tagName, string className) - { - return JsRuntime.InvokeVoidAsync("abp.utils.addClassToTag", tagName, className); - } - - public ValueTask RemoveClassFromTagAsync(string tagName, string className) - { - return JsRuntime.InvokeVoidAsync("abp.utils.removeClassFromTag", tagName, className); - } - - public ValueTask HasClassOnTagAsync(string tagName, string className) - { - return JsRuntime.InvokeAsync("abp.utils.hasClassOnTag", tagName, className); - } - - public ValueTask ReplaceLinkHrefByIdAsync(string linkId, string hrefValue) - { - return JsRuntime.InvokeVoidAsync("abp.utils.replaceLinkHrefById", linkId, hrefValue); - } - - public ValueTask ToggleFullscreenAsync() - { - return JsRuntime.InvokeVoidAsync("abp.utils.toggleFullscreen"); - } - - public ValueTask RequestFullscreenAsync() - { - return JsRuntime.InvokeVoidAsync("abp.utils.requestFullscreen"); - } - - public ValueTask ExitFullscreenAsync() - { - return JsRuntime.InvokeVoidAsync("abp.utils.exitFullscreen"); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Alerts/AlertManager.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Alerts/AlertManager.cs deleted file mode 100644 index 02c1251f16..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Alerts/AlertManager.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Volo.Abp.AspNetCore.Components.Alerts; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.Alerts -{ - public class AlertManager : IAlertManager, IScopedDependency - { - public AlertList Alerts { get; } - - public AlertManager() - { - Alerts = new AlertList(); - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ApplicationConfigurationCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ApplicationConfigurationCache.cs deleted file mode 100644 index df41c996b6..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ApplicationConfigurationCache.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class ApplicationConfigurationCache : ISingletonDependency - { - protected ApplicationConfigurationDto Configuration { get; set; } - - public virtual ApplicationConfigurationDto Get() - { - return Configuration; - } - - internal void Set(ApplicationConfigurationDto configuration) - { - Configuration = configuration; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs deleted file mode 100644 index 9f05ff24d1..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Volo.Abp.Bundling; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class ComponentsWebAssemblyBundleContributor : IBundleContributor - { - public void AddScripts(BundleContext context) - { - context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly/libs/abp/js/abp.js"); - } - - public void AddStyles(BundleContext context) - { - - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs deleted file mode 100644 index 929995fa05..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public class CookieOptions - { - public DateTimeOffset? ExpireDate { get; set; } - public string Path { get; set; } - public bool Secure { get; set; } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs deleted file mode 100644 index c0dc94ebfa..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.JSInterop; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - [Dependency(ReplaceServices = true)] - public class CookieService : ICookieService, ITransientDependency - { - public IJSRuntime JsRuntime { get; } - - public CookieService(IJSRuntime jsRuntime) - { - JsRuntime = jsRuntime; - } - - public async ValueTask SetAsync(string key, string value, CookieOptions options) - { - await JsRuntime.InvokeVoidAsync("abp.utils.setCookieValue", key, value, options?.ExpireDate?.ToString("r"), options?.Path, options?.Secure); - } - - public async ValueTask GetAsync(string key) - { - return await JsRuntime.InvokeAsync("abp.utils.getCookieValue", key); - } - - public async ValueTask DeleteAsync(string key, string path = null) - { - await JsRuntime.InvokeVoidAsync("abp.utils.deleteCookie", key); - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/DependencyInjection/WebAssemblyClientScopeServiceProviderAccessor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/DependencyInjection/WebAssemblyClientScopeServiceProviderAccessor.cs deleted file mode 100644 index 74b16ec951..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/DependencyInjection/WebAssemblyClientScopeServiceProviderAccessor.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.DependencyInjection -{ - public class WebAssemblyClientScopeServiceProviderAccessor : - IClientScopeServiceProviderAccessor, - ISingletonDependency - { - public IServiceProvider ServiceProvider { get; set; } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLogger.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLogger.cs deleted file mode 100644 index 2190489d4c..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLogger.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling -{ - public class AbpExceptionHandlingLogger : ILogger - { - private readonly IServiceCollection _serviceCollection; - private IUserExceptionInformer _userExceptionInformer; - - public AbpExceptionHandlingLogger(IServiceCollection serviceCollection) - { - _serviceCollection = serviceCollection; - } - - public virtual void Log( - LogLevel logLevel, - EventId eventId, - TState state, - Exception exception, - Func formatter) - { - if (exception == null) - { - return; - } - - if (logLevel != LogLevel.Critical && logLevel != LogLevel.Error) - { - return; - } - - TryInitialize(); - - if (_userExceptionInformer == null) - { - return; - } - - _userExceptionInformer.Inform(new UserExceptionInformerContext(exception)); - } - - protected virtual void TryInitialize() - { - var serviceProvider = _serviceCollection.GetServiceProviderOrNull(); - if (serviceProvider == null) - { - return; - } - - _userExceptionInformer = serviceProvider.GetRequiredService(); - } - - public virtual bool IsEnabled(LogLevel logLevel) - { - return logLevel == LogLevel.Critical || logLevel == LogLevel.Error; - } - - public virtual IDisposable BeginScope(TState state) - { - return NullDisposable.Instance; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs deleted file mode 100644 index 85eb021284..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling -{ - public class AbpExceptionHandlingLoggerProvider : ILoggerProvider - { - private AbpExceptionHandlingLogger _logger; - private static readonly object SyncObj = new object(); - private readonly IServiceCollection _serviceCollection; - - public AbpExceptionHandlingLoggerProvider(IServiceCollection serviceCollection) - { - _serviceCollection = serviceCollection; - } - - public ILogger CreateLogger(string categoryName) - { - if (_logger == null) - { - lock (SyncObj) - { - if (_logger == null) - { - _logger = new AbpExceptionHandlingLogger(_serviceCollection); - } - } - } - - return _logger; - } - - public void Dispose() - { - - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/IUserExceptionInformer.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/IUserExceptionInformer.cs deleted file mode 100644 index 2abbe3667b..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/IUserExceptionInformer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling -{ - public interface IUserExceptionInformer - { - void Inform(UserExceptionInformerContext context); - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformer.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformer.cs deleted file mode 100644 index ca3a2be9c5..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformer.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Volo.Abp.AspNetCore.Components.Messages; -using Volo.Abp.AspNetCore.ExceptionHandling; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Http; -using Volo.Abp.Http.Client; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling -{ - public class UserExceptionInformer : IUserExceptionInformer, ITransientDependency - { - public ILogger Logger { get; set; } - protected IUiMessageService MessageService { get; } - protected IExceptionToErrorInfoConverter ExceptionToErrorInfoConverter { get; } - - public UserExceptionInformer( - IUiMessageService messageService, - IExceptionToErrorInfoConverter exceptionToErrorInfoConverter) - { - MessageService = messageService; - ExceptionToErrorInfoConverter = exceptionToErrorInfoConverter; - Logger = NullLogger.Instance; - } - - public void Inform(UserExceptionInformerContext context) - { - var errorInfo = GetErrorInfo(context); - - if (errorInfo.Details.IsNullOrEmpty()) - { - //TODO: Should we introduce MessageService.Error (sync) method instead of such a usage (without await)..? - MessageService.Error(errorInfo.Message); - } - else - { - MessageService.Error(errorInfo.Details, errorInfo.Message); - } - } - - protected virtual RemoteServiceErrorInfo GetErrorInfo(UserExceptionInformerContext context) - { - if (context.Exception is AbpRemoteCallException remoteCallException) - { - return remoteCallException.Error; - } - - return ExceptionToErrorInfoConverter.Convert(context.Exception, false); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformerContext.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformerContext.cs deleted file mode 100644 index d860467b12..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ExceptionHandling/UserExceptionInformerContext.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using JetBrains.Annotations; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling -{ - public class UserExceptionInformerContext - { - [NotNull] - public Exception Exception { get; } - - public UserExceptionInformerContext(Exception exception) - { - Exception = exception; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs deleted file mode 100644 index 6724d18ee0..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Threading.Tasks; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public interface IAbpUtilsService - { - ValueTask AddClassToTagAsync(string tagName, string className); - - ValueTask RemoveClassFromTagAsync(string tagName, string className); - - ValueTask HasClassOnTagAsync(string tagName, string className); - - ValueTask ReplaceLinkHrefByIdAsync(string linkId, string hrefValue); - - ValueTask ToggleFullscreenAsync(); - - ValueTask RequestFullscreenAsync(); - - ValueTask ExitFullscreenAsync(); - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs deleted file mode 100644 index 21254c9da5..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Threading.Tasks; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly -{ - public interface ICookieService - { - public ValueTask SetAsync(string key, string value, CookieOptions options = null); - public ValueTask GetAsync(string key); - public ValueTask DeleteAsync(string key, string path = null); - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Messages/SimpleUiMessageService.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Messages/SimpleUiMessageService.cs deleted file mode 100644 index 3218912ad0..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Messages/SimpleUiMessageService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.JSInterop; -using Volo.Abp.AspNetCore.Components.Messages; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.Messages -{ - public class SimpleUiMessageService : IUiMessageService, ITransientDependency - { - protected IJSRuntime JsRuntime { get; } - - public SimpleUiMessageService(IJSRuntime jsRuntime) - { - JsRuntime = jsRuntime; - } - - public async Task Info(string message, string title = null, Action options = null) - { - await JsRuntime.InvokeVoidAsync("alert", message); - } - - public async Task Success(string message, string title = null, Action options = null) - { - await JsRuntime.InvokeVoidAsync("alert", message); - } - - public async Task Warn(string message, string title = null, Action options = null) - { - await JsRuntime.InvokeVoidAsync("alert", message); - } - - public async Task Error(string message, string title = null, Action options = null) - { - await JsRuntime.InvokeVoidAsync("alert", message); - } - - public async Task Confirm(string message, string title = null, Action options = null) - { - return await JsRuntime.InvokeAsync("confirm", message); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyCurrentTenantAccessor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyCurrentTenantAccessor.cs deleted file mode 100644 index 3857db2b36..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyCurrentTenantAccessor.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.MultiTenancy; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.MultiTenancy -{ - [Dependency(ReplaceServices = true)] - public class WebAssemblyCurrentTenantAccessor : ICurrentTenantAccessor, ISingletonDependency - { - public BasicTenantInfo Current { get; set; } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStore.cs deleted file mode 100644 index 7e132db9c9..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStore.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Mvc.MultiTenancy; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Http.Client.DynamicProxying; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Threading; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.MultiTenancy -{ - public class WebAssemblyRemoteTenantStore : ITenantStore, ITransientDependency - { - protected IHttpClientProxy Proxy { get; } - protected WebAssemblyRemoteTenantStoreCache Cache { get; } - - public WebAssemblyRemoteTenantStore( - IHttpClientProxy proxy, - WebAssemblyRemoteTenantStoreCache cache) - { - Proxy = proxy; - Cache = cache; - } - - public async Task FindAsync(string name) - { - var cached = Cache.Find(name); - if (cached != null) - { - return cached; - } - - var tenant = CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)); - Cache.Set(tenant); - return tenant; - } - - public async Task FindAsync(Guid id) - { - var cached = Cache.Find(id); - if (cached != null) - { - return cached; - } - - var tenant = CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)); - Cache.Set(tenant); - return tenant; - } - - public TenantConfiguration Find(string name) - { - return AsyncHelper.RunSync(() => FindAsync(name)); - } - - public TenantConfiguration Find(Guid id) - { - return AsyncHelper.RunSync(() => FindAsync(id)); - } - - protected virtual TenantConfiguration CreateTenantConfiguration(FindTenantResultDto tenantResultDto) - { - if (!tenantResultDto.Success || tenantResultDto.TenantId == null) - { - return null; - } - - return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStoreCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStoreCache.cs deleted file mode 100644 index e1c5112e02..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/MultiTenancy/WebAssemblyRemoteTenantStoreCache.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Volo.Abp.DependencyInjection; -using Volo.Abp.MultiTenancy; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.MultiTenancy -{ - public class WebAssemblyRemoteTenantStoreCache : IScopedDependency - { - protected readonly List CachedTenants = new List(); - - public virtual TenantConfiguration Find(string name) - { - return CachedTenants.FirstOrDefault(t => t.Name == name); - } - - public virtual TenantConfiguration Find(Guid id) - { - return CachedTenants.FirstOrDefault(t => t.Id == id); - } - - public virtual void Set(TenantConfiguration tenant) - { - var existingTenant = Find(tenant.Id); - if (existingTenant != null) - { - existingTenant.Name = tenant.Name; - return; - } - - CachedTenants.Add(tenant); - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Security/AbpWebAssemblyClaimsCache.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Security/AbpWebAssemblyClaimsCache.cs deleted file mode 100644 index a0826ee940..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/Security/AbpWebAssemblyClaimsCache.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Authorization; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.AspNetCore.Components.WebAssembly.Security -{ - [ExposeServices( - typeof(AbpWebAssemblyClaimsCache), - typeof(IAsyncInitialize) - )] - public class AbpWebAssemblyClaimsCache : ISingletonDependency, IAsyncInitialize - { - public ClaimsPrincipal Principal { get; private set; } - - private readonly AuthenticationStateProvider _authenticationStateProvider; - - public AbpWebAssemblyClaimsCache(AuthenticationStateProvider authenticationStateProvider) - { - _authenticationStateProvider = authenticationStateProvider; - } - - public virtual async Task InitializeAsync() - { - var authenticationState = await _authenticationStateProvider.GetAuthenticationStateAsync(); - Principal = authenticationState.User; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs index d71b97334a..e423df2997 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Components.UI; using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.DependencyInjection; diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs index 9e9357c908..73ba8471ad 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentPrincipalAccessor.cs @@ -1,5 +1,5 @@ using System.Security.Claims; -using Volo.Abp.AspNetCore.Components.WebAssembly.Security; +using Volo.Abp.AspNetCore.Components.UI.Security; using Volo.Abp.DependencyInjection; using Volo.Abp.Security.Claims; @@ -7,10 +7,10 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly { public class WebAssemblyCurrentPrincipalAccessor : CurrentPrincipalAccessorBase, ITransientDependency { - protected AbpWebAssemblyClaimsCache ClaimsCache { get; } + protected AbpComponentsClaimsCache ClaimsCache { get; } public WebAssemblyCurrentPrincipalAccessor( - AbpWebAssemblyClaimsCache claimsCache) + AbpComponentsClaimsCache claimsCache) { ClaimsCache = claimsCache; } diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpBlazoriseModule.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpBlazoriseModule.cs index 2af5b67ab0..3e83f784cd 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpBlazoriseModule.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpBlazoriseModule.cs @@ -1,12 +1,13 @@ using Blazorise; using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Components; using Volo.Abp.AspNetCore.Components.UI; using Volo.Abp.Modularity; namespace Volo.Abp.BlazoriseUI { [DependsOn( - typeof(AbpAspNetCoreComponentsUIModule) + typeof(AbpAspNetCoreComponentsModule) )] public class AbpBlazoriseUIModule : AbpModule { diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorModule.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorModule.cs index 7cdeb0295b..b4de67835e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorModule.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Routing; +using Volo.Abp.AspNetCore.Components.UI.Theming.Routing; using Volo.Abp.AutoMapper; using Volo.Abp.BlazoriseUI; using Volo.Abp.Modularity; diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor index 2465940abd..0cf1ba52b4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor @@ -2,10 +2,9 @@ @attribute [Authorize( IdentityPermissions.Roles.Default )] @using Volo.Abp.Identity @using Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Components.Forms @using Volo.Abp.PermissionManagement.Blazor.Components -@using Microsoft.Extensions.Localization @using Volo.Abp.Identity.Localization +@using Volo.Abp.AspNetCore.Components.UI @inject AbpBlazorMessageLocalizerHelper LH @inherits AbpCrudPageBase diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor index f4b7e411d9..e72d74ade4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor @@ -1,10 +1,9 @@ @page "/identity/users" @attribute [Authorize( IdentityPermissions.Users.Default )] @using Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Components.Forms @using Volo.Abp.PermissionManagement.Blazor.Components -@using Microsoft.Extensions.Localization @using Volo.Abp.Identity.Localization +@using Volo.Abp.AspNetCore.Components.UI @inject AbpBlazorMessageLocalizerHelper LH @inherits AbpCrudPageBase @@ -17,7 +16,7 @@

@L["Users"]

- @if (HasCreatePermission) + @if ( HasCreatePermission ) {