import {defineMessages, FormattedMessage, intlShape, injectIntl} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import Modal from '../../containers/modal.jsx'; import RestorePoint from './restore-point.jsx'; import styles from './restore-point-modal.css'; import classNames from 'classnames'; import {APP_NAME} from '../../lib/brand'; import {formatBytes} from '../../lib/tw-bytes-utils'; const messages = defineMessages({ title: { defaultMessage: 'Restore Points', description: 'Title of restore point management modal', id: 'tw.restorePoints.title' }, never: { defaultMessage: 'never', id: 'tw.restorePoints.never', description: 'Part of restore point modal. Appears as dropdown in context "Restore points are created [never]"' }, oneMinute: { defaultMessage: 'every minute', id: 'tw.restorePoints.1minute', // eslint-disable-next-line max-len description: 'Part of restore point modal. Appears as dropdown in context "Restore points are created [every minute]"' }, minutes: { defaultMessage: 'every {n} minutes', id: 'tw.restorePoints.minutes', // eslint-disable-next-line max-len description: 'Part of restore point modal. Appears as dropdown in context "Restore points are created [every 5 minutes]". {n} will be replaced with a number greater than 1.' } }); const MINUTE = 1000 * 60; const INTERVAL_OPTIONS = [ MINUTE * 1, MINUTE * 5, MINUTE * 10, MINUTE * 15, MINUTE * 30, -1 ]; const IntervalSelector = props => ( ); IntervalSelector.propTypes = { intl: intlShape, value: PropTypes.number.isRequired, onChange: PropTypes.func.isRequired }; const RestorePointModal = props => (

) }} />

{props.interval < 0 && (

)} {props.error ? (

{props.error}

) : props.isLoading ? (
) : props.restorePoints.length === 0 ? (
) : (
{props.restorePoints.map(restorePoint => ( ))}
)}
); RestorePointModal.propTypes = { intl: intlShape, interval: PropTypes.number.isRequired, onChangeInterval: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, onClickCreate: PropTypes.func.isRequired, onClickDelete: PropTypes.func.isRequired, onClickDeleteAll: PropTypes.func.isRequired, onClickExport: PropTypes.func.isRequired, onClickLoad: PropTypes.func.isRequired, isExporting: PropTypes.func.isRequired, isLoading: PropTypes.bool.isRequired, totalSize: PropTypes.number.isRequired, restorePoints: PropTypes.arrayOf(PropTypes.shape({})), error: PropTypes.string }; export default injectIntl(RestorePointModal);