External tools require terms or guestbook response if applicable#987
Conversation
There was a problem hiding this comment.
Pull request overview
This PR ensures that embedded external file tools (e.g., Preview/Query tools shown on the File page when navigated from Dataset external-tool actions) are gated behind dataset terms/license acceptance and guestbook completion when required, matching the JSF behavior described in #941.
Changes:
- Gate
FileEmbeddedExternalToolloading behindDownloadWithTermsAndGuestbookModalwhen terms/license/guestbook requirements apply. - Extend guestbook submission flow to support a “success callback” path (accept/complete requirements without triggering an actual download).
- Add/adjust Cypress component tests for terms gating, tool filtering, requirements metadata filtering, and resolved tool URL params; add i18n strings for the new UX.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/component/sections/file/file-embedded-external-tool/FileEmbeddedExternalTool.spec.tsx | Adds coverage to ensure terms are accepted before the embedded tool URL is fetched/iframe rendered. |
| tests/component/sections/file/file-action-buttons/access-file-menu/FileToolOptions.spec.tsx | Expands tests for filtering by file type, resolved URL call args (preview=false + locale), and unsupported requirements metadata. |
| tests/component/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/FileTools.spec.tsx | Adjusts tests for applicable tool rendering and unsupported requirements metadata handling. |
| tests/component/sections/dataset/dataset-action-buttons/DatasetToolOptions.spec.tsx | Adds tests for filtering dataset tools and unsupported requirements metadata, plus resolved URL call behavior. |
| src/sections/file/file-embedded-external-tool/FileEmbeddedExternalTool.tsx | Implements the gating modal + “terms required” fallback UI before fetching external tool URLs. |
| src/sections/file/file-action-buttons/access-file-menu/FileToolOptions.tsx | Fixes rendering to iterate over applicableTools (filtered) rather than the unfiltered tools. |
| src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/useGuestbookCollectSubmission.ts | Adds optional onSubmitSuccess to allow “accept requirements” without starting a download. |
| src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/file-options-menu/DownloadWithTermsAndGuestbookModal.tsx | Wires onAccept through to the guestbook submission hook as a success callback. |
| public/locales/en/file.json | Adds previewTab.termsRequired string. |
| public/locales/es/file.json | Adds previewTab.termsRequired string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Loads the tool every time the tab is in view or the tool selection changes. | ||
| useEffect(() => { | ||
| if (!isInView) return | ||
| if (isWaitingForTermsAndGuestbook) { | ||
| setShowTermsAndGuestbookModal(true) | ||
| return | ||
| } |
…nd-guestbook-response-before-access-a-file
…nd-guestbook-response-before-access-a-file
ekraffmiller
left a comment
There was a problem hiding this comment.
Looks good! I think the only thing needed is a link to allow the user to accept terms after canceling.
…nd-guestbook-response-before-access-a-file
|
Hi @ekraffmiller , thanks for the review, and this PR is ready for review agian. I added a link to open the modal if the terms/guestbooks is needed for a file. |
ekraffmiller
left a comment
There was a problem hiding this comment.
looks good! approved


What this PR does / why we need it:
On the Dataset page, some external tools are available(like Preview, Ask the Data...). Clicking this icon navigates the user to the Preview tab on the File page. If the file belongs to a dataset that requires acceptance of terms and completion of a guestbook, these must be presented and completed before the file preview is made available.
Related PR #815
Which issue(s) this PR closes:
Special notes for your reviewer:
Suggestions on how to test this:
Building external tool here, and test if the terms and guestbook window poped up, if you're a guest user
To install an external tool in local Dataverse:
Example dataset tool:
{ "displayName": "Dataset Tool", "toolName": "datasetFileTool", "description": "Dataset Explore Tool", "types": ["explore"], "scope": "dataset", "toolUrl": "http://example.org/dataset-tool", "toolParameters": { "queryParameters": [{ "datasetPid": "{datasetPid}" }] } }curl -H "X-Dataverse-key:$API_TOKEN" \ -H "Content-type: application/json" \ -X POST http://localhost:8000/api/externalTools \ --upload-file tool.jsoncurl http://localhost:8000/api/externalToolsDoes this PR introduce a user interface change? If mockups are available, please link/include them here:
If you are a guest user of current dataset, when there is a term or guestbook applied, if you try to use an external tool, the pop-up window should exist


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