web/admin: link build hash when set

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-08 16:57:27 +02:00
parent 2a53bc4330
commit a9ef1a3190
6 changed files with 21 additions and 13 deletions

View File

@ -131,7 +131,7 @@ export class AdminOverviewPage extends LitElement {
</div>
<!-- row 2 -->
<div
class="pf-l-grid__item pf-m-6-col pf-m-4-col-on-md pf-m-4-col-on-xl card-container"
class="pf-l-grid__item pf-m-6-col pf-m-4-col-on-md pf-m-3-col-on-xl card-container"
>
<ak-admin-status-version
icon="pf-icon pf-icon-bundle"
@ -141,7 +141,7 @@ export class AdminOverviewPage extends LitElement {
</ak-admin-status-version>
</div>
<div
class="pf-l-grid__item pf-m-6-col pf-m-2-col-on-md pf-m-2-col-on-xl card-container"
class="pf-l-grid__item pf-m-6-col pf-m-2-col-on-md pf-m-3-col-on-xl card-container"
>
<ak-admin-status-card-backup
icon="fa fa-database"

View File

@ -6,7 +6,7 @@ import { PFSize } from "../../../elements/Spinner";
export interface AdminStatus {
icon: string;
message?: string;
message?: TemplateResult;
}
export abstract class AdminStatusCard<T> extends AggregateCard {

View File

@ -36,12 +36,12 @@ export class BackupStatusCard extends AdminStatusCard<StatusEnum> {
case StatusEnum.Warning:
return Promise.resolve<AdminStatus>({
icon: "fa fa-exclamation-triangle pf-m-warning",
message: t`Backup finished with warnings/backup not supported.`,
message: html`${t`Backup finished with warnings/backup not supported.`}`,
});
case StatusEnum.Error:
return Promise.resolve<AdminStatus>({
icon: "fa fa-times-circle pf-m-danger",
message: t`Backup finished with errors.`,
message: html`${t`Backup finished with errors.`}`,
});
default:
return Promise.resolve<AdminStatus>({

View File

@ -20,7 +20,7 @@ export class SystemStatusCard extends AdminStatusCard<System> {
this.header = t`Warning`;
return Promise.resolve<AdminStatus>({
icon: "fa fa-exclamation-triangle pf-m-warning",
message: t`HTTPS is not detected correctly`,
message: html`${t`HTTPS is not detected correctly`}`,
});
}
const timeDiff = value.serverTime.getTime() - (this.now || new Date()).getTime();
@ -29,12 +29,12 @@ export class SystemStatusCard extends AdminStatusCard<System> {
this.header = t`Warning`;
return Promise.resolve<AdminStatus>({
icon: "fa fa-exclamation-triangle pf-m-warning",
message: t`Server and client are further than 5 seconds apart.`,
message: html`${t`Server and client are further than 5 seconds apart.`}`,
});
}
return Promise.resolve<AdminStatus>({
icon: "fa fa-check-circle pf-m-success",
message: t`Everything is ok.`,
message: html`${t`Everything is ok.`}`,
});
}

View File

@ -14,18 +14,26 @@ export class VersionStatusCard extends AdminStatusCard<Version> {
if (value.buildHash) {
return Promise.resolve<AdminStatus>({
icon: "fa fa-check-circle pf-m-success",
message: t`Build hash: ${value.buildHash?.substring(0, 10)}`,
message: html`
${t`Build hash: `}
<a
href="https://github.com/goauthentik/authentik/commit/${value.buildHash}"
target="_blank"
>
${value.buildHash?.substring(0, 7)}
</a>
`,
});
}
if (value.outdated) {
return Promise.resolve<AdminStatus>({
icon: "fa fa-exclamation-triangle pf-m-warning",
message: t`${value.versionLatest} is available!`,
message: html`${t`${value.versionLatest} is available!`}`,
});
}
return Promise.resolve<AdminStatus>({
icon: "fa fa-check-circle pf-m-success",
message: t`Up-to-date!`,
message: html`${t`Up-to-date!`}`,
});
}

View File

@ -1,5 +1,5 @@
import { t } from "@lingui/macro";
import { customElement } from "lit-element";
import { customElement, html } from "lit-element";
import { AdminApi } from "authentik-api";
import { DEFAULT_CONFIG } from "../../../api/Config";
import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
@ -16,7 +16,7 @@ export class WorkersStatusCard extends AdminStatusCard<number> {
if (value < 1) {
return Promise.resolve<AdminStatus>({
icon: "fa fa-times-circle pf-m-danger",
message: t`No workers connected. Background tasks will not run.`,
message: html`${t`No workers connected. Background tasks will not run.`}`,
});
} else {
return Promise.resolve<AdminStatus>({