| | |
| | | .setProgressInfo(msg) |
| | | .setDescription(description) |
| | | .setStatus(AbstractJob.Status.QUEUED) |
| | | .setCommandLineAsString(description); |
| | | .setCommandLineAsString("borg info --json --log-json --progress ssh://...:23/./backups/my-computer::my-computer-2018-12-05T23:10:33"); |
| | | job.buildProgressText(); |
| | | if (message != null) { |
| | | job.setStatus(AbstractJob.Status.RUNNING); |
| | |
| | | import React from 'react'; |
| | | import {Progress} from 'reactstrap'; |
| | | import {Button, Card, CardBody, Collapse, Progress} from 'reactstrap'; |
| | | import {IconCancelJob} from '../../general/IconComponents' |
| | | |
| | | function Job({job}) { |
| | | class Job extends React.Component { |
| | | constructor(props) { |
| | | super(props); |
| | | this.toggle = this.toggle.bind(this); |
| | | this.state = {collapse: false}; |
| | | } |
| | | |
| | | toggle() { |
| | | this.setState({collapse: !this.state.collapse}); |
| | | } |
| | | |
| | | render() { |
| | | let content = undefined; |
| | | let job = this.props.job; |
| | | if (job.status === 'RUNNING') { |
| | | content = <Progress animated color={'success'} value="100">{job.progressText}</Progress>; |
| | | } else { |
| | |
| | | } |
| | | return ( |
| | | <div> |
| | | <div>{job.description}</div> |
| | | <Button color="link" onClick={this.toggle}>{job.description}</Button> |
| | | <div>{content}<IconCancelJob /></div> |
| | | <Collapse isOpen={this.state.collapse}> |
| | | <Card> |
| | | <CardBody> |
| | | <table><tr><th>Status</th><td>{job.status}</td></tr> |
| | | <tr><th>Command line</th><td>{job.commandLineAsString}</td></tr></table> |
| | | </CardBody> |
| | | </Card> |
| | | </Collapse> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Job; |
| | |
| | | <h2>To-do</h2> |
| | | Zum Testen den Button "Test-Mode" drücken. |
| | | <ol> |
| | | <li>Kein Geflackere: Nach einem fetch (alle 2 Sekunden) wird der das ganze DOM neu gerendert, obwohl sich eigentlich nix |
| | | geändert hat. Schön wäre, wenn sich nur die Komponenten neu rendern, die auch in den REST-Daten von fetch sich geändert haben.</li> |
| | | <li>Toggle-Status z. B. von My Computer merken (zum Reproduzieren: Klick auf "My Computer"..</li> |
| | | <li>Kein Geflackere: Nach einem fetch (alle 2 Sekunden) wird der das ganze DOM neu gerendert, |
| | | obwohl sich eigentlich nix |
| | | geändert hat. Schön wäre, wenn sich nur die Komponenten neu rendern, die auch in den |
| | | REST-Daten von fetch sich geändert haben. |
| | | </li> |
| | | <li>Toggle-Status z. B. von My Computer und von einem einzelnen Job merken (zum Reproduzieren: |
| | | Klick auf "My Computer" bzw. "Loading info of ...". |
| | | <br/>Es wäre |
| | | auch OK, wenn genau nur ein Job aufgeklappt wäre. Auf das Auf- und Zuklappen von "My |
| | | Computer" kann ich verzichten, wenn es einfacher werden würde. |
| | | </li> |
| | | <li>Cancel-Button soll rechts neben die Progressbar.</li> |
| | | </ol> |
| | | </code></React.Fragment> |
| | |
| | | import React from 'react'; |
| | | import { Collapse, Button, CardBody, Card } from 'reactstrap'; |
| | | import {Button, Card, CardBody, Collapse} from 'reactstrap'; |
| | | import Job from "./Job"; |
| | | |
| | | class JobQueue extends React.Component { |