Skip to content

Commit 1f027a7

Browse files
committed
on second thought just show the connecting thing when starting
1 parent 2698f33 commit 1f027a7

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

app/pages/project/instances/instance/SerialConsolePage.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,16 @@ export function SerialConsolePage() {
147147
</Link>
148148

149149
<div className="gutter relative w-full shrink grow overflow-hidden">
150-
{connectionStatus === 'connecting' && <ConnectingSkeleton />}
150+
{
151+
// show connecting state if we are either actually connecting (which
152+
// is usually extremely quick) or waiting for the instance to start
153+
(connectionStatus === 'connecting' ||
154+
(connectionStatus === 'closed' && isStarting(instanceData))) && (
155+
<ConnectingSkeleton />
156+
)
157+
}
151158
{connectionStatus === 'error' && <ErrorSkeleton />}
152-
{connectionStatus === 'closed' && !canConnect && (
159+
{connectionStatus === 'closed' && !canConnect && !isStarting(instanceData) && (
153160
<CannotConnect instance={instanceData} />
154161
)}
155162
{/* closed && canConnect shouldn't be possible because there's no way to
@@ -222,10 +229,8 @@ const CannotConnect = ({ instance }: { instance: Instance }) => (
222229
<span>The instance is </span>
223230
<InstanceStatusBadge className="ml-1.5" status={instance.runState} />
224231
</p>
225-
<p className="mt-2 text-center text-secondary">
226-
{isStarting(instance)
227-
? 'We will try to connect as soon as the instance starts.'
228-
: 'You can only connect to the serial console on a running instance.'}
232+
<p className="mt-2 text-balance text-center text-secondary">
233+
You can only connect to the serial console on a running instance.
229234
</p>
230235
</SerialSkeleton>
231236
)

test/e2e/instance-serial.e2e.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ test('serial console can connect while starting', async ({ page }) => {
2121
await page.getByRole('tab', { name: 'Connect' }).click()
2222
await page.getByRole('link', { name: 'Connect' }).click()
2323

24-
// The message goes from creating to starting and then disappears once
25-
// the instance is running
26-
await expect(page.getByText('The instance is creating')).toBeVisible()
27-
await expect(page.getByText('We will try to connect')).toBeVisible()
28-
await expect(page.getByText('The instance is starting')).toBeVisible()
29-
await expect(page.getByText('The instance is')).toBeHidden()
24+
// "Connecting" displays and then disappears once the instance is running
25+
const connecting = page.getByText('Connecting to serial console')
26+
await expect(connecting).toBeVisible()
27+
await expect(connecting).toBeHidden()
3028

3129
// Here it would be nice to test that the serial console connects, but we
3230
// can't mock websockets with MSW yet: https://github.com/mswjs/msw/pull/2011

0 commit comments

Comments
 (0)