show metadata extraction progress
This commit is contained in:
parent
3d4382effe
commit
0ad204a2c2
|
@ -40,70 +40,78 @@ export function UploadProgressDialog() {
|
|||
<Dialog maxWidth="xs" open={open} onClose={handleClose}>
|
||||
<UploadProgressHeader />
|
||||
{(uploadStage === UPLOAD_STAGES.UPLOADING ||
|
||||
uploadStage === UPLOAD_STAGES.FINISH) && (
|
||||
uploadStage === UPLOAD_STAGES.FINISH ||
|
||||
uploadStage === UPLOAD_STAGES.EXTRACTING_METADATA) && (
|
||||
<DialogContent sx={{ '&&&': { px: 0 } }}>
|
||||
{uploadStage === UPLOAD_STAGES.UPLOADING && (
|
||||
{(uploadStage === UPLOAD_STAGES.UPLOADING ||
|
||||
uploadStage === UPLOAD_STAGES.EXTRACTING_METADATA) && (
|
||||
<InProgressSection />
|
||||
)}
|
||||
{(uploadStage === UPLOAD_STAGES.UPLOADING ||
|
||||
uploadStage === UPLOAD_STAGES.FINISH) && (
|
||||
<>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.UPLOADED}
|
||||
sectionTitle={constants.SUCCESSFUL_UPLOADS}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={
|
||||
UPLOAD_RESULT.UPLOADED_WITH_STATIC_THUMBNAIL
|
||||
}
|
||||
sectionTitle={
|
||||
constants.THUMBNAIL_GENERATION_FAILED_UPLOADS
|
||||
}
|
||||
sectionInfo={
|
||||
constants.THUMBNAIL_GENERATION_FAILED_INFO
|
||||
}
|
||||
/>
|
||||
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.UPLOADED}
|
||||
sectionTitle={constants.SUCCESSFUL_UPLOADS}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={
|
||||
UPLOAD_RESULT.UPLOADED_WITH_STATIC_THUMBNAIL
|
||||
}
|
||||
sectionTitle={
|
||||
constants.THUMBNAIL_GENERATION_FAILED_UPLOADS
|
||||
}
|
||||
sectionInfo={constants.THUMBNAIL_GENERATION_FAILED_INFO}
|
||||
/>
|
||||
{uploadStage === UPLOAD_STAGES.FINISH &&
|
||||
hasUnUploadedFiles && (
|
||||
<NotUploadSectionHeader>
|
||||
{constants.FILE_NOT_UPLOADED_LIST}
|
||||
</NotUploadSectionHeader>
|
||||
)}
|
||||
|
||||
{uploadStage === UPLOAD_STAGES.FINISH &&
|
||||
hasUnUploadedFiles && (
|
||||
<NotUploadSectionHeader>
|
||||
{constants.FILE_NOT_UPLOADED_LIST}
|
||||
</NotUploadSectionHeader>
|
||||
)}
|
||||
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.BLOCKED}
|
||||
sectionTitle={constants.BLOCKED_UPLOADS}
|
||||
sectionInfo={constants.ETAGS_BLOCKED(
|
||||
getOSSpecificDesktopAppDownloadLink()
|
||||
)}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.FAILED}
|
||||
sectionTitle={constants.FAILED_UPLOADS}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.ALREADY_UPLOADED}
|
||||
sectionTitle={constants.SKIPPED_FILES}
|
||||
sectionInfo={constants.SKIPPED_INFO}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={
|
||||
UPLOAD_RESULT.LARGER_THAN_AVAILABLE_STORAGE
|
||||
}
|
||||
sectionTitle={
|
||||
constants.LARGER_THAN_AVAILABLE_STORAGE_UPLOADS
|
||||
}
|
||||
sectionInfo={
|
||||
constants.LARGER_THAN_AVAILABLE_STORAGE_INFO
|
||||
}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.UNSUPPORTED}
|
||||
sectionTitle={constants.UNSUPPORTED_FILES}
|
||||
sectionInfo={constants.UNSUPPORTED_INFO}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.TOO_LARGE}
|
||||
sectionTitle={constants.TOO_LARGE_UPLOADS}
|
||||
sectionInfo={constants.TOO_LARGE_INFO}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.BLOCKED}
|
||||
sectionTitle={constants.BLOCKED_UPLOADS}
|
||||
sectionInfo={constants.ETAGS_BLOCKED(
|
||||
getOSSpecificDesktopAppDownloadLink()
|
||||
)}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.FAILED}
|
||||
sectionTitle={constants.FAILED_UPLOADS}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.ALREADY_UPLOADED}
|
||||
sectionTitle={constants.SKIPPED_FILES}
|
||||
sectionInfo={constants.SKIPPED_INFO}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={
|
||||
UPLOAD_RESULT.LARGER_THAN_AVAILABLE_STORAGE
|
||||
}
|
||||
sectionTitle={
|
||||
constants.LARGER_THAN_AVAILABLE_STORAGE_UPLOADS
|
||||
}
|
||||
sectionInfo={
|
||||
constants.LARGER_THAN_AVAILABLE_STORAGE_INFO
|
||||
}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.UNSUPPORTED}
|
||||
sectionTitle={constants.UNSUPPORTED_FILES}
|
||||
sectionInfo={constants.UNSUPPORTED_INFO}
|
||||
/>
|
||||
<ResultSection
|
||||
uploadResult={UPLOAD_RESULT.TOO_LARGE}
|
||||
sectionTitle={constants.TOO_LARGE_UPLOADS}
|
||||
sectionInfo={constants.TOO_LARGE_INFO}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</DialogContent>
|
||||
)}
|
||||
{uploadStage === UPLOAD_STAGES.FINISH && <UploadProgressFooter />}
|
||||
|
|
|
@ -10,15 +10,16 @@ import {
|
|||
} from './section';
|
||||
import UploadProgressContext from 'contexts/uploadProgress';
|
||||
import constants from 'utils/strings/constants';
|
||||
import { UPLOAD_STAGES } from 'constants/upload';
|
||||
|
||||
export const InProgressSection = () => {
|
||||
const { inProgressUploads, hasLivePhotos, uploadFileNames } = useContext(
|
||||
UploadProgressContext
|
||||
);
|
||||
const { inProgressUploads, hasLivePhotos, uploadFileNames, uploadStage } =
|
||||
useContext(UploadProgressContext);
|
||||
const fileList = inProgressUploads ?? [];
|
||||
|
||||
return (
|
||||
<UploadProgressSection defaultExpanded>
|
||||
<UploadProgressSection
|
||||
defaultExpanded={uploadStage === UPLOAD_STAGES.UPLOADING}>
|
||||
<UploadProgressSectionTitle expandIcon={<ExpandMoreIcon />}>
|
||||
{constants.INPROGRESS_UPLOADS}
|
||||
</UploadProgressSectionTitle>
|
||||
|
@ -30,8 +31,13 @@ export const InProgressSection = () => {
|
|||
fileList={fileList.map(({ localFileID, progress }) => (
|
||||
<InProgressItemContainer key={localFileID}>
|
||||
<span>{uploadFileNames.get(localFileID)}</span>
|
||||
<span className="separator">{`-`}</span>
|
||||
<span>{`${progress}%`}</span>
|
||||
{uploadStage === UPLOAD_STAGES.UPLOADING && (
|
||||
<>
|
||||
{' '}
|
||||
<span className="separator">{`-`}</span>
|
||||
<span>{`${progress}%`}</span>
|
||||
</>
|
||||
)}
|
||||
</InProgressItemContainer>
|
||||
))}
|
||||
/>
|
||||
|
|
|
@ -20,6 +20,8 @@ function UploadProgressSubtitleText() {
|
|||
return (
|
||||
<Typography color="text.secondary">
|
||||
{uploadStage === UPLOAD_STAGES.UPLOADING
|
||||
? constants.UPLOAD_STAGE_MESSAGE[uploadStage](uploadCounter)
|
||||
: uploadStage === UPLOAD_STAGES.EXTRACTING_METADATA
|
||||
? constants.UPLOAD_STAGE_MESSAGE[uploadStage](uploadCounter)
|
||||
: constants.UPLOAD_STAGE_MESSAGE[uploadStage]}
|
||||
</Typography>
|
||||
|
|
|
@ -111,6 +111,14 @@ class UploadManager {
|
|||
addLogLine(
|
||||
`received ${filesWithCollectionToUploadIn.length} files to upload`
|
||||
);
|
||||
uiService.setFilenames(
|
||||
new Map<number, string>(
|
||||
filesWithCollectionToUploadIn.map((mediaFile) => [
|
||||
mediaFile.localID,
|
||||
UploadService.getAssetName(mediaFile),
|
||||
])
|
||||
)
|
||||
);
|
||||
const { metadataJSONFiles, mediaFiles } =
|
||||
segregateMetadataAndMediaFiles(filesWithCollectionToUploadIn);
|
||||
addLogLine(`has ${metadataJSONFiles.length} metadata json files`);
|
||||
|
@ -274,6 +282,7 @@ class UploadManager {
|
|||
addLogLine(`extractMetadataFromFiles executed`);
|
||||
UIService.reset(mediaFiles.length);
|
||||
for (const { file, localID, collectionID } of mediaFiles) {
|
||||
UIService.setFileProgress(localID, 0);
|
||||
if (uploadCancelService.isUploadCancelationRequested()) {
|
||||
throw Error(CustomError.UPLOAD_CANCELLED);
|
||||
}
|
||||
|
@ -296,6 +305,10 @@ class UploadManager {
|
|||
file
|
||||
)} `
|
||||
);
|
||||
UIService.moveFileToResultList(
|
||||
localID,
|
||||
UPLOAD_RESULT.UPLOADED
|
||||
);
|
||||
} catch (e) {
|
||||
if (e.message === CustomError.UPLOAD_CANCELLED) {
|
||||
throw e;
|
||||
|
|
|
@ -107,7 +107,8 @@ const englishConstants = {
|
|||
UPLOAD_STAGE_MESSAGE: {
|
||||
0: 'Preparing to upload',
|
||||
1: 'Reading google metadata files',
|
||||
2: 'Reading file metadata',
|
||||
2: (fileCounter) =>
|
||||
`${fileCounter.finished} / ${fileCounter.total} files metadata extracted`,
|
||||
3: (fileCounter) =>
|
||||
`${fileCounter.finished} / ${fileCounter.total} files backed up`,
|
||||
4: 'Cancelling remaining uploads',
|
||||
|
@ -543,7 +544,7 @@ const englishConstants = {
|
|||
'Skipped these as there are files with matching names in the same album',
|
||||
UNSUPPORTED_INFO: 'ente does not support these file formats yet',
|
||||
BLOCKED_UPLOADS: 'Blocked uploads',
|
||||
INPROGRESS_UPLOADS: 'Uploads in progress',
|
||||
INPROGRESS_UPLOADS: 'In progress',
|
||||
TOO_LARGE_UPLOADS: 'Large files',
|
||||
LARGER_THAN_AVAILABLE_STORAGE_UPLOADS: 'Insufficient storage',
|
||||
LARGER_THAN_AVAILABLE_STORAGE_INFO:
|
||||
|
|
Loading…
Reference in a new issue