web: make table pagination size user-configurable

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-14 12:48:52 +02:00
parent 8eddb4b95b
commit f341479732
39 changed files with 122 additions and 114 deletions

View File

@ -26,6 +26,9 @@ export interface UIConfig {
background: string; background: string;
cardBackground: string; cardBackground: string;
}; };
pagination: {
perPage: number;
};
} }
export class DefaultUIConfig implements UIConfig { export class DefaultUIConfig implements UIConfig {
@ -43,20 +46,26 @@ export class DefaultUIConfig implements UIConfig {
background: "", background: "",
cardBackground: "", cardBackground: "",
}; };
pagination = {
perPage: 20,
};
} }
export function parseConfig(raw: string): UIConfig { let globalUiConfig: Promise<UIConfig>;
const c = JSON.parse(raw);
return Object.assign(new DefaultUIConfig(), c);
}
export function uiConfig(): Promise<UIConfig> { export function uiConfig(): Promise<UIConfig> {
return me().then((user) => { if (!globalUiConfig) {
globalUiConfig = me().then((user) => {
const settings = user.user.settings; const settings = user.user.settings;
let config = new DefaultUIConfig(); let config = new DefaultUIConfig();
if (!settings) {
return config;
}
if ("userInterface" in settings) { if ("userInterface" in settings) {
config = parseConfig(settings.userInterface); config = Object.assign(new DefaultUIConfig(), settings.userInterface);
} }
return config; return config;
}); });
} }
return globalUiConfig;
}

View File

@ -4,7 +4,6 @@ export const ERROR_CLASS = "pf-m-danger";
export const PROGRESS_CLASS = "pf-m-in-progress"; export const PROGRESS_CLASS = "pf-m-in-progress";
export const CURRENT_CLASS = "pf-m-current"; export const CURRENT_CLASS = "pf-m-current";
export const VERSION = "2021.9.8"; export const VERSION = "2021.9.8";
export const PAGE_SIZE = 20;
export const TITLE_DEFAULT = "authentik"; export const TITLE_DEFAULT = "authentik";
export const ROUTE_SEPARATOR = ";"; export const ROUTE_SEPARATOR = ";";

View File

