🔀 Merge branch 'main' into release/v1.0.3 with fixes #621 #619 #615 #614 #612 #608

This commit is contained in:
Eric Doughty-Papassideris
2024-07-23 14:52:54 +02:00
9 changed files with 81 additions and 267 deletions
@@ -42,7 +42,7 @@ export default ({ pendingFilesState, visible }: PropsType) => {
const momentTimeRemaining = moment(new Date().getTime() + timeRemainingInMs).fromNow();
if (momentTimeRemaining !== 'Invalid date') {
return Languages.t('components.pending_file_list.estimation.end') + `Will end ${momentTimeRemaining}...`;
return Languages.t('components.pending_file_list.estimation.end') + ` ${momentTimeRemaining}...`;
} else {
return Languages.t('components.pending_file_list.estimation.approximations');
}
@@ -99,7 +99,7 @@ export const useDriveActions = () => {
);
const downloadZip = useCallback(
async (ids: string[], isDirectory?: boolean) => {
async (ids: string[], isDirectory = false) => {
try {
const url = await DriveApiClient.getDownloadZipUrl(companyId, ids, isDirectory);
(window as any).open(url, '_blank').focus();
@@ -114,7 +114,7 @@ export const useDriveActions = () => {
async (id: string, parentId: string) => {
try {
await DriveApiClient.remove(companyId, id);
await refresh(parentId || '');
await refresh(parentId || '', true);
await getQuota();
} catch (e) {
ToasterService.error(Languages.t('hooks.use-drive-actions.unable_remove_file'));
@@ -127,7 +127,7 @@ export const useDriveActions = () => {
async (id: string, parentId: string) => {
try {
await DriveApiClient.restore(companyId, id);
await refresh(parentId || '');
await refresh(parentId || '', true);
} catch (e) {
ToasterService.error(Languages.t('hooks.use-drive-actions.unable_restore_file'));
}
@@ -158,7 +158,7 @@ export const useDriveActions = () => {
level: level,
};
await DriveApiClient.updateLevel(companyId, id, updateBody);
await refresh(id || '');
await refresh(id || '', true);
} catch (e) {
ToasterService.error(Languages.t('hooks.use-drive-actions.unable_update_file'));
}
@@ -55,8 +55,13 @@ export const useDriveUpload = () => {
// Upload files into directories
logger.debug("Start file uploading")
//create counter to calculate number of uploaded files, and refresh browsing window only when all the files were uploaded
let expectedUploadsCount = 0;
const parentFolder = context.parentId;
let uploadedFilesCount = 0;
for (const parentId of Object.keys(filesPerParentId)) {
logger.debug(`Upload files for directory ${parentId}`);
expectedUploadsCount += filesPerParentId[parentId].length;
await FileUploadService.upload(filesPerParentId[parentId], {
context: {
companyId: context.companyId,
@@ -64,6 +69,7 @@ export const useDriveUpload = () => {
},
callback: (file, context) => {
logger.debug('created file: ', file);
uploadedFilesCount++;
if (file) {
create(
{
@@ -87,10 +93,12 @@ export const useDriveUpload = () => {
},
);
}
if (uploadedFilesCount == expectedUploadsCount) {
refresh(parentFolder, true);
}
},
});
}
await refresh(context.parentId, true);
};
const uploadFromUrl = (
@@ -118,7 +118,7 @@ export const ExpiryEditorRow = (props: {
<Input
inputRef={inputRef}
disabled={disabled}
className="max-w-xs mr-4 mt-1"
className="max-w-xs mr-4 mt-1 py-0"
type="date"
size='sm'
min={moment().add(1, 'days').toISOString().split('T')[0]}