wallet-core/packages/taler-wallet-webextension/src/components/Diagnostics.tsx

89 lines
2.5 KiB
TypeScript
Raw Normal View History

2021-09-13 18:33:13 +02:00
/*
This file is part of GNU Taler
(C) 2021 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
2022-02-23 19:18:37 +01:00
import { Translate, WalletDiagnostics } from "@gnu-taler/taler-util";
2021-11-16 17:59:53 +01:00
import { Fragment, h, VNode } from "preact";
2021-08-23 21:51:49 +02:00
import { PageLink } from "../renderHtml";
2021-08-13 23:04:05 +02:00
interface Props {
timedOut: boolean;
2021-11-15 15:18:58 +01:00
diagnostics: WalletDiagnostics | undefined;
2021-08-13 23:04:05 +02:00
}
2021-11-16 17:59:53 +01:00
export function Diagnostics({ timedOut, diagnostics }: Props): VNode {
if (timedOut) {
2022-02-23 19:18:37 +01:00
return (
<p>
<Translate>
Diagnostics timed out. Could not talk to the wallet backend.
</Translate>
</p>
);
}
if (diagnostics) {
if (diagnostics.errors.length === 0) {
2021-11-16 17:59:53 +01:00
return <Fragment />;
}
2021-11-16 17:59:53 +01:00
return (
<div
style={{
borderLeft: "0.5em solid red",
paddingLeft: "1em",
paddingTop: "0.2em",
paddingBottom: "0.2em",
}}
>
2022-02-23 19:18:37 +01:00
<p>
<Translate>Problems detected:</Translate>
</p>
2021-11-16 17:59:53 +01:00
<ol>
{diagnostics.errors.map((errMsg) => (
<li key={errMsg}>{errMsg}</li>
))}
</ol>
{diagnostics.firefoxIdbProblem ? (
<p>
2022-02-23 19:18:37 +01:00
<Translate>
Please check in your <code>about:config</code> settings that you
have IndexedDB enabled (check the preference name{" "}
<code>dom.indexedDB.enabled</code>).
</Translate>
2021-11-16 17:59:53 +01:00
</p>
) : null}
{diagnostics.dbOutdated ? (
<p>
2022-02-23 19:18:37 +01:00
<Translate>
Your wallet database is outdated. Currently automatic migration is
not supported. Please go{" "}
<PageLink pageName="/reset-required">
<Translate>here</Translate>
</PageLink>{" "}
to reset the wallet database.
</Translate>
2021-11-16 17:59:53 +01:00
</p>
) : null}
</div>
);
}
2022-02-23 19:18:37 +01:00
return (
<p>
<Translate>Running diagnostics</Translate> ...
</p>
);
}