web/admin: add backup status card

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-05 20:40:30 +02:00
parent dcc873b88b
commit b98b4f2ae7
4 changed files with 95 additions and 30 deletions

View File

@ -168,7 +168,7 @@ msgstr "Application's display Name."
msgid "Applications" msgid "Applications"
msgstr "Applications" msgstr "Applications"
#: src/pages/admin-overview/AdminOverviewPage.ts:40 #: src/pages/admin-overview/AdminOverviewPage.ts:41
msgid "Apps with most usage" msgid "Apps with most usage"
msgstr "Apps with most usage" msgstr "Apps with most usage"
@ -301,6 +301,18 @@ msgstr "Background"
msgid "Background shown during execution." msgid "Background shown during execution."
msgstr "Background shown during execution." msgstr "Background shown during execution."
#: src/pages/admin-overview/cards/BackupStatusCard.ts:35
msgid "Backup finished with errors."
msgstr "Backup finished with errors."
#: src/pages/admin-overview/cards/BackupStatusCard.ts:30
msgid "Backup finished with warnings."
msgstr "Backup finished with warnings."
#: src/pages/admin-overview/AdminOverviewPage.ts:58
msgid "Backup status"
msgstr "Backup status"
#: src/pages/sources/ldap/LDAPSourceForm.ts:130 #: src/pages/sources/ldap/LDAPSourceForm.ts:130
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:91 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:91
msgid "Base DN" msgid "Base DN"
@ -356,11 +368,11 @@ msgstr "Build hash: {0}"
msgid "CA which the endpoint's Certificate is verified against. Can be left empty for no validation." msgid "CA which the endpoint's Certificate is verified against. Can be left empty for no validation."
msgstr "CA which the endpoint's Certificate is verified against. Can be left empty for no validation." msgstr "CA which the endpoint's Certificate is verified against. Can be left empty for no validation."
#: src/pages/admin-overview/AdminOverviewPage.ts:55 #: src/pages/admin-overview/AdminOverviewPage.ts:56
msgid "Cached Flows" msgid "Cached Flows"
msgstr "Cached Flows" msgstr "Cached Flows"
#: src/pages/admin-overview/AdminOverviewPage.ts:53 #: src/pages/admin-overview/AdminOverviewPage.ts:54
msgid "Cached Policies" msgid "Cached Policies"
msgstr "Cached Policies" msgstr "Cached Policies"
@ -1565,6 +1577,7 @@ msgstr "Last run"
msgid "Last seen: {0}" msgid "Last seen: {0}"
msgstr "Last seen: {0}" msgstr "Last seen: {0}"
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:23
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:150 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:150
msgid "Last sync: {0}" msgid "Last sync: {0}"
msgstr "Last sync: {0}" msgstr "Last sync: {0}"
@ -1665,7 +1678,7 @@ msgstr "Login to continue to {0}."
msgid "Logins" msgid "Logins"
msgstr "Logins" msgstr "Logins"
#: src/pages/admin-overview/AdminOverviewPage.ts:37 #: src/pages/admin-overview/AdminOverviewPage.ts:38
#: src/pages/applications/ApplicationViewPage.ts:71 #: src/pages/applications/ApplicationViewPage.ts:71
msgid "Logins over the last 24 hours" msgid "Logins over the last 24 hours"
msgstr "Logins over the last 24 hours" msgstr "Logins over the last 24 hours"
@ -1926,7 +1939,7 @@ msgstr "Not found"
msgid "Not synced in the last hour, check System tasks." msgid "Not synced in the last hour, check System tasks."
msgstr "Not synced in the last hour, check System tasks." msgstr "Not synced in the last hour, check System tasks."
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:28 #: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:32
msgid "Not synced." msgid "Not synced."
msgstr "Not synced." msgstr "Not synced."
@ -2150,7 +2163,7 @@ msgid "Please enter your password"
msgstr "Please enter your password" msgstr "Please enter your password"
#: src/interfaces/AdminInterface.ts:26 #: src/interfaces/AdminInterface.ts:26
#: src/pages/admin-overview/AdminOverviewPage.ts:45 #: src/pages/admin-overview/AdminOverviewPage.ts:46
#: src/pages/flows/FlowListPage.ts:50 #: src/pages/flows/FlowListPage.ts:50
#: src/pages/policies/PolicyListPage.ts:38 #: src/pages/policies/PolicyListPage.ts:38
msgid "Policies" msgid "Policies"
@ -2300,7 +2313,7 @@ msgid "Provider type"
msgstr "Provider type" msgstr "Provider type"
#: src/interfaces/AdminInterface.ts:20 #: src/interfaces/AdminInterface.ts:20
#: src/pages/admin-overview/AdminOverviewPage.ts:43 #: src/pages/admin-overview/AdminOverviewPage.ts:44
#: src/pages/outposts/OutpostForm.ts:82 #: src/pages/outposts/OutpostForm.ts:82
#: src/pages/outposts/OutpostListPage.ts:50 #: src/pages/outposts/OutpostListPage.ts:50
msgid "Providers" msgid "Providers"
@ -3081,11 +3094,7 @@ msgstr "Sync users"
msgid "Sync users' passwords" msgid "Sync users' passwords"
msgstr "Sync users' passwords" msgstr "Sync users' passwords"
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:34 #: src/pages/admin-overview/AdminOverviewPage.ts:33
msgid "Synced {0}:{1}:{2}"
msgstr "Synced {0}:{1}:{2}"
#: src/pages/admin-overview/AdminOverviewPage.ts:32
msgid "System Overview" msgid "System Overview"
msgstr "System Overview" msgstr "System Overview"
@ -3525,7 +3534,7 @@ msgid "Username: Same as Text input, but checks for and prevents duplicate usern
msgstr "Username: Same as Text input, but checks for and prevents duplicate usernames." msgstr "Username: Same as Text input, but checks for and prevents duplicate usernames."
#: src/interfaces/AdminInterface.ts:32 #: src/interfaces/AdminInterface.ts:32
#: src/pages/admin-overview/AdminOverviewPage.ts:47 #: src/pages/admin-overview/AdminOverviewPage.ts:48
#: src/pages/users/UserListPage.ts:31 #: src/pages/users/UserListPage.ts:31
msgid "Users" msgid "Users"
msgstr "Users" msgstr "Users"
@ -3558,7 +3567,7 @@ msgstr "Validity days"
msgid "Verification Certificate" msgid "Verification Certificate"
msgstr "Verification Certificate" msgstr "Verification Certificate"
#: src/pages/admin-overview/AdminOverviewPage.ts:49 #: src/pages/admin-overview/AdminOverviewPage.ts:50
msgid "Version" msgid "Version"
msgstr "Version" msgstr "Version"
@ -3658,7 +3667,7 @@ msgstr "Whoops!"
msgid "Windows" msgid "Windows"
msgstr "Windows" msgstr "Windows"
#: src/pages/admin-overview/AdminOverviewPage.ts:51 #: src/pages/admin-overview/AdminOverviewPage.ts:52
msgid "Workers" msgid "Workers"
msgstr "Workers" msgstr "Workers"

