Manage guestbook page integration#992
Conversation
ekraffmiller
left a comment
There was a problem hiding this comment.
I've suggested some name changes to match the Guestbook js-dataverse use cases, will review again after checkbox logic is updated :)
| "position": "Cargo" | ||
| } | ||
| }, | ||
| "customQuestions": { |
There was a problem hiding this comment.
It looks like the Spanish translation is missing some keys that are in the English translation
| guestbookId: number, | ||
| enabled: boolean | ||
| ) => Promise<void> | ||
| downloadGuestbookResponsesByDataverseId: (dataverseId: number | string) => Promise<string> |
There was a problem hiding this comment.
Update to use collectionId
| downloadGuestbookResponsesByDataverseId: (dataverseId: number | string) => Promise<string> | |
| downloadGuestbookResponsesByCollectionId: (collectionId: number | string) => Promise<string> |
| ) => Promise<void> | ||
| downloadGuestbookResponsesByDataverseId: (dataverseId: number | string) => Promise<string> | ||
| downloadGuestbookResponsesOfAGuestbook: ( | ||
| dataverseId: number | string, |
There was a problem hiding this comment.
| dataverseId: number | string, | |
| collectionId: number | string, |
|
|
||
| export function downloadGuestbookResponsesByDataverseId( | ||
| guestbookRepository: GuestbookRepository, | ||
| dataverseId: number | string |
There was a problem hiding this comment.
| dataverseId: number | string | |
| collectionId: number | string |
|
|
||
| export function downloadGuestbookResponsesOfAGuestbook( | ||
| guestbookRepository: GuestbookRepository, | ||
| dataverseId: number | string, |
There was a problem hiding this comment.
| dataverseId: number | string, | |
| collectionId: number | string, |
| downloadGuestbookResponsesByDataverseId(dataverseId: number | string): Promise<string> { | ||
| return downloadGuestbookResponsesByDataverseId.execute(dataverseId) | ||
| } | ||
|
|
||
| downloadGuestbookResponsesOfAGuestbook( | ||
| dataverseId: number | string, | ||
| guestbookId: number | ||
| ): Promise<string> { | ||
| return downloadGuestbookResponsesOfAGuestbook.execute(dataverseId, guestbookId) |
There was a problem hiding this comment.
| downloadGuestbookResponsesByDataverseId(dataverseId: number | string): Promise<string> { | |
| return downloadGuestbookResponsesByDataverseId.execute(dataverseId) | |
| } | |
| downloadGuestbookResponsesOfAGuestbook( | |
| dataverseId: number | string, | |
| guestbookId: number | |
| ): Promise<string> { | |
| return downloadGuestbookResponsesOfAGuestbook.execute(dataverseId, guestbookId) | |
| downloadGuestbookResponsesByCollectionId(collectionId: number | string): Promise<string> { | |
| return downloadGuestbookResponsesByCollectionId.execute(collectionId) | |
| } | |
| downloadGuestbookResponsesOfAGuestbook( | |
| collectionId: number | string, | |
| guestbookId: number | |
| ): Promise<string> { | |
| return downloadGuestbookResponsesOfAGuestbook.execute(collectionId, guestbookId) |
| answers.push({ | ||
| id: resolveAnswerId(fieldName, question, guestbook), | ||
| value | ||
| value: question.type === 'textarea' ? value.split(/\r?\n/) : value |
There was a problem hiding this comment.
When the API is updated to take either a string or an array, we won't have to do this extra logic of converting the string to an array, but good to keep for now.
| } | ||
| ]) | ||
| const guestbooksGuideUrl = | ||
| 'https://guides.dataverse.org/en/6.9/user/dataverse-management.html#dataset-guestbooks' |
There was a problem hiding this comment.
| 'https://guides.dataverse.org/en/6.9/user/dataverse-management.html#dataset-guestbooks' | |
| 'https://guides.dataverse.org/en/latest/user/dataverse-management.html#dataset-guestbooks' |
|
|
||
| const generalInfoUrl = `/spa${RouteWithParams.EDIT_COLLECTION(collectionId)}` | ||
| const guestbooksGuideUrl = | ||
| 'https://guides.dataverse.org/en/6.9/user/dataverse-management.html#dataset-guestbooks' |
There was a problem hiding this comment.
| 'https://guides.dataverse.org/en/6.9/user/dataverse-management.html#dataset-guestbooks' | |
| 'https://guides.dataverse.org/en/latest/user/dataverse-management.html#dataset-guestbooks' |
| }) | ||
| const rootCollectionNames = collection?.hierarchy?.toArray().map((node) => node.name) ?? [] | ||
|
|
||
| const currentDataverseId = Number(collection?.id) || 1 |
There was a problem hiding this comment.
| const currentDataverseId = Number(collection?.id) || 1 | |
| const currentCollectionId = Number(collection?.id) || 1 |
|
Hi @ekraffmiller 👋 Thanks for your review! I’ve just made some changes based on the feedback. While working on the changes for this PR, I noticed that we were also missing an API for deleting a guestbook. I've created an issue in Dataverse for this IQSS/dataverse#12453. Also, in another issue IQSS/dataverse#12451, I added a comment about an additional requirement: including inherited guestbooks in the GetDataset API response. (Maybe it's better to create another issue for this? ) |
Hi @ChengShi-1, thanks for adding the issue for delete API, good catch. For the other issue, I don't think we need an API change. In the Edit Guestbook section on the Dataset Page, The list of Guestbooks comes from getGuestbooksByCollectionId, not from GetDataset. So since IQSS/dataverse#12451 adds a parameter to get inherited guestbooks, we can use that, unless I'm missing something? |
Right now the frontend can only infer that with something like |
Ok, I see what you mean! So yes, we need to save that in the Collection object. In the Dataverse backend, the field is "guestbookRoot". So we need an API specifically for getting/setting this value, or update the Collection object to include this field, and use the get/update collection use cases to manage it. I think it's worth adding a new issue to address this. Thanks for catching this! |
Thanks, it's really helpful! I just created an issue to track this: IQSS/dataverse#12459 |

What this PR does / why we need it:
Which issue(s) this PR closes:
Special notes for your reviewer:
use js-dataverse IQSS/dataverse-client-javascript#449
Suggestions on how to test this:
In collection page Edit => Dataset Guestbook, then you arrive the Manage Guestbook Page,

If there is no guestbook, it should show text to guide users and a Create Guestbook button.
If there is one or more guestbook, it should show a table with info just like JSF.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Create Dataset Guestbook




Is there a release notes or changelog update needed for this change?:
Yes
Additional documentation: