Display diff state and download removed files from other archive.
| | |
| | | }); |
| | | } |
| | | |
| | | 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> |
| | |
| | | </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++) { |
| | |
| | | {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} |
| | |
| | | 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> |
| | |
| | | {entries |
| | | .map((entry, index) => <FileListEntry |
| | | archiveId={archiveId} |
| | | diffArchiveId={diffArchiveId} |
| | | entry={entry} |
| | | search={lowercaseSearch} |
| | | mode={mode} |
| | |
| | | |
| | | FileListTable.propTypes = { |
| | | archiveId: PropTypes.string, |
| | | diffArchiveId: PropTypes.string, |
| | | entries: PropTypes.array, |
| | | search: PropTypes.string, |
| | | mode: PropTypes.string, |