diff --git a/web/src/api/Client.ts b/web/src/api/Client.ts index dfb74c42f..55c593759 100644 --- a/web/src/api/Client.ts +++ b/web/src/api/Client.ts @@ -4,7 +4,9 @@ import { NotFoundError, RequestError } from "./Error"; export const VERSION = "v2beta"; export interface QueryArguments { - [key: string]: number | string | boolean | null; + page?: number; + page_size?: number; + [key: string]: number | string | boolean | undefined | null; } export interface BaseInheritanceModel { diff --git a/web/src/constants.ts b/web/src/constants.ts index a7c83cadc..3bdb374e8 100644 --- a/web/src/constants.ts +++ b/web/src/constants.ts @@ -4,3 +4,4 @@ export const ERROR_CLASS = "pf-m-danger"; export const PROGRESS_CLASS = "pf-m-in-progress"; export const CURRENT_CLASS = "pf-m-current"; export const VERSION = "2021.2.6-stable"; +export const PAGE_SIZE = 20; diff --git a/web/src/elements/policies/BoundPoliciesList.ts b/web/src/elements/policies/BoundPoliciesList.ts index 24c67f844..03d198cbe 100644 --- a/web/src/elements/policies/BoundPoliciesList.ts +++ b/web/src/elements/policies/BoundPoliciesList.ts @@ -11,6 +11,7 @@ import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/Dropdown"; import { Policy } from "../../api/Policies"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-bound-policies-list") export class BoundPoliciesList extends Table { @@ -22,6 +23,7 @@ export class BoundPoliciesList extends Table { target: this.target || "", ordering: "order", page: page, + page_size: PAGE_SIZE, }); } diff --git a/web/src/pages/applications/ApplicationListPage.ts b/web/src/pages/applications/ApplicationListPage.ts index 608670c58..4e26216bc 100644 --- a/web/src/pages/applications/ApplicationListPage.ts +++ b/web/src/pages/applications/ApplicationListPage.ts @@ -7,6 +7,7 @@ import { TablePage } from "../../elements/table/TablePage"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-application-list") export class ApplicationListPage extends TablePage { @@ -30,6 +31,7 @@ export class ApplicationListPage extends TablePage { return Application.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/crypto/CertificateKeyPairListPage.ts b/web/src/pages/crypto/CertificateKeyPairListPage.ts index 98aaa04be..8a3591752 100644 --- a/web/src/pages/crypto/CertificateKeyPairListPage.ts +++ b/web/src/pages/crypto/CertificateKeyPairListPage.ts @@ -7,6 +7,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { CertificateKeyPair } from "../../api/CertificateKeyPair"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-crypto-certificatekeypair-list") export class CertificateKeyPairListPage extends TablePage { @@ -32,6 +33,7 @@ export class CertificateKeyPairListPage extends TablePage { return CertificateKeyPair.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/events/EventListPage.ts b/web/src/pages/events/EventListPage.ts index 4f7edcbe6..228add3e2 100644 --- a/web/src/pages/events/EventListPage.ts +++ b/web/src/pages/events/EventListPage.ts @@ -2,6 +2,7 @@ import { gettext } from "django"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Event } from "../../api/Events"; +import { PAGE_SIZE } from "../../constants"; import { TableColumn } from "../../elements/table/Table"; import { TablePage } from "../../elements/table/TablePage"; import { time } from "../../utils"; @@ -31,6 +32,7 @@ export class EventListPage extends TablePage { return Event.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE * 3, search: this.search || "", }); } diff --git a/web/src/pages/events/RuleListPage.ts b/web/src/pages/events/RuleListPage.ts index cc4b9b379..3cd4c0f1a 100644 --- a/web/src/pages/events/RuleListPage.ts +++ b/web/src/pages/events/RuleListPage.ts @@ -8,6 +8,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Rule } from "../../api/EventRules"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-event-rule-list") export class RuleListPage extends TablePage { @@ -33,6 +34,7 @@ export class RuleListPage extends TablePage { return Rule.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/events/TransportListPage.ts b/web/src/pages/events/TransportListPage.ts index 6918ef551..df21d5954 100644 --- a/web/src/pages/events/TransportListPage.ts +++ b/web/src/pages/events/TransportListPage.ts @@ -8,6 +8,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Transport } from "../../api/EventTransports"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-event-transport-list") export class TransportListPage extends TablePage { @@ -31,6 +32,7 @@ export class TransportListPage extends TablePage { return Transport.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/flows/BoundStagesList.ts b/web/src/pages/flows/BoundStagesList.ts index b0bc4ecb7..2d32d3c57 100644 --- a/web/src/pages/flows/BoundStagesList.ts +++ b/web/src/pages/flows/BoundStagesList.ts @@ -11,6 +11,7 @@ import "../../elements/buttons/Dropdown"; import "../../elements/policies/BoundPoliciesList"; import { FlowStageBinding, Stage } from "../../api/Flows"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-bound-stages-list") export class BoundStagesList extends Table { @@ -24,6 +25,7 @@ export class BoundStagesList extends Table { target: this.target || "", ordering: "order", page: page, + page_size: PAGE_SIZE, }); } diff --git a/web/src/pages/flows/FlowListPage.ts b/web/src/pages/flows/FlowListPage.ts index b7ae5a90f..8bcf06955 100644 --- a/web/src/pages/flows/FlowListPage.ts +++ b/web/src/pages/flows/FlowListPage.ts @@ -7,6 +7,7 @@ import { TablePage } from "../../elements/table/TablePage"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-flow-list") export class FlowListPage extends TablePage { @@ -30,6 +31,7 @@ export class FlowListPage extends TablePage { return Flow.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/groups/GroupListPage.ts b/web/src/pages/groups/GroupListPage.ts index 5a1ce6063..57140f7e7 100644 --- a/web/src/pages/groups/GroupListPage.ts +++ b/web/src/pages/groups/GroupListPage.ts @@ -7,6 +7,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Group } from "../../api/Groups"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-group-list") export class GroupListPage extends TablePage { @@ -30,6 +31,7 @@ export class GroupListPage extends TablePage { return Group.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/outposts/OutpostListPage.ts b/web/src/pages/outposts/OutpostListPage.ts index f56028356..dbb35852b 100644 --- a/web/src/pages/outposts/OutpostListPage.ts +++ b/web/src/pages/outposts/OutpostListPage.ts @@ -10,6 +10,7 @@ import "./OutpostHealth"; import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/TokenCopyButton"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-outpost-list") export class OutpostListPage extends TablePage { @@ -29,6 +30,7 @@ export class OutpostListPage extends TablePage { return Outpost.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/outposts/OutpostServiceConnectionListPage.ts b/web/src/pages/outposts/OutpostServiceConnectionListPage.ts index 7e8eb4333..86e729769 100644 --- a/web/src/pages/outposts/OutpostServiceConnectionListPage.ts +++ b/web/src/pages/outposts/OutpostServiceConnectionListPage.ts @@ -11,6 +11,7 @@ import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/Dropdown"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-outpost-service-connection-list") export class OutpostServiceConnectionListPage extends TablePage { @@ -31,6 +32,7 @@ export class OutpostServiceConnectionListPage extends TablePage { @@ -31,7 +32,8 @@ export class PolicyListPage extends TablePage { apiEndpoint(page: number): Promise> { return Policy.list({ ordering: this.order, - page: page, + page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/property-mappings/PropertyMappingListPage.ts b/web/src/pages/property-mappings/PropertyMappingListPage.ts index 210059ce1..f9bd61ab0 100644 --- a/web/src/pages/property-mappings/PropertyMappingListPage.ts +++ b/web/src/pages/property-mappings/PropertyMappingListPage.ts @@ -9,6 +9,7 @@ import "../../elements/buttons/Dropdown"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-property-mapping-list") export class PropertyMappingListPage extends TablePage { @@ -35,6 +36,7 @@ export class PropertyMappingListPage extends TablePage { return PropertyMapping.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", managed__isnull: this.hideManaged, }); diff --git a/web/src/pages/providers/ProviderListPage.ts b/web/src/pages/providers/ProviderListPage.ts index fe6ed3bab..eb996d0be 100644 --- a/web/src/pages/providers/ProviderListPage.ts +++ b/web/src/pages/providers/ProviderListPage.ts @@ -9,6 +9,7 @@ import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/Dropdown"; import { TableColumn } from "../../elements/table/Table"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-provider-list") export class ProviderListPage extends TablePage { @@ -32,6 +33,7 @@ export class ProviderListPage extends TablePage { return Provider.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/sources/SourcesListPage.ts b/web/src/pages/sources/SourcesListPage.ts index 76e9b9410..b747f5920 100644 --- a/web/src/pages/sources/SourcesListPage.ts +++ b/web/src/pages/sources/SourcesListPage.ts @@ -9,6 +9,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/Dropdown"; import { until } from "lit-html/directives/until"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-source-list") export class SourceListPage extends TablePage { @@ -32,6 +33,7 @@ export class SourceListPage extends TablePage { return Source.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/stages/InvitationListPage.ts b/web/src/pages/stages/InvitationListPage.ts index e53cfd293..a5f6cced5 100644 --- a/web/src/pages/stages/InvitationListPage.ts +++ b/web/src/pages/stages/InvitationListPage.ts @@ -7,6 +7,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Invitation } from "../../api/Invitations"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-stage-invitation-list") export class InvitationListPage extends TablePage { @@ -30,6 +31,7 @@ export class InvitationListPage extends TablePage { return Invitation.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/stages/PromptListPage.ts b/web/src/pages/stages/PromptListPage.ts index 37bc2c8f6..ba9926d9f 100644 --- a/web/src/pages/stages/PromptListPage.ts +++ b/web/src/pages/stages/PromptListPage.ts @@ -7,6 +7,7 @@ import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Prompt } from "../../api/Prompts"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-stage-prompt-list") export class PromptListPage extends TablePage { @@ -30,6 +31,7 @@ export class PromptListPage extends TablePage { return Prompt.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/stages/StageListPage.ts b/web/src/pages/stages/StageListPage.ts index 710512a1d..4d2cddb1e 100644 --- a/web/src/pages/stages/StageListPage.ts +++ b/web/src/pages/stages/StageListPage.ts @@ -9,6 +9,7 @@ import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/Dropdown"; import { until } from "lit-html/directives/until"; import { Stage } from "../../api/Flows"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-stage-list") export class StageListPage extends TablePage { @@ -32,6 +33,7 @@ export class StageListPage extends TablePage { return Stage.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/tokens/TokenListPage.ts b/web/src/pages/tokens/TokenListPage.ts index f96016d11..4f6926192 100644 --- a/web/src/pages/tokens/TokenListPage.ts +++ b/web/src/pages/tokens/TokenListPage.ts @@ -8,6 +8,7 @@ import "../../elements/buttons/Dropdown"; import "../../elements/buttons/TokenCopyButton"; import { TableColumn } from "../../elements/table/Table"; import { Token } from "../../api/Tokens"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-token-list") export class TokenListPage extends TablePage { @@ -31,6 +32,7 @@ export class TokenListPage extends TablePage { return Token.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/tokens/UserTokenList.ts b/web/src/pages/tokens/UserTokenList.ts index fba40547b..cc8a3355f 100644 --- a/web/src/pages/tokens/UserTokenList.ts +++ b/web/src/pages/tokens/UserTokenList.ts @@ -7,6 +7,7 @@ import "../../elements/buttons/Dropdown"; import "../../elements/buttons/TokenCopyButton"; import { Table, TableColumn } from "../../elements/table/Table"; import { Token } from "../../api/Tokens"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-token-user-list") export class UserTokenList extends Table { @@ -21,6 +22,7 @@ export class UserTokenList extends Table { return Token.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); } diff --git a/web/src/pages/users/UserListPage.ts b/web/src/pages/users/UserListPage.ts index e3580b237..e714a05a1 100644 --- a/web/src/pages/users/UserListPage.ts +++ b/web/src/pages/users/UserListPage.ts @@ -8,6 +8,7 @@ import "../../elements/buttons/Dropdown"; import "../../elements/buttons/ActionButton"; import { TableColumn } from "../../elements/table/Table"; import { User } from "../../api/Users"; +import { PAGE_SIZE } from "../../constants"; @customElement("ak-user-list") export class UserListPage extends TablePage { @@ -31,6 +32,7 @@ export class UserListPage extends TablePage { return User.list({ ordering: this.order, page: page, + page_size: PAGE_SIZE, search: this.search || "", }); }