aboutsummaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-18 04:09:04 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-18 04:09:04 +0100
commit356ebd2137eb5ca31486ed49ab8223c8256b1554 (patch)
treef3aa2214b928119b3d6e5ba22b8fa348fa929c25 /src/pages
parent2986afb3d4e5f750f34e68cd46e394e2da392a4a (diff)
downloadwallet-core-356ebd2137eb5ca31486ed49ab8223c8256b1554.tar.xz
persistent logging
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/logs.html36
-rw-r--r--src/pages/logs.tsx76
2 files changed, 112 insertions, 0 deletions
diff --git a/src/pages/logs.html b/src/pages/logs.html
new file mode 100644
index 000000000..8d35bcbd7
--- /dev/null
+++ b/src/pages/logs.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>Taler Wallet: Logs</title>
+
+ <link rel="stylesheet" type="text/css" href="../style/lang.css">
+ <link rel="stylesheet" type="text/css" href="../style/wallet.css">
+
+ <link rel="icon" href="/img/icon.png">
+
+ <script src="/src/vendor/URI.js"></script>
+ <script src="/src/vendor/react.js"></script>
+ <script src="/src/vendor/react-dom.js"></script>
+
+ <!-- i18n -->
+ <script src="/src/vendor/jed.js"></script>
+ <script src="/src/i18n.js"></script>
+ <script src="/src/i18n/strings.js"></script>
+
+ <script src="/src/vendor/system-csp-production.src.js"></script>
+ <script src="/src/module-trampoline.js"></script>
+
+ <style>
+ .tree-item {
+ margin: 2em;
+ border-radius: 5px;
+ border: 1px solid gray;
+ padding: 1em;
+ }
+ </style>
+
+ <body>
+ <div id="container"></div>
+ </body>
+</html>
diff --git a/src/pages/logs.tsx b/src/pages/logs.tsx
new file mode 100644
index 000000000..f971f3f85
--- /dev/null
+++ b/src/pages/logs.tsx
@@ -0,0 +1,76 @@
+/*
+ This file is part of TALER
+ (C) 2016 Inria
+
+ 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.
+
+ 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
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Show wallet logs.
+ *
+ * @author Florian Dold
+ */
+
+import {LogEntry, getLogs} from "src/logging";
+
+interface LogViewProps {
+ log: LogEntry;
+}
+
+class LogView extends React.Component<LogViewProps, void> {
+ render(): JSX.Element {
+ let e = this.props.log;
+ return (
+ <div className="tree-item">
+ <ul>
+ <li>id: {e.id || "unknown"}</li>
+ <li>msg: {e.msg}</li>
+ <li>file: {e.source || "(unknown)"}</li>
+ </ul>
+ </div>
+ );
+ }
+}
+
+interface LogsState {
+ logs: LogEntry[]|undefined;
+}
+
+class Logs extends React.Component<any, LogsState> {
+ constructor() {
+ super();
+ this.update();
+ this.state = {} as any;
+ }
+
+ async update() {
+ let logs = await getLogs();
+ this.setState({logs});
+ }
+
+ render(): JSX.Element {
+ let logs = this.state.logs;
+ if (!logs) {
+ return <span>...</span>;
+ }
+ return (
+ <div className="tree-item">
+ Logs:
+ {logs.map(e => <LogView log={e} />)}
+ </div>
+ );
+ }
+}
+
+export function main() {
+ ReactDOM.render(<Logs />, document.getElementById("container")!);
+}