mirror of https://github.com/micromata/borgbackup-butler.git

Kai Reinhard
05.03.2019 add986cff9c8e1a00428122a0d5515e6bd00120f
borgbutler-webapp/src/components/views/jobs/JobQueue.jsx
@@ -1,16 +1,36 @@
import React from 'react';
import { Collapse, Button, CardBody, Card } from 'reactstrap';
import Job from "./Job";
function JobQueue({queue}) {
    return (
        <div>
            <h2>{queue.repo}</h2>
            {queue.jobs
                .map((job, index) => <Job
                    job={job}
                    key={job.commandLineAsString}
                />)}
        </div>
    )
class JobQueue extends React.Component {
    constructor(props) {
        super(props);
        this.toggle = this.toggle.bind(this);
        this.state = {collapse: true};
    }
    toggle() {
        this.setState({collapse: !this.state.collapse});
    }
    render() {
        return (
            <div>
                <Button color="primary" onClick={this.toggle} style={{ marginBottom: '1rem' }}>{this.props.queue.repo}</Button>
                <Collapse isOpen={this.state.collapse}>
                    <Card>
                        <CardBody>
                            {this.props.queue.jobs
                                .map((job, index) => <Job
                                    job={job}
                                    key={job.commandLineAsString}
                                />)}
                        </CardBody>
                    </Card>
                </Collapse>
            </div>
        );
    }
}
export default JobQueue;