Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,18 @@ function descriptionHtml(exec) {
var desc = exec.description || "";
var basePath = uiRoot + appBasePath;
var url = basePath + "/SQL/execution/?id=" + exec.id;
var link;
if (desc.length > 100) {
var short = escapeHtml(desc.substring(0, 100)) + "...";
return '<a href="' + url + '" title="' + escapeHtml(desc) + '">' +
link = '<a href="' + url + '" title="' + escapeHtml(desc) + '">' +
short + '</a>';
} else {
link = '<a href="' + url + '">' + (escapeHtml(desc) || exec.id) + '</a>';
}
return '<a href="' + url + '">' + (escapeHtml(desc) || exec.id) + '</a>';
var copyBtn = '<button class="btn btn-sm btn-outline-secondary ms-1 copy-sql-btn" ' +
'type="button" title="Copy SQL to clipboard" ' +
'data-sql="' + escapeHtml(desc) + '">&#x1f4cb;</button>';
return link + copyBtn;
}

// Remove client-side filter — status filtering is now server-side
Expand Down Expand Up @@ -227,6 +233,15 @@ $(document).ready(function () {
table.draw();
});

// Copy SQL to clipboard via delegated handler on the DataTable
$("#sql-table").on("click", ".copy-sql-btn", function (e) {
e.stopPropagation();
var sql = $(this).attr("data-sql");
if (sql) {
navigator.clipboard.writeText(sql);
}
});

} // end init

if (appId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,20 @@ document.addEventListener("DOMContentLoaded", function () {
renderPlanViz();
}

// Copy SQL description to clipboard
var copySqlBtn = document.getElementById("copy-sql-btn");
if (copySqlBtn) {
copySqlBtn.addEventListener("click", function () {
var sqlEl = document.getElementById("sql-description");
var text = sqlEl ? sqlEl.textContent : "";
navigator.clipboard.writeText(text.trim()).then(function () {
if (typeof showToast === "function") {
showToast("SQL copied to clipboard", "success");
}
});
});
}

// Copy physical plan text to clipboard
var copyPlanBtn = document.getElementById("copy-plan-btn");
if (copyPlanBtn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ class ExecutionPage(parent: SQLTab) extends WebUIPage("execution") with Logging
<label for="plan-viz-format-select">
<a id="plan-viz-download-btn" class="downloadbutton">Download</a>
</label>
<button id="copy-plan-btn" class="btn btn-sm btn-outline-secondary ms-2"
<button id="copy-sql-btn" class="btn btn-sm btn-outline-secondary ms-2"
type="button" title="Copy SQL to clipboard">
&#x1f4cb; Copy SQL</button>
<button id="copy-plan-btn" class="btn btn-sm btn-outline-secondary ms-1"
type="button" title="Copy physical plan to clipboard">
&#x1f4cb; Copy Plan</button>
<button id="copy-link-btn" class="btn btn-sm btn-outline-secondary ms-1"
Expand All @@ -111,11 +114,17 @@ class ExecutionPage(parent: SQLTab) extends WebUIPage("execution") with Logging
</div>
</div>

val sqlDescription =
<div id="sql-description" style="display:none">
{executionUIData.description}
</div>

val metrics = sqlStore.executionMetrics(executionId)
val graph = sqlStore.planGraph(executionId)
val configs = Option(executionUIData.modifiedConfigs).getOrElse(Map.empty)

summary ++
sqlDescription ++
planVisualization(request, metrics, graph) ++
physicalPlanDescription(executionUIData.physicalPlanDescription) ++
jobsTable(request, executionUIData) ++
Expand Down