web/admin: don't show backup error when server can't backup
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
1f35f73c66
commit
bedf7fbcaa
|
@ -365,8 +365,8 @@ msgid "Backup finished with errors."
|
|||
msgstr "Backup finished with errors."
|
||||
|
||||
#: src/pages/admin-overview/cards/BackupStatusCard.ts
|
||||
msgid "Backup finished with warnings."
|
||||
msgstr "Backup finished with warnings."
|
||||
msgid "Backup finished with warnings/backup not supported."
|
||||
msgstr "Backup finished with warnings/backup not supported."
|
||||
|
||||
#: src/pages/admin-overview/AdminOverviewPage.ts
|
||||
msgid "Backup status"
|
||||
|
|
|
@ -361,7 +361,7 @@ msgid "Backup finished with errors."
|
|||
msgstr ""
|
||||
|
||||
#:
|
||||
msgid "Backup finished with warnings."
|
||||
msgid "Backup finished with warnings/backup not supported."
|
||||
msgstr ""
|
||||
|
||||
#:
|
||||
|
|
|
@ -2,8 +2,9 @@ import { t } from "@lingui/macro";
|
|||
import { customElement, html, TemplateResult } from "lit-element";
|
||||
import { AdminStatus, AdminStatusCard } from "./AdminStatusCard";
|
||||
import { AdminApi, StatusEnum } from "authentik-api";
|
||||
import { DEFAULT_CONFIG } from "../../../api/Config";
|
||||
import { config, DEFAULT_CONFIG } from "../../../api/Config";
|
||||
import { convertToTitle } from "../../../utils";
|
||||
import { CapabilitiesEnum } from "authentik-api/src";
|
||||
|
||||
@customElement("ak-admin-status-card-backup")
|
||||
export class BackupStatusCard extends AdminStatusCard<StatusEnum> {
|
||||
|
@ -14,7 +15,14 @@ export class BackupStatusCard extends AdminStatusCard<StatusEnum> {
|
|||
}).then((value) => {
|
||||
return value.status;
|
||||
}).catch(() => {
|
||||
// On error (probably 404), check the config and see if the server
|
||||
// can even backup
|
||||
return config().then(c => {
|
||||
if (c.capabilities.includes(CapabilitiesEnum.Backup)) {
|
||||
return StatusEnum.Error;
|
||||
}
|
||||
return StatusEnum.Warning;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -27,7 +35,7 @@ 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.`,
|
||||
message: t`Backup finished with warnings/backup not supported.`,
|
||||
});
|
||||
case StatusEnum.Error:
|
||||
return Promise.resolve<AdminStatus>({
|
||||
|
|
Reference in New Issue