From 66448fd2b01e88c6aac3eed1425f15e982ff14ef Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Thu, 18 Mar 2021 11:45:08 +0300 Subject: [PATCH] Move entity actions and table columns to the Volo.Abp.AspNetCore.Components.Web project. --- .../EntityActions/EntityAction.cs | 2 +- .../EntityActions/EntityActionDictionary.cs | 2 +- .../Extensibility/TableColumns/TableColumn.cs | 4 +- .../TableColumns/TableColumnDictionary.cs | 5 +- .../Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 6 +- .../Components/AbpExtensibleDataGrid.razor.cs | 6 +- .../Components/EntityAction.razor.cs | 3 +- .../ExtensionProperties.razor.cs | 3 +- .../LookupExtensionProperty.razor.cs | 60 +++++++++---------- .../Volo.Abp.BlazoriseUI.csproj | 1 + .../Pages/Identity/RoleManagement.razor.cs | 4 +- .../Pages/Identity/UserManagement.razor.cs | 4 +- .../TenantManagement.razor.cs | 4 +- 13 files changed, 50 insertions(+), 54 deletions(-) rename framework/src/{Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components => Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web}/Extensibility/EntityActions/EntityAction.cs (90%) rename framework/src/{Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components => Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web}/Extensibility/EntityActions/EntityActionDictionary.cs (79%) rename framework/src/{Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components => Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web}/Extensibility/TableColumns/TableColumn.cs (80%) rename framework/src/{Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components => Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web}/Extensibility/TableColumns/TableColumnDictionary.cs (66%) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityAction.cs similarity index 90% rename from framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs rename to framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityAction.cs index 8d2646e688..018bea1740 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityAction.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityAction.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -namespace Volo.Abp.AspNetCore.Components.Extensibility.EntityActions +namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions { public class EntityAction : IEquatable { diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityActionDictionary.cs similarity index 79% rename from framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs rename to framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityActionDictionary.cs index 4b1009da67..36117abb37 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/EntityActions/EntityActionDictionary.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/EntityActions/EntityActionDictionary.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Volo.Abp.AspNetCore.Components.Extensibility.EntityActions +namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions { public class EntityActionDictionary : Dictionary> { diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs similarity index 80% rename from framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs rename to framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs index eac10dc23b..0676c14399 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumn.cs @@ -1,9 +1,9 @@ using JetBrains.Annotations; using System; using System.Collections.Generic; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; -namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns +namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns { public class TableColumn { diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumnDictionary.cs similarity index 66% rename from framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs rename to framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumnDictionary.cs index d414839e8b..a68ad437d4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumnDictionary.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Extensibility/TableColumns/TableColumnDictionary.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; -namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns +namespace Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns { public class TableColumnDictionary : Dictionary> { diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index e651fd4e35..3875297873 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -13,14 +13,14 @@ using Microsoft.Extensions.Options; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.AspNetCore.Components; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; -using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; using Volo.Abp.Localization; using Volo.Abp.Authorization; using Volo.Abp.BlazoriseUI.Components; using Volo.Abp.BlazoriseUI.Components.ObjectExtending; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.ObjectExtending; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns; namespace Volo.Abp.BlazoriseUI { @@ -565,7 +565,7 @@ namespace Volo.Abp.BlazoriseUI Title = propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory), Data = $"ExtraProperties[{propertyInfo.Name}]" }; - + if (propertyInfo.IsDate() || propertyInfo.IsDateTime()) { column.DisplayFormat = propertyInfo.GetDateEditInputFormatOrNull(); diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs index 623b26dc5f..a6c9498467 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs @@ -3,13 +3,11 @@ using Blazorise.Extensions; using Blazorise.DataGrid; using Microsoft.AspNetCore.Components; using System.Collections.Generic; -using JetBrains.Annotations; -using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; -using System.Linq; using System.Text.RegularExpressions; using Microsoft.Extensions.Localization; using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns; namespace Volo.Abp.BlazoriseUI.Components { diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 5011c5b05f..33418ecf88 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -52,8 +52,7 @@ namespace Volo.Abp.BlazoriseUI.Components { await base.OnInitializedAsync(); await SetDefaultValuesAsync(); - IsEntityActionVisible = await Visible?.Invoke(); - if (!RequiredPolicy.IsNullOrEmpty() && IsEntityActionVisible) + if (!RequiredPolicy.IsNullOrEmpty()) { HasPermission = await AuthorizationService.IsGrantedAsync(RequiredPolicy); } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs index 5f13e38458..f5d9704155 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Localization; -using System; -using Volo.Abp.AspNetCore.Components.WebAssembly; +using Volo.Abp.AspNetCore.Components.Web; using Volo.Abp.Data; namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor.cs index b46a10fd9a..2ace2ebfed 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.Http; using Volo.Abp.Http.Client; -using Volo.Abp.Http.Client.Authentication; +//using Volo.Abp.Http.Client.Authentication; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectExtending; @@ -32,17 +32,17 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending [Parameter] public ObjectExtensionPropertyInfo PropertyInfo { get; set; } - [Inject] - public IRemoteServiceHttpClientAuthenticator ClientAuthenticator { get; set; } + //[Inject] + //public IRemoteServiceHttpClientAuthenticator ClientAuthenticator { get; set; } - [Inject] - public IHttpClientFactory HttpClientFactory { get; set; } + //[Inject] + //public IHttpClientFactory HttpClientFactory { get; set; } [Inject] public ICurrentTenant CurrentTenant { get; set; } - [Inject] - public IOptions RemoteServiceOptions { get; set; } + //[Inject] + //public IOptions RemoteServiceOptions { get; set; } public string TextPropertyName => PropertyInfo.Name + "_Text"; @@ -94,28 +94,28 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending url += $"?{PropertyInfo.Lookup.FilterParamName}={filter.Trim()}"; } - var client = HttpClientFactory.CreateClient(); - var requestMessage = new HttpRequestMessage(HttpMethod.Get, url); - AddHeaders(requestMessage); - - if (!uri.IsAbsoluteUri) - { - var remoteServiceConfig = RemoteServiceOptions.Value.RemoteServices.GetConfigurationOrDefault("Default"); - client.BaseAddress = new Uri(remoteServiceConfig.BaseUrl); - await ClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration(remoteServiceConfig.BaseUrl), string.Empty)); - } - - var response = await client.SendAsync(requestMessage); - var document = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync()); - var itemsArrayProp = document.RootElement.GetProperty(PropertyInfo.Lookup.ResultListPropertyName); - foreach (var item in itemsArrayProp.EnumerateArray()) - { - selectItems.Add(new SelectItem - { - Text = item.GetProperty(PropertyInfo.Lookup.DisplayPropertyName).GetString(), - Value = JsonSerializer.Deserialize(item.GetProperty(PropertyInfo.Lookup.ValuePropertyName).GetRawText(), PropertyInfo.Type) - }); - } + //var client = HttpClientFactory.CreateClient(); + //var requestMessage = new HttpRequestMessage(HttpMethod.Get, url); + //AddHeaders(requestMessage); + + //if (!uri.IsAbsoluteUri) + //{ + // var remoteServiceConfig = RemoteServiceOptions.Value.RemoteServices.GetConfigurationOrDefault("Default"); + // client.BaseAddress = new Uri(remoteServiceConfig.BaseUrl); + // await ClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration(remoteServiceConfig.BaseUrl), string.Empty)); + //} + + //var response = await client.SendAsync(requestMessage); + //var document = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync()); + //var itemsArrayProp = document.RootElement.GetProperty(PropertyInfo.Lookup.ResultListPropertyName); + //foreach (var item in itemsArrayProp.EnumerateArray()) + //{ + // selectItems.Add(new SelectItem + // { + // Text = item.GetProperty(PropertyInfo.Lookup.DisplayPropertyName).GetString(), + // Value = JsonSerializer.Deserialize(item.GetProperty(PropertyInfo.Lookup.ValuePropertyName).GetRawText(), PropertyInfo.Type) + // }); + //} return selectItems; } @@ -143,7 +143,7 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending requestMessage.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(currentCulture)); } - requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MimeTypes.Application.Json)); + //requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MimeTypes.Application.Json)); } } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj index fecc9a51a3..1900a890c1 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj +++ b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj @@ -17,6 +17,7 @@ + diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs index e2393bde26..9b46325afe 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs @@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Authorization; using System; using System.Collections.Generic; using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; -using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns; using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.PageToolbars; using Volo.Abp.Identity.Localization; using Volo.Abp.PermissionManagement.Blazor.Components; diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs index 5ebc1881db..2fa7229681 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs @@ -7,8 +7,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Components.Extensibility; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; -using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns; using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.PageToolbars; using Volo.Abp.Identity.Localization; using Volo.Abp.ObjectExtending; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs index 8814a362a2..68033185d6 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Volo.Abp.AspNetCore.Components.Extensibility.EntityActions; -using Volo.Abp.AspNetCore.Components.Extensibility.TableColumns; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; +using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns; using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.PageToolbars; using Volo.Abp.BlazoriseUI; using Volo.Abp.FeatureManagement.Blazor.Components;