import { gettext } from "django"; import { css, CSSResult, customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { TablePage } from "../../elements/table/TablePage"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { PAGE_SIZE } from "../../constants"; import { Application, CoreApi } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import { AdminURLManager } from "../../api/legacy"; @customElement("ak-application-list") export class ApplicationListPage extends TablePage { searchEnabled(): boolean { return true; } pageTitle(): string { return gettext("Applications"); } pageDescription(): string { return gettext("External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML."); } pageIcon(): string { return gettext("pf-icon pf-icon-applications"); } @property() order = "name"; apiEndpoint(page: number): Promise> { return new CoreApi(DEFAULT_CONFIG).coreApplicationsList({ ordering: this.order, page: page, pageSize: PAGE_SIZE, search: this.search || "", }); } static get styles(): CSSResult[] { return super.styles.concat(css` tr td:first-child { width: auto; min-width: 0px; text-align: center; vertical-align: middle; } `); } columns(): TableColumn[] { return [ new TableColumn(""), new TableColumn("Name", "name"), new TableColumn("Slug", "slug"), new TableColumn("Provider"), new TableColumn("Provider Type"), new TableColumn(""), ]; } row(item: Application): TemplateResult[] { return [ item.metaIcon ? html`${gettext(` : html``, html`
${item.name}
${item.metaPublisher ? html`${item.metaPublisher}` : html``}
`, html`${item.slug}`, html`${item.provider?.name}`, html`${item.provider?.verboseName}`, html` ${gettext("Edit")}
${gettext("Delete")}
`, ]; } renderToolbar(): TemplateResult { return html` ${gettext("Create")}
${super.renderToolbar()} `; } }