kkalyan opened a new pull request, #5261:
URL: https://github.com/apache/zeppelin/pull/5261

   ## What is this PR for?
   
   Adds **Copy as TSV** and **Copy as CSV** options to the table result export 
dropdown, in both the Angular (`zeppelin-web-angular`) and classic AngularJS 
(`zeppelin-web`) UIs.
   
   This supersedes and closes #3496 (original implementation by @amakaur, 
2019), ported and extended for the current Angular frontend.
   
   ### Changes
   
   **Angular UI (`zeppelin-web-angular`)**
   - `result.component` — paragraph toolbar dropdown: renamed existing items to 
"Download as CSV/TSV", added divider, then "Copy as TSV" and "Copy as CSV"
   - `table-visualization.component` — inner table Export menu: added "Copy all 
data as TSV/CSV" and "Copy visible data as TSV/CSV" (mirrors the existing 
"Export visible" scope)
   
   **Classic AngularJS UI (`zeppelin-web`)**
   - `result-chart-selector.html` — same dropdown restructure: Download / 
divider / Copy
   - `result.controller.js` — new `$scope.copyToClipboard(delimiter)` function
   
   ### Behaviour
   - Header row (column names) is always included in the copied text
   - Cell values containing the delimiter, double-quotes, or newlines are RFC 
4180 quoted
   - Uses `navigator.clipboard.writeText` with a `document.execCommand('copy')` 
fallback for older browsers
   
   ## What type of PR is it?
   Feature
   
   ## What is the Jira issue?
   https://issues.apache.org/jira/browse/ZEPPELIN-4407
   
   ## How should this be tested?
   
   1. Run a paragraph that outputs a TABLE (e.g. `%sh printf 
"col1\tcol2\na\t1\nb\t2\n"`)
   2. Click the **▾** next to the download button in the paragraph toolbar
   3. Verify the menu shows: **Download as CSV**, **Download as TSV**, 
*(divider)*, **Copy as TSV**, **Copy as CSV**
   4. Click **Copy as TSV** → paste into a spreadsheet app or text editor — 
expect headers + rows, tab-delimited
   5. Click **Copy as CSV** → paste → expect headers + rows, comma-delimited
   6. Test with a cell value containing a comma, e.g. `"hello, world"` → the 
CSV copy should quote it correctly
   
   ## Tests
   
   - **Classic UI (Karma/Jasmine):** 
`zeppelin-web/src/app/notebook/paragraph/result/result.controller.test.js` — 4 
new specs covering TSV copy, CSV copy, delimiter quoting, and double-quote 
escaping
   - **Angular UI (Playwright E2E):** 
`zeppelin-web-angular/e2e/tests/notebook/paragraph/copy-to-clipboard.spec.ts` — 
3 new specs (skipped on CI, require a live interpreter)
   
   ## Questions
   - Does the license file need update? No
   - Is there a breaking change for older versions? No — existing Download as 
CSV/TSV behaviour is unchanged
   - Does this need documentation? No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to