From a476ca3a3f232924f416a555808c7a37c3e96421 Mon Sep 17 00:00:00 2001 From: capdiem Date: Thu, 4 Jan 2024 18:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20bug=20after=20upgrading?= =?UTF-8?q?=20masa.blazor=20(#1264)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Organization/Organization.razor | 2 +- .../Pages/Organization/Organization.razor.cs | 19 ++++++------ .../Organization/Position/Position.razor | 2 +- .../Organization/Position/Position.razor.cs | 16 +++++----- .../Pages/RolePermissions/Roles/Role.razor | 2 +- .../Pages/RolePermissions/Roles/Role.razor.cs | 29 +++++++++++++------ .../Pages/Sso/ApiResource/ApiResource.razor | 2 +- .../Sso/ApiResource/ApiResource.razor.cs | 20 +++++++------ .../Pages/Sso/ApiScope/ApiScope.razor | 2 +- .../Pages/Sso/ApiScope/ApiScope.razor.cs | 20 +++++++------ .../Pages/Sso/Client/Client.razor | 2 +- .../Pages/Sso/Client/Client.razor.cs | 20 +++++++------ .../CustomLoginRegister.razor | 2 +- .../CustomLoginRegister.razor.cs | 26 ++++++++++------- .../IdentityResource/IdentityResource.razor | 2 +- .../IdentityResource.razor.cs | 27 +++++++++-------- .../Pages/Sso/UserClaim/UserClaim.razor | 2 +- .../Pages/Sso/UserClaim/UserClaim.razor.cs | 16 +++++----- .../ThirdPartyIdps/ThirdPartyIdp.razor | 2 +- .../ThirdPartyIdps/ThirdPartyIdp.razor.cs | 26 +++++++++-------- .../Pages/Subjects/Users/Staff.razor | 2 +- .../Pages/Subjects/Users/Staff.razor.cs | 23 ++++++++------- .../Pages/Subjects/Users/ThirdPartyUser.razor | 2 +- .../Subjects/Users/ThirdPartyUser.razor.cs | 20 +++++++------ .../Pages/Subjects/Users/User.razor | 2 +- .../Pages/Subjects/Users/User.razor.cs | 25 ++++++++++------ .../Pages/Webhooks/Index.razor | 2 +- .../Pages/Webhooks/Index.razor.cs | 18 +++++++----- 28 files changed, 189 insertions(+), 144 deletions(-) diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor index 38c6f5579..8da335319 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor @@ -121,7 +121,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor.cs index 220c0b603..e45b448d1 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Organization.razor.cs @@ -17,6 +17,7 @@ public partial class Organization CopyOrgSheet _copyOrgSheet = null!; OrgSheet _orgSheet = null!; string _searchName = string.Empty; + private List> _headers = new(); DepartmentService DepartmentService => AuthCaller.DepartmentService; @@ -25,18 +26,18 @@ public partial class Organization [Parameter] public Guid DepartmentId { get; set; } = Guid.Empty; - public List> GetHeaders() => new() - { - new() { Text = T(nameof(Staff)), Value = nameof(StaffDto.Name), CellClass = "body-medium emphasis2--text" }, - new() { Text = T(nameof(StaffDto.Account)), Value = nameof(StaffDto.Account), CellClass = "subtitle" }, - new() { Text = T(nameof(StaffDto.Position)), Value = nameof(StaffDto.Position), CellClass = "subtitle" }, - new() { Text = T(nameof(StaffDto.JobNumber)), Value = nameof(StaffDto.JobNumber), CellClass = "subtitle" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="80px" } - }; - protected override void OnInitialized() { PageName = "OrganizationBlock"; + + _headers = new List> { + new() { Text = T(nameof(Staff)), Value = nameof(StaffDto.Name), CellClass = "body-medium emphasis2--text" }, + new() { Text = T(nameof(StaffDto.Account)), Value = nameof(StaffDto.Account), CellClass = "subtitle" }, + new() { Text = T(nameof(StaffDto.Position)), Value = nameof(StaffDto.Position), CellClass = "subtitle" }, + new() { Text = T(nameof(StaffDto.JobNumber)), Value = nameof(StaffDto.JobNumber), CellClass = "subtitle" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "80px" } + }; + base.OnInitialized(); } diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor index db9472ada..3ec170ebf 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor @@ -21,7 +21,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor.cs index e294046cb..5c162e03a 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Organization/Position/Position.razor.cs @@ -57,20 +57,22 @@ public int PageSize public bool UpdatePositionDialogVisible { get; set; } private PositionService PositionService => AuthCaller.PositionService; + + private List> _headers = new(); protected override async Task OnInitializedAsync() { PageName = "PositionBlock"; + + _headers = new List>() { + new() { Text = T("Index"), Value = "Index", Sortable = false, Width = "105px" }, + new() { Text = T("Name"), Value = nameof(PositionDto.Name), Sortable = false }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "105px" }, + }; + await GetPositionsAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("Index"), Value = "Index", Sortable = false , Width="105px" }, - new() { Text = T("Name"), Value = nameof(PositionDto.Name), Sortable = false }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetPositionsAsync() { var reuquest = new GetPositionsDto(Page, PageSize, Search); diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor index fcc3504bc..677b280b5 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor.cs index c802a411d..60e5b5f17 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/RolePermissions/Roles/Role.razor.cs @@ -74,17 +74,28 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } await base.OnAfterRenderAsync(firstRender); } + + private List> _headers = new(); - public List> GetHeaders() => new() + protected override void OnInitialized() { - new() { Text = T("Name"), Value = nameof(RoleDto.Name), Sortable = false, Align=DataTableHeaderAlign.Start }, - new() { Text = T(nameof(RoleDto.CreationTime)), Value = nameof(RoleDto.CreationTime), Sortable = false, Align = DataTableHeaderAlign.Start }, - new() { Text = T(nameof(RoleDto.ModificationTime)), Value = nameof(RoleDto.ModificationTime), Sortable = false , Align = DataTableHeaderAlign.Start }, - new() { Text = T(nameof(RoleDto.Creator)), Value = nameof(RoleDto.Creator), Sortable = false, Align = DataTableHeaderAlign.Start }, - new() { Text = T(nameof(RoleDto.Modifier)), Value = nameof(RoleDto.Modifier), Sortable = false , Align = DataTableHeaderAlign.Start }, - new() { Text = T("State"), Value = nameof(RoleDto.Enabled), Sortable = false , Align=DataTableHeaderAlign.Start, Width = "105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "105px" }, - }; + _headers = new List>() { + new() { Text = T("Name"), Value = nameof(RoleDto.Name), Sortable = false, Align = DataTableHeaderAlign.Start }, + new() { + Text = T(nameof(RoleDto.CreationTime)), Value = nameof(RoleDto.CreationTime), Sortable = false, Align = DataTableHeaderAlign.Start + }, + new() { + Text = T(nameof(RoleDto.ModificationTime)), Value = nameof(RoleDto.ModificationTime), Sortable = false, + Align = DataTableHeaderAlign.Start + }, + new() { Text = T(nameof(RoleDto.Creator)), Value = nameof(RoleDto.Creator), Sortable = false, Align = DataTableHeaderAlign.Start }, + new() { Text = T(nameof(RoleDto.Modifier)), Value = nameof(RoleDto.Modifier), Sortable = false, Align = DataTableHeaderAlign.Start }, + new() { Text = T("State"), Value = nameof(RoleDto.Enabled), Sortable = false, Align = DataTableHeaderAlign.Start, Width = "105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "105px" }, + }; + + base.OnInitialized(); + } public async Task GetRolesAsync() { diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor index e7f2fcfc1..6ce2cf0f1 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor.cs index 1cb36bf64..9d6b5ed83 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiResource/ApiResource.razor.cs @@ -52,21 +52,23 @@ public int PageSize private ApiResourceService ApiResourceService => AuthCaller.ApiResourceService; + private List> _headers = new(); + protected override async Task OnInitializedAsync() { PageName = "ApiResourceBlock"; + + _headers = new List> { + new() { Text = T("Name"), Value = nameof(ApiResourceDto.Name), Sortable = false, Width = "250px" }, + new() { Text = T(nameof(ApiResourceDto.DisplayName)), Value = nameof(ApiResourceDto.DisplayName), Sortable = false, Width = "250px" }, + new() { Text = T(nameof(ApiResourceDto.Description)), Value = nameof(ApiResourceDto.Description), Sortable = false }, + new() { Text = T("State"), Value = nameof(ApiResourceDto.Enabled), Sortable = false, Width = "105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "105px" }, + }; + await GetApiResourcesAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("Name"), Value = nameof(ApiResourceDto.Name), Sortable = false, Width="250px" }, - new() { Text = T(nameof(ApiResourceDto.DisplayName)), Value = nameof(ApiResourceDto.DisplayName), Sortable = false, Width="250px" }, - new() { Text = T(nameof(ApiResourceDto.Description)), Value = nameof(ApiResourceDto.Description), Sortable = false }, - new() { Text = T("State"), Value = nameof(ApiResourceDto.Enabled), Sortable = false , Width="105px"}, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetApiResourcesAsync() { var reuquest = new GetApiResourcesDto(Page, PageSize, Search); diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor index 6e31e3a97..1d229ca15 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor.cs index 6d6a318d2..5c8e07171 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/ApiScope/ApiScope.razor.cs @@ -55,18 +55,20 @@ public int PageSize protected override async Task OnInitializedAsync() { PageName = "ApiScopeBlock"; + + _headers = new List> { + new() { Text = T("Name"), Value = nameof(ApiScopeDto.Name), Sortable = false, Width="250px" }, + new() { Text = T(nameof(ApiScopeDto.DisplayName)), Value = nameof(ApiScopeDto.DisplayName), Sortable = false , Width="250px"}, + new() { Text = T("Required"), Value = nameof(ApiScopeDto.Required), Sortable = false, Width="105px" }, + new() { Text = T(nameof(ApiScopeDto.Description)), Value = nameof(ApiScopeDto.Description), Sortable = false }, + new() { Text = T("State"), Value = nameof(ApiScopeDto.Enabled), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + await GetApiScopesAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("Name"), Value = nameof(ApiScopeDto.Name), Sortable = false, Width="250px" }, - new() { Text = T(nameof(ApiScopeDto.DisplayName)), Value = nameof(ApiScopeDto.DisplayName), Sortable = false , Width="250px"}, - new() { Text = T("Required"), Value = nameof(ApiScopeDto.Required), Sortable = false, Width="105px" }, - new() { Text = T(nameof(ApiScopeDto.Description)), Value = nameof(ApiScopeDto.Description), Sortable = false }, - new() { Text = T("State"), Value = nameof(ApiScopeDto.Enabled), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; + private List> _headers = new(); public async Task GetApiScopesAsync() { diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor index db24b787a..6ef935006 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor.cs index 53cd5c36c..ae39c4e44 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor.cs @@ -12,19 +12,21 @@ public partial class Client ClientService _clientService => AuthCaller.ClientService; - public List> GetHeaders() => new() - { - new() { Text = T(nameof(ClientDto.ClientName)), Value = nameof(ClientDto.ClientName), Sortable = false , Width="300px"}, - new() { Text = T(nameof(ClientDto.ClientId)), Value = nameof(ClientDto.ClientId), Sortable = false, Width="300px" }, - new() { Text = T(nameof(ClientDto.ClientType)), Value = nameof(ClientDto.ClientType), Sortable = false, Width="105px" }, - new() { Text = T(nameof(ClientDto.Description)), Value = nameof(ClientDto.Description), Sortable = false }, - new() { Text = T(nameof(ClientDto.Enabled)), Value = nameof(ClientDto.Enabled), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; + private List> _headers = new(); protected override void OnInitialized() { PageName = "ClientBlock"; + + _headers = new List> { + new() { Text = T(nameof(ClientDto.ClientName)), Value = nameof(ClientDto.ClientName), Sortable = false , Width="300px"}, + new() { Text = T(nameof(ClientDto.ClientId)), Value = nameof(ClientDto.ClientId), Sortable = false, Width="300px" }, + new() { Text = T(nameof(ClientDto.ClientType)), Value = nameof(ClientDto.ClientType), Sortable = false, Width="105px" }, + new() { Text = T(nameof(ClientDto.Description)), Value = nameof(ClientDto.Description), Sortable = false }, + new() { Text = T(nameof(ClientDto.Enabled)), Value = nameof(ClientDto.Enabled), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + base.OnInitialized(); } diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor index 6965e3105..f94d6490c 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor.cs index 0c746201a..b3f1cc352 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/CustomLoginRegister/CustomLoginRegister.razor.cs @@ -64,17 +64,23 @@ protected override async Task OnAfterRenderAsync(bool firstRender) await base.OnAfterRenderAsync(firstRender); } - public List> GetHeaders() => new() + protected override void OnInitialized() { - new() { Text = T(nameof(ClientDto.LogoUri)), Value = nameof(ClientDto.LogoUri), Sortable = false, Width="105px" }, - new() { Text = T("TitleName"), Value = nameof(CustomLoginDto.Name), Sortable = false}, - new() { Text = T("ClientName"), Value = nameof(ClientDto.ClientName), Sortable = false}, - new() { Text = T(nameof(CustomLoginDto.CreationTime)), Value = nameof(CustomLoginDto.CreationTime), Sortable = false , Width="250px" }, - new() { Text = T(nameof(CustomLoginDto.ModificationTime)), Value = nameof(CustomLoginDto.ModificationTime), Sortable = false, Width="250px" }, - new() { Text = T(nameof(CustomLoginDto.Modifier)), Value = nameof(CustomLoginDto.Modifier), Sortable = false, Width="105px" }, - new() { Text = T("State"), Value = nameof(CustomLoginDto.Enabled), Sortable = false , Width="105px"}, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; + base.OnInitialized(); + + _headers = new List> { + new() { Text = T(nameof(ClientDto.LogoUri)), Value = nameof(ClientDto.LogoUri), Sortable = false, Width="105px" }, + new() { Text = T("TitleName"), Value = nameof(CustomLoginDto.Name), Sortable = false}, + new() { Text = T("ClientName"), Value = nameof(ClientDto.ClientName), Sortable = false}, + new() { Text = T(nameof(CustomLoginDto.CreationTime)), Value = nameof(CustomLoginDto.CreationTime), Sortable = false , Width="250px" }, + new() { Text = T(nameof(CustomLoginDto.ModificationTime)), Value = nameof(CustomLoginDto.ModificationTime), Sortable = false, Width="250px" }, + new() { Text = T(nameof(CustomLoginDto.Modifier)), Value = nameof(CustomLoginDto.Modifier), Sortable = false, Width="105px" }, + new() { Text = T("State"), Value = nameof(CustomLoginDto.Enabled), Sortable = false , Width="105px"}, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + } + + private List> _headers = new(); public async Task GetCustomLoginsAsync() { diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor index 09b05ca26..e1f9db1cb 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor @@ -24,7 +24,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor.cs index bc690ddf7..4e47f1843 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/IdentityResource/IdentityResource.razor.cs @@ -7,6 +7,7 @@ public partial class IdentityResource { private string? _search; private int _page = 1, _pageSize = 20; + private List> _headers = new(); public string Search { @@ -55,19 +56,21 @@ public int PageSize protected override async Task OnInitializedAsync() { PageName = "IdentityResourceBlock"; + + _headers = new List> { + new() { Text = T("Name"), Value = nameof(IdentityResourceDto.Name), Sortable = false, Width = "250px" }, + new() { + Text = T(nameof(IdentityResourceDto.DisplayName)), Value = nameof(IdentityResourceDto.DisplayName), Sortable = false, Width = "250px" + }, + new() { Text = T("Required"), Value = nameof(IdentityResourceDto.Required), Sortable = false, Width = "105px" }, + new() { Text = T(nameof(IdentityResourceDto.Description)), Value = nameof(IdentityResourceDto.Description), Sortable = false }, + new() { Text = T("State"), Value = nameof(IdentityResourceDto.Enabled), Sortable = false, Width = "105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width = "105px" }, + }; + await GetIdentityResourcesAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("Name"), Value = nameof(IdentityResourceDto.Name), Sortable = false, Width="250px"}, - new() { Text = T(nameof(IdentityResourceDto.DisplayName)), Value = nameof(IdentityResourceDto.DisplayName), Sortable = false, Width="250px" }, - new() { Text = T("Required"), Value = nameof(IdentityResourceDto.Required), Sortable = false, Width="105px" }, - new() { Text = T(nameof(IdentityResourceDto.Description)), Value = nameof(IdentityResourceDto.Description), Sortable = false }, - new() { Text = T("State"), Value = nameof(IdentityResourceDto.Enabled), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetIdentityResourcesAsync() { var reuquest = new GetIdentityResourcesDto(Page, PageSize, Search); @@ -100,7 +103,8 @@ public void OpenUpdateRoleDialog(IdentityResourceDto identityResource) public async Task OpenRemoveIdentityResourceDialog(IdentityResourceDto identityResource) { - var confirm = await OpenConfirmDialog(T("Delete IdentityResource"), T("Are you sure delete identityResource \"{0}\"?", identityResource.Name)); + var confirm = await OpenConfirmDialog(T("Delete IdentityResource"), + T("Are you sure delete identityResource \"{0}\"?", identityResource.Name)); if (confirm) await RemoveIdentityResourceAsync(identityResource.Id); } @@ -111,4 +115,3 @@ public async Task RemoveIdentityResourceAsync(Guid identityResourceId) await GetIdentityResourcesAsync(); } } - diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor index eaaa32b2d..53e28f976 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor @@ -24,7 +24,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor.cs index 5d9e94ea2..7e588b109 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/UserClaim/UserClaim.razor.cs @@ -55,16 +55,18 @@ public int PageSize protected override async Task OnInitializedAsync() { PageName = "UserClaimBlock"; + + _headers = new List> { + new() { Text = T("Name"), Value = nameof(UserClaimDto.Name), Sortable = false, Width="250px" }, + new() { Text = T(nameof(UserClaimDto.Description)), Value = nameof(UserClaimDto.Description), Sortable = false }, + new() { Text = T("Type"), Value = nameof(UserClaimDto.UserClaimType), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + await GetUserClaimsAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("Name"), Value = nameof(UserClaimDto.Name), Sortable = false, Width="250px" }, - new() { Text = T(nameof(UserClaimDto.Description)), Value = nameof(UserClaimDto.Description), Sortable = false }, - new() { Text = T("Type"), Value = nameof(UserClaimDto.UserClaimType), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; + private List> _headers = new(); public async Task GetUserClaimsAsync() { diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor index f40bce514..95d6cc5f5 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor @@ -20,7 +20,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor.cs index 21d891353..8b744622c 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/ThirdPartyIdps/ThirdPartyIdp.razor.cs @@ -66,24 +66,26 @@ public int PageSize private ThirdPartyIdpService ThirdPartyIdpService => AuthCaller.ThirdPartyIdpService; + private List> _headers = new(); + protected override async Task OnInitializedAsync() { PageName = "ThirdPartyIdpBlock"; + + _headers = new List> { + new() { Text = T(nameof(ThirdPartyIdpDto.Icon)), Value = nameof(ThirdPartyIdpDto.Icon), Sortable = false }, + new() { Text = T(nameof(ThirdPartyIdpDto.Name)), Value = nameof(ThirdPartyIdpDto.Name), Sortable = false }, + new() { Text = T(nameof(ThirdPartyIdpDto.DisplayName)), Value = nameof(ThirdPartyIdpDto.DisplayName), Sortable = false }, + new() { Text = T(nameof(ThirdPartyIdpDto.AuthenticationType)), Value = nameof(ThirdPartyIdpDto.AuthenticationType), Sortable = false }, + new() { Text = T("PlatformType"), Value = nameof(ThirdPartyIdpDto.ThirdPartyIdpType), Sortable = false }, + new() { Text = T(nameof(ThirdPartyIdpDto.CreationTime)), Value = nameof(ThirdPartyIdpDto.CreationTime), Sortable = false }, + new() { Text = T("State"), Value = nameof(ThirdPartyIdpDto.Enabled), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + await GetThirdPartyIdpsAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T(nameof(ThirdPartyIdpDto.Icon)), Value = nameof(ThirdPartyIdpDto.Icon), Sortable = false }, - new() { Text = T(nameof(ThirdPartyIdpDto.Name)), Value = nameof(ThirdPartyIdpDto.Name), Sortable = false }, - new() { Text = T(nameof(ThirdPartyIdpDto.DisplayName)), Value = nameof(ThirdPartyIdpDto.DisplayName), Sortable = false }, - new() { Text = T(nameof(ThirdPartyIdpDto.AuthenticationType)), Value = nameof(ThirdPartyIdpDto.AuthenticationType), Sortable = false }, - new() { Text = T("PlatformType"), Value = nameof(ThirdPartyIdpDto.ThirdPartyIdpType), Sortable = false }, - new() { Text = T(nameof(ThirdPartyIdpDto.CreationTime)), Value = nameof(ThirdPartyIdpDto.CreationTime), Sortable = false }, - new() { Text = T("State"), Value = nameof(ThirdPartyIdpDto.Enabled), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetThirdPartyIdpsAsync() { var request = new GetThirdPartyIdpsDto(Page, PageSize, Search); diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/Staff.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/Staff.razor index ed0f1c168..d8f16ea4a 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/Staff.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/Staff.razor @@ -18,7 +18,7 @@ - > _headers = new(); [Parameter] public User? UserCompontent { get; set; } @@ -75,20 +76,20 @@ public int PageSize protected override async Task OnInitializedAsync() { PageName = "StaffBlock"; + + _headers = new List> { + new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false }, + new() { Text = T(nameof(UserDto.Account)), Value = nameof(UserDto.Account), Sortable = false }, + new() { Text = T(nameof(StaffDto.Department)), Value = nameof(StaffDto.Department), Sortable = false }, + new() { Text = T(nameof(StaffDto.JobNumber)), Value = nameof(StaffDto.JobNumber), Sortable = false }, + new() { Text = T(nameof(StaffDto.Position)), Value = nameof(StaffDto.Position), Sortable = false }, + new() { Text = T("State"), Value = nameof(StaffDto.Enabled), Sortable = false , Width="105px"}, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + await GetStaffAsync(); } - public List> GetHeaders() => new() - { - new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false }, - new() { Text = T(nameof(UserDto.Account)), Value = nameof(UserDto.Account), Sortable = false }, - new() { Text = T(nameof(StaffDto.Department)), Value = nameof(StaffDto.Department), Sortable = false }, - new() { Text = T(nameof(StaffDto.JobNumber)), Value = nameof(StaffDto.JobNumber), Sortable = false }, - new() { Text = T(nameof(StaffDto.Position)), Value = nameof(StaffDto.Position), Sortable = false }, - new() { Text = T("State"), Value = nameof(StaffDto.Enabled), Sortable = false , Width="105px"}, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetStaffAsync() { var request = new GetStaffsDto(Page, PageSize, Search, Enabled); diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/ThirdPartyUser.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/ThirdPartyUser.razor index c2188a07e..d6cc6dcde 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/ThirdPartyUser.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/ThirdPartyUser.razor @@ -30,7 +30,7 @@ > { + new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false, Width = "20%" }, + new() { Text = T("Source"), Value = nameof(ThirdPartyUserDto.IdpDetailDto), Sortable = false, Width = "20%" }, + new() { Text = T(nameof(ThirdPartyUserDto.CreationTime)), Value = nameof(ThirdPartyUserDto.CreationTime), Sortable = false, Width = "20%" }, + new() { Text = T(nameof(ThirdPartyUserDto.ModificationTime)), Value = nameof(ThirdPartyUserDto.ModificationTime), Sortable = false, Width = "20%" }, + new() { Text = T("State"), Value = nameof(UserDto.Enabled), Sortable = false, Align = DataTableHeaderAlign.Center, Width = "20%" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px"} + };; + await GetThirdPartyUsersAsync(); } @@ -123,15 +133,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } } - public List> GetHeaders() => new() - { - new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false, Width = "20%" }, - new() { Text = T("Source"), Value = nameof(ThirdPartyUserDto.IdpDetailDto), Sortable = false, Width = "20%" }, - new() { Text = T(nameof(ThirdPartyUserDto.CreationTime)), Value = nameof(ThirdPartyUserDto.CreationTime), Sortable = false, Width = "20%" }, - new() { Text = T(nameof(ThirdPartyUserDto.ModificationTime)), Value = nameof(ThirdPartyUserDto.ModificationTime), Sortable = false, Width = "20%" }, - new() { Text = T("State"), Value = nameof(UserDto.Enabled), Sortable = false, Align = DataTableHeaderAlign.Center, Width = "20%" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px"} - }; + private List> _headers = new(); public async Task GetThirdPartyUsersAsync() { diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/User.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/User.razor index ce1fae7d1..22c6753bf 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/User.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Subjects/Users/User.razor @@ -30,7 +30,7 @@ > _headers = new(); + protected override string? PageName => "UserBlock"; + protected override void OnInitialized() + { + base.OnInitialized(); + + _headers = new() + { + new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false }, + new() { Text = T(nameof(UserDto.Account)), Value = nameof(UserDto.Account), Sortable = false }, + new() { Text = T(nameof(UserDto.CreationTime)), Value = nameof(UserDto.CreationTime), Sortable = false }, + new() { Text = T("State"), Value = nameof(UserDto.Enabled), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + } + protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) @@ -118,15 +134,6 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } } - public List> GetHeaders() => new() - { - new() { Text = T("User"), Value = nameof(UserDto.Avatar), Sortable = false }, - new() { Text = T(nameof(UserDto.Account)), Value = nameof(UserDto.Account), Sortable = false }, - new() { Text = T(nameof(UserDto.CreationTime)), Value = nameof(UserDto.CreationTime), Sortable = false }, - new() { Text = T("State"), Value = nameof(UserDto.Enabled), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; - public async Task GetUserAsync() { var request = new GetUsersDto(Page, PageSize, UserId, Enabled, StartTime?.ToDateTime(TimeOnly.MinValue), EndTime?.ToDateTime(TimeOnly.MaxValue)); diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor index 83d60360f..9b0f85caf 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor @@ -19,7 +19,7 @@ diff --git a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor.cs b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor.cs index 7ccc72d55..58b138ef8 100644 --- a/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor.cs +++ b/src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Webhooks/Index.razor.cs @@ -12,18 +12,20 @@ public partial class Index WebhookService _webhookService => AuthCaller.WebhookService; - public List> GetHeaders() => new() - { - new() { Text = T(nameof(WebhookItemDto.Name)), Value = nameof(WebhookItemDto.Name), Sortable = false , Width="300px"}, - new() { Text = T(nameof(WebhookItemDto.Url)), Value = nameof(WebhookItemDto.Url), Sortable = false, Width="300px" }, - new() { Text = T(nameof(WebhookItemDto.WebhookEvent)), Value = nameof(WebhookItemDto.WebhookEvent), Sortable = false, Width="105px" }, - new() { Text = T(nameof(WebhookItemDto.IsActive)), Value = nameof(WebhookItemDto.IsActive), Sortable = false, Width="105px" }, - new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, - }; + private List> _headers = new(); protected override void OnInitialized() { PageName = "Webhook"; + + _headers = new List> { + new() { Text = T(nameof(WebhookItemDto.Name)), Value = nameof(WebhookItemDto.Name), Sortable = false , Width="300px"}, + new() { Text = T(nameof(WebhookItemDto.Url)), Value = nameof(WebhookItemDto.Url), Sortable = false, Width="300px" }, + new() { Text = T(nameof(WebhookItemDto.WebhookEvent)), Value = nameof(WebhookItemDto.WebhookEvent), Sortable = false, Width="105px" }, + new() { Text = T(nameof(WebhookItemDto.IsActive)), Value = nameof(WebhookItemDto.IsActive), Sortable = false, Width="105px" }, + new() { Text = T("Action"), Value = "Action", Sortable = false, Align = DataTableHeaderAlign.Center, Width="105px" }, + }; + base.OnInitialized(); }