- Notifications
You must be signed in to change notification settings - Fork1k
feat(site): add support for external agents in the UI and extend CodeExample#19288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
kacpersaw commentedAug 11, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
d0f7fd7
to5ea333a
Compare1d9ad42
to2b42673
Compare5ea333a
tobd266b3
Compare2b42673
to039892b
Comparebd266b3
tob91a963
Comparee1fd6e8
toe7e9376
Compareb65b376
tod9d2161
Compared36771a
tocec9a8d
Compared9d2161
to2177e0d
Comparecec9a8d
toac11687
Compare2177e0d
to43a2123
Compare43a2123
to9a26156
Compareac11687
to515fd53
Comparef12ed83
to64b9a7a
Comparece5c3e0
tod5f8141
Compare64b9a7a
to956e5fb
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
a word of warning: if you implement your own react data fetching youwill implement it incorrectly. it is deceptively hard. please use react-query instead. tell your friends. 👻
useEffect(()=>{ | ||
if( | ||
isExternalAgent&& | ||
(agent.status==="timeout"||agent.status==="connecting") | ||
){ | ||
API.getWorkspaceAgentCredentials(workspace.id,agent.name) | ||
.then((res)=>{ | ||
setExternalAgentToken(res.agent_token); | ||
setCommand(res.command); | ||
}) | ||
.catch((err)=>{ | ||
displayError( | ||
getErrorMessage(err,"Failed to get external agent credentials"), | ||
); | ||
}); | ||
} | ||
},[isExternalAgent,agent.status,workspace.id,agent.name]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
useuseQuery
for this. you can look at plenty of examples in the api/queries/ folder.
); | ||
const[command,setCommand]=useState<string|null>(null); | ||
constorigin=isChromatic() ?"https://example.com" :window.location.origin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
we should use the deployment config value here instead
const { deploymentConfig } = useDeploymentConfig();deploymentConfig.config.access_url
constshouldDisplayAgentApps= | ||
(agent.status==="connected"&&hasAppsToDisplay)|| | ||
agent.status==="connecting"; | ||
(agent.status==="connecting"&&!isExternalAgent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
why do we only hide them while connecting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
bf67f24
tod67eace
Compared5f8141
toae3f780
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
looks great now! thank you!
kacpersaw commentedAug 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Merge activity
|
7b3c5d6
to044076a
Compare7f72067
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This pull request introduces support for external workspace management, allowing users to register and manage workspaces that are provisioned and managed outside of the Coder.