import { gettext } from "django"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { Event, TopNEvent } from "../../api/Events"; import { COMMON_STYLES } from "../../common/styles"; import "../../elements/Spinner"; @customElement("ak-top-applications-table") export class TopApplicationsTable extends LitElement { @property({attribute: false}) topN?: TopNEvent[]; static get styles(): CSSResult[] { return COMMON_STYLES; } firstUpdated(): void { Event.topForUser("authorize_application").then(events => this.topN = events); } renderRow(event: TopNEvent): TemplateResult { return html` ${event.application.name} ${event.counted_events} `; } render(): TemplateResult { return html` ${this.topN ? this.topN.map((e) => this.renderRow(e)) : html``}
${gettext("Application")} ${gettext("Logins")}
`; } }