Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ValJed committed Aug 29, 2023
1 parent d0e3147 commit 65221ec
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
18 changes: 6 additions & 12 deletions lib/formats/archiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,15 @@ async function compressAttachments(apos, archive, attachments = {}) {
archive.append(res.body, {
name: `attachments/${name}`
});
}).catch((err) => {
reject(err);
});
})
.catch(reject);
});
});

const chunkedPromises = chunkPromises(promises, 2);
try {
for (const chunk of chunkedPromises) {
const res = await Promise.all(chunk);
console.log('res', res);
}
} catch (err) {
console.log('err', err);
// TODO should we stop the whole process? At least notify the user that an attachment could not be downloaded
const chunkedPromises = chunkPromises(promises, 5);
/* const failedRequests = []; */
for (const chunk of chunkedPromises) {
await Promise.allSettled(chunk);
}
}

Expand Down
36 changes: 18 additions & 18 deletions lib/methods/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ module.exports = self => {
const downloadUrl = `${self.apos.attachment.uploadfs.getUrl()}${downloadPath}`;

if (reporting) {
/* reporting.setResults({ */
/* url: downloadUrl */
/* }); */
reporting.setResults({
url: downloadUrl
});
} else {
// No reporting means no batch operation:
// We need to handle the notification manually
// when exporting a single document:
/* await self.apos.notification.trigger(req, 'aposImportExport:exported', { */
/* interpolate: { */
/* count: req.body._ids.length, */
/* type: req.body.type */
/* }, */
/* dismiss: true, */
/* icon: 'database-export-icon', */
/* type: 'success', */
/* event: { */
/* name: 'export-download', */
/* data: { */
/* url: downloadUrl */
/* } */
/* } */
/* }); */
await self.apos.notification.trigger(req, 'aposImportExport:exported', {
interpolate: {
count: req.body._ids.length,
type: req.body.type
},
dismiss: true,
icon: 'database-export-icon',
type: 'success',
event: {
name: 'export-download',
data: {
url: downloadUrl
}
}
});
}

await self.removeArchive(filepath);
Expand Down
4 changes: 3 additions & 1 deletion ui/apos/components/AposExportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export default {
computed: {
moduleLabel() {
const moduleOptions = apos.modules[this.moduleName];
const label = this.checked?.length > 1 ? moduleOptions.pluralLabel : moduleOptions.label;
const label = this.checked?.length > 1
? moduleOptions.pluralLabel
: moduleOptions.label;
return this.$t(label).toLowerCase();
},
Expand Down

0 comments on commit 65221ec

Please sign in to comment.