api: optimise pagination in API schema (#6478)

This commit is contained in:
Jens L
2023-08-05 15:37:06 +02:00
committed by GitHub
parent efc660938c
commit 00fae2353c
9 changed files with 177 additions and 2052 deletions

View File

@ -49,6 +49,8 @@ export class SystemTaskListPage extends TablePage<Task> {
startIndex: 1,
endIndex: tasks.length,
current: page,
next: 0,
previous: 0,
},
results: tasks,
};

View File

@ -47,6 +47,8 @@ export class DeleteObjectsTable<T> extends Table<T> {
totalPages: 1,
startIndex: 1,
endIndex: this.objects.length,
next: 0,
previous: 0,
},
results: this.objects,
});

View File

@ -7,7 +7,6 @@ import "@goauthentik/elements/chips/Chip";
import "@goauthentik/elements/chips/ChipGroup";
import { getURLParam, updateURLParams } from "@goauthentik/elements/router/RouteMatch";
import "@goauthentik/elements/table/TablePagination";
import { Pagination } from "@goauthentik/elements/table/TablePagination";
import "@goauthentik/elements/table/TableSearch";
import { msg } from "@lit/localize";
@ -24,6 +23,8 @@ import PFToolbar from "@patternfly/patternfly/components/Toolbar/toolbar.css";
import PFBullseye from "@patternfly/patternfly/layouts/Bullseye/bullseye.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { Pagination } from "@goauthentik/api";
export class TableColumn {
title: string;
orderBy?: string;

View File

@ -8,17 +8,7 @@ import PFButton from "@patternfly/patternfly/components/Button/button.css";
import PFPagination from "@patternfly/patternfly/components/Pagination/pagination.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
export interface Pagination {
next?: number;
previous?: number;
count: number;
current: number;
totalPages: number;
startIndex: number;
endIndex: number;
}
import { Pagination } from "@goauthentik/api";
@customElement("ak-table-pagination")
export class TablePagination extends AKElement {

View File

@ -28,6 +28,8 @@ export class UserDeviceList extends MFADevicesPage {
totalPages: 1,
startIndex: 1,
endIndex: res.length,
next: 0,
previous: 0,
},
results: res,
};

View File

@ -49,6 +49,8 @@ export class MFADevicesPage extends Table<Device> {
totalPages: 1,
startIndex: 1,
endIndex: devices.length,
next: 0,
previous: 0,
},
results: devices,
};