diff --git a/web/src/api/Client.ts b/web/src/api/Client.ts index 4632fa17d..ffac8d47a 100644 --- a/web/src/api/Client.ts +++ b/web/src/api/Client.ts @@ -9,6 +9,8 @@ export interface QueryArguments { export interface BaseInheritanceModel { + object_type: string; + verbose_name: string; verbose_name_plural: string; diff --git a/web/src/api/Policies.ts b/web/src/api/Policies.ts index 3273ddb77..88e2bb073 100644 --- a/web/src/api/Policies.ts +++ b/web/src/api/Policies.ts @@ -7,6 +7,7 @@ export class Policy implements BaseInheritanceModel { constructor() { throw Error(); } + object_type: string; verbose_name: string; verbose_name_plural: string; diff --git a/web/src/api/Sources.ts b/web/src/api/Sources.ts index c2d184dcc..6d48d7081 100644 --- a/web/src/api/Sources.ts +++ b/web/src/api/Sources.ts @@ -11,6 +11,7 @@ export class Source implements BaseInheritanceModel { constructor() { throw Error(); } + object_type: string; verbose_name: string; verbose_name_plural: string; diff --git a/web/src/pages/sources/SourcesListPage.ts b/web/src/pages/sources/SourcesListPage.ts new file mode 100644 index 000000000..45e719ac1 --- /dev/null +++ b/web/src/pages/sources/SourcesListPage.ts @@ -0,0 +1,66 @@ +import { gettext } from "django"; +import { customElement, html, LitElement, property, TemplateResult } from "lit-element"; +import { DefaultClient, PBResponse } from "../../api/Client"; +import { Source } from "../../api/Sources"; +import { TableColumn } from "../../elements/table/Table"; +import { TablePage } from "../../elements/table/TablePage"; + +@customElement("ak-source-list") +export class SourceListPage extends TablePage { + pageTitle(): string { + return "Sources"; + } + pageDescription(): string | undefined { + return "External Sources which can be used to get Identities into authentik, for example Social Providers like Twiter and GitHub or Enterprise Providers like ADFS and LDAP."; + } + pageIcon(): string { + return "pf-icon pf-icon-middleware"; + } + searchEnabled(): boolean { + return true; + } + + @property() + order = "name"; + + apiEndpoint(page: number): Promise> { + return Source.list({ + ordering: this.order, + page: page, + search: this.search || "", + }); + } + + columns(): TableColumn[] { + return [ + new TableColumn("Name", "name"), + new TableColumn("Type", "verbose_name"), + new TableColumn(""), + ]; + } + + row(item: Source): TemplateResult[] { + return [ + html` +
${item.name}
+ ${item.enabled ? html`` : html`${gettext("Disabled")}`} +
`, + html`${item.verbose_name}`, + html` + + + Edit + +
+
  + + + Delete + +
+
+ `, + ]; + } + +} diff --git a/web/src/routes.ts b/web/src/routes.ts index 3237b3046..e5a90026d 100644 --- a/web/src/routes.ts +++ b/web/src/routes.ts @@ -5,6 +5,7 @@ import "./pages/LibraryPage"; import "./pages/admin-overview/AdminOverviewPage"; import "./pages/applications/ApplicationListPage"; import "./pages/applications/ApplicationViewPage"; +import "./pages/sources/SourcesListPage"; import "./pages/sources/SourceViewPage"; import "./pages/flows/FlowViewPage"; import "./pages/events/EventListPage"; @@ -30,6 +31,7 @@ export const ROUTES: Route[] = [ new Route(new RegExp(`^/applications/(?${SLUG_REGEX})$`)).then((args) => { return html``; }), + new Route(new RegExp("^/sources$"), html``), new Route(new RegExp(`^/sources/(?${SLUG_REGEX})$`)).then((args) => { return html``; }),