Skip to content

WEBUI-1916: drive action buttons handle failure [LTS-2025]#3109

Closed
swarnadipa-dev wants to merge 6 commits into
lts-2025from
fix-WEBUI-1916-nuuxeo-drive-action-buttons-handle-failure-lts-2025
Closed

WEBUI-1916: drive action buttons handle failure [LTS-2025]#3109
swarnadipa-dev wants to merge 6 commits into
lts-2025from
fix-WEBUI-1916-nuuxeo-drive-action-buttons-handle-failure-lts-2025

Conversation

@swarnadipa-dev

Copy link
Copy Markdown
Contributor

@swarnadipa-dev swarnadipa-dev requested a review from a team as a code owner May 7, 2026 06:09
@swarnadipa-dev swarnadipa-dev requested review from Nishant0928, Copilot and naveen-konda and removed request for a team, Nishant0928 and naveen-konda May 7, 2026 06:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses WEBUI-1916 by improving Nuxeo Drive action buttons’ failure handling: Drive protocol navigation is routed through a shared helper that heuristically detects whether Drive is installed, and action buttons now surface clearer error feedback instead of silently failing.

Changes:

  • Added a shared openDriveUrl protocol handler utility (focus/blur + timeout heuristic) and adopted it in Drive upload/edit/download buttons.
  • Added new i18n keys/messages for Drive action failure cases.
  • Added/expanded unit tests for the protocol handler and Drive buttons, with shared test helpers to reduce duplication.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
i18n/messages.json Adds new Drive-related error message keys for upload/edit failures and URL-length validation.
addons/nuxeo-drive/elements/nuxeo-drive-protocol-handler.js Introduces a shared helper to open nxdrive:// URLs and decide when to show the “install Drive” dialog.
addons/nuxeo-drive/elements/nuxeo-drive-upload-button.js Uses shared protocol handler, adds toast-based error reporting, and compresses direct-transfer URLs with length guarding.
addons/nuxeo-drive/elements/nuxeo-drive-edit-button.js Adds token fetch failure handling, toast-based error reporting, and routes protocol opens through the shared handler.
addons/nuxeo-drive/elements/nuxeo-drive-download-button.js Routes protocol opens through shared handler and improves error creation for server URL too-long cases.
addons/nuxeo-drive/test/nuxeo-drive-test-helpers.js Adds shared i18n/bootstrap, async helpers, toast stubs, and reusable test suites for Drive button tests.
addons/nuxeo-drive/test/nuxeo-drive-protocol-handler.test.js Adds focused unit tests for focus/blur timeout heuristics and navigateTo DOM behavior.
addons/nuxeo-drive/test/nuxeo-drive-upload-button.test.js Adds upload button coverage for error handling and URL compression behavior.
addons/nuxeo-drive/test/nuxeo-drive-edit-button.test.js Adds edit button coverage for error handling and availability/null guards.
addons/nuxeo-drive/test/nuxeo-drive-download-button.test.js Significantly expands coverage for selection handling (including select-all + deselection) and download guard/error paths.
Comments suppressed due to low confidence (1)

addons/nuxeo-drive/test/nuxeo-drive-download-button.test.js:459

  • This file still contains an entire duplicated block of i18n assignments and a second suite('nuxeo-drive-download-button', ...) starting here. This will run the same tests twice and can introduce flakiness/extra runtime. Remove the leftover block (roughly from this point to EOF) so the file only defines the suite once.
window.nuxeo.I18n.en['driveDownload.directTransfer.failed'] =
  'An error occurred while trying to download the document with Nuxeo Drive.';
window.nuxeo.I18n.en['driveEditButton.dialog.heading'] = 'Download Nuxeo Drive Client';
window.nuxeo.I18n.en['command.close'] = 'Close';

Comment thread addons/nuxeo-drive/test/nuxeo-drive-shared-suites.test.js
Comment thread addons/nuxeo-drive/test/nuxeo-drive-upload-button.test.js Outdated
Comment thread addons/nuxeo-drive/test/nuxeo-drive-upload-button.test.js
Comment thread addons/nuxeo-drive/test/nuxeo-drive-download-button.test.js
Comment thread addons/nuxeo-drive/test/nuxeo-drive-edit-button.test.js
Comment thread addons/nuxeo-drive/test/nuxeo-drive-upload-button.test.js
@swarnadipa-dev swarnadipa-dev changed the title WEBUI-1916: drive action buttons handle failure WEBUI-1916: drive action buttons handle failure [LTS-2025] May 7, 2026
@swarnadipa-dev swarnadipa-dev force-pushed the fix-WEBUI-1916-nuuxeo-drive-action-buttons-handle-failure-lts-2025 branch from a45f19d to 4514339 Compare May 20, 2026 06:05
- Add _isAvailable branch tests for upload-button (null, undefined, permission, facet, proxy)
- Add _isAvailable fallback tests for download-button (empty selectedItems/items)
- Add err.userMessage error path test for download-button
- Add dialog-already-opened guard tests for no-token path (upload + download)
- Add _openDriveUrl callback guard tests (cancelRef, dialog.opened)
- Add Firefox UA test for protocol-handler (skips onFocusAfterOpened)
- Add show() idempotency test for protocol-handler
- Format all source and test files with Prettier
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants