Calendar item/episode status fixes

New: Calendar shows icon when download is complete and not yet imported
New: Episode status shows pending import and importing icon
This commit is contained in:
Mark McDowall 2020-05-24 13:32:33 -07:00
parent 910de6d94a
commit c646bef369
3 changed files with 42 additions and 6 deletions

View File

@ -10,13 +10,13 @@ function QueueDetails(props) {
size,
sizeleft,
estimatedCompletionTime,
status: queueStatus,
status,
trackedDownloadState,
trackedDownloadStatus,
errorMessage,
progressBar
} = props;
const status = queueStatus.toLowerCase();
const progress = (100 - sizeleft / size * 100);
if (status === 'pending') {
@ -39,7 +39,35 @@ function QueueDetails(props) {
);
}
// TODO: show an icon when download is complete, but not imported yet?
if (trackedDownloadStatus === 'warning') {
return (
<Icon
name={icons.DOWNLOAD}
kind={kinds.WARNING}
title={'Downloaded - Unable to Import: check logs for details'}
/>
);
}
if (trackedDownloadState === 'importPending') {
return (
<Icon
name={icons.DOWNLOAD}
kind={kinds.PURPLE}
title={'Downloaded - Waiting to Import'}
/>
);
}
if (trackedDownloadState === 'importing') {
return (
<Icon
name={icons.DOWNLOAD}
kind={kinds.PURPLE}
title={'Downloaded - Importing'}
/>
);
}
}
if (errorMessage) {
@ -90,6 +118,8 @@ QueueDetails.propTypes = {
sizeleft: PropTypes.number.isRequired,
estimatedCompletionTime: PropTypes.string,
status: PropTypes.string.isRequired,
trackedDownloadState: PropTypes.string.isRequired,
trackedDownloadStatus: PropTypes.string.isRequired,
errorMessage: PropTypes.string,
progressBar: PropTypes.node.isRequired
};

View File

@ -11,10 +11,12 @@ function CalendarEventQueueDetails(props) {
sizeleft,
estimatedCompletionTime,
status,
trackedDownloadState,
trackedDownloadStatus,
errorMessage
} = props;
const progress = (100 - sizeleft / size * 100);
const progress = size ? (100 - sizeleft / size * 100) : 0;
return (
<QueueDetails
@ -23,6 +25,8 @@ function CalendarEventQueueDetails(props) {
sizeleft={sizeleft}
estimatedCompletionTime={estimatedCompletionTime}
status={status}
trackedDownloadState={trackedDownloadState}
trackedDownloadStatus={trackedDownloadStatus}
errorMessage={errorMessage}
progressBar={
<div title={`Episode is downloading - ${progress.toFixed(1)}% ${title}`}>
@ -44,6 +48,8 @@ CalendarEventQueueDetails.propTypes = {
sizeleft: PropTypes.number.isRequired,
estimatedCompletionTime: PropTypes.string,
status: PropTypes.string.isRequired,
trackedDownloadState: PropTypes.string.isRequired,
trackedDownloadStatus: PropTypes.string.isRequired,
errorMessage: PropTypes.string
};

View File

@ -27,7 +27,7 @@ function EpisodeStatus(props) {
size
} = queueItem;
const progress = (100 - sizeleft / size * 100);
const progress = size ? (100 - sizeleft / size * 100) : 0;
return (
<div className={styles.center}>