View File

@ -168,7 +168,7 @@ msgstr ""
msgid "Applications" msgid "Applications"
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:40 #: src/pages/admin-overview/AdminOverviewPage.ts:41
msgid "Apps with most usage" msgid "Apps with most usage"
msgstr "" msgstr ""
@ -297,6 +297,18 @@ msgstr ""
msgid "Background shown during execution." msgid "Background shown during execution."
msgstr "" msgstr ""
#: src/pages/admin-overview/cards/BackupStatusCard.ts:35
msgid "Backup finished with errors."
msgstr ""
#: src/pages/admin-overview/cards/BackupStatusCard.ts:30
msgid "Backup finished with warnings."
msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:58
msgid "Backup status"
msgstr ""
#: src/pages/sources/ldap/LDAPSourceForm.ts:130 #: src/pages/sources/ldap/LDAPSourceForm.ts:130
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:91 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:91
msgid "Base DN" msgid "Base DN"
@ -352,11 +364,11 @@ msgstr ""
msgid "CA which the endpoint's Certificate is verified against. Can be left empty for no validation." msgid "CA which the endpoint's Certificate is verified against. Can be left empty for no validation."
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:55 #: src/pages/admin-overview/AdminOverviewPage.ts:56
msgid "Cached Flows" msgid "Cached Flows"
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:53 #: src/pages/admin-overview/AdminOverviewPage.ts:54
msgid "Cached Policies" msgid "Cached Policies"
msgstr "" msgstr ""
@ -1561,6 +1573,7 @@ msgstr ""
msgid "Last seen: {0}" msgid "Last seen: {0}"
msgstr "" msgstr ""
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:23
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:150 #: src/pages/sources/ldap/LDAPSourceViewPage.ts:150
msgid "Last sync: {0}" msgid "Last sync: {0}"
msgstr "" msgstr ""
@ -1661,7 +1674,7 @@ msgstr ""
msgid "Logins" msgid "Logins"
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:37 #: src/pages/admin-overview/AdminOverviewPage.ts:38
#: src/pages/applications/ApplicationViewPage.ts:71 #: src/pages/applications/ApplicationViewPage.ts:71
msgid "Logins over the last 24 hours" msgid "Logins over the last 24 hours"
msgstr "" msgstr ""
@ -1922,7 +1935,7 @@ msgstr ""
msgid "Not synced in the last hour, check System tasks." msgid "Not synced in the last hour, check System tasks."
msgstr "" msgstr ""
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:28 #: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:32
msgid "Not synced." msgid "Not synced."
msgstr "" msgstr ""
@ -2146,7 +2159,7 @@ msgid "Please enter your password"
msgstr "" msgstr ""
#: src/interfaces/AdminInterface.ts:26 #: src/interfaces/AdminInterface.ts:26
#: src/pages/admin-overview/AdminOverviewPage.ts:45 #: src/pages/admin-overview/AdminOverviewPage.ts:46
#: src/pages/flows/FlowListPage.ts:50 #: src/pages/flows/FlowListPage.ts:50
#: src/pages/policies/PolicyListPage.ts:38 #: src/pages/policies/PolicyListPage.ts:38
msgid "Policies" msgid "Policies"
@ -2296,7 +2309,7 @@ msgid "Provider type"
msgstr "" msgstr ""
#: src/interfaces/AdminInterface.ts:20 #: src/interfaces/AdminInterface.ts:20
#: src/pages/admin-overview/AdminOverviewPage.ts:43 #: src/pages/admin-overview/AdminOverviewPage.ts:44
#: src/pages/outposts/OutpostForm.ts:82 #: src/pages/outposts/OutpostForm.ts:82
#: src/pages/outposts/OutpostListPage.ts:50 #: src/pages/outposts/OutpostListPage.ts:50
msgid "Providers" msgid "Providers"
@ -3077,11 +3090,7 @@ msgstr ""
msgid "Sync users' passwords" msgid "Sync users' passwords"
msgstr "" msgstr ""
#: src/pages/admin-overview/cards/LDAPSyncStatusCard.ts:34 #: src/pages/admin-overview/AdminOverviewPage.ts:33
msgid "Synced {0}:{1}:{2}"
msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:32
msgid "System Overview" msgid "System Overview"
msgstr "" msgstr ""
@ -3519,7 +3528,7 @@ msgid "Username: Same as Text input, but checks for and prevents duplicate usern
msgstr "" msgstr ""
#: src/interfaces/AdminInterface.ts:32 #: src/interfaces/AdminInterface.ts:32
#: src/pages/admin-overview/AdminOverviewPage.ts:47 #: src/pages/admin-overview/AdminOverviewPage.ts:48
#: src/pages/users/UserListPage.ts:31 #: src/pages/users/UserListPage.ts:31
msgid "Users" msgid "Users"
msgstr "" msgstr ""
@ -3552,7 +3561,7 @@ msgstr ""
msgid "Verification Certificate" msgid "Verification Certificate"
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:49 #: src/pages/admin-overview/AdminOverviewPage.ts:50
msgid "Version" msgid "Version"
msgstr "" msgstr ""
@ -3652,7 +3661,7 @@ msgstr ""
msgid "Windows" msgid "Windows"
msgstr "" msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts:51 #: src/pages/admin-overview/AdminOverviewPage.ts:52
msgid "Workers" msgid "Workers"
msgstr "" msgstr ""

