web/admin: allow custom sorting for bound* tables (#9080)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -47,3 +47,4 @@ class FlowStageBindingViewSet(UsedByMixin, ModelViewSet):
 | 
				
			|||||||
    filterset_fields = "__all__"
 | 
					    filterset_fields = "__all__"
 | 
				
			||||||
    search_fields = ["stage__name"]
 | 
					    search_fields = ["stage__name"]
 | 
				
			||||||
    ordering = ["order"]
 | 
					    ordering = ["order"]
 | 
				
			||||||
 | 
					    ordering_fields = ["order", "stage__name"]
 | 
				
			||||||
 | 
				
			|||||||
@ -23,13 +23,15 @@ export class BoundStagesList extends Table<FlowStageBinding> {
 | 
				
			|||||||
    checkbox = true;
 | 
					    checkbox = true;
 | 
				
			||||||
    clearOnRefresh = true;
 | 
					    clearOnRefresh = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    order = "order";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property()
 | 
					    @property()
 | 
				
			||||||
    target?: string;
 | 
					    target?: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async apiEndpoint(page: number): Promise<PaginatedResponse<FlowStageBinding>> {
 | 
					    async apiEndpoint(page: number): Promise<PaginatedResponse<FlowStageBinding>> {
 | 
				
			||||||
        return new FlowsApi(DEFAULT_CONFIG).flowsBindingsList({
 | 
					        return new FlowsApi(DEFAULT_CONFIG).flowsBindingsList({
 | 
				
			||||||
            target: this.target || "",
 | 
					            target: this.target || "",
 | 
				
			||||||
            ordering: "order",
 | 
					            ordering: this.order,
 | 
				
			||||||
            page: page,
 | 
					            page: page,
 | 
				
			||||||
            pageSize: (await uiConfig()).pagination.perPage,
 | 
					            pageSize: (await uiConfig()).pagination.perPage,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -37,8 +39,8 @@ export class BoundStagesList extends Table<FlowStageBinding> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    columns(): TableColumn[] {
 | 
					    columns(): TableColumn[] {
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            new TableColumn(msg("Order")),
 | 
					            new TableColumn(msg("Order"), "order"),
 | 
				
			||||||
            new TableColumn(msg("Name")),
 | 
					            new TableColumn(msg("Name"), "stage__name"),
 | 
				
			||||||
            new TableColumn(msg("Type")),
 | 
					            new TableColumn(msg("Type")),
 | 
				
			||||||
            new TableColumn(msg("Actions")),
 | 
					            new TableColumn(msg("Actions")),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
				
			|||||||
@ -31,10 +31,12 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
 | 
				
			|||||||
    checkbox = true;
 | 
					    checkbox = true;
 | 
				
			||||||
    clearOnRefresh = true;
 | 
					    clearOnRefresh = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    order = "order";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async apiEndpoint(page: number): Promise<PaginatedResponse<PolicyBinding>> {
 | 
					    async apiEndpoint(page: number): Promise<PaginatedResponse<PolicyBinding>> {
 | 
				
			||||||
        return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsList({
 | 
					        return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsList({
 | 
				
			||||||
            target: this.target || "",
 | 
					            target: this.target || "",
 | 
				
			||||||
            ordering: "order",
 | 
					            ordering: this.order,
 | 
				
			||||||
            page: page,
 | 
					            page: page,
 | 
				
			||||||
            pageSize: (await uiConfig()).pagination.perPage,
 | 
					            pageSize: (await uiConfig()).pagination.perPage,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user