Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: bug after upgrading masa.blazor #1264

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<SDataTable
Dense
Height="@("calc(100vh - 420px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="@_paginationStaffs.Items"
TItem="StaffDto">
<HeaderColContent Context="header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public partial class Organization
CopyOrgSheet _copyOrgSheet = null!;
OrgSheet _orgSheet = null!;
string _searchName = string.Empty;
private List<DataTableHeader<StaffDto>> _headers = new();

DepartmentService DepartmentService => AuthCaller.DepartmentService;

Expand All @@ -25,18 +26,18 @@ public partial class Organization
[Parameter]
public Guid DepartmentId { get; set; } = Guid.Empty;

public List<DataTableHeader<StaffDto>> 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<DataTableHeader<StaffDto>> {
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<SDataTable
FixedHeader
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="Positions"
TItem="PositionDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ public int PageSize
public bool UpdatePositionDialogVisible { get; set; }

private PositionService PositionService => AuthCaller.PositionService;

private List<DataTableHeader<PositionDto>> _headers = new();

protected override async Task OnInitializedAsync()
{
PageName = "PositionBlock";

_headers = new List<DataTableHeader<PositionDto>>() {
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<DataTableHeader<PositionDto>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AutoHeightContent>
<SDataTable Dense
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="Roles"
TItem="RoleDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,28 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
await base.OnAfterRenderAsync(firstRender);
}

private List<DataTableHeader<RoleDto>> _headers = new();

public List<DataTableHeader<RoleDto>> 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<DataTableHeader<RoleDto>>() {
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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AutoHeightContent>
<SDataTable
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="ApiResources"
TItem="ApiResourceDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,23 @@ public int PageSize

private ApiResourceService ApiResourceService => AuthCaller.ApiResourceService;

private List<DataTableHeader<ApiResourceDto>> _headers = new();

protected override async Task OnInitializedAsync()
{
PageName = "ApiResourceBlock";

_headers = new List<DataTableHeader<ApiResourceDto>> {
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<DataTableHeader<ApiResourceDto>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AutoHeightContent>
<SDataTable
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="ApiScopes"
TItem="ApiScopeDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,20 @@ public int PageSize
protected override async Task OnInitializedAsync()
{
PageName = "ApiScopeBlock";

_headers = new List<DataTableHeader<ApiScopeDto>> {
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<DataTableHeader<ApiScopeDto>> 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<DataTableHeader<ApiScopeDto>> _headers = new();

public async Task GetApiScopesAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AutoHeightContent>
<SDataTable
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="_paginationDto.Items"
TItem="ClientDto"
ItemsPerPage="_clientPaginationDto.PageSize">
Expand Down
20 changes: 11 additions & 9 deletions src/Web/Masa.Auth.Web.Admin.Rcl/Pages/Sso/Client/Client.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ public partial class Client

ClientService _clientService => AuthCaller.ClientService;

public List<DataTableHeader<ClientDto>> 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<DataTableHeader<ClientDto>> _headers = new();

protected override void OnInitialized()
{
PageName = "ClientBlock";

_headers = new List<DataTableHeader<ClientDto>> {
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AutoHeightContent>
<SDataTable Dense
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="CustomLogins"
TItem="CustomLoginDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,23 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
await base.OnAfterRenderAsync(firstRender);
}

public List<DataTableHeader<CustomLoginDto>> 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<DataTableHeader<CustomLoginDto>> {
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<DataTableHeader<CustomLoginDto>> _headers = new();

public async Task GetCustomLoginsAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<AutoHeightContent>
<SDataTable
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="IdentityResources"
TItem="IdentityResourceDto"
ItemsPerPage="PageSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public partial class IdentityResource
{
private string? _search;
private int _page = 1, _pageSize = 20;
private List<DataTableHeader<IdentityResourceDto>> _headers = new();

public string Search
{
Expand Down Expand Up @@ -55,19 +56,21 @@ public int PageSize
protected override async Task OnInitializedAsync()
{
PageName = "IdentityResourceBlock";

_headers = new List<DataTableHeader<IdentityResourceDto>> {
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<DataTableHeader<IdentityResourceDto>> 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);
Expand Down Expand Up @@ -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);
}

Expand All @@ -111,4 +115,3 @@ public async Task RemoveIdentityResourceAsync(Guid identityResourceId)
await GetIdentityResourcesAsync();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<AutoHeightContent>
<SDataTable
Height="@("calc(100vh - 288px)")"
Headers="GetHeaders()"
Headers="@_headers"
Items="UserClaims"
TItem="UserClaimDto"
ItemsPerPage="PageSize">
Expand Down
Loading