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

Kai Reinhard
20.14.2018 9fae05615784eb899c70c91346249680644d0fdf
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import PropTypes from 'prop-types';
import {Table} from 'reactstrap';
import FileListEntry from './FileListEntry';
 
function FileListTable({archiveId, diffArchiveId, entries, search, mode, changeCurrentDirectory}) {
    const lowercaseSearch = search.split(' ')[0].toLowerCase();
    let diffCol = undefined;
    if (diffArchiveId) {
        diffCol = <th>Modification</th>;
    }
    return (
        <Table striped bordered hover size={'sm'} responsive>
            <thead>
            <tr>
                <th>Path</th>
                <th></th>
                <th>Size</th>
                <th>Mode</th>
                <th>Modified time</th>
                {diffCol}
            </tr>
            </thead>
            <tbody>
            {entries
                .map((entry, index) => <FileListEntry
                    archiveId={archiveId}
                    diffArchiveId={diffArchiveId}
                    entry={entry}
                    search={lowercaseSearch}
                    mode={mode}
                    changeCurrentDirectory={changeCurrentDirectory}
                    key={index}
                />)}
            </tbody>
        </Table>
    );
}
 
FileListTable.propTypes = {
    archiveId: PropTypes.string,
    diffArchiveId: PropTypes.string,
    entries: PropTypes.array,
    search: PropTypes.string,
    mode: PropTypes.string,
    changeCurrentDirectory: PropTypes.func.isRequired
};
 
FileListTable.defaultProps = {
    entries: [],
    search: '',
    mode: 'flat'
};
 
export default FileListTable;