This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/pages/outposts/OutpostHealth.ts

48 lines
1.6 KiB
TypeScript
Raw Normal View History

import { t } from "@lingui/macro";
import { CSSResult, LitElement, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators";
import AKGlobal from "../../authentik.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { OutpostHealth } from "@goauthentik/api";
import { PFColor } from "../../elements/Label";
import "../../elements/Spinner";
2021-02-08 18:04:19 +00:00
@customElement("ak-outpost-health")
export class OutpostHealthElement extends LitElement {
@property({ attribute: false })
outpostHealth?: OutpostHealth;
2021-02-08 18:04:19 +00:00
static get styles(): CSSResult[] {
return [PFBase, AKGlobal];
2021-02-08 18:04:19 +00:00
}
render(): TemplateResult {
if (!this.outpostHealth) {
2021-02-08 18:04:19 +00:00
return html`<ak-spinner></ak-spinner>`;
}
return html` <ul>
<li role="cell">
<ak-label
color=${PFColor.Green}
text=${t`Last seen: ${this.outpostHealth.lastSeen?.toLocaleTimeString()}`}
></ak-label>
</li>
<li role="cell">
${this.outpostHealth.versionOutdated
? html`<ak-label
color=${PFColor.Red}
text=${t`${this.outpostHealth.version}, should be ${this.outpostHealth.versionShould}`}
></ak-label>`
: html`<ak-label
color=${PFColor.Green}
text=${t`Version: ${this.outpostHealth.version || ""}`}
></ak-label>`}
</li>
</ul>`;
2021-02-08 18:04:19 +00:00
}
}