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

Kai Reinhard
20.48.2018 539bcaa982ba2d7e7d0a53ab8dfc618868709bb1
Display diff state and download removed files from other archive.
3 files modified
25 ■■■■ changed files
borgbutler-webapp/src/components/views/archives/FileListEntry.jsx 19 ●●●● patch | view | raw | blame | history
borgbutler-webapp/src/components/views/archives/FileListPanel.jsx 2 ●●● patch | view | raw | blame | history
borgbutler-webapp/src/components/views/archives/FileListTable.jsx 4 ●●● patch | view | raw | blame | history
borgbutler-webapp/src/components/views/archives/FileListEntry.jsx
@@ -33,18 +33,29 @@
        });
}
function FileListEntry({archiveId, entry, search, mode, changeCurrentDirectory}) {
function FileListEntry({archiveId, diffArchiveId, entry, search, mode, changeCurrentDirectory}) {
    let displayPath = entry.displayPath;
    let downloadArchiveId = archiveId;
    if (entry.diffStatus === 'NEW') {
        displayPath = "New: " + displayPath;
    } else if  (entry.diffStatus === 'REMOVED') {
        displayPath = "Rem: " + displayPath;
        // Download removed files from other archive.
        downloadArchiveId = diffArchiveId;
    } else if (entry.diffStatus === 'MODIFIED') {
        displayPath = "Mod: " + displayPath;
    }
    let path;
    if (mode === 'tree' && entry.type === 'd') {
        path = <Button color={'link'} onClick={() => changeCurrentDirectory(entry.path)}><Highlight search={search}>{entry.displayPath}</Highlight></Button>;
        path = <Button color={'link'} onClick={() => changeCurrentDirectory(entry.path)}><Highlight search={search}>{displayPath}</Highlight></Button>;
    } else {
        path = <Highlight search={search}>{entry.displayPath}</Highlight>;
        path = <Highlight search={search}>{displayPath}</Highlight>;
    }
    return (
        <tr>
            <td className={'tt'}>{path}</td>
            <td className={'tt'}>
                <div className={'btn'} onClick={() => download(archiveId, entry.fileNumber)}>
                <div className={'btn'} onClick={() => download(downloadArchiveId, entry.fileNumber)}>
                    <IconDownload/></div>
            </td>
            <td className={'tt'}>{humanFileSize(entry.size, true, true)}</td>
borgbutler-webapp/src/components/views/archives/FileListPanel.jsx
@@ -98,7 +98,6 @@
                </React.Fragment>;
            } else {
                if (this.state.filter.mode === 'tree' && this.state.filter.currentDirectory.length > 0) {
                    console.log(this.state.filter.currentDirectory);
                    let dirs = this.state.filter.currentDirectory.split('/');
                    let breadcrumbs = [];
                    for (let i = 0; i < dirs.length - 1; i++) {
@@ -135,6 +134,7 @@
                    {breadcrumb}
                    <FileListTable
                        archiveId={this.props.archiveId}
                        diffArchiveId={this.state.filter.diffArchiveId}
                        entries={this.state.fileList}
                        search={this.state.filter.search}
                        mode={this.state.filter.mode}
borgbutler-webapp/src/components/views/archives/FileListTable.jsx
@@ -3,7 +3,7 @@
import {Table} from 'reactstrap';
import FileListEntry from './FileListEntry';
function FileListTable({archiveId, entries, search, mode, changeCurrentDirectory}) {
function FileListTable({archiveId, diffArchiveId, entries, search, mode, changeCurrentDirectory}) {
    const lowercaseSearch = search.split(' ')[0].toLowerCase();
    return (
        <Table striped bordered hover size={'sm'} responsive>
@@ -20,6 +20,7 @@
            {entries
                .map((entry, index) => <FileListEntry
                    archiveId={archiveId}
                    diffArchiveId={diffArchiveId}
                    entry={entry}
                    search={lowercaseSearch}
                    mode={mode}
@@ -33,6 +34,7 @@
FileListTable.propTypes = {
    archiveId: PropTypes.string,
    diffArchiveId: PropTypes.string,
    entries: PropTypes.array,
    search: PropTypes.string,
    mode: PropTypes.string,