cxzl25 commented on code in PR #54886:
URL: https://github.com/apache/spark/pull/54886#discussion_r3587163299


##########
sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js:
##########
@@ -699,6 +676,32 @@ document.addEventListener("DOMContentLoaded", function () {
   if (shouldRenderPlanViz()) {
     renderPlanViz();
   }
+
+  // Copy physical plan text to clipboard
+  var copyPlanBtn = document.getElementById("copy-plan-btn");
+  if (copyPlanBtn) {
+    copyPlanBtn.addEventListener("click", function () {
+      var planEl = document.getElementById("physical-plan-details");
+      var text = planEl ? planEl.textContent : "";
+      navigator.clipboard.writeText(text.trim()).then(function () {

Review Comment:
   ```
   spark-sql-viz.js:1089 Uncaught TypeError: Cannot read properties of 
undefined (reading 'writeText')
       at HTMLButtonElement.<anonymous> (spark-sql-viz.js:1089:27)
   ```
   
   writeText can only work under https. If the ui is accessed using http, it 
cannot be copied normally.
   
   https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText
   
   https://stackoverflow.com/a/71876238



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to