Open Merge and Discard confirmations beside their buttons
This commit is contained in:
Vendored
+5
-4
@@ -79,6 +79,7 @@ function taskHead(rerender) {
|
||||
const busy = sess?.state === "running" || sess?.state === "queued";
|
||||
const held = task.merge_queued_at !== undefined;
|
||||
const merge = h("button", {
|
||||
class: "merge-button",
|
||||
disabled: busy || held || unmerged?.taskId !== task.id || !unmerged.has,
|
||||
title: held
|
||||
? "Waiting for the merge in progress in this project to finish"
|
||||
@@ -97,7 +98,7 @@ function taskHead(rerender) {
|
||||
}
|
||||
};
|
||||
const discard = h("button", { class: "danger", disabled: busy, title: "Delete the worktree and branch without merging" }, "Discard");
|
||||
discard.onclick = () => confirmThen(`Discard "${task.title}"?`, "Discard", true, async () => {
|
||||
discard.onclick = () => confirmThen(`Discard "${task.title}"?`, "Discard", true, discard, async () => {
|
||||
await post("/api/tasks/{taskId}/discard", { path: { taskId: task.id } });
|
||||
await setFocus({ task_id: null });
|
||||
});
|
||||
@@ -906,7 +907,7 @@ export async function confirmMerge(taskId) {
|
||||
void showAlert(errorText(err));
|
||||
return;
|
||||
}
|
||||
await confirmThen(mergeQuestion(task.merge_title, target, coAuthors), "Merge", false, async () => {
|
||||
await confirmThen(mergeQuestion(task.merge_title, target, coAuthors), "Merge", false, document.querySelector(".merge-button"), async () => {
|
||||
await post("/api/tasks/{taskId}/merge", { path: { taskId } });
|
||||
});
|
||||
}
|
||||
@@ -922,8 +923,8 @@ function mergeQuestion(title, target, coAuthors) {
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
async function confirmThen(question, action, danger, act) {
|
||||
if (!(await showConfirm(question, action, danger))) {
|
||||
async function confirmThen(question, action, danger, anchor, act) {
|
||||
if (!(await showConfirm(question, action, danger, anchor))) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user