import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { TableColumn } from "../../elements/table/Table"; import { TablePage } from "../../elements/table/TablePage"; import "../../elements/buttons/SpinnerButton"; import "../../elements/buttons/Dropdown"; import "../../elements/forms/DeleteForm"; import "../../elements/forms/ModalForm"; import "../../elements/forms/ProxyForm"; import { until } from "lit-html/directives/until"; import { PAGE_SIZE } from "../../constants"; import { Source, SourcesApi } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import { ifDefined } from "lit-html/directives/if-defined"; import "./ldap/LDAPSourceForm"; import "./saml/SAMLSourceForm"; import "./oauth/OAuthSourceForm"; @customElement("ak-source-list") export class SourceListPage extends TablePage { pageTitle(): string { return t`Sources`; } pageDescription(): string | undefined { return t`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 new SourcesApi(DEFAULT_CONFIG).sourcesAllList({ ordering: this.order, page: page, pageSize: PAGE_SIZE, search: this.search || "", }); } columns(): TableColumn[] { return [ new TableColumn(t`Name`, "name"), new TableColumn(t`Type`), new TableColumn(""), ]; } row(item: Source): TemplateResult[] { return [ html`
${item.name}
${item.enabled ? html`` : html`${t`Disabled`}`}
`, html`${item.verboseName}`, html` ${t`Update`} ${t`Update ${item.verboseName}`} { return new SourcesApi(DEFAULT_CONFIG).sourcesAllDelete({ slug: item.slug || "" }); }}> `, ]; } renderToolbar(): TemplateResult { return html` ${super.renderToolbar()}`; } }