View File

@ -6,6 +6,7 @@ import "../../elements/cards/AggregatePromiseCard";
import "./TopApplicationsTable"; import "./TopApplicationsTable";
import "./cards/AdminStatusCard"; import "./cards/AdminStatusCard";
import "./cards/BackupStatusCard";
import "./cards/FlowCacheStatusCard"; import "./cards/FlowCacheStatusCard";
import "./cards/LDAPSyncStatusCardContainer"; import "./cards/LDAPSyncStatusCardContainer";
import "./cards/PolicyCacheStatusCard"; import "./cards/PolicyCacheStatusCard";
@ -55,6 +56,8 @@ export class AdminOverviewPage extends LitElement {
</ak-admin-status-card-policy-cache> </ak-admin-status-card-policy-cache>
<ak-admin-status-card-flow-cache class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header=${t`Cached Flows`}> <ak-admin-status-card-flow-cache class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header=${t`Cached Flows`}>
</ak-admin-status-card-flow-cache> </ak-admin-status-card-flow-cache>
<ak-admin-status-card-backup class="pf-l-gallery__item pf-m-4-col" icon="fa fa-database" header=${t`Backup status`} headerLink="#/administration/system-tasks">
</ak-admin-status-card-backup>
<ak-admin-status-card-ldap-sync-container > <ak-admin-status-card-ldap-sync-container >
</ak-admin-status-card-ldap-sync-container> </ak-admin-status-card-ldap-sync-container>
</div> </div>

View File

@ -0,0 +1,44 @@
import { t } from "@lingui/macro";
import { customElement, html, TemplateResult } from "lit-element";
import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
import { AdminApi, TaskStatusEnum } from "authentik-api";
import { DEFAULT_CONFIG } from "../../../api/Config";
import { convertToTitle } from "../../../utils";
@customElement("ak-admin-status-card-backup")
export class BackupStatusCard extends AdminStatusCard<TaskStatusEnum> {
getPrimaryValue(): Promise<TaskStatusEnum> {
return new AdminApi(DEFAULT_CONFIG).adminSystemTasksRead({
id: "backup_database"
}).then((value) => {
return value.status;
}).catch(() => {
return TaskStatusEnum.Error;
});
}
renderValue(): TemplateResult {
return html`${convertToTitle(this.value?.toString() || "")}`;
}
getStatus(value: TaskStatusEnum): Promise<AdminStatus> {
switch (value) {
case TaskStatusEnum.Warning:
return Promise.resolve<AdminStatus>({
icon: "fa fa-exclamation-triangle pf-m-warning",
message: t`Backup finished with warnings.`,
});
case TaskStatusEnum.Error:
return Promise.resolve<AdminStatus>({
icon: "fa fas fa-times-circle pf-m-danger",
message: t`Backup finished with errors.`,
});
default:
return Promise.resolve<AdminStatus>({
icon: "fa fa-check-circle pf-m-success"
});
}
}
}