Browse Source
Merge pull request #6069 from abpframework/cotur/crudpagebase
Replace Id parameter with object at OpenEditModalAsync in AbpCrudPageBase
pull/6074/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
17 additions and
17 deletions
-
docs/en/Tutorials/Part-3.md
-
docs/en/Tutorials/Part-5.md
-
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
-
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor
-
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor
-
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs
-
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor
-
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor/Pages/TenantManagement/TenantManagement.razor.cs
|
|
|
@ -1264,7 +1264,7 @@ Open the `Books.razor` and add the following `DataGridColumn` section inside the |
|
|
|
@L["Actions"] |
|
|
|
</DropdownToggle> |
|
|
|
<DropdownMenu> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context.Id)"> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context)"> |
|
|
|
@L["Edit"] |
|
|
|
</DropdownItem> |
|
|
|
</DropdownMenu> |
|
|
|
@ -1273,7 +1273,7 @@ Open the `Books.razor` and add the following `DataGridColumn` section inside the |
|
|
|
</DataGridColumn> |
|
|
|
```` |
|
|
|
|
|
|
|
* `OpenEditModalAsync` is defined in the base class which takes the `Id` of the entity (book) to edit. |
|
|
|
* `OpenEditModalAsync` is defined in the base class which takes the entity (book) to edit. |
|
|
|
|
|
|
|
This adds an "Actions" dropdown to all the books inside the `DataGrid` with an `Edit` action: |
|
|
|
|
|
|
|
@ -1419,7 +1419,7 @@ Here the complete code to create the book management CRUD page, that has been de |
|
|
|
@L["Actions"] |
|
|
|
</DropdownToggle> |
|
|
|
<DropdownMenu> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context.Id)"> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context)"> |
|
|
|
@L["Edit"] |
|
|
|
</DropdownItem> |
|
|
|
<DropdownItem Clicked="() => DeleteEntityAsync(context)"> |
|
|
|
|
|
|
|
@ -523,7 +523,7 @@ As similar to the *New Book* button, we can use `if` blocks to conditionally sho |
|
|
|
````xml |
|
|
|
@if (canEditBook) |
|
|
|
{ |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context.Id)"> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context)"> |
|
|
|
@L["Edit"] |
|
|
|
</DropdownItem> |
|
|
|
} |
|
|
|
|
|
|
|
@ -300,15 +300,15 @@ namespace Volo.Abp.BlazoriseUI |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task OpenEditModalAsync(TKey id) |
|
|
|
protected virtual async Task OpenEditModalAsync(TListViewModel entity) |
|
|
|
{ |
|
|
|
EditValidationsRef?.ClearAll(); |
|
|
|
|
|
|
|
await CheckUpdatePolicyAsync(); |
|
|
|
|
|
|
|
var entityDto = await AppService.GetAsync(id); |
|
|
|
var entityDto = await AppService.GetAsync(entity.Id); |
|
|
|
|
|
|
|
EditingEntityId = id; |
|
|
|
EditingEntityId = entity.Id; |
|
|
|
EditingEntity = MapToEditingEntity(entityDto); |
|
|
|
|
|
|
|
await InvokeAsync(() => StateHasChanged()); |
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ |
|
|
|
<EntityActions TItem="IdentityRoleDto" EntityActionsColumn="@EntityActionsColumn"> |
|
|
|
<EntityAction TItem="IdentityRoleDto" |
|
|
|
RequiredPolicy="@UpdatePolicyName" |
|
|
|
Clicked="() => OpenEditModalAsync(context.Id)" |
|
|
|
Clicked="() => OpenEditModalAsync(context)" |
|
|
|
Text="@L["Edit"]"></EntityAction> |
|
|
|
<EntityAction TItem="IdentityRoleDto" |
|
|
|
RequiredPolicy="@ManagePermissionsPolicyName" |
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ |
|
|
|
<EntityActions TItem="IdentityUserDto" EntityActionsColumn="@EntityActionsColumn"> |
|
|
|
<EntityAction TItem="IdentityUserDto" |
|
|
|
RequiredPolicy="@UpdatePolicyName" |
|
|
|
Clicked="() => OpenEditModalAsync(context.Id)" |
|
|
|
Clicked="() => OpenEditModalAsync(context)" |
|
|
|
Text="@L["Edit"]" /> |
|
|
|
<EntityAction TItem="IdentityUserDto" |
|
|
|
RequiredPolicy="@ManagePermissionsPolicyName" |
|
|
|
|
|
|
|
@ -69,11 +69,11 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity |
|
|
|
return base.OnCreatingEntityAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
protected async override Task OpenEditModalAsync(Guid id) |
|
|
|
protected async override Task OpenEditModalAsync(IdentityUserDto entity) |
|
|
|
{ |
|
|
|
EditModalSelectedTab = DefaultSelectedTab; |
|
|
|
|
|
|
|
var userRoleNames = (await AppService.GetRolesAsync(id)).Items.Select(r => r.Name).ToList(); |
|
|
|
var userRoleNames = (await AppService.GetRolesAsync(entity.Id)).Items.Select(r => r.Name).ToList(); |
|
|
|
|
|
|
|
EditUserRoles = Roles.Select(x => new AssignedRoleViewModel |
|
|
|
{ |
|
|
|
@ -81,7 +81,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity |
|
|
|
IsAssigned = userRoleNames.Contains(x.Name) |
|
|
|
}).ToArray(); |
|
|
|
|
|
|
|
await base.OpenEditModalAsync(id); |
|
|
|
await base.OpenEditModalAsync(entity); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Task OnUpdatingEntityAsync() |
|
|
|
|
|
|
|
@ -34,11 +34,11 @@ |
|
|
|
<EntityActions TItem="TenantDto" EntityActionsColumn="@EntityActionsColumn"> |
|
|
|
<EntityAction TItem="TenantDto" |
|
|
|
RequiredPolicy="@UpdatePolicyName" |
|
|
|
Clicked="() => OpenEditModalAsync(context.Id)" |
|
|
|
Clicked="() => OpenEditModalAsync(context)" |
|
|
|
Text="@L["Edit"]"></EntityAction> |
|
|
|
<EntityAction TItem="TenantDto" |
|
|
|
RequiredPolicy="@ManageConnectionStringsPolicyName" |
|
|
|
Clicked="() => OpenEditConnectionStringModalAsync(context.Id)" |
|
|
|
Clicked="() => OpenEditConnectionStringModalAsync(context)" |
|
|
|
Text="@L["ConnectionStrings"]"></EntityAction> |
|
|
|
<EntityAction TItem="TenantDto" |
|
|
|
RequiredPolicy="@ManageFeaturesPolicyName" |
|
|
|
|
|
|
|
@ -47,15 +47,15 @@ namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement |
|
|
|
HasManageFeaturesPermission = await AuthorizationService.IsGrantedAsync(ManageFeaturesPolicyName); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task OpenEditConnectionStringModalAsync(Guid id) |
|
|
|
protected virtual async Task OpenEditConnectionStringModalAsync(TenantDto entity) |
|
|
|
{ |
|
|
|
ManageConnectionStringValidations.ClearAll(); |
|
|
|
|
|
|
|
var tenantConnectionString = await AppService.GetDefaultConnectionStringAsync(id); |
|
|
|
var tenantConnectionString = await AppService.GetDefaultConnectionStringAsync(entity.Id); |
|
|
|
|
|
|
|
TenantInfo = new TenantInfoModel |
|
|
|
{ |
|
|
|
Id = id, |
|
|
|
Id = entity.Id, |
|
|
|
DefaultConnectionString = tenantConnectionString, |
|
|
|
UseSharedDatabase = tenantConnectionString.IsNullOrWhiteSpace() |
|
|
|
}; |
|
|
|
|