From 356ebd2137eb5ca31486ed49ab8223c8256b1554 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 18 Nov 2016 04:09:04 +0100 Subject: persistent logging --- src/pages/logs.html | 36 +++++++++++++++++++++++++ src/pages/logs.tsx | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/pages/logs.html create mode 100644 src/pages/logs.tsx (limited to 'src/pages') 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 @@ + + + + + Taler Wallet: Logs + + + + + + + + + + + + + + + + + + + + + +
+ + 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 + */ + +/** + * Show wallet logs. + * + * @author Florian Dold + */ + +import {LogEntry, getLogs} from "src/logging"; + +interface LogViewProps { + log: LogEntry; +} + +class LogView extends React.Component { + render(): JSX.Element { + let e = this.props.log; + return ( +
+
    +
  • id: {e.id || "unknown"}
  • +
  • msg: {e.msg}
  • +
  • file: {e.source || "(unknown)"}
  • +
+
+ ); + } +} + +interface LogsState { + logs: LogEntry[]|undefined; +} + +class Logs extends React.Component { + 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 ...; + } + return ( +
+ Logs: + {logs.map(e => )} +
+ ); + } +} + +export function main() { + ReactDOM.render(, document.getElementById("container")!); +} -- cgit v1.2.3