const React = require('react'); const { connect } = require('react-redux'); const Setting = require('lib/models/Setting.js'); const { bridge } = require('electron').remote.require('./bridge'); const { Header } = require('./Header.min.js'); const { themeStyle } = require('../theme.js'); const { _ } = require('lib/locale.js'); const { ReportService } = require('lib/services/report.js'); const fs = require('fs-extra'); class StatusScreenComponent extends React.Component { constructor() { super(); this.state = { report: [], }; } componentWillMount() { this.resfreshScreen(); } async resfreshScreen() { const service = new ReportService(); const report = await service.status(Setting.value('sync.target')); this.setState({ report: report }); } async exportDebugReportClick() { const filename = `syncReport-${new Date().getTime()}.csv`; const filePath = bridge().showSaveDialog({ title: _('Please select where the sync status should be exported to'), defaultPath: filename, }); if (!filePath) return; const service = new ReportService(); const csv = await service.basicItemList({ format: 'csv' }); await fs.writeFileSync(filePath, csv); } render() { const theme = themeStyle(this.props.theme); const style = this.props.style; const headerStyle = Object.assign({}, theme.headerStyle, { width: style.width }); const retryStyle = Object.assign({}, theme.urlStyle, { marginLeft: 5 }); const containerPadding = 10; const containerStyle = Object.assign({}, theme.containerStyle, { padding: containerPadding, height: style.height - theme.headerHeight - containerPadding * 2, }); function renderSectionTitleHtml(key, title) { return (