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/>
|
|
|
|
*/
|
|
|
|
|
2021-06-16 22:17:12 +02:00
|
|
|
import { WalletDiagnostics } from "@gnu-taler/taler-util";
|
2021-08-23 21:51:49 +02:00
|
|
|
import { h } from "preact";
|
2021-06-16 22:17:12 +02:00
|
|
|
import { JSX } from "preact/jsx-runtime";
|
2021-08-23 21:51:49 +02:00
|
|
|
import { PageLink } from "../renderHtml";
|
2021-06-16 22:17:12 +02:00
|
|
|
|
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-06-16 22:17:12 +02:00
|
|
|
|
2021-11-15 15:18:58 +01:00
|
|
|
export function Diagnostics({
|
|
|
|
timedOut,
|
|
|
|
diagnostics,
|
|
|
|
}: Props): JSX.Element | null {
|
2021-06-16 22:17:12 +02:00
|
|
|
if (timedOut) {
|
|
|
|
return <p>Diagnostics timed out. Could not talk to the wallet backend.</p>;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (diagnostics) {
|
|
|
|
if (diagnostics.errors.length === 0) {
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
borderLeft: "0.5em solid red",
|
|
|
|
paddingLeft: "1em",
|
|
|
|
paddingTop: "0.2em",
|
|
|
|
paddingBottom: "0.2em",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<p>Problems detected:</p>
|
|
|
|
<ol>
|
|
|
|
{diagnostics.errors.map((errMsg) => (
|
|
|
|
<li key={errMsg}>{errMsg}</li>
|
|
|
|
))}
|
|
|
|
</ol>
|
|
|
|
{diagnostics.firefoxIdbProblem ? (
|
|
|
|
<p>
|
|
|
|
Please check in your <code>about:config</code> settings that you
|
|
|
|
have IndexedDB enabled (check the preference name{" "}
|
|
|
|
<code>dom.indexedDB.enabled</code>).
|
|
|
|
</p>
|
|
|
|
) : null}
|
|
|
|
{diagnostics.dbOutdated ? (
|
|
|
|
<p>
|
|
|
|
Your wallet database is outdated. Currently automatic migration is
|
|
|
|
not supported. Please go{" "}
|
2021-11-15 15:18:58 +01:00
|
|
|
<PageLink pageName="/reset-required">here</PageLink> to reset the
|
|
|
|
wallet database.
|
2021-06-16 22:17:12 +02:00
|
|
|
</p>
|
|
|
|
) : null}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return <p>Running diagnostics ...</p>;
|
|
|
|
}
|