-
Notifications
You must be signed in to change notification settings - Fork 968
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d0f7fd7 to
5ea333a
Compare
1d9ad42 to
2b42673
Compare
5ea333a to
bd266b3
Compare
2b42673 to
039892b
Compare
bd266b3 to
b91a963
Compare
e1fd6e8 to
e7e9376
Compare
b65b376 to
d9d2161
Compare
d36771a to
cec9a8d
Compare
d9d2161 to
2177e0d
Compare
cec9a8d to
ac11687
Compare
2177e0d to
43a2123
Compare
43a2123 to
9a26156
Compare
ac11687 to
515fd53
Compare
f12ed83 to
64b9a7a
Compare
ce5c3e0 to
d5f8141
Compare
64b9a7a to
956e5fb
Compare
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.
a word of warning: if you implement your own react data fetching you will 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.
use useQuery for this. you can look at plenty of examples in the api/queries/ folder.
| ); | ||
| const [command, setCommand] = useState<string | null>(null); | ||
|
|
||
| const origin = 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
| const shouldDisplayAgentApps = | ||
| (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 to
d67eace
Compare
d5f8141 to
ae3f780
Compare
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.
looks great now! thank you!
Merge activity
|
7b3c5d6 to
044076a
Compare



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.