web: make sure naming matches backend

This commit is contained in:
Jens Langhammer 2020-12-16 23:02:43 +01:00
parent 2d9efe035e
commit 3b7bba5a62
35 changed files with 64 additions and 62 deletions

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client"; import { DefaultClient, PBResponse, QueryArguments } from "./Client";
export class Application { export class Application {
pk: string; pk: string;

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client"; import { DefaultClient, PBResponse, QueryArguments } from "./Client";
export enum FlowDesignation { export enum FlowDesignation {
Authentication = "authentication", Authentication = "authentication",

24
web/src/api/Policies.ts Normal file
View File

@ -0,0 +1,24 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
export class Policy {
pk: string;
name: string;
constructor() {
throw Error();
}
static get(pk: string): Promise<Policy> {
return DefaultClient.fetch<Policy>(["policies", "all", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Policy>> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "all"], filter);
}
static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "cached"]).then(r => {
return r.pagination.count;
});
}
}

View File

@ -1,27 +1,5 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client"; import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { Policy } from "./Policies";
export class Policy {
pk: string;
name: string;
constructor() {
throw Error();
}
static get(pk: string): Promise<Policy> {
return DefaultClient.fetch<Policy>(["policies", "all", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Policy>> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "all"], filter);
}
static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "cached"]).then(r => {
return r.pagination.count;
});
}
}
export class PolicyBinding { export class PolicyBinding {
pk: string; pk: string;

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client"; import { DefaultClient, PBResponse, QueryArguments } from "./Client";
export class Provider { export class Provider {
pk: number; pk: number;

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./client"; import { DefaultClient, PBResponse, QueryArguments } from "./Client";
export class Source { export class Source {
pk: string; pk: string;

View File

@ -1,4 +1,4 @@
import { DefaultClient } from "./client"; import { DefaultClient } from "./Client";
interface TokenResponse { interface TokenResponse {
key: string; key: string;

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse } from "./client"; import { DefaultClient, PBResponse } from "./Client";
let _globalMePromise: Promise<User>; let _globalMePromise: Promise<User>;

View File

@ -1,4 +1,4 @@
import { DefaultClient } from "./client"; import { DefaultClient } from "./Client";
export class Version { export class Version {

View File

@ -1,4 +1,4 @@
import { NotFoundError, RequestError } from "./errors"; import { NotFoundError, RequestError } from "./Error";
export const VERSION = "v2beta"; export const VERSION = "v2beta";

View File

@ -1,4 +1,4 @@
import { DefaultClient } from "./client"; import { DefaultClient } from "./Client";
import * as Sentry from "@sentry/browser"; import * as Sentry from "@sentry/browser";
import { Integrations } from "@sentry/tracing"; import { Integrations } from "@sentry/tracing";
import { VERSION } from "../constants"; import { VERSION } from "../constants";

View File

@ -1,4 +1,4 @@
import { DefaultClient } from "./client"; import { DefaultClient } from "./Client";
export class AuditEvent { export class AuditEvent {
//audit/events/top_per_user/?filter_action=authorize_application //audit/events/top_per_user/?filter_action=authorize_application

View File

@ -3,7 +3,7 @@ import { css, CSSResult, customElement, html, LitElement, property, TemplateResu
import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css";
// @ts-ignore // @ts-ignore
import ButtonStyle from "@patternfly/patternfly/components/Button/button.css"; import ButtonStyle from "@patternfly/patternfly/components/Button/button.css";
import { tokenByIdentifier } from "../../api/token"; import { tokenByIdentifier } from "../../api/Tokens";
import { ColorStyles, ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants"; import { ColorStyles, ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants";
@customElement("ak-token-copy-button") @customElement("ak-token-copy-button")

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { LitElement, html, customElement, TemplateResult, property } from "lit-element"; import { LitElement, html, customElement, TemplateResult, property } from "lit-element";
import { DefaultClient } from "../../api/client"; import { DefaultClient } from "../../api/Client";
import "./Message"; import "./Message";
import { APIMessage } from "./Message"; import { APIMessage } from "./Message";

View File

@ -1,8 +1,8 @@
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 { PBResponse } from "../../api/Client";
import { PolicyBinding } from "../../api/policy";
import { Table } from "../../elements/table/Table"; import { Table } from "../../elements/table/Table";
import { PolicyBinding } from "../../api/PolicyBindings";
import "../../elements/Tabs"; import "../../elements/Tabs";
import "../../elements/AdminLoginsChart"; import "../../elements/AdminLoginsChart";

View File

@ -3,7 +3,7 @@ import { css, CSSResult, customElement, html, LitElement, property, TemplateResu
import PageStyle from "@patternfly/patternfly/components/Page/page.css"; import PageStyle from "@patternfly/patternfly/components/Page/page.css";
// @ts-ignore // @ts-ignore
import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css";
import { Config } from "../../api/config"; import { Config } from "../../api/Config";
export const DefaultConfig: Config = { export const DefaultConfig: Config = {
branding_logo: " /static/dist/assets/icons/icon_left_brand.svg", branding_logo: " /static/dist/assets/icons/icon_left_brand.svg",

View File

@ -5,7 +5,7 @@ import NavStyle from "@patternfly/patternfly/components/Nav/nav.css";
import fa from "@fortawesome/fontawesome-free/css/all.css"; import fa from "@fortawesome/fontawesome-free/css/all.css";
// @ts-ignore // @ts-ignore
import AvatarStyle from "@patternfly/patternfly/components/Avatar/avatar.css"; import AvatarStyle from "@patternfly/patternfly/components/Avatar/avatar.css";
import { User } from "../../api/user"; import { User } from "../../api/Users";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
@customElement("ak-sidebar-user") @customElement("ak-sidebar-user")

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 { PBResponse } from "../../api/Client";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import "./TablePagination"; import "./TablePagination";

View File

@ -1,6 +1,6 @@
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import { PBPagination } from "../../api/client"; import { PBPagination } from "../../api/Client";
@customElement("ak-table-pagination") @customElement("ak-table-pagination")
export class TablePagination extends LitElement { export class TablePagination extends LitElement {

View File

@ -1,5 +1,5 @@
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { User } from "../api/user"; import { User } from "../api/Users";
import { SidebarItem } from "../elements/sidebar/Sidebar"; import { SidebarItem } from "../elements/sidebar/Sidebar";
import { SLUG_REGEX } from "../elements/router/Route"; import { SLUG_REGEX } from "../elements/router/Route";
import { Interface } from "./Interface"; import { Interface } from "./Interface";

View File

@ -1,8 +1,8 @@
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 { ifDefined } from "lit-html/directives/if-defined"; import { ifDefined } from "lit-html/directives/if-defined";
import { Application } from "../api/application"; import { Application } from "../api/Applications";
import { PBResponse } from "../api/client"; import { PBResponse } 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";

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { DefaultClient } from "../../api/client"; import { DefaultClient } from "../../api/Client";
import { User } from "../../api/user"; import { User } from "../../api/Users";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import "../../elements/AdminLoginsChart"; import "../../elements/AdminLoginsChart";

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { AuditEvent, TopNEvent } from "../../api/events"; import { AuditEvent, TopNEvent } from "../../api/Events";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import "../../elements/Spinner"; import "../../elements/Spinner";

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, TemplateResult } from "lit-element"; import { customElement, html, TemplateResult } from "lit-element";
import { Flow } from "../../../api/flow"; import { Flow } from "../../../api/Flows";
import { AdminStatus, AdminStatusCard } from "./AdminStatusCard"; import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { TemplateResult, html } from "lit-html"; import { TemplateResult, html } from "lit-html";
import { Policy } from "../../../api/policy"; import { Policy } from "../../../api/Policies";
import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
import "../../../elements/buttons/ModalButton"; import "../../../elements/buttons/ModalButton";

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { Policy } from "../../../api/policy"; import { Policy } from "../../../api/Policies";
import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
@customElement("ak-admin-status-card-policy-unbound") @customElement("ak-admin-status-card-policy-unbound")

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { Provider } from "../../../api/provider"; import { Provider } from "../../../api/Providers";
import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
@customElement("ak-admin-status-card-provider") @customElement("ak-admin-status-card-provider")

View File

@ -1,6 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { Version } from "../../../api/version"; import { Version } from "../../../api/Versions";
import { AdminStatusCard, AdminStatus } from "./AdminStatusCard"; import { AdminStatusCard, AdminStatus } from "./AdminStatusCard";
@customElement("ak-admin-status-version") @customElement("ak-admin-status-version")

View File

@ -1,6 +1,6 @@
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, PBResponse } 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")

View File

@ -1,7 +1,7 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, TemplateResult } from "lit-element"; import { customElement, html, TemplateResult } from "lit-element";
import { Application } from "../../api/application"; import { Application } from "../../api/Applications";
import { PBResponse } from "../../api/client"; import { PBResponse } from "../../api/Client";
import { TablePage } from "../../elements/table/TablePage"; import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";

View File

@ -1,7 +1,7 @@
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 { Application } from "../../api/application"; import { Application } from "../../api/Applications";
import { DefaultClient } from "../../api/client"; import { DefaultClient } from "../../api/Client";
import { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import "../../elements/Tabs"; import "../../elements/Tabs";

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 { PBResponse } from "../../api/Client";
import { Table } from "../../elements/table/Table"; import { Table } from "../../elements/table/Table";
import "../../elements/Tabs"; import "../../elements/Tabs";
@ -8,7 +8,7 @@ import "../../elements/AdminLoginsChart";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/policies/BoundPoliciesList"; import "../../elements/policies/BoundPoliciesList";
import { FlowStageBinding } from "../../api/flow"; import { FlowStageBinding } from "../../api/Flows";
@customElement("ak-bound-stages-list") @customElement("ak-bound-stages-list")
export class BoundStagesList extends Table<FlowStageBinding> { export class BoundStagesList extends Table<FlowStageBinding> {

View File

@ -1,7 +1,7 @@
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 { COMMON_STYLES } from "../../common/styles"; import { COMMON_STYLES } from "../../common/styles";
import { Flow } from "../../api/flow"; import { Flow } from "../../api/Flows";
import "../../elements/Tabs"; import "../../elements/Tabs";
import "../../elements/AdminLoginsChart"; import "../../elements/AdminLoginsChart";

View File

@ -7,7 +7,7 @@ import "../../elements/AdminLoginsChart";
import "../../elements/buttons/ModalButton"; import "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/SpinnerButton";
import "../../elements/policies/BoundPoliciesList"; import "../../elements/policies/BoundPoliciesList";
import { Source } from "../../api/source"; import { Source } from "../../api/Sources";
@customElement("ak-source-view") @customElement("ak-source-view")
export class SourceViewPage extends LitElement { export class SourceViewPage extends LitElement {