fix(site): Hide agent lifecycle unless opted in via `delay_login_until_ready` (#5850)

Refs: #5835, #5749
This commit is contained in:
Mathias Fredriksson 2023-01-25 15:23:31 +02:00 committed by GitHub
parent 78ede50be8
commit 5c5ddc6b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 16 deletions

View File

@ -135,22 +135,32 @@ const StartErrorLifecycle: React.FC<{
const ConnectedStatus: React.FC<{
agent: WorkspaceAgent
}> = ({ agent }) => {
return (
<ChooseOne>
<Cond condition={agent.lifecycle_state === "ready"}>
<ReadyLifeCycle />
</Cond>
<Cond condition={agent.lifecycle_state === "start_timeout"}>
<StartTimeoutLifecycle agent={agent} />
</Cond>
<Cond condition={agent.lifecycle_state === "start_error"}>
<StartErrorLifecycle agent={agent} />
</Cond>
<Cond>
<StartingLifecycle />
</Cond>
</ChooseOne>
)
// NOTE(mafredri): Keep this behind feature flag for the time-being,
// if delay_login_until_ready is true, the user has updated to
// terraform-provider-coder v0.6.7 and opted in to the functionality.
//
// Remove check once documentation is in place and we do a breaking
// release indicating startup script behavior has changed.
// https://github.com/coder/coder/issues/5749
if (agent.delay_login_until_ready) {
return (
<ChooseOne>
<Cond condition={agent.lifecycle_state === "ready"}>
<ReadyLifeCycle />
</Cond>
<Cond condition={agent.lifecycle_state === "start_timeout"}>
<StartTimeoutLifecycle agent={agent} />
</Cond>
<Cond condition={agent.lifecycle_state === "start_error"}>
<StartErrorLifecycle agent={agent} />
</Cond>
<Cond>
<StartingLifecycle />
</Cond>
</ChooseOne>
)
}
return <ReadyLifeCycle />
}
const DisconnectedStatus: React.FC = () => {