/*
 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 * as React from "react";
import * as ReactDOM from "react-dom";
import {LogEntry, getLogs} from "../logging";
interface LogViewProps {
  log: LogEntry;
}
class LogView extends React.Component {
  render(): JSX.Element {
    let e = this.props.log;
    return (
      
        
          - level: {e.level}
- msg: {e.msg}
- id: {e.id || "unknown"}
- file: {e.source || "(unknown)"}
- line: {e.line || "(unknown)"}
- col: {e.col || "(unknown)"}{(e.detail ?
-  detail: {e.detail}
: [])}
 
    );
  }
}
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 => )}
      
    );
  }
}
document.addEventListener("DOMContentLoaded", () => {
  ReactDOM.render(, document.getElementById("container")!);
});