import PropTypes from 'prop-types'; import React from 'react'; import formatDateTime from 'Utilities/Date/formatDateTime'; import formatAge from 'Utilities/Number/formatAge'; import Link from 'Components/Link/Link'; import DescriptionList from 'Components/DescriptionList/DescriptionList'; import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle'; import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription'; function HistoryDetails(props) { const { eventType, sourceTitle, data, shortDateFormat, timeFormat } = props; if (eventType === 'grabbed') { const { indexer, releaseGroup, nzbInfoUrl, downloadClient, downloadId, age, ageHours, ageMinutes, publishedDate } = data; return ( { !!indexer && } { !!releaseGroup && } { !!nzbInfoUrl && Info URL {nzbInfoUrl} } { !!downloadClient && } { !!downloadId && } { !!indexer && } { !!publishedDate && } ); } if (eventType === 'downloadFailed') { const { message } = data; return ( { !!message && } ); } if (eventType === 'downloadFolderImported') { const { droppedPath, importedPath } = data; return ( { !!droppedPath && } { !!importedPath && } ); } if (eventType === 'episodeFileDeleted') { const { reason } = data; let reasonMessage = ''; switch (reason) { case 'Manual': reasonMessage = 'File was deleted by via UI'; break; case 'MissingFromDisk': reasonMessage = 'Sonarr was unable to find the file on disk so it was removed'; break; case 'Upgrade': reasonMessage = 'File was deleted to import an upgrade'; break; default: reasonMessage = ''; } return ( ); } if (eventType === 'episodeFileRenamed') { const { sourcePath, sourceRelativePath, path, relativePath } = data; return ( ); } } HistoryDetails.propTypes = { eventType: PropTypes.string.isRequired, sourceTitle: PropTypes.string.isRequired, data: PropTypes.object.isRequired, shortDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired }; export default HistoryDetails;