From b3ba2e3186e078607ff0f6489022eb20c45cfaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lkay=20=C4=B0lknur?= Date: Wed, 21 Oct 2020 17:33:54 +0300 Subject: [PATCH 01/14] entity actions component implementation. --- .../Components/EntityAction.razor | 21 ++++++++++ .../Components/EntityAction.razor.cs | 33 ++++++++++++++++ .../Components/EntityActions.razor | 30 ++++++++++++++ .../Components/EntityActions.razor.cs | 39 +++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor new file mode 100644 index 0000000000..c36620f195 --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor @@ -0,0 +1,21 @@ +@typeparam TItem +@using Blazorise + +@if (ParentActions.Type == ActionType.Dropdown) +{ + if (IsVisible && Primary == false) + { + @Text + } +} +else +{ + if (IsVisible) + { + + @Text + + } +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs new file mode 100644 index 0000000000..8dc4dcb5a0 --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -0,0 +1,33 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; + +namespace Volo.Abp.BlazoriseUI.Components +{ + public partial class EntityAction : ComponentBase + { + [Parameter] + public bool IsVisible { get; set; } + [Parameter] + public string Text { get; set; } + + [Parameter] + public bool Primary { get; set; } + + [Parameter] + public EventCallback Clicked { get; set; } + + [CascadingParameter] + public EntityActions ParentActions { get; set; } + + protected override void OnInitialized() + { + base.OnInitialized(); + ParentActions.AddAction(this); + } + + protected virtual async Task ActionClickedAsync() + { + await Clicked.InvokeAsync(ParentActions.Entity); + } + } +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor new file mode 100644 index 0000000000..b5afcdbadf --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor @@ -0,0 +1,30 @@ +@typeparam TItem + + @if (Type == ActionType.Dropdown) + { + + @if (HasPrimaryAction) + { + + @PrimaryAction.Text + + + } + else + { + + @ToggleText + + } + + @ChildContent + + + } + else + { + @ChildContent + } + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs new file mode 100644 index 0000000000..d24c7125a7 --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Blazorise; +using Microsoft.AspNetCore.Components; + +namespace Volo.Abp.BlazoriseUI.Components +{ + public partial class EntityActions : ComponentBase + { + protected List> Actions = new List>(); + protected bool HasPrimaryAction => Actions.Any(t => t.Primary); + protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary); + protected internal ActionType Type => Actions.Count(t => t.IsVisible) > 1 ? ActionType.Dropdown : ActionType.Button; + + [Parameter] + public Color ToggleColor { get; set; } + + [Parameter] + public string ToggleText { get; set; } + + [Parameter] + public TItem Entity { get; set; } + + [Parameter] + public RenderFragment ChildContent { get; set; } + + internal void AddAction(EntityAction action) + { + Actions.Add(action); + StateHasChanged(); + } + } + + public enum ActionType + { + Dropdown, + Button + } +} From f7a3955e368b80dd4397849a30a251d490afaa18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lkay=20=C4=B0lknur?= Date: Fri, 23 Oct 2020 15:13:01 +0300 Subject: [PATCH 02/14] Introduce DataGridActionsColumn and add policy check, default value setting --- .../Components/DataGridEntityActionsColumn.cs | 23 ++++++++ .../Components/EntityAction.razor | 5 +- .../Components/EntityAction.razor.cs | 57 +++++++++++++++---- .../Components/EntityActions.razor | 7 +-- .../Components/EntityActions.razor.cs | 30 +++++++--- 5 files changed, 98 insertions(+), 24 deletions(-) create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs new file mode 100644 index 0000000000..316c01370b --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs @@ -0,0 +1,23 @@ +using System.Linq; +using Blazorise.DataGrid; +using Localization.Resources.AbpUi; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; + +namespace Volo.Abp.BlazoriseUI.Components +{ + public class DataGridEntityActionsColumn : DataGridColumn + { + [Inject] + public IStringLocalizer UiLocalizer { get; set; } + + protected override void OnInitialized() + { + base.OnInitialized(); + Caption = UiLocalizer["Actions"]; + Width = "150px"; + Sortable = false; + Field = typeof(TItem).GetProperties().First().Name; + } + } +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor index c36620f195..4988af6725 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor @@ -1,5 +1,4 @@ -@typeparam TItem -@using Blazorise +@using Blazorise @if (ParentActions.Type == ActionType.Dropdown) { @@ -13,7 +12,7 @@ else if (IsVisible) { @Text diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 8dc4dcb5a0..872a735f83 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -1,12 +1,16 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; +using Blazorise; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; +using Volo.Abp.AspNetCore.Components.WebAssembly; namespace Volo.Abp.BlazoriseUI.Components { - public partial class EntityAction : ComponentBase + public partial class EntityAction : ComponentBase { - [Parameter] - public bool IsVisible { get; set; } + internal bool IsVisible; + [Parameter] public string Text { get; set; } @@ -14,20 +18,53 @@ namespace Volo.Abp.BlazoriseUI.Components public bool Primary { get; set; } [Parameter] - public EventCallback Clicked { get; set; } + public EventCallback Clicked { get; set; } + + [Parameter] + public string Policy { get; set; } + + [Parameter] + public Color Color { get; set; } + + [Parameter] + public string ConfirmationMessage { get; set; } [CascadingParameter] - public EntityActions ParentActions { get; set; } + public EntityActions ParentActions { get; set; } - protected override void OnInitialized() + [Inject] + protected IAuthorizationService AuthorizationService { get; set; } + + [Inject] + protected IUiMessageService UiMessageService { get; set; } + + protected async override Task OnInitializedAsync() { - base.OnInitialized(); + await base.OnInitializedAsync(); + await SetDefaultValuesAsync(); ParentActions.AddAction(this); + IsVisible = await AuthorizationService.IsGrantedAsync(Policy); + } + + protected internal virtual async Task ActionClickedAsync() + { + if (!ConfirmationMessage.IsNullOrEmpty()) + { + if (await UiMessageService.ConfirmAsync(ConfirmationMessage)) + { + await Clicked.InvokeAsync(); + } + } + else + { + await Clicked.InvokeAsync(); + } } - protected virtual async Task ActionClickedAsync() + protected virtual ValueTask SetDefaultValuesAsync() { - await Clicked.InvokeAsync(ParentActions.Entity); + Color = Color.Primary; + return ValueTask.CompletedTask; } } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor index b5afcdbadf..16e4889490 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor @@ -1,13 +1,12 @@ -@typeparam TItem - + @if (Type == ActionType.Dropdown) { @if (HasPrimaryAction) { + Color="@PrimaryAction.Color" + Clicked="async ()=> await PrimaryAction.ActionClickedAsync()"> @PrimaryAction.Text diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs index d24c7125a7..9024bf0d4b 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs @@ -1,15 +1,18 @@ using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Blazorise; +using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; namespace Volo.Abp.BlazoriseUI.Components { - public partial class EntityActions : ComponentBase + public partial class EntityActions : ComponentBase { - protected List> Actions = new List>(); + protected readonly List Actions = new List(); protected bool HasPrimaryAction => Actions.Any(t => t.Primary); - protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary); + protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary); protected internal ActionType Type => Actions.Count(t => t.IsVisible) > 1 ? ActionType.Dropdown : ActionType.Button; [Parameter] @@ -18,17 +21,30 @@ namespace Volo.Abp.BlazoriseUI.Components [Parameter] public string ToggleText { get; set; } - [Parameter] - public TItem Entity { get; set; } - [Parameter] public RenderFragment ChildContent { get; set; } - internal void AddAction(EntityAction action) + [Inject] + public IStringLocalizer UiLocalizer { get; set; } + + internal void AddAction(EntityAction action) { Actions.Add(action); StateHasChanged(); } + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + await SetDefaultValuesAsync(); + } + + protected virtual ValueTask SetDefaultValuesAsync() + { + ToggleColor = Color.Primary; + ToggleText = UiLocalizer["Actions"]; + return ValueTask.CompletedTask; + } } public enum ActionType From a2643f3f2834444ae515cb43023e6009fcc120db Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Sun, 25 Oct 2020 23:50:43 +0300 Subject: [PATCH 03/14] add datagridentityactionscolumn reference to the entityactions component and code refactorings. --- .../Components/DataGridEntityActionsColumn.cs | 11 ++++++-- .../Components/EntityAction.razor | 3 +- .../Components/EntityAction.razor.cs | 6 ++-- .../Components/EntityActions.razor | 3 +- .../Components/EntityActions.razor.cs | 28 +++++++++---------- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs index 316c01370b..f41ec63e2c 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Threading.Tasks; using Blazorise.DataGrid; using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Components; @@ -11,13 +12,19 @@ namespace Volo.Abp.BlazoriseUI.Components [Inject] public IStringLocalizer UiLocalizer { get; set; } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + await SetDefaultValuesAsync(); + } + + protected virtual ValueTask SetDefaultValuesAsync() { - base.OnInitialized(); Caption = UiLocalizer["Actions"]; Width = "150px"; Sortable = false; Field = typeof(TItem).GetProperties().First().Name; + return ValueTask.CompletedTask; } } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor index 4988af6725..99e0383fdc 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor @@ -1,4 +1,5 @@ -@using Blazorise +@typeparam TItem +@using Blazorise @if (ParentActions.Type == ActionType.Dropdown) { diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 872a735f83..60b2495938 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -7,7 +7,7 @@ using Volo.Abp.AspNetCore.Components.WebAssembly; namespace Volo.Abp.BlazoriseUI.Components { - public partial class EntityAction : ComponentBase + public partial class EntityAction : ComponentBase { internal bool IsVisible; @@ -30,7 +30,7 @@ namespace Volo.Abp.BlazoriseUI.Components public string ConfirmationMessage { get; set; } [CascadingParameter] - public EntityActions ParentActions { get; set; } + public EntityActions ParentActions { get; set; } [Inject] protected IAuthorizationService AuthorizationService { get; set; } @@ -42,8 +42,8 @@ namespace Volo.Abp.BlazoriseUI.Components { await base.OnInitializedAsync(); await SetDefaultValuesAsync(); - ParentActions.AddAction(this); IsVisible = await AuthorizationService.IsGrantedAsync(Policy); + ParentActions.AddAction(this); } protected internal virtual async Task ActionClickedAsync() diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor index 16e4889490..d445d102d3 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor @@ -1,4 +1,5 @@ - +@typeparam TItem + @if (Type == ActionType.Dropdown) { diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs index 9024bf0d4b..ef3d9a8a9e 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs @@ -8,15 +8,15 @@ using Microsoft.Extensions.Localization; namespace Volo.Abp.BlazoriseUI.Components { - public partial class EntityActions : ComponentBase + public partial class EntityActions : ComponentBase { - protected readonly List Actions = new List(); + protected readonly List> Actions = new List>(); protected bool HasPrimaryAction => Actions.Any(t => t.Primary); - protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary); + protected EntityAction PrimaryAction => Actions.FirstOrDefault(t => t.Primary); protected internal ActionType Type => Actions.Count(t => t.IsVisible) > 1 ? ActionType.Dropdown : ActionType.Button; [Parameter] - public Color ToggleColor { get; set; } + public Color ToggleColor { get; set; } = Color.Primary; [Parameter] public string ToggleText { get; set; } @@ -24,26 +24,26 @@ namespace Volo.Abp.BlazoriseUI.Components [Parameter] public RenderFragment ChildContent { get; set; } + [Parameter] + public DataGridEntityActionsColumn EntityActionsColumn { get; set; } + [Inject] public IStringLocalizer UiLocalizer { get; set; } - internal void AddAction(EntityAction action) + internal void AddAction(EntityAction action) { Actions.Add(action); + if (EntityActionsColumn != null) + { + EntityActionsColumn.Displayable = Actions.Any(t => t.IsVisible); + } StateHasChanged(); } - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - await SetDefaultValuesAsync(); - } - - protected virtual ValueTask SetDefaultValuesAsync() + protected override void OnInitialized() { - ToggleColor = Color.Primary; + base.OnInitialized(); ToggleText = UiLocalizer["Actions"]; - return ValueTask.CompletedTask; } } From b2d05a53bc1a9bbb5b6e196312f0fe4051633f80 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Mon, 26 Oct 2020 11:50:43 +0300 Subject: [PATCH 04/14] policy name changed. --- .../Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 60b2495938..7d2a96dcf1 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -21,12 +21,12 @@ namespace Volo.Abp.BlazoriseUI.Components public EventCallback Clicked { get; set; } [Parameter] - public string Policy { get; set; } + public string RequiredPolicy { get; set; } [Parameter] public Color Color { get; set; } - - [Parameter] + + [Parameter] public string ConfirmationMessage { get; set; } [CascadingParameter] @@ -42,7 +42,7 @@ namespace Volo.Abp.BlazoriseUI.Components { await base.OnInitializedAsync(); await SetDefaultValuesAsync(); - IsVisible = await AuthorizationService.IsGrantedAsync(Policy); + IsVisible = await AuthorizationService.IsGrantedAsync(RequiredPolicy); ParentActions.AddAction(this); } From a36ccf1e822727c7cf7af0e8c4f3147c99f7a648 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Mon, 26 Oct 2020 13:55:16 +0300 Subject: [PATCH 05/14] move confirmation check to the actions component. --- framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 6 ------ .../Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs | 8 +++++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index 76f7caf377..4df70152fa 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -169,7 +169,6 @@ namespace Volo.Abp.BlazoriseUI where TUpdateViewModel : class, new() { [Inject] protected TAppService AppService { get; set; } - [Inject] protected IUiMessageService UiMessageService { get; set; } [Inject] protected IStringLocalizer UiLocalizer { get; set; } [Inject] protected IAuthorizationService AuthorizationService { get; set; } @@ -392,11 +391,6 @@ namespace Volo.Abp.BlazoriseUI { await CheckDeletePolicyAsync(); - if (!await UiMessageService.ConfirmAsync(GetDeleteConfirmationMessage(entity))) - { - return; - } - await AppService.DeleteAsync(entity.Id); await GetEntitiesAsync(); } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 7d2a96dcf1..6e98865297 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -1,8 +1,10 @@ using System; using System.Threading.Tasks; using Blazorise; +using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Localization; using Volo.Abp.AspNetCore.Components.WebAssembly; namespace Volo.Abp.BlazoriseUI.Components @@ -27,7 +29,7 @@ namespace Volo.Abp.BlazoriseUI.Components public Color Color { get; set; } [Parameter] - public string ConfirmationMessage { get; set; } + public Func ConfirmationMessage { get; set; } [CascadingParameter] public EntityActions ParentActions { get; set; } @@ -48,9 +50,9 @@ namespace Volo.Abp.BlazoriseUI.Components protected internal virtual async Task ActionClickedAsync() { - if (!ConfirmationMessage.IsNullOrEmpty()) + if (ConfirmationMessage != null) { - if (await UiMessageService.ConfirmAsync(ConfirmationMessage)) + if (await UiMessageService.ConfirmAsync(ConfirmationMessage())) { await Clicked.InvokeAsync(); } From 3666579a2970a14089b23a5b14d17990d138b340 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Mon, 26 Oct 2020 14:14:40 +0300 Subject: [PATCH 06/14] move action type enum to a new file. --- .../src/Volo.Abp.BlazoriseUI/Components/ActionType.cs | 8 ++++++++ .../Components/EntityActions.razor.cs | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/ActionType.cs diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ActionType.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ActionType.cs new file mode 100644 index 0000000000..8f6afd69c9 --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ActionType.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.BlazoriseUI.Components +{ + public enum ActionType + { + Dropdown, + Button + } +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs index ef3d9a8a9e..0d058904c4 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor.cs @@ -46,10 +46,4 @@ namespace Volo.Abp.BlazoriseUI.Components ToggleText = UiLocalizer["Actions"]; } } - - public enum ActionType - { - Dropdown, - Button - } } From 8364cabfccf581b6c892b637462b000e3b39102b Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Sun, 1 Nov 2020 19:06:06 +0300 Subject: [PATCH 07/14] EntityActionsColumn added. --- framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index bec51fe149..2b7e8421b8 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -15,6 +15,7 @@ using Volo.Abp.Application.Services; using Volo.Abp.AspNetCore.Components; using Volo.Abp.AspNetCore.Components.WebAssembly; using Volo.Abp.Authorization; +using Volo.Abp.BlazoriseUI.Components; using Volo.Abp.ObjectMapping; namespace Volo.Abp.BlazoriseUI @@ -188,6 +189,7 @@ namespace Volo.Abp.BlazoriseUI protected Validations CreateValidationsRef; protected Validations EditValidationsRef; protected List BreadcrumbItems = new List(2); + protected DataGridEntityActionsColumn EntityActionsColumn; protected string CreatePolicyName { get; set; } protected string UpdatePolicyName { get; set; } From b1d622ea02e78cb8f2f8f66c7e8a0f4572a16c88 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Sun, 1 Nov 2020 19:31:27 +0300 Subject: [PATCH 08/14] make required policy optional --- .../Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index 6e98865297..a7680edc81 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.BlazoriseUI.Components { public partial class EntityAction : ComponentBase { - internal bool IsVisible; + internal bool IsVisible = true; [Parameter] public string Text { get; set; } @@ -44,7 +44,10 @@ namespace Volo.Abp.BlazoriseUI.Components { await base.OnInitializedAsync(); await SetDefaultValuesAsync(); - IsVisible = await AuthorizationService.IsGrantedAsync(RequiredPolicy); + if (!RequiredPolicy.IsNullOrEmpty()) + { + IsVisible = await AuthorizationService.IsGrantedAsync(RequiredPolicy); + } ParentActions.AddAction(this); } From 700946270af5df367b2bc62ef6a2d42695ca37e5 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Sun, 1 Nov 2020 21:29:54 +0300 Subject: [PATCH 09/14] use datagrid entity actions column usage in modules. --- .../Pages/Identity/RoleManagement.razor | 117 ++++++++---------- .../Pages/Identity/RoleManagement.razor.cs | 16 +-- .../Pages/Identity/UserManagement.razor | 62 ++++------ .../Pages/Identity/UserManagement.razor.cs | 22 ++-- .../Volo.Abp.Identity.Blazor/_Imports.razor | 1 + .../TenantManagement/TenantManagement.razor | 81 ++++++------ .../TenantManagement.razor.cs | 43 ++++--- .../_Imports.razor | 1 + 8 files changed, 154 insertions(+), 189 deletions(-) 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 4639f81be2..353bfa3b6b 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 @@ -1,5 +1,5 @@ @page "/identity/roles" -@attribute [Authorize( IdentityPermissions.Roles.Default )] +@attribute [Authorize(IdentityPermissions.Roles.Default)] @using Volo.Abp.Identity @using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @@ -14,7 +14,7 @@ @L["Roles"] - @if ( HasCreatePermission ) + @if (HasCreatePermission) { @@ -31,40 +31,33 @@ ShowPager="true" PageSize="PageSize"> - @if ( ShouldShowEntityActions ) - { - - - - - @L["Actions"] - - - @if ( HasUpdatePermission ) - { - @L["Edit"] - } - @if ( HasManagePermissionsPermission ) - { - @L["Permissions"] - } - @if ( HasDeletePermission ) - { - @L["Delete"] - } - - - - - } + + + + + + + + + - @(context.As().Name) - @if ( context.As().IsDefault ) + @(context.Name) + @if (context.IsDefault) { @L["DisplayName:IsDefault"] } - @if ( context.As().IsPublic ) + @if (context.IsPublic) { @L["DisplayName:IsPublic"] } @@ -74,42 +67,42 @@ @* ************************* CREATE MODAL ************************* *@ -@if ( HasCreatePermission ) +@if (HasCreatePermission) { - - - - - @L["NewRole"] - - - - - - - @L["DisplayName:RoleName"] - - - - - - - + + + + + @L["NewRole"] + + + + + - @L["DisplayName:IsDefault"] - @L["DisplayName:IsPublic"] + @L["DisplayName:RoleName"] + + + + + - - - - - - - - + + + @L["DisplayName:IsDefault"] + @L["DisplayName:IsPublic"] + + + + + + + + + } @* ************************* EDIT MODAL ************************* *@ -@if ( HasUpdatePermission ) +@if (HasUpdatePermission) { 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 04b7a1011d..f64615c1f0 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 @@ -13,11 +13,10 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity protected const string PermissionProviderName = "R"; protected PermissionManagementModal PermissionManagementModal; + protected string ManagePermissionsPolicyName; protected bool HasManagePermissionsPermission { get; set; } - protected bool ShouldShowEntityActions { get; set; } - public RoleManagementBase() { ObjectMapperContext = typeof(AbpIdentityBlazorModule); @@ -26,19 +25,12 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity CreatePolicyName = IdentityPermissions.Roles.Create; UpdatePolicyName = IdentityPermissions.Roles.Update; DeletePolicyName = IdentityPermissions.Roles.Delete; + ManagePermissionsPolicyName = IdentityPermissions.Roles.ManagePermissions; } - protected override async Task SetPermissionsAsync() + protected override string GetDeleteConfirmationMessage(IdentityRoleDto entity) { - await base.SetPermissionsAsync(); - - HasManagePermissionsPermission = await AuthorizationService.IsGrantedAsync( - IdentityPermissions.Roles.ManagePermissions - ); - - ShouldShowEntityActions = HasUpdatePermission || - HasDeletePermission || - HasManagePermissionsPermission; + return string.Format(L["RoleDeletionConfirmationMessage"], entity.Name); } } } 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 93e0ccaa85..e5ad942275 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,5 +1,5 @@ @page "/identity/users" -@attribute [Authorize( IdentityPermissions.Users.Default )] +@attribute [Authorize(IdentityPermissions.Users.Default)] @using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @using Volo.Abp.Identity.Localization @@ -13,7 +13,7 @@

@L["Users"]

- @if ( HasCreatePermission ) + @if (HasCreatePermission) { @@ -30,33 +30,25 @@ ShowPager="true" PageSize="PageSize"> - @if ( ShouldShowEntityActions ) - { - - - - - @L["Actions"] - - - @if ( HasUpdatePermission ) - { - @L["Edit"] - } - @if ( HasManagePermissionsPermission ) - { - @L["Permissions"] - } - @if ( HasDeletePermission ) - { - - @L["Delete"] - } - - - - - } + + + + + + + + + @(context.As().UserName) @@ -76,7 +68,7 @@ @* ************************* CREATE MODAL ************************* *@ -@if ( HasCreatePermission ) +@if (HasCreatePermission) { @@ -159,9 +151,9 @@ - @if ( NewUserRoles != null ) + @if (NewUserRoles != null) { - @foreach ( var role in NewUserRoles ) + @foreach (var role in NewUserRoles) { @@ -183,7 +175,7 @@ } @* ************************* EDIT MODAL ************************* *@ -@if ( HasUpdatePermission ) +@if (HasUpdatePermission) { @@ -268,9 +260,9 @@ - @if ( EditUserRoles != null ) + @if (EditUserRoles != null) { - @foreach ( var role in EditUserRoles ) + @foreach (var role in EditUserRoles) { 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 0265bf89d1..303c511b80 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 @@ -24,8 +24,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity protected AssignedRoleViewModel[] EditUserRoles; - protected bool ShouldShowEntityActions { get; set; } - protected bool HasManagePermissionsPermission { get; set; } + protected string ManagePermissionsPolicyName; protected string CreateModalSelectedTab = DefaultSelectedTab; @@ -39,6 +38,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity CreatePolicyName = IdentityPermissions.Users.Create; UpdatePolicyName = IdentityPermissions.Users.Update; DeletePolicyName = IdentityPermissions.Users.Delete; + ManagePermissionsPolicyName = IdentityPermissions.Users.ManagePermissions; } protected override async Task OnInitializedAsync() @@ -48,19 +48,6 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity Roles = (await AppService.GetAssignableRolesAsync()).Items; } - protected override async Task SetPermissionsAsync() - { - await base.SetPermissionsAsync(); - - HasManagePermissionsPermission = await AuthorizationService.IsGrantedAsync( - IdentityPermissions.Users.ManagePermissions - ); - - ShouldShowEntityActions = HasUpdatePermission || - HasDeletePermission || - HasManagePermissionsPermission; - } - protected override async Task OnOpeningCreateModalAsync() { CreateModalSelectedTab = DefaultSelectedTab; @@ -104,6 +91,11 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity return base.OnUpdatingEntityAsync(); } + + protected override string GetDeleteConfirmationMessage(IdentityUserDto entity) + { + return string.Format(L["UserDeletionConfirmationMessage"], entity.UserName); + } } public class AssignedRoleViewModel diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/_Imports.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/_Imports.razor index bcb4626f1f..51955030c9 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/_Imports.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/_Imports.razor @@ -2,5 +2,6 @@ @using Volo.Abp.AspNetCore.Components.WebAssembly @using Microsoft.AspNetCore.Components.Forms @using Volo.Abp.BlazoriseUI +@using Volo.Abp.BlazoriseUI.Components @using Blazorise @using Blazorise.DataGrid diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor index 0b2f60d23b..c777bcb50b 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor @@ -6,7 +6,6 @@ @using Volo.Abp.FeatureManagement.Blazor.Components @inherits TenantManagementBase @inject IStringLocalizer L - @* ************************* PAGE HEADER ************************* *@ @@ -30,40 +29,32 @@ ShowPager="true" PageSize="PageSize"> - @if (ShouldShowEntityActions) - { - - - - - @L["Actions"] - - - @if (HasUpdatePermission) - { - @L["Edit"] - } - @if (HasManageConnectionStringsPermission) - { - @L["ConnectionStrings"] - } - @if (HasManageFeaturesPermission) - { - @L["Features"] - } - @if (HasDeletePermission) - { - - @L["Delete"] - } - - - - - } + + + + + + + + + + - @(context.As().Name) + @(context.Name) @@ -73,25 +64,25 @@ @if (HasCreatePermission) { - + @L["NewTenant"] - + @L["TenantName"] - + @L["DisplayName:AdminEmailAddress"] - + @L["DisplayName:AdminPassword"] - + @@ -107,17 +98,17 @@ @if (HasUpdatePermission) { - + @L["Edit"] - + @L["TenantName"] - + @@ -133,11 +124,11 @@ @if (HasUpdatePermission) { - + @L["ConnectionStrings"] - + @@ -149,7 +140,7 @@ { @L["DisplayName:DefaultConnectionString"] - + } @@ -164,5 +155,5 @@ @if (HasManageFeaturesPermission) { - + } \ No newline at end of file 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 f9dd57422e..9106c32c78 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 @@ -7,21 +7,22 @@ using Volo.Abp.FeatureManagement.Blazor.Components; namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement { - public abstract class TenantManagementBase + public abstract class TenantManagementBase : AbpCrudPageBase { protected const string FeatureProviderName = "T"; - - protected bool ShouldShowEntityActions; + protected bool HasManageConnectionStringsPermission; protected bool HasManageFeaturesPermission; + protected string ManageConnectionStringsPolicyName; + protected string ManageFeaturesPolicyName; protected FeatureManagementModal FeatureManagementModal; - + protected Modal ManageConnectionStringModal; protected TenantInfoModel TenantInfo; - + public TenantManagementBase() { ObjectMapperContext = typeof(AbpTenantManagementBlazorModule); @@ -29,37 +30,34 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement CreatePolicyName = TenantManagementPermissions.Tenants.Create; UpdatePolicyName = TenantManagementPermissions.Tenants.Update; DeletePolicyName = TenantManagementPermissions.Tenants.Delete; - + ManageConnectionStringsPolicyName = TenantManagementPermissions.Tenants.ManageConnectionStrings; + ManageFeaturesPolicyName = TenantManagementPermissions.Tenants.ManageFeatures; + TenantInfo = new TenantInfoModel(); } - + protected override async Task SetPermissionsAsync() { await base.SetPermissionsAsync(); - HasManageConnectionStringsPermission = await AuthorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.ManageConnectionStrings); - HasManageFeaturesPermission = await AuthorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.ManageFeatures); - - ShouldShowEntityActions = HasUpdatePermission || - HasDeletePermission || - HasManageConnectionStringsPermission || - HasManageFeaturesPermission; + HasManageConnectionStringsPermission = await AuthorizationService.IsGrantedAsync(ManageConnectionStringsPolicyName); + HasManageFeaturesPermission = await AuthorizationService.IsGrantedAsync(ManageFeaturesPolicyName); } protected virtual async Task OpenEditConnectionStringModalAsync(Guid id) { var tenantConnectionString = await AppService.GetDefaultConnectionStringAsync(id); - + TenantInfo = new TenantInfoModel { Id = id, DefaultConnectionString = tenantConnectionString, UseSharedDatabase = tenantConnectionString.IsNullOrWhiteSpace() }; - + ManageConnectionStringModal.Show(); } - + protected virtual Task CloseEditConnectionStringModal() { ManageConnectionStringModal.Hide(); @@ -68,7 +66,7 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement protected virtual async Task UpdateConnectionStringAsync() { - await CheckPolicyAsync(TenantManagementPermissions.Tenants.ManageConnectionStrings); + await CheckPolicyAsync(ManageConnectionStringsPolicyName); if (TenantInfo.UseSharedDatabase || TenantInfo.DefaultConnectionString.IsNullOrWhiteSpace()) { @@ -78,9 +76,14 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement { await AppService.UpdateDefaultConnectionStringAsync(TenantInfo.Id, TenantInfo.DefaultConnectionString); } - + ManageConnectionStringModal.Hide(); } + + protected override string GetDeleteConfirmationMessage(TenantDto entity) + { + return string.Format(L["TenantDeletionConfirmationMessage"], entity.Name); + } } public class TenantInfoModel @@ -88,7 +91,7 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement public Guid Id { get; set; } public bool UseSharedDatabase { get; set; } - + public string DefaultConnectionString { get; set; } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/_Imports.razor b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/_Imports.razor index bcb4626f1f..51955030c9 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/_Imports.razor +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/_Imports.razor @@ -2,5 +2,6 @@ @using Volo.Abp.AspNetCore.Components.WebAssembly @using Microsoft.AspNetCore.Components.Forms @using Volo.Abp.BlazoriseUI +@using Volo.Abp.BlazoriseUI.Components @using Blazorise @using Blazorise.DataGrid From abbfb3a6eec589fb9ffc0f0510a391c29a52643d Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Sun, 1 Nov 2020 21:37:51 +0300 Subject: [PATCH 10/14] blazorise.snackbar package added. --- .../MyCompanyName.MyProjectName.Blazor.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj index 6a3f216d47..b3da53f3a4 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -9,6 +9,7 @@ + From 4fbe8d34f10a7ed24ae349209323a0c75920c938 Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Mon, 2 Nov 2020 10:01:32 +0100 Subject: [PATCH 11/14] Add null check for validations component --- .../Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index eb9cab5a73..18ff4bf7a1 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -281,9 +281,7 @@ namespace Volo.Abp.BlazoriseUI protected virtual async Task OpenCreateModalAsync() { - await OnOpeningCreateModalAsync(); - - CreateValidationsRef.ClearAll(); + CreateValidationsRef?.ClearAll(); await CheckCreatePolicyAsync(); @@ -296,11 +294,6 @@ namespace Volo.Abp.BlazoriseUI CreateModal.Show(); } - protected virtual Task OnOpeningCreateModalAsync() - { - return Task.CompletedTask; - } - protected virtual Task CloseCreateModalAsync() { CreateModal.Hide(); @@ -309,9 +302,7 @@ namespace Volo.Abp.BlazoriseUI protected virtual async Task OpenEditModalAsync(TKey id) { - await OnOpeningEditModalAsync(id); - - EditValidationsRef.ClearAll(); + EditValidationsRef?.ClearAll(); await CheckUpdatePolicyAsync(); @@ -325,11 +316,6 @@ namespace Volo.Abp.BlazoriseUI EditModal.Show(); } - protected virtual Task OnOpeningEditModalAsync(TKey id) - { - return Task.CompletedTask; - } - protected virtual TUpdateViewModel MapToEditingEntity(TGetOutputDto entityDto) { return ObjectMapper.Map(entityDto); @@ -363,7 +349,7 @@ namespace Volo.Abp.BlazoriseUI protected virtual async Task CreateEntityAsync() { - if (CreateValidationsRef.ValidateAll()) + if (CreateValidationsRef?.ValidateAll() ?? false) { await OnCreatingEntityAsync(); @@ -390,7 +376,7 @@ namespace Volo.Abp.BlazoriseUI protected virtual async Task UpdateEntityAsync() { - if (EditValidationsRef.ValidateAll()) + if (EditValidationsRef?.ValidateAll() ?? false) { await OnUpdatingEntityAsync(); From 895a94d15994a0c902f4e75ca81cd5b9e434e878 Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Mon, 2 Nov 2020 10:01:57 +0100 Subject: [PATCH 12/14] Removed on OnOpeningCreateModalAsync and OnOpeningEditModalAsync --- .../Pages/Identity/UserManagement.razor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 b47998f55d..e905215616 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 @@ -61,7 +61,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity HasManagePermissionsPermission; } - protected override async Task OnOpeningCreateModalAsync() + protected override Task OpenCreateModalAsync() { CreateModalSelectedTab = DefaultSelectedTab; @@ -71,7 +71,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity IsAssigned = x.IsDefault }).ToArray(); - await base.OnOpeningCreateModalAsync(); + return base.OpenCreateModalAsync(); } protected override Task OnCreatingEntityAsync() @@ -94,7 +94,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity IsAssigned = userRoleNames.Contains(x.Name) }).ToArray(); - await base.OnOpeningEditModalAsync(id); + await base.OpenEditModalAsync(id); } protected override Task OnUpdatingEntityAsync() From 6b6ff5f6bc720108b79516872a8b21ecad299d4c Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Mon, 2 Nov 2020 12:46:14 +0300 Subject: [PATCH 13/14] build break fix. --- .../Pages/Identity/UserManagement.razor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 bd1ac19814..647246b954 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 @@ -48,7 +48,8 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity Roles = (await AppService.GetAssignableRolesAsync()).Items; } - protected override Task OnOpeningCreateModalAsync() + + protected override Task OpenCreateModalAsync() { CreateModalSelectedTab = DefaultSelectedTab; From acfccff7ce09c1b26d41cabbfb474cac77d57fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 2 Nov 2020 13:45:08 +0300 Subject: [PATCH 14/14] Revert "Blazorise snackbar package added." --- .../MyCompanyName.MyProjectName.Blazor.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj index b3da53f3a4..6a3f216d47 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -9,7 +9,6 @@ -