| ... | ... | @@ -87,6 +87,11 @@ export function PullRequestStackMenu({ |
| 87 | 87 | layer.headSha ? [{ number: layer.number, headSha: layer.headSha }] : [], |
| 88 | 88 | ); |
| 89 | 89 | setPending(true); |
| 90 | setConfirmation(null); |
| 91 | const toastId = toastManager.add({ |
| 92 | type: "loading", |
| 93 | title: action === "merge" ? "Merging stack..." : "Rebasing stack...", |
| 94 | }); |
| 90 | 95 | const result = await runAction({ |
| 91 | 96 | environmentId, |
| 92 | 97 | input: { |
| ... | ... | @@ -99,16 +104,15 @@ export function PullRequestStackMenu({ |
| 99 | 104 | }, |
| 100 | 105 | }); |
| 101 | 106 | setPending(false); |
| 102 | | setConfirmation(null); |
| 103 | 107 | onActed(); |
| 104 | 108 | if (result._tag === "Failure") { |
| 105 | | toastManager.add({ |
| 109 | toastManager.update(toastId, { |
| 106 | 110 | type: "error", |
| 107 | | title: "Stack operation did not complete", |
| 111 | title: action === "merge" ? "Could not merge the stack" : "Could not rebase the stack", |
| 108 | 112 | description: String(squashAtomCommandFailure(result)), |
| 109 | 113 | }); |
| 110 | 114 | } else { |
| 111 | | toastManager.add({ |
| 115 | toastManager.update(toastId, { |
| 112 | 116 | type: "success", |
| 113 | 117 | title: action === "merge" ? "Stack merge request completed" : "Stack rebased", |
| 114 | 118 | description: |
| ... | ... | @@ -216,10 +220,10 @@ export function PullRequestStackMenu({ |
| 216 | 220 | <Dialog |
| 217 | 221 | open={confirmation !== null} |
| 218 | 222 | onOpenChange={(value) => { |
| 219 | | if (!value && !pending) setConfirmation(null); |
| 223 | if (!value) setConfirmation(null); |
| 220 | 224 | }} |
| 221 | 225 | > |
| 222 | | <DialogPopup className="max-w-md" showCloseButton={!pending}> |
| 226 | <DialogPopup className="max-w-md"> |
| 223 | 227 | <DialogHeader> |
| 224 | 228 | <DialogTitle> |
| 225 | 229 | {confirmation === "merge" |
| ... | ... | @@ -245,11 +249,11 @@ export function PullRequestStackMenu({ |
| 245 | 249 | </ul> |
| 246 | 250 | </DialogPanel> |
| 247 | 251 | <DialogFooter> |
| 248 | | <Button variant="outline" disabled={pending} onClick={() => setConfirmation(null)}> |
| 252 | <Button variant="outline" onClick={() => setConfirmation(null)}> |
| 249 | 253 | Cancel |
| 250 | 254 | </Button> |
| 251 | | <Button disabled={pending} onClick={() => void run()}> |
| 252 | | {pending ? "Working…" : confirmation === "merge" ? "Merge stack" : "Rebase stack"} |
| 255 | <Button onClick={() => void run()}> |
| 256 | {confirmation === "merge" ? "Merge stack" : "Rebase stack"} |
| 253 | 257 | </Button> |
| 254 | 258 | </DialogFooter> |
| 255 | 259 | </DialogPopup> |