Skip to content

Commit 1ce9b9f

Browse files
[+] Parameter to show pagesize control in connectiontable
[-] PageSizeComponent should not use pagesize config value anymore
1 parent 88f1ad9 commit 1ce9b9f

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

roles/ui/files/FWO.UI/Shared/ConnectionTable.razor

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,81 +7,84 @@
77

88
@inject UserConfig userConfig
99

10-
<PageSizeComponent PageSizeCallback="UpdatePageSize"></PageSizeComponent>
10+
@if (ShowPageSizeInput)
11+
{
12+
<PageSizeComponent PageSizeCallback="UpdatePageSize"></PageSizeComponent>
13+
}
1114
<Table class="table table-bordered th-bg-secondary sticky-header show-scrollbar table-responsive" TableItem="ModellingConnection"
1215
Items="Connections" PageSize="PageSize" ColumnReorder="true" TableRowClass="@(con => getTableRowClass(con))"
1316
SelectedItems="SelectedConns" RowClickAction="@(conn => ToggleSelection(conn))">
1417
@if (!Readonly && !SelectInterfaceView && AppHandler != null)
1518
{
16-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("actions"))" Field="(x => x.Id)" Sortable="false" Filterable="false">
17-
<Template>
18-
<div class="btn-group">
19-
<button type="button" class="btn btn-sm btn-primary" @onclick="async () =>
19+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("actions"))" Field="(x => x.Id)" Sortable="false" Filterable="false">
20+
<Template>
21+
<div class="btn-group">
22+
<button type="button" class="btn btn-sm btn-primary" @onclick="async () =>
2023
{ await AppHandler.ShowDetails(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
2124
@(AppHandler.DisplayButton("details", Icons.Display))
22-
</button>
25+
</button>
2326
@if (AppActive)
2427
{
2528
@if (!context.GetBoolProperty(ConState.InterfaceRejected.ToString()) && !context.GetBoolProperty(ConState.Rejected.ToString()))
2629
{
27-
<button type="button" class="btn btn-sm btn-warning" @onclick="async () =>
30+
<button type="button" class="btn btn-sm btn-warning" @onclick="async () =>
2831
{ await AppHandler.EditConn(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
2932
@(AppHandler.DisplayButton("edit", Icons.Edit))
30-
</button>
33+
</button>
3134
}
32-
<button type="button" class="btn btn-sm btn-danger" @onclick="async () =>
35+
<button type="button" class="btn btn-sm btn-danger" @onclick="async () =>
3336
{ await AppHandler.RequestDeleteConnection(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
3437
@(AppHandler.DisplayButton("delete", Icons.Delete))
35-
</button>
38+
</button>
3639
}
37-
</div>
38-
</Template>
39-
</Column>
40+
</div>
41+
</Template>
42+
</Column>
4043
}
4144
@if (ShowSelectionColumn)
4245
{
43-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("select"))" Sortable="false" Filterable="false">
44-
<Template>
46+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("select"))" Sortable="false" Filterable="false">
47+
<Template>
4548
@if (SelectionType == SelectionType.Single)
4649
{
47-
<input type="radio" checked="@(SelectedConns.Contains(context))" />
50+
<input type="radio" checked="@(SelectedConns.Contains(context))" />
4851
}
4952
else if (SelectionType == SelectionType.Multiple)
5053
{
51-
<input type="checkbox" checked="@(SelectedConns.Contains(context))" />
54+
<input type="checkbox" checked="@(SelectedConns.Contains(context))" />
5255
}
53-
</Template>
54-
</Column>
56+
</Template>
57+
</Column>
5558
}
5659
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true" />
5760
@if (!SelectInterfaceView)
5861
{
5962
@if (Connections.Count > 0 && Connections.First().IsInterface)
6063
{
61-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("published"))" Field="@(x => x.IsPublished)" Sortable="true" Filterable="true">
62-
<Template>
64+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("published"))" Field="@(x => x.IsPublished)" Sortable="true" Filterable="true">
65+
<Template>
6366
@(context.IsPublished.ShowAsHtml())
64-
</Template>
65-
</Column>
67+
</Template>
68+
</Column>
6669
}
67-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("state"))" Field="@(x => x.Id)" Sortable="true" Filterable="false">
68-
<Template>
70+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("state"))" Field="@(x => x.Id)" Sortable="true" Filterable="false">
71+
<Template>
6972
@((MarkupString)DisplayState(context))
70-
</Template>
71-
</Column>
73+
</Template>
74+
</Column>
7275
}
7376
@if (ShowAppName)
7477
{
75-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("owner"))" Field="@(x => x.App.Name)" Sortable="true" Filterable="true">
76-
<Template>
78+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("owner"))" Field="@(x => x.App.Name)" Sortable="true" Filterable="true">
79+
<Template>
7780
@(context.App?.DisplayWithoutAppId(userConfig.GetText("common_service")))
78-
</Template>
79-
</Column>
80-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("ext_app_id"))" Field="@(x => x.App.ExtAppId)" Sortable="true" Filterable="true">
81-
<Template>
81+
</Template>
82+
</Column>
83+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("ext_app_id"))" Field="@(x => x.App.ExtAppId)" Sortable="true" Filterable="true">
84+
<Template>
8285
@(context.App.ExtAppId)
83-
</Template>
84-
</Column>
86+
</Template>
87+
</Column>
8588
}
8689
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
8790
<Template>
@@ -160,6 +163,9 @@
160163
[Parameter]
161164
public SelectionType SelectionType { get; set; } = SelectionType.Single;
162165

166+
[Parameter]
167+
public bool ShowPageSizeInput { get; set; } = false;
168+
163169
private int PageSize { get; set; }
164170

165171
private void UpdatePageSize(int pageSize)

roles/ui/files/FWO.UI/Shared/PageSizeComponent.razor

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
@code {
1313
[Parameter] public EventCallback<int> PageSizeCallback { get; set; }
1414

15-
private int PageSize { get; set; }
15+
private int PageSize { get; set; } = 0;
1616

1717
protected override async Task OnInitializedAsync()
1818
{
19-
PageSize = UserConfig.MaxModellingTableRows;
20-
2119
await SubmitPageSize();
2220

2321
base.OnInitialized();

0 commit comments

Comments
 (0)