fix: hide retry without a live target
This commit is contained in:
@@ -134,6 +134,13 @@ describe("DemoRunLaunchControl", () => {
|
||||
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", () => {
|
||||
renderControl({ status: checkingStatus, liveTargetReady: false });
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ export const DemoRunLaunchControl = ({
|
||||
? "Run prepared workflow"
|
||||
: "Play replay walkthrough";
|
||||
const canLaunch = launchLive ? timelineAgent.canRunLive : timelineAgent.canRun;
|
||||
const canRetryLive = status.kind !== "replay" || liveTargetReady;
|
||||
const statusLabel = liveTargetReady ? "Live target ready" : status.label;
|
||||
const statusDetail = liveTargetReady && status.kind === "replay"
|
||||
? "Direct view is replay; launch starts live operations."
|
||||
@@ -56,14 +57,16 @@ export const DemoRunLaunchControl = ({
|
||||
>
|
||||
{launchLabel}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="demo-run-launch-control__retry"
|
||||
onClick={retryHealth}
|
||||
disabled={isChecking}
|
||||
>
|
||||
Retry live service
|
||||
</button>
|
||||
{canRetryLive ? (
|
||||
<button
|
||||
type="button"
|
||||
className="demo-run-launch-control__retry"
|
||||
onClick={retryHealth}
|
||||
disabled={isChecking}
|
||||
>
|
||||
Retry live service
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user