web/admin: allow custom sorting for bound* tables (#9080)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2024-03-30 21:35:28 +01:00
committed by GitHub
parent 2c64f72ebc
commit ac1f3332dc
3 changed files with 9 additions and 4 deletions

View File

@ -47,3 +47,4 @@ class FlowStageBindingViewSet(UsedByMixin, ModelViewSet):
filterset_fields = "__all__"
search_fields = ["stage__name"]
ordering = ["order"]
ordering_fields = ["order", "stage__name"]

View File

@ -23,13 +23,15 @@ export class BoundStagesList extends Table<FlowStageBinding> {
checkbox = true;
clearOnRefresh = true;
order = "order";
@property()
target?: string;
async apiEndpoint(page: number): Promise<PaginatedResponse<FlowStageBinding>> {
return new FlowsApi(DEFAULT_CONFIG).flowsBindingsList({
target: this.target || "",
ordering: "order",
ordering: this.order,
page: page,
pageSize: (await uiConfig()).pagination.perPage,
});
@ -37,8 +39,8 @@ export class BoundStagesList extends Table<FlowStageBinding> {
columns(): TableColumn[] {
return [
new TableColumn(msg("Order")),
new TableColumn(msg("Name")),
new TableColumn(msg("Order"), "order"),
new TableColumn(msg("Name"), "stage__name"),
new TableColumn(msg("Type")),
new TableColumn(msg("Actions")),
];

View File

@ -31,10 +31,12 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
checkbox = true;
clearOnRefresh = true;
order = "order";
async apiEndpoint(page: number): Promise<PaginatedResponse<PolicyBinding>> {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsList({
target: this.target || "",
ordering: "order",
ordering: this.order,
page: page,
pageSize: (await uiConfig()).pagination.perPage,
});