import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import Nav from '../blocks/nav.js'; import JobList from '../blocks/job_list.js'; import User from '../blocks/user.js'; import { api, httpGET } from '../http.js'; import './history.css'; export default class History extends Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { var url; if (this.props.cmd !== undefined) { url = api("/commands/" + this.props.cmd + "/jobs") } else if (this.props.userID !== undefined) { url = api("/users/" + this.props.userID + "/jobs") } else { url = api("/jobs") } httpGET(url, (status, body) => { let jobs = JSON.parse(body); this.setState({jobs: jobs}); }, (error) => { console.log("Failed to load jobs:", error); }, ); } render() { let details; if (this.props.cmd !== undefined) { details = (
Command
{this.props.cmd}
); } else if (this.props.userID !== undefined) { details = ( ); } return (
); } }