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

Kai Reinhard
12.15.2019 151cf8aef0675b6b30dc83f0d4994537fdf88f98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import {Link} from 'react-router-dom';
import {Card, CardBody, CardFooter, CardHeader} from 'reactstrap';
 
class RepoCard extends React.Component {
 
    buildItem = (label, content) => {
        return <li className="list-group-item">{label}{content.map((line, index) => {
            return <div className="card-list-entry" key={index}>{line[0]} <span
                className={`card-list-entry-value ${line[2]}`}>{line[1]}</span>
            </div>;
        })}</li>;
    }
 
    render = () => {
        const repo = this.props.repo;
        let content = [['Id', repo.id, 'id'], ['Location', repo.location, 'location']];
        let repoText = this.buildItem(null, content);
 
        return <React.Fragment>
            <Card tag={Link} to={`/repoArchives/${repo.id}/${repo.displayName}`} outline color="success" className={'repo'}
                  style={{backgroundColor: '#fff'}}>
                <CardHeader>{repo.displayName}</CardHeader>
                <CardBody>
                    <ul className="list-group list-group-flush">
                        {repoText}
                    </ul>
                </CardBody>
                <CardFooter><span className={'lastModified'}>Last refresh: {repo.lastCacheRefresh}, last modified: {repo.lastModified}</span></CardFooter>
            </Card>
        </React.Fragment>
    };
 
    constructor(props) {
        super(props);
 
        this.buildItem = this.buildItem.bind(this);
    }
}
 
export default RepoCard;