| | |
| | | import React from 'react' |
| | | import {getRestServiceUrl, humanFileSize} from '../../../utilities/global'; |
| | | import {getRestServiceUrl} from '../../../utilities/global'; |
| | | import ErrorAlert from '../../general/ErrorAlert'; |
| | | import FileListTable from "./FileListTable"; |
| | | |
| | | class ArchiveView extends React.Component { |
| | | |
| | | state = { |
| | | isFetching: false, activeTab: '1', |
| | | fileList : undefined |
| | | }; |
| | | |
| | | componentDidMount = () => { |
| | |
| | | failed: false |
| | | }); |
| | | fetch(getRestServiceUrl('archives/filelist', { |
| | | archive: this.props.archiveId, |
| | | archiveId: this.props.archiveId, |
| | | force: forceReload |
| | | }), { |
| | | method: 'GET', |
| | |
| | | .then(json => { |
| | | this.setState({ |
| | | isFetching: false, |
| | | archive: json |
| | | fileList: json |
| | | }) |
| | | }) |
| | | .catch(() => this.setState({isFetching: false, failed: true})); |
| | |
| | | |
| | | render = () => { |
| | | let content = undefined; |
| | | let archive = this.state.archive; |
| | | |
| | | if (this.state.isFetching) { |
| | | content = <i>Loading...</i>; |
| | |
| | | title: 'Try again' |
| | | }} |
| | | />; |
| | | } else if (this.state.archive) { |
| | | } else if (this.state.fileList) { |
| | | content = <React.Fragment> |
| | | Hurzel; |
| | | <FileListTable |
| | | entries={this.state.fileList}/> |
| | | </React.Fragment>; |
| | | } |
| | | return <React.Fragment> |