Start Shardok profiling without confirmation (#8781)

This commit is contained in:
2026-07-24 22:30:37 -07:00
committed by GitHub
parent 4950bd3609
commit 4e59580d5e
2 changed files with 10 additions and 19 deletions
@@ -120,7 +120,7 @@ func TestLayoutTemplateIncludesShardokProfileControls(t *testing.T) {
}
for _, expected := range []string{
"shardok-profile-controls",
"shardok-profile-dialog",
`onclick="startShardokProfile()"`,
"shardok-profile-stop-dialog",
"shardokProfileStopWithDownload",
"shardokProfileStopOnly",
@@ -130,4 +130,12 @@ func TestLayoutTemplateIncludesShardokProfileControls(t *testing.T) {
t.Fatalf("layout does not include %q", expected)
}
}
for _, unwanted := range []string{
"shardok-profile-dialog",
"showShardokProfileDialog",
} {
if strings.Contains(string(layout), unwanted) {
t.Fatalf("layout unexpectedly includes %q", unwanted)
}
}
}
@@ -50,18 +50,6 @@
</article>
</dialog>
<!-- Shardok CPU Profile Dialog -->
<dialog id="shardok-profile-dialog">
<article style="max-width: 440px;">
<h3>Record Shardok CPU Profile</h3>
<p>The recording runs until you stop it, or automatically stops after one hour or 100 MB.</p>
<footer style="display: flex; gap: 0.5rem; justify-content: flex-end;">
<button class="secondary outline" onclick="document.getElementById('shardok-profile-dialog').close()">Cancel</button>
<button onclick="startShardokProfile()">Start</button>
</footer>
</article>
</dialog>
<!-- Shardok CPU Profile Stop Dialog -->
<dialog id="shardok-profile-stop-dialog">
<article style="max-width: 400px;">
@@ -199,7 +187,7 @@
: '';
container.innerHTML = `
<span class="jfr-status jfr-off">Shardok CPU: ${data.profile_available ? 'READY' : 'OFF'}</span>
<button onclick="showShardokProfileDialog()" class="btn-small">Start</button>
<button onclick="startShardokProfile()" class="btn-small">Start</button>
${download}
`;
}
@@ -211,12 +199,7 @@
return element.innerHTML;
}
function showShardokProfileDialog() {
document.getElementById('shardok-profile-dialog').showModal();
}
function startShardokProfile() {
document.getElementById('shardok-profile-dialog').close();
htmx.ajax('POST', '/shardok-profile/start', {
target: '#shardok-profile-controls',
swap: 'none'