import { gettext } from "django"; import { 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/Dropdown"; import "../../elements/buttons/SpinnerButton"; import "../../elements/forms/DeleteForm"; import "../../elements/forms/ModalForm"; import "../../elements/forms/ProxyForm"; import "./PropertyMappingTestForm"; import "./PropertyMappingScopeForm"; import "./PropertyMappingLDAPForm"; import "./PropertyMappingSAMLForm"; import { TableColumn } from "../../elements/table/Table"; import { until } from "lit-html/directives/until"; import { PAGE_SIZE } from "../../constants"; import { PropertyMapping, PropertymappingsApi } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import { ifDefined } from "lit-html/directives/if-defined"; @customElement("ak-property-mapping-list") export class PropertyMappingListPage extends TablePage { searchEnabled(): boolean { return true; } pageTitle(): string { return gettext("Property Mappings"); } pageDescription(): string { return gettext("Control how authentik exposes and interprets information."); } pageIcon(): string { return "pf-icon pf-icon-blueprint"; } @property() order = "name"; @property({type: Boolean}) hideManaged = false; apiEndpoint(page: number): Promise> { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllList({ ordering: this.order, page: page, pageSize: PAGE_SIZE, search: this.search || "", managedIsnull: this.hideManaged ? "true" : undefined, }); } columns(): TableColumn[] { return [ new TableColumn("Name", "name"), new TableColumn("Type", "type"), new TableColumn(""), ]; } row(item: PropertyMapping): TemplateResult[] { return [ html`${item.name}`, html`${item.verboseName}`, html` ${gettext("Update")} ${gettext(`Update ${item.verboseName}`)} ${gettext("Test")} ${gettext("Test Property Mapping")} { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllDelete({ pmUuid: item.pk || "" }); }}> `, ]; } renderToolbar(): TemplateResult { return html` ${super.renderToolbar()}`; } renderToolbarAfter(): TemplateResult { return html`
{ this.hideManaged = !this.hideManaged; this.page = 1; this.fetch(); }} />
`; } }