@ -8,7 +8,7 @@ import { Event, EventsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { EventWithContext } from "../../api/Events"; import { EventWithContext } from "../../api/Events";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../pages/events/EventInfo"; import "../../pages/events/EventInfo";
import "../Tabs"; import "../Tabs";
import "../buttons/Dropdown"; import "../buttons/Dropdown";
@ -32,12 +32,12 @@ export class ObjectChangelog extends Table<Event> {
@property() @property()
targetModelName!: string; targetModelName!: string;
apiEndpoint(page: number): Promise<AKResponse<Event>> { async apiEndpoint(page: number): Promise<AKResponse<Event>> {
return new EventsApi(DEFAULT_CONFIG).eventsEventsList({ return new EventsApi(DEFAULT_CONFIG).eventsEventsList({
action: "model_", action: "model_",
page: page, page: page,
ordering: this.order, ordering: this.order,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
contextModelApp: this.targetModelApp, contextModelApp: this.targetModelApp,
contextModelName: this.targetModelName, contextModelName: this.targetModelName,
contextModelPk: this.targetModelPk.toString(), contextModelPk: this.targetModelPk.toString(),

View File

@ -8,7 +8,7 @@ import { Event, EventsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { EventWithContext } from "../../api/Events"; import { EventWithContext } from "../../api/Events";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../pages/events/EventInfo"; import "../../pages/events/EventInfo";
import "../Tabs"; import "../Tabs";
import "../buttons/Dropdown"; import "../buttons/Dropdown";
@ -26,11 +26,11 @@ export class ObjectChangelog extends Table<Event> {
@property() @property()
targetUser!: string; targetUser!: string;
apiEndpoint(page: number): Promise<AKResponse<Event>> { async apiEndpoint(page: number): Promise<AKResponse<Event>> {
return new EventsApi(DEFAULT_CONFIG).eventsEventsList({ return new EventsApi(DEFAULT_CONFIG).eventsEventsList({
page: page, page: page,
ordering: this.order, ordering: this.order,
pageSize: PAGE_SIZE / 2, pageSize: (await uiConfig()).pagination.perPage / 2,
username: this.targetUser, username: this.targetUser,
}); });
} }

View File

@ -38,7 +38,7 @@ export class DeleteObjectsTable<T> extends Table<T> {
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
apiEndpoint(page: number): Promise<AKResponse<T>> { async apiEndpoint(page: number): Promise<AKResponse<T>> {
return Promise.resolve({ return Promise.resolve({
pagination: { pagination: {
count: this.objects.length, count: this.objects.length,

View File

@ -7,7 +7,7 @@ import { ExpiringBaseGrantModel, Oauth2Api } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../forms/DeleteBulkForm"; import "../forms/DeleteBulkForm";
import { Table, TableColumn } from "../table/Table"; import { Table, TableColumn } from "../table/Table";
@ -16,12 +16,12 @@ export class UserOAuthCodeList extends Table<ExpiringBaseGrantModel> {
@property({ type: Number }) @property({ type: Number })
userId?: number; userId?: number;
apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> { async apiEndpoint(page: number): Promise<AKResponse<ExpiringBaseGrantModel>> {
return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesList({ return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesList({
user: this.userId, user: this.userId,
ordering: "expires", ordering: "expires",
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -9,7 +9,7 @@ import { RefreshTokenModel, Oauth2Api, ExpiringBaseGrantModel } from "@goauthent
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../forms/DeleteBulkForm"; import "../forms/DeleteBulkForm";
import { Table, TableColumn } from "../table/Table"; import { Table, TableColumn } from "../table/Table";
@ -24,12 +24,12 @@ export class UserOAuthRefreshList extends Table<RefreshTokenModel> {
return super.styles.concat(PFFlex); return super.styles.concat(PFFlex);
} }
apiEndpoint(page: number): Promise<AKResponse<RefreshTokenModel>> { async apiEndpoint(page: number): Promise<AKResponse<RefreshTokenModel>> {
return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensList({ return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensList({
user: this.userId, user: this.userId,
ordering: "expires", ordering: "expires",
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, AuthenticatedSession } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../forms/DeleteBulkForm"; import "../forms/DeleteBulkForm";
import { Table, TableColumn } from "../table/Table"; import { Table, TableColumn } from "../table/Table";
@ -16,12 +16,12 @@ export class AuthenticatedSessionList extends Table<AuthenticatedSession> {
@property() @property()
targetUser!: string; targetUser!: string;
apiEndpoint(page: number): Promise<AKResponse<AuthenticatedSession>> { async apiEndpoint(page: number): Promise<AKResponse<AuthenticatedSession>> {
return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsList({ return new CoreApi(DEFAULT_CONFIG).coreAuthenticatedSessionsList({
userUsername: this.targetUser, userUsername: this.targetUser,
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, UserConsent } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../forms/DeleteBulkForm"; import "../forms/DeleteBulkForm";
import { Table, TableColumn } from "../table/Table"; import { Table, TableColumn } from "../table/Table";
@ -16,12 +16,12 @@ export class UserConsentList extends Table<UserConsent> {
@property({ type: Number }) @property({ type: Number })
userId?: number; userId?: number;
apiEndpoint(page: number): Promise<AKResponse<UserConsent>> { async apiEndpoint(page: number): Promise<AKResponse<UserConsent>> {
return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({ return new CoreApi(DEFAULT_CONFIG).coreUserConsentList({
user: this.userId, user: this.userId,
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -20,6 +20,7 @@ import { CurrentTenant, EventsApi } from "@goauthentik/api";
import { DEFAULT_CONFIG, tenant } from "../api/Config"; import { DEFAULT_CONFIG, tenant } from "../api/Config";
import { configureSentry } from "../api/Sentry"; import { configureSentry } from "../api/Sentry";
import { me } from "../api/Users"; import { me } from "../api/Users";
import { uiConfig, UserDisplay } from "../common/config";
import { WebsocketClient } from "../common/ws"; import { WebsocketClient } from "../common/ws";
import { import {
EVENT_API_DRAWER_TOGGLE, EVENT_API_DRAWER_TOGGLE,
@ -34,7 +35,6 @@ import "../elements/sidebar/Sidebar";
import { DefaultTenant } from "../elements/sidebar/SidebarBrand"; import { DefaultTenant } from "../elements/sidebar/SidebarBrand";
import "../elements/sidebar/SidebarItem"; import "../elements/sidebar/SidebarItem";
import { ROUTES } from "../routesUser"; import { ROUTES } from "../routesUser";
import { uiConfig, UserDisplay } from "../user/config";
import { first } from "../utils"; import { first } from "../utils";
import "./locale"; import "./locale";

View File

@ -9,7 +9,7 @@ import { Application, CoreApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -37,11 +37,11 @@ export class ApplicationListPage extends TablePage<Application> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Application>> { async apiEndpoint(page: number): Promise<AKResponse<Application>> {
return new CoreApi(DEFAULT_CONFIG).coreApplicationsList({ return new CoreApi(DEFAULT_CONFIG).coreApplicationsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
superuserFullList: true, superuserFullList: true,
}); });

View File

@ -9,7 +9,7 @@ import { CryptoApi, CertificateKeyPair } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -43,11 +43,11 @@ export class CertificateKeyPairListPage extends TablePage<CertificateKeyPair> {
return super.styles.concat(PFDescriptionList); return super.styles.concat(PFDescriptionList);
} }
apiEndpoint(page: number): Promise<AKResponse<CertificateKeyPair>> { async apiEndpoint(page: number): Promise<AKResponse<CertificateKeyPair>> {
return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsList({ return new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -8,7 +8,7 @@ import { Event, EventsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { EventWithContext } from "../../api/Events"; import { EventWithContext } from "../../api/Events";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "./EventInfo"; import "./EventInfo";
@ -34,11 +34,11 @@ export class EventListPage extends TablePage<Event> {
@property() @property()
order = "-created"; order = "-created";
apiEndpoint(page: number): Promise<AKResponse<Event>> { async apiEndpoint(page: number): Promise<AKResponse<Event>> {
return new EventsApi(DEFAULT_CONFIG).eventsEventsList({ return new EventsApi(DEFAULT_CONFIG).eventsEventsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { EventsApi, NotificationRule } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -37,11 +37,11 @@ export class RuleListPage extends TablePage<NotificationRule> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<NotificationRule>> { async apiEndpoint(page: number): Promise<AKResponse<NotificationRule>> {
return new EventsApi(DEFAULT_CONFIG).eventsRulesList({ return new EventsApi(DEFAULT_CONFIG).eventsRulesList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { EventsApi, NotificationTransport } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/ActionButton"; import "../../elements/buttons/ActionButton";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -36,11 +36,11 @@ export class TransportListPage extends TablePage<NotificationTransport> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<NotificationTransport>> { async apiEndpoint(page: number): Promise<AKResponse<NotificationTransport>> {
return new EventsApi(DEFAULT_CONFIG).eventsTransportsList({ return new EventsApi(DEFAULT_CONFIG).eventsTransportsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { FlowsApi, FlowStageBinding, StagesApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/Tabs"; import "../../elements/Tabs";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
@ -28,12 +28,12 @@ export class BoundStagesList extends Table<FlowStageBinding> {
@property() @property()
target?: string; target?: string;
apiEndpoint(page: number): Promise<AKResponse<FlowStageBinding>> { async apiEndpoint(page: number): Promise<AKResponse<FlowStageBinding>> {
return new FlowsApi(DEFAULT_CONFIG).flowsBindingsList({ return new FlowsApi(DEFAULT_CONFIG).flowsBindingsList({
target: this.target || "", target: this.target || "",
ordering: "order", ordering: "order",
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -7,7 +7,7 @@ import { Flow, FlowsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/ConfirmationForm"; import "../../elements/forms/ConfirmationForm";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -39,11 +39,11 @@ export class FlowListPage extends TablePage<Flow> {
@property() @property()
order = "slug"; order = "slug";
apiEndpoint(page: number): Promise<AKResponse<Flow>> { async apiEndpoint(page: number): Promise<AKResponse<Flow>> {
return new FlowsApi(DEFAULT_CONFIG).flowsInstancesList({ return new FlowsApi(DEFAULT_CONFIG).flowsInstancesList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, Group } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -34,11 +34,11 @@ export class GroupListPage extends TablePage<Group> {
@property() @property()
order = "slug"; order = "slug";
apiEndpoint(page: number): Promise<AKResponse<Group>> { async apiEndpoint(page: number): Promise<AKResponse<Group>> {
return new CoreApi(DEFAULT_CONFIG).coreGroupsList({ return new CoreApi(DEFAULT_CONFIG).coreGroupsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, User } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { TableModal } from "../../elements/table/TableModal"; import { TableModal } from "../../elements/table/TableModal";
@ -27,11 +27,11 @@ export class MemberSelectTable extends TableModal<User> {
order = "username"; order = "username";
apiEndpoint(page: number): Promise<AKResponse<User>> { async apiEndpoint(page: number): Promise<AKResponse<User>> {
return new CoreApi(DEFAULT_CONFIG).coreUsersList({ return new CoreApi(DEFAULT_CONFIG).coreUsersList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE / 2, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -12,7 +12,7 @@ import { Outpost, OutpostsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import { PFSize } from "../../elements/Spinner"; import { PFSize } from "../../elements/Spinner";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -40,11 +40,11 @@ export class OutpostListPage extends TablePage<Outpost> {
searchEnabled(): boolean { searchEnabled(): boolean {
return true; return true;
} }
apiEndpoint(page: number): Promise<AKResponse<Outpost>> { async apiEndpoint(page: number): Promise<AKResponse<Outpost>> {
return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesList({ return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { OutpostsApi, ServiceConnection } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import { PFColor } from "../../elements/Label"; import { PFColor } from "../../elements/Label";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
@ -39,11 +39,11 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio
checkbox = true; checkbox = true;
apiEndpoint(page: number): Promise<AKResponse<ServiceConnection>> { async apiEndpoint(page: number): Promise<AKResponse<ServiceConnection>> {
return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllList({ return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { PoliciesApi, PolicyBinding } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import { PFSize } from "../../elements/Spinner"; import { PFSize } from "../../elements/Spinner";
import "../../elements/Tabs"; import "../../elements/Tabs";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
@ -32,12 +32,12 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
checkbox = true; checkbox = true;
apiEndpoint(page: number): Promise<AKResponse<PolicyBinding>> { async apiEndpoint(page: number): Promise<AKResponse<PolicyBinding>> {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsList({ return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsList({
target: this.target || "", target: this.target || "",
ordering: "order", ordering: "order",
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
}); });
} }

View File

@ -9,7 +9,7 @@ import { PoliciesApi, Policy } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/ConfirmationForm"; import "../../elements/forms/ConfirmationForm";
@ -48,11 +48,11 @@ export class PolicyListPage extends TablePage<Policy> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Policy>> { async apiEndpoint(page: number): Promise<AKResponse<Policy>> {
return new PoliciesApi(DEFAULT_CONFIG).policiesAllList({ return new PoliciesApi(DEFAULT_CONFIG).policiesAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { IPReputation, PoliciesApi } from "@goauthentik/api";
import { AKResponse } from "../../../api/Client"; import { AKResponse } from "../../../api/Client";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { PAGE_SIZE } from "../../../constants"; import { uiConfig } from "../../../common/config";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton"; import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteBulkForm"; import "../../../elements/forms/DeleteBulkForm";
@ -35,11 +35,11 @@ export class IPReputationListPage extends TablePage<IPReputation> {
checkbox = true; checkbox = true;
apiEndpoint(page: number): Promise<AKResponse<IPReputation>> { async apiEndpoint(page: number): Promise<AKResponse<IPReputation>> {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsList({ return new PoliciesApi(DEFAULT_CONFIG).policiesReputationIpsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { UserReputation, PoliciesApi } from "@goauthentik/api";
import { AKResponse } from "../../../api/Client"; import { AKResponse } from "../../../api/Client";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { PAGE_SIZE } from "../../../constants"; import { uiConfig } from "../../../common/config";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton"; import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteBulkForm"; import "../../../elements/forms/DeleteBulkForm";
@ -35,11 +35,11 @@ export class UserReputationListPage extends TablePage<UserReputation> {
@property() @property()
order = "username"; order = "username";
apiEndpoint(page: number): Promise<AKResponse<UserReputation>> { async apiEndpoint(page: number): Promise<AKResponse<UserReputation>> {
return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersList({ return new PoliciesApi(DEFAULT_CONFIG).policiesReputationUsersList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { PropertyMapping, PropertymappingsApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -47,11 +47,11 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
@property({ type: Boolean }) @property({ type: Boolean })
hideManaged = false; hideManaged = false;
apiEndpoint(page: number): Promise<AKResponse<PropertyMapping>> { async apiEndpoint(page: number): Promise<AKResponse<PropertyMapping>> {
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllList({ return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
managedIsnull: this.hideManaged ? true : undefined, managedIsnull: this.hideManaged ? true : undefined,
}); });

View File

@ -9,7 +9,7 @@ import { Provider, ProvidersApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -43,11 +43,11 @@ export class ProviderListPage extends TablePage<Provider> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Provider>> { async apiEndpoint(page: number): Promise<AKResponse<Provider>> {
return new ProvidersApi(DEFAULT_CONFIG).providersAllList({ return new ProvidersApi(DEFAULT_CONFIG).providersAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { Source, SourcesApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -42,11 +42,11 @@ export class SourceListPage extends TablePage<Source> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Source>> { async apiEndpoint(page: number): Promise<AKResponse<Source>> {
return new SourcesApi(DEFAULT_CONFIG).sourcesAllList({ return new SourcesApi(DEFAULT_CONFIG).sourcesAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -9,7 +9,7 @@ import { Stage, StagesApi } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -58,11 +58,11 @@ export class StageListPage extends TablePage<Stage> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Stage>> { async apiEndpoint(page: number): Promise<AKResponse<Stage>> {
return new StagesApi(DEFAULT_CONFIG).stagesAllList({ return new StagesApi(DEFAULT_CONFIG).stagesAllList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { Invitation, StagesApi } from "@goauthentik/api";
import { AKResponse } from "../../../api/Client"; import { AKResponse } from "../../../api/Client";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { PAGE_SIZE } from "../../../constants"; import { uiConfig } from "../../../common/config";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton"; import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteBulkForm"; import "../../../elements/forms/DeleteBulkForm";
@ -39,11 +39,11 @@ export class InvitationListPage extends TablePage<Invitation> {
@property() @property()
order = "expires"; order = "expires";
apiEndpoint(page: number): Promise<AKResponse<Invitation>> { async apiEndpoint(page: number): Promise<AKResponse<Invitation>> {
return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsList({ return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { Prompt, StagesApi } from "@goauthentik/api";
import { AKResponse } from "../../../api/Client"; import { AKResponse } from "../../../api/Client";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { PAGE_SIZE } from "../../../constants"; import { uiConfig } from "../../../common/config";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/SpinnerButton"; import "../../../elements/buttons/SpinnerButton";
import "../../../elements/forms/DeleteBulkForm"; import "../../../elements/forms/DeleteBulkForm";
@ -37,11 +37,11 @@ export class PromptListPage extends TablePage<Prompt> {
@property() @property()
order = "order"; order = "order";
apiEndpoint(page: number): Promise<AKResponse<Prompt>> { async apiEndpoint(page: number): Promise<AKResponse<Prompt>> {
return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsList({ return new StagesApi(DEFAULT_CONFIG).stagesPromptPromptsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -40,7 +40,7 @@ export class SystemTaskListPage extends TablePage<Task> {
return super.styles.concat(PFDescriptionList); return super.styles.concat(PFDescriptionList);
} }
apiEndpoint(page: number): Promise<AKResponse<Task>> { async apiEndpoint(page: number): Promise<AKResponse<Task>> {
return new AdminApi(DEFAULT_CONFIG).adminSystemTasksList().then((tasks) => { return new AdminApi(DEFAULT_CONFIG).adminSystemTasksList().then((tasks) => {
return { return {
pagination: { pagination: {

View File

@ -7,7 +7,7 @@ import { CoreApi, Tenant } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -35,11 +35,11 @@ export class TenantListPage extends TablePage<Tenant> {
@property() @property()
order = "domain"; order = "domain";
apiEndpoint(page: number): Promise<AKResponse<Tenant>> { async apiEndpoint(page: number): Promise<AKResponse<Tenant>> {
return new CoreApi(DEFAULT_CONFIG).coreTenantsList({ return new CoreApi(DEFAULT_CONFIG).coreTenantsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, IntentEnum, Token } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/Dropdown"; import "../../elements/buttons/Dropdown";
import "../../elements/buttons/TokenCopyButton"; import "../../elements/buttons/TokenCopyButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
@ -49,11 +49,11 @@ export class TokenListPage extends TablePage<Token> {
@property() @property()
order = "expires"; order = "expires";
apiEndpoint(page: number): Promise<AKResponse<Token>> { async apiEndpoint(page: number): Promise<AKResponse<Token>> {
return new CoreApi(DEFAULT_CONFIG).coreTokensList({ return new CoreApi(DEFAULT_CONFIG).coreTokensList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -7,7 +7,7 @@ import { CoreApi, Group } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config"; import { DEFAULT_CONFIG } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { TableModal } from "../../elements/table/TableModal"; import { TableModal } from "../../elements/table/TableModal";
@ -26,11 +26,11 @@ export class GroupSelectModal extends TableModal<Group> {
order = "name"; order = "name";
apiEndpoint(page: number): Promise<AKResponse<Group>> { async apiEndpoint(page: number): Promise<AKResponse<Group>> {
return new CoreApi(DEFAULT_CONFIG).coreGroupsList({ return new CoreApi(DEFAULT_CONFIG).coreGroupsList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE / 2, pageSize: (await uiConfig()).pagination.perPage / 2,
search: this.search || "", search: this.search || "",
}); });
} }

View File

@ -10,7 +10,7 @@ import { CoreApi, User } from "@goauthentik/api";
import { AKResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG, tenant } from "../../api/Config"; import { DEFAULT_CONFIG, tenant } from "../../api/Config";
import { PAGE_SIZE } from "../../constants"; import { uiConfig } from "../../common/config";
import "../../elements/buttons/ActionButton"; import "../../elements/buttons/ActionButton";
import "../../elements/forms/DeleteBulkForm"; import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm"; import "../../elements/forms/ModalForm";
@ -52,11 +52,11 @@ export class UserListPage extends TablePage<User> {
return super.styles.concat(PFDescriptionList); return super.styles.concat(PFDescriptionList);
} }
apiEndpoint(page: number): Promise<AKResponse<User>> { async apiEndpoint(page: number): Promise<AKResponse<User>> {
return new CoreApi(DEFAULT_CONFIG).coreUsersList({ return new CoreApi(DEFAULT_CONFIG).coreUsersList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
attributes: this.hideServiceAccounts attributes: this.hideServiceAccounts
? JSON.stringify({ ? JSON.stringify({

View File

@ -14,8 +14,8 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { Application } from "@goauthentik/api"; import { Application } from "@goauthentik/api";
import { me } from "../api/Users"; import { me } from "../api/Users";
import { uiConfig } from "../common/config";
import { truncate } from "../utils"; import { truncate } from "../utils";
import { uiConfig } from "./config";
@customElement("ak-library-app") @customElement("ak-library-app")
export class LibraryApplication extends LitElement { export class LibraryApplication extends LitElement {

View File

@ -18,9 +18,9 @@ import { Application, CoreApi } from "@goauthentik/api";
import { AKResponse } from "../api/Client"; import { AKResponse } from "../api/Client";
import { DEFAULT_CONFIG } from "../api/Config"; import { DEFAULT_CONFIG } from "../api/Config";
import { UIConfig, uiConfig } from "../common/config";
import { loading } from "../utils"; import { loading } from "../utils";
import "./LibraryApplication"; import "./LibraryApplication";
import { UIConfig, uiConfig } from "./config";
@customElement("ak-library") @customElement("ak-library")
export class LibraryPage extends LitElement { export class LibraryPage extends LitElement {

View File

@ -9,7 +9,7 @@ import { CoreApi, IntentEnum, Token } from "@goauthentik/api";
import { AKResponse } from "../../../api/Client"; import { AKResponse } from "../../../api/Client";
import { DEFAULT_CONFIG } from "../../../api/Config"; import { DEFAULT_CONFIG } from "../../../api/Config";
import { PAGE_SIZE } from "../../../constants"; import { uiConfig } from "../../../common/config";
import "../../../elements/buttons/Dropdown"; import "../../../elements/buttons/Dropdown";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/TokenCopyButton"; import "../../../elements/buttons/TokenCopyButton";
@ -31,11 +31,11 @@ export class UserTokenList extends Table<Token> {
@property() @property()
order = "expires"; order = "expires";
apiEndpoint(page: number): Promise<AKResponse<Token>> { async apiEndpoint(page: number): Promise<AKResponse<Token>> {
return new CoreApi(DEFAULT_CONFIG).coreTokensList({ return new CoreApi(DEFAULT_CONFIG).coreTokensList({
ordering: this.order, ordering: this.order,
page: page, page: page,
pageSize: PAGE_SIZE, pageSize: (await uiConfig()).pagination.perPage,
search: this.search || "", search: this.search || "",
managed: "", managed: "",
}); });