mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 20:55:44 +00:00
Offer Shardok profile download on stop (#8772)
This commit is contained in:
@@ -118,7 +118,14 @@ func TestLayoutTemplateIncludesShardokProfileControls(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("read layout: %v", err)
|
||||
}
|
||||
for _, expected := range []string{"shardok-profile-controls", "shardok-profile-dialog"} {
|
||||
for _, expected := range []string{
|
||||
"shardok-profile-controls",
|
||||
"shardok-profile-dialog",
|
||||
"shardok-profile-stop-dialog",
|
||||
"shardokProfileStopWithDownload",
|
||||
"shardokProfileStopOnly",
|
||||
"shardokProfileStopCancel",
|
||||
} {
|
||||
if !strings.Contains(string(layout), expected) {
|
||||
t.Fatalf("layout does not include %q", expected)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,19 @@
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
<!-- Shardok CPU Profile Stop Dialog -->
|
||||
<dialog id="shardok-profile-stop-dialog">
|
||||
<article style="max-width: 400px;">
|
||||
<h3>Stop Shardok CPU Profile</h3>
|
||||
<p>Download the recording after stopping?</p>
|
||||
<footer style="display: flex; gap: 0.5rem; justify-content: flex-end;">
|
||||
<button class="secondary outline" onclick="shardokProfileStopCancel()">Cancel</button>
|
||||
<button class="secondary" onclick="shardokProfileStopOnly()">Stop Only</button>
|
||||
<button onclick="shardokProfileStopWithDownload()">Download & Stop</button>
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
<!-- JFR Stop Dialog -->
|
||||
<dialog id="jfr-stop-dialog">
|
||||
<article style="max-width: 400px;">
|
||||
@@ -211,12 +224,38 @@
|
||||
}
|
||||
|
||||
function stopShardokProfile() {
|
||||
document.getElementById('shardok-profile-stop-dialog').showModal();
|
||||
}
|
||||
|
||||
function shardokProfileStopWithDownload() {
|
||||
document.getElementById('shardok-profile-stop-dialog').close();
|
||||
const downloadWindow = window.open('about:blank', '_blank');
|
||||
htmx.ajax('POST', '/shardok-profile/stop', {
|
||||
target: '#shardok-profile-controls',
|
||||
swap: 'none'
|
||||
}).then(function() {
|
||||
if (downloadWindow) {
|
||||
downloadWindow.location = '/shardok-profile/download';
|
||||
}
|
||||
}).catch(function() {
|
||||
if (downloadWindow) {
|
||||
downloadWindow.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function shardokProfileStopOnly() {
|
||||
document.getElementById('shardok-profile-stop-dialog').close();
|
||||
htmx.ajax('POST', '/shardok-profile/stop', {
|
||||
target: '#shardok-profile-controls',
|
||||
swap: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
function shardokProfileStopCancel() {
|
||||
document.getElementById('shardok-profile-stop-dialog').close();
|
||||
}
|
||||
|
||||
function confirmEagleRestart() {
|
||||
document.getElementById('eagle-restart-dialog').showModal();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user