fix: hide retry without a live target

This commit is contained in:
lda
2026-07-12 11:11:30 +07:00 Verified
parent 173e9f8803
commit 429c3e6c2c
2 changed files with 18 additions and 8 deletions
@@ -134,6 +134,13 @@ describe("DemoRunLaunchControl", () => {
expect(retry).toHaveBeenCalledOnce(); expect(retry).toHaveBeenCalledOnce();
}); });
it("does not offer retry when no live target is configured", () => {
renderControl({ status: replayStatus, liveTargetReady: false });
expect(screen.getByRole("button", { name: "Play replay walkthrough" })).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Retry live service" })).not.toBeInTheDocument();
});
it("keeps the action visible but disabled while health is checking", () => { it("keeps the action visible but disabled while health is checking", () => {
renderControl({ status: checkingStatus, liveTargetReady: false }); renderControl({ status: checkingStatus, liveTargetReady: false });
@@ -30,6 +30,7 @@ export const DemoRunLaunchControl = ({
? "Run prepared workflow" ? "Run prepared workflow"
: "Play replay walkthrough"; : "Play replay walkthrough";
const canLaunch = launchLive ? timelineAgent.canRunLive : timelineAgent.canRun; const canLaunch = launchLive ? timelineAgent.canRunLive : timelineAgent.canRun;
const canRetryLive = status.kind !== "replay" || liveTargetReady;
const statusLabel = liveTargetReady ? "Live target ready" : status.label; const statusLabel = liveTargetReady ? "Live target ready" : status.label;
const statusDetail = liveTargetReady && status.kind === "replay" const statusDetail = liveTargetReady && status.kind === "replay"
? "Direct view is replay; launch starts live operations." ? "Direct view is replay; launch starts live operations."
@@ -56,14 +57,16 @@ export const DemoRunLaunchControl = ({
> >
{launchLabel} {launchLabel}
</button> </button>
<button {canRetryLive ? (
type="button" <button
className="demo-run-launch-control__retry" type="button"
onClick={retryHealth} className="demo-run-launch-control__retry"
disabled={isChecking} onClick={retryHealth}
> disabled={isChecking}
Retry live service >
</button> Retry live service
</button>
) : null}
</div> </div>
</section> </section>
); );