web: PBResponse -> AKResponse

This commit is contained in:
Jens Langhammer 2021-02-09 17:04:55 +01:00
parent 45f1d95bf9
commit f8bcdb26b3
29 changed files with 78 additions and 74 deletions

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Provider } from "./Providers"; import { Provider } from "./Providers";
export class Application { export class Application {
@ -22,8 +22,8 @@ export class Application {
return DefaultClient.fetch<Application>(["core", "applications", slug]); return DefaultClient.fetch<Application>(["core", "applications", slug]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Application>> { static list(filter?: QueryArguments): Promise<AKResponse<Application>> {
return DefaultClient.fetch<PBResponse<Application>>(["core", "applications"], filter); return DefaultClient.fetch<AKResponse<Application>>(["core", "applications"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -94,7 +94,7 @@ export interface PBPagination {
end_index: number; end_index: number;
} }
export interface PBResponse<T> { export interface AKResponse<T> {
pagination: PBPagination; pagination: PBPagination;
results: Array<T>; results: Array<T>;

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client"; import { DefaultClient, QueryArguments, AKResponse } from "./Client";
import { Event } from "./Events"; import { Event } from "./Events";
export class Notification { export class Notification {
@ -17,8 +17,8 @@ export class Notification {
return DefaultClient.fetch<Notification>(["events", "notifications", pk]); return DefaultClient.fetch<Notification>(["events", "notifications", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Notification>> { static list(filter?: QueryArguments): Promise<AKResponse<Notification>> {
return DefaultClient.fetch<PBResponse<Notification>>(["events", "notifications"], filter); return DefaultClient.fetch<AKResponse<Notification>>(["events", "notifications"], filter);
} }
static markSeen(pk: string): Promise<{seen: boolean}> { static markSeen(pk: string): Promise<{seen: boolean}> {

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client"; import { DefaultClient, QueryArguments, AKResponse } from "./Client";
import { Group } from "./Groups"; import { Group } from "./Groups";
export class Rule { export class Rule {
@ -16,8 +16,8 @@ export class Rule {
return DefaultClient.fetch<Rule>(["events", "rules", pk]); return DefaultClient.fetch<Rule>(["events", "rules", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Rule>> { static list(filter?: QueryArguments): Promise<AKResponse<Rule>> {
return DefaultClient.fetch<PBResponse<Rule>>(["events", "rules"], filter); return DefaultClient.fetch<AKResponse<Rule>>(["events", "rules"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client"; import { DefaultClient, QueryArguments, AKResponse } from "./Client";
export class Transport { export class Transport {
pk: string; pk: string;
@ -15,8 +15,8 @@ export class Transport {
return DefaultClient.fetch<Transport>(["events", "transports", pk]); return DefaultClient.fetch<Transport>(["events", "transports", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Transport>> { static list(filter?: QueryArguments): Promise<AKResponse<Transport>> {
return DefaultClient.fetch<PBResponse<Transport>>(["events", "transports"], filter); return DefaultClient.fetch<AKResponse<Transport>>(["events", "transports"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export interface EventUser { export interface EventUser {
pk: number; pk: number;
@ -28,8 +28,8 @@ export class Event {
return DefaultClient.fetch<Event>(["events", "events", pk]); return DefaultClient.fetch<Event>(["events", "events", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Event>> { static list(filter?: QueryArguments): Promise<AKResponse<Event>> {
return DefaultClient.fetch<PBResponse<Event>>(["events", "events"], filter); return DefaultClient.fetch<AKResponse<Event>>(["events", "events"], filter);
} }
// events/events/top_per_user/?filter_action=authorize_application // events/events/top_per_user/?filter_action=authorize_application

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export enum FlowDesignation { export enum FlowDesignation {
Authentication = "authentication", Authentication = "authentication",
@ -34,12 +34,12 @@ export class Flow {
return DefaultClient.fetch<{ diagram: string }>(["flows", "instances", slug, "diagram"]); return DefaultClient.fetch<{ diagram: string }>(["flows", "instances", slug, "diagram"]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Flow>> { static list(filter?: QueryArguments): Promise<AKResponse<Flow>> {
return DefaultClient.fetch<PBResponse<Flow>>(["flows", "instances"], filter); return DefaultClient.fetch<AKResponse<Flow>>(["flows", "instances"], filter);
} }
static cached(): Promise<number> { static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Flow>>(["flows", "cached"]).then(r => { return DefaultClient.fetch<AKResponse<Flow>>(["flows", "cached"]).then(r => {
return r.pagination.count; return r.pagination.count;
}); });
} }
@ -76,8 +76,8 @@ export class FlowStageBinding {
return DefaultClient.fetch<FlowStageBinding>(["flows", "bindings", slug]); return DefaultClient.fetch<FlowStageBinding>(["flows", "bindings", slug]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<FlowStageBinding>> { static list(filter?: QueryArguments): Promise<AKResponse<FlowStageBinding>> {
return DefaultClient.fetch<PBResponse<FlowStageBinding>>(["flows", "bindings"], filter); return DefaultClient.fetch<AKResponse<FlowStageBinding>>(["flows", "bindings"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Provider } from "./Providers"; import { Provider } from "./Providers";
export interface OutpostHealth { export interface OutpostHealth {
@ -26,8 +26,8 @@ export class Outpost {
return DefaultClient.fetch<Outpost>(["outposts", "outposts", pk]); return DefaultClient.fetch<Outpost>(["outposts", "outposts", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Outpost>> { static list(filter?: QueryArguments): Promise<AKResponse<Outpost>> {
return DefaultClient.fetch<PBResponse<Outpost>>(["outposts", "outposts"], filter); return DefaultClient.fetch<AKResponse<Outpost>>(["outposts", "outposts"], filter);
} }
static health(pk: string): Promise<OutpostHealth[]> { static health(pk: string): Promise<OutpostHealth[]> {

View File

@ -1,4 +1,4 @@
import { DefaultClient, BaseInheritanceModel, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, BaseInheritanceModel, AKResponse, QueryArguments } from "./Client";
export class Policy implements BaseInheritanceModel { export class Policy implements BaseInheritanceModel {
pk: string; pk: string;
@ -15,12 +15,12 @@ export class Policy implements BaseInheritanceModel {
return DefaultClient.fetch<Policy>(["policies", "all", pk]); return DefaultClient.fetch<Policy>(["policies", "all", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Policy>> { static list(filter?: QueryArguments): Promise<AKResponse<Policy>> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "all"], filter); return DefaultClient.fetch<AKResponse<Policy>>(["policies", "all"], filter);
} }
static cached(): Promise<number> { static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "cached"]).then(r => { return DefaultClient.fetch<AKResponse<Policy>>(["policies", "cached"]).then(r => {
return r.pagination.count; return r.pagination.count;
}); });
} }

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Policy } from "./Policies"; import { Policy } from "./Policies";
export class PolicyBinding { export class PolicyBinding {
@ -18,8 +18,8 @@ export class PolicyBinding {
return DefaultClient.fetch<PolicyBinding>(["policies", "bindings", pk]); return DefaultClient.fetch<PolicyBinding>(["policies", "bindings", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<PolicyBinding>> { static list(filter?: QueryArguments): Promise<AKResponse<PolicyBinding>> {
return DefaultClient.fetch<PBResponse<PolicyBinding>>(["policies", "bindings"], filter); return DefaultClient.fetch<AKResponse<PolicyBinding>>(["policies", "bindings"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client"; import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export class PropertyMapping { export class PropertyMapping {
pk: string; pk: string;
@ -16,8 +16,8 @@ export class PropertyMapping {
return DefaultClient.fetch<PropertyMapping>(["propertymappings", "all", pk]); return DefaultClient.fetch<PropertyMapping>(["propertymappings", "all", pk]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<PropertyMapping>> { static list(filter?: QueryArguments): Promise<AKResponse<PropertyMapping>> {
return DefaultClient.fetch<PBResponse<PropertyMapping>>(["propertymappings", "all"], filter); return DefaultClient.fetch<AKResponse<PropertyMapping>>(["propertymappings", "all"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { BaseInheritanceModel, DefaultClient, PBResponse, QueryArguments } from "./Client"; import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
export class Provider implements BaseInheritanceModel { export class Provider implements BaseInheritanceModel {
pk: number; pk: number;
@ -20,8 +20,8 @@ export class Provider implements BaseInheritanceModel {
return DefaultClient.fetch<Provider>(["providers", "all", id.toString()]); return DefaultClient.fetch<Provider>(["providers", "all", id.toString()]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Provider>> { static list(filter?: QueryArguments): Promise<AKResponse<Provider>> {
return DefaultClient.fetch<PBResponse<Provider>>(["providers", "all"], filter); return DefaultClient.fetch<AKResponse<Provider>>(["providers", "all"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { BaseInheritanceModel, DefaultClient, PBResponse, QueryArguments } from "./Client"; import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
export class Source implements BaseInheritanceModel { export class Source implements BaseInheritanceModel {
pk: string; pk: string;
@ -19,8 +19,8 @@ export class Source implements BaseInheritanceModel {
return DefaultClient.fetch<Source>(["sources", "all", slug]); return DefaultClient.fetch<Source>(["sources", "all", slug]);
} }
static list(filter?: QueryArguments): Promise<PBResponse<Source>> { static list(filter?: QueryArguments): Promise<AKResponse<Source>> {
return DefaultClient.fetch<PBResponse<Source>>(["sources", "all"], filter); return DefaultClient.fetch<AKResponse<Source>>(["sources", "all"], filter);
} }
static adminUrl(rest: string): string { static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse } from "./Client"; import { DefaultClient, AKResponse } from "./Client";
let _globalMePromise: Promise<User>; let _globalMePromise: Promise<User>;
@ -22,7 +22,7 @@ export class User {
} }
static count(): Promise<number> { static count(): Promise<number> {
return DefaultClient.fetch<PBResponse<User>>(["core", "users"], { return DefaultClient.fetch<AKResponse<User>>(["core", "users"], {
"page_size": 1 "page_size": 1
}).then(r => { }).then(r => {
return r.pagination.count; return r.pagination.count;

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Notification } from "../../api/EventNotification"; import { Notification } from "../../api/EventNotification";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
@ -8,7 +8,7 @@ import { COMMON_STYLES } from "../../common/styles";
export class NotificationDrawer extends LitElement { export class NotificationDrawer extends LitElement {
@property({attribute: false}) @property({attribute: false})
notifications?: PBResponse<Notification>; notifications?: AKResponse<Notification>;
@property({type: Number}) @property({type: Number})
unread = 0; unread = 0;

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../../elements/table/Table"; import { Table, TableColumn } from "../../elements/table/Table";
import { PolicyBinding } from "../../api/PolicyBindings"; import { PolicyBinding } from "../../api/PolicyBindings";
@ -14,7 +14,7 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
@property() @property()
target?: string; target?: string;
apiEndpoint(page: number): Promise<PBResponse<PolicyBinding>> { apiEndpoint(page: number): Promise<AKResponse<PolicyBinding>> {
return PolicyBinding.list({ return PolicyBinding.list({
target: this.target || "", target: this.target || "",
ordering: "order", ordering: "order",

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { CSSResult, html, LitElement, property, TemplateResult } from "lit-element"; import { CSSResult, html, LitElement, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import "./TablePagination"; import "./TablePagination";
@ -69,7 +69,7 @@ export class TableColumn {
} }
export abstract class Table<T> extends LitElement { export abstract class Table<T> extends LitElement {
abstract apiEndpoint(page: number): Promise<PBResponse<T>>; abstract apiEndpoint(page: number): Promise<AKResponse<T>>;
abstract columns(): TableColumn[]; abstract columns(): TableColumn[];
abstract row(item: T): TemplateResult[]; abstract row(item: T): TemplateResult[];
@ -84,7 +84,7 @@ export abstract class Table<T> extends LitElement {
} }
@property({attribute: false}) @property({attribute: false})
data?: PBResponse<T>; data?: AKResponse<T>;
@property({type: Number}) @property({type: Number})
page = 1; page = 1;

View File

@ -2,7 +2,7 @@ import { gettext } from "django";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined"; import { ifDefined } from "lit-html/directives/if-defined";
import { Application } from "../api/Applications"; import { Application } from "../api/Applications";
import { PBResponse } from "../api/Client"; import { AKResponse } from "../api/Client";
import { COMMON_STYLES } from "../common/styles"; import { COMMON_STYLES } from "../common/styles";
import { loading, truncate } from "../utils"; import { loading, truncate } from "../utils";
@ -52,7 +52,7 @@ export class LibraryApplication extends LitElement {
@customElement("ak-library") @customElement("ak-library")
export class LibraryPage extends LitElement { export class LibraryPage extends LitElement {
@property({attribute: false}) @property({attribute: false})
apps?: PBResponse<Application>; apps?: AKResponse<Application>;
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return COMMON_STYLES; return COMMON_STYLES;

View File

@ -1,13 +1,13 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { DefaultClient, PBResponse } from "../../../api/Client"; import { DefaultClient, AKResponse } from "../../../api/Client";
import { AdminStatus, AdminStatusCard } from "./AdminStatusCard"; import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
@customElement("ak-admin-status-card-workers") @customElement("ak-admin-status-card-workers")
export class WorkersStatusCard extends AdminStatusCard<number> { export class WorkersStatusCard extends AdminStatusCard<number> {
getPrimaryValue(): Promise<number> { getPrimaryValue(): Promise<number> {
return DefaultClient.fetch<PBResponse<number>>(["admin", "workers"]).then((r) => { return DefaultClient.fetch<AKResponse<number>>(["admin", "workers"]).then((r) => {
return r.pagination.count; return r.pagination.count;
}); });
} }

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { Application } from "../../api/Applications"; import { Application } from "../../api/Applications";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
@ -26,7 +26,7 @@ export class ApplicationListPage extends TablePage<Application> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<PBResponse<Application>> { apiEndpoint(page: number): Promise<AKResponse<Application>> {
return Application.list({ return Application.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Event } from "../../api/Events"; import { Event } from "../../api/Events";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
@ -27,7 +27,7 @@ export class EventListPage extends TablePage<Event> {
@property() @property()
order = "-created"; order = "-created";
apiEndpoint(page: number): Promise<PBResponse<Event>> { apiEndpoint(page: number): Promise<AKResponse<Event>> {
return Event.list({ return Event.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/policies/BoundPoliciesList"; import "../../elements/policies/BoundPoliciesList";
@ -29,7 +29,7 @@ export class RuleListPage extends TablePage<Rule> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<PBResponse<Rule>> { apiEndpoint(page: number): Promise<AKResponse<Rule>> {
return Rule.list({ return Rule.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { DefaultClient, PBResponse } from "../../api/Client"; import { DefaultClient, AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ActionButton"; import "../../elements/buttons/ActionButton";
@ -27,7 +27,7 @@ export class TransportListPage extends TablePage<Transport> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<PBResponse<Transport>> { apiEndpoint(page: number): Promise<AKResponse<Transport>> {
return Transport.list({ return Transport.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Table, TableColumn } from "../../elements/table/Table"; import { Table, TableColumn } from "../../elements/table/Table";
import "../../elements/Tabs"; import "../../elements/Tabs";
@ -17,7 +17,7 @@ export class BoundStagesList extends Table<FlowStageBinding> {
@property() @property()
target?: string; target?: string;
apiEndpoint(page: number): Promise<PBResponse<FlowStageBinding>> { apiEndpoint(page: number): Promise<AKResponse<FlowStageBinding>> {
return FlowStageBinding.list({ return FlowStageBinding.list({
target: this.target || "", target: this.target || "",
ordering: "order", ordering: "order",

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, property } from "lit-element"; import { customElement, property } from "lit-element";
import { html, TemplateResult } from "lit-html"; import { html, TemplateResult } from "lit-html";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Outpost } from "../../api/Outposts"; import { Outpost } from "../../api/Outposts";
import { TableColumn } from "../../elements/table/Table"; import { TableColumn } from "../../elements/table/Table";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
@ -25,7 +25,7 @@ export class OutpostListPage extends TablePage<Outpost> {
searchEnabled(): boolean { searchEnabled(): boolean {
return true; return true;
} }
apiEndpoint(page: number): Promise<PBResponse<Outpost>> { apiEndpoint(page: number): Promise<AKResponse<Outpost>> {
return Outpost.list({ return Outpost.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { PropertyMapping } from "../../api/PropertyMapping"; import { PropertyMapping } from "../../api/PropertyMapping";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
@ -30,7 +30,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
@property({type: Boolean}) @property({type: Boolean})
hideManaged = false; hideManaged = false;
apiEndpoint(page: number): Promise<PBResponse<PropertyMapping>> { apiEndpoint(page: number): Promise<AKResponse<PropertyMapping>> {
return PropertyMapping.list({ return PropertyMapping.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { Provider } from "../../api/Providers"; import { Provider } from "../../api/Providers";
import { PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
@ -27,7 +27,7 @@ export class ProviderListPage extends TablePage<Provider> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<PBResponse<Provider>> { apiEndpoint(page: number): Promise<AKResponse<Provider>> {
return Provider.list({ return Provider.list({
ordering: this.order, ordering: this.order,
page: page, page: page,

View File

@ -4,6 +4,7 @@ import { COMMON_STYLES } from "../../common/styles";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/buttons/ActionButton";
import "../../elements/CodeMirror"; import "../../elements/CodeMirror";
import "../../elements/Tabs"; import "../../elements/Tabs";
import { Page } from "../../elements/Page"; import { Page } from "../../elements/Page";
@ -112,7 +113,7 @@ export class LDAPSourceViewPage extends Page {
return gettext("Not synced in the last hour, check System tasks."); return gettext("Not synced in the last hour, check System tasks.");
} }
const syncDate = new Date(ls.last_sync * 1000); const syncDate = new Date(ls.last_sync * 1000);
return gettext(`Last sync: ${syncDate.toLocaleString()}`) return gettext(`Last sync: ${syncDate.toLocaleString()}`);
}), "loading")} }), "loading")}
</p> </p>
</div> </div>

View File

@ -1,10 +1,13 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { customElement, html, property, TemplateResult } from "lit-element";
import { DefaultClient, PBResponse } from "../../api/Client"; import { AKResponse } from "../../api/Client";
import { Source } from "../../api/Sources"; import { Source } from "../../api/Sources";
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 "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton";
@customElement("ak-source-list") @customElement("ak-source-list")
export class SourceListPage extends TablePage<Source> { export class SourceListPage extends TablePage<Source> {
pageTitle(): string { pageTitle(): string {
@ -23,7 +26,7 @@ export class SourceListPage extends TablePage<Source> {
@property() @property()
order = "name"; order = "name";
apiEndpoint(page: number): Promise<PBResponse<Source>> { apiEndpoint(page: number): Promise<AKResponse<Source>> {
return Source.list({ return Source.list({
ordering: this.order, ordering: this.order,
page: page, page: page,