Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make changes for import/export module to work properly #4270

Merged
merged 26 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
30ab5da
pass checked document ids to toolbar
ETLaurent Aug 15, 2023
5cbec97
use dismissProgressNotification
ETLaurent Aug 23, 2023
c714926
pass notification options and sent results as an event in notif
ETLaurent Aug 23, 2023
3b06f5e
remove notification options and use req.body.messages to sent results…
ETLaurent Aug 23, 2023
7c94ea6
adds the option originalResponse to the http remote method for the ba…
ValJed Aug 28, 2023
ccb5c18
disable export for users
ETLaurent Aug 29, 2023
eaf5179
importExport
ETLaurent Aug 30, 2023
b376997
adds new color variable
ValJed Sep 18, 2023
fc15e25
allows to pass existing ID to attachment insert method
ValJed Sep 18, 2023
bea905a
when passing attachmentId check if this one exists already
ValJed Sep 20, 2023
f1eb181
adds update method
ValJed Sep 21, 2023
a560591
returns promise in order to wait if needed
ValJed Sep 22, 2023
5346f26
starts notification with percentage of 0 to avoid NaN
ValJed Sep 26, 2023
e9f7a0c
removes an useless return satement
ValJed Sep 26, 2023
66989c4
in attachment update method, make sure to delete the existing retriev…
ValJed Sep 28, 2023
2b62ecf
Merge remote-tracking branch 'origin/main' into pro-4261-export-docs
ETLaurent Oct 2, 2023
6d88220
fixes lint
ValJed Oct 3, 2023
26df2d0
adds changelog
ValJed Oct 3, 2023
b1b72c2
minor changes
ValJed Oct 4, 2023
2c6f00a
compute new docIds and archivedDocIds when updating attachment to ver…
ValJed Oct 6, 2023
734e292
moves import export related options to the module itself
ValJed Oct 6, 2023
90f9fb3
only gets existing related docs from IDs
ValJed Oct 6, 2023
92b8054
Merge remote-tracking branch 'origin/main' into pro-4261-export-docs
ETLaurent Oct 11, 2023
526c519
typos
ETLaurent Oct 12, 2023
8af5ac0
typo
ETLaurent Oct 12, 2023
4ba007d
use docIds and archivedDocIds from existing attachment to get related…
ETLaurent Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/@apostrophecms/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ module.exports = {
// `fullResponse` (if true, return an object with `status`, `headers` and `body`
// properties, rather than returning the body directly; the individual `headers` are canonicalized
// to lowercase names. If a header appears multiple times an array is returned for it)
// `originalResponse` (if true, return the response object exactly as it is returned by node-fetch)
//
// If the status code is >= 400 an error is thrown. The error object will be
// similar to a `fullResponse` object, with a `status` property.
Expand Down Expand Up @@ -225,6 +226,9 @@ module.exports = {
options.jar.setCookieSync(cookie, url);
});
}
if (options.originalResponse) {
return res;
}
awaitedBody = true;
body = await getBody();
if (res.status >= 400) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
:labels="moduleLabels"
:disable="relationshipErrors === 'min'"
:displayed-items="items.length"
:checked="checked"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, was this just an unrelated bug?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bug, it has been added to be consistent with the other vue changes.
Basically the modal for exporting documents needed the checked IDs so we pass it to AposDocsManagerToolbar when used.

:checked-count="checked.length"
:module-name="moduleName"
@page-change="updatePage"
Expand Down
12 changes: 10 additions & 2 deletions modules/@apostrophecms/job/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module.exports = {
await self.triggerNotification(req, 'completed', {
count: total,
dismiss: true
});
}, results);
// Dismiss the progress notification. It will delay 4 seconds
// because "completed" notification will dismiss in 5 and we want
// to maintain the feeling of process order for users.
Expand All @@ -261,11 +261,18 @@ module.exports = {
// array
// No messages are required, but they provide helpful information to
// end users.
async triggerNotification(req, stage, options = {}) {
async triggerNotification(req, stage, options = {}, results) {
if (!req.body || !req.body.messages || !req.body.messages[stage]) {
return {};
}

const event = req.body.messages.resultsEventName && results
? {
name: req.body.messages.resultsEventName,
data: { ...results }
}
: null;

ValJed marked this conversation as resolved.
Show resolved Hide resolved
return self.apos.notification.trigger(req, req.body.messages[stage], {
interpolate: {
count: options.count || (req.body._ids && req.body._ids.length),
Expand All @@ -277,6 +284,7 @@ module.exports = {
action: options.action,
ids: options.ids
},
event,
icon: req.body.messages.icon || 'database-export-icon',
type: options.type || 'success',
return: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export default {
type: Number,
required: true
},
checked: {
type: Array,
default: () => []
},
checkedCount: {
type: Number,
required: true
Expand Down Expand Up @@ -273,7 +277,7 @@ export default {
modal, ...rest
}) {
await apos.modal.execute(modal, {
count: this.checkedCount,
checked: this.checked,
moduleName: this.moduleName,
...rest
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
:labels="moduleLabels"
:displayed-items="items.length"
:is-relationship="!!relationshipField"
:checked="checked"
:checked-count="checked.length"
:batch-operations="moduleOptions.batchOperations"
:module-name="moduleName"
Expand Down
3 changes: 2 additions & 1 deletion modules/@apostrophecms/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ module.exports = {
publishRole: 'admin',
viewRole: 'admin',
showPermissions: true,
relationshipSuggestionIcon: 'account-box-icon'
relationshipSuggestionIcon: 'account-box-icon',
export: false
ValJed marked this conversation as resolved.
Show resolved Hide resolved
},
fields(self, options) {
const fields = {};
Expand Down