import { applicationListStyle } from "@goauthentik/admin/applications/ApplicationListPage"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import "@goauthentik/elements/AppIcon"; import { PaginatedResponse, Table, TableColumn } from "@goauthentik/elements/table/Table"; import "@patternfly/elements/pf-tooltip/pf-tooltip.js"; import { msg } from "@lit/localize"; import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { Application, CoreApi, User } from "@goauthentik/api"; @customElement("ak-user-application-table") export class UserApplicationTable extends Table { @property({ attribute: false }) user?: User; static get styles(): CSSResult[] { return super.styles.concat(applicationListStyle); } async apiEndpoint(): Promise> { return new CoreApi(DEFAULT_CONFIG).coreApplicationsList({ ...(await this.defaultEndpointConfig()), forUser: this.user?.pk, }); } columns(): TableColumn[] { return [ new TableColumn(""), new TableColumn(msg("Name"), "name"), new TableColumn(msg("Group"), "group"), new TableColumn(msg("Provider")), new TableColumn(msg("Provider Type")), new TableColumn(msg("Actions")), ]; } row(item: Application): TemplateResult[] { return [ html``, html`
${item.name}
${item.metaPublisher ? html`${item.metaPublisher}` : html``}
`, html`${item.group || msg("-")}`, item.provider ? html` ${item.providerObj?.name} ` : html`-`, html`${item.providerObj?.verboseName || msg("-")}`, html` ${msg("Update")} ${msg("Update Application")} ${item.launchUrl ? html` ` : html``}`, ]; } } declare global { interface HTMLElementTagNameMap { "ak-user-application-table": UserApplicationTable; } }