Skip to content
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

[DO NOT MERGE] Toolbox refactor #478

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

[DO NOT MERGE] Toolbox refactor #478

wants to merge 11 commits into from

Conversation

code-asher
Copy link
Member

@code-asher code-asher commented Sep 12, 2024

It must not be merged, because we still need to maintain the old plugin.

I kept as much refactoring as I could in the main branch, so the changes here are as minimal as I could make them. It is essentially a loop that polls for workspaces, plus some pages that return fields to implement a sign-in, and then filling out various trivial interfaces, so this PR is pretty simple in the end really.

There are a few TODOs that still need to be addressed. The ones suffixed with @JB are waiting for responses from JetBrains.

You will notice no new tests. There was no documentation on how this was to be done, and I think mocking out the Toolbox portion would be unfortunate because the main part I have concerns about is where we interact with Toolbox, and how it interacts with us, and mocking would remove that interaction. It would be less a concern if I could read their source to validate my mocks though...definitely open to thoughts on all this.

Also, CI is probably broken. Need to look at that later.


```
./gradlew clean runIDE --args="jetbrains-gateway://connect#type=coder&workspace=dev&agent=coder&folder=/home/coder&url=https://dev.coder.com&token=<redacted>&ide_product_code=IU&ide_build_number=223.8836.41&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2022.3.3.tar.gz"
jetbrains://gateway/com.coder.gateway/connect?workspace=dev&agent=coder&url=https://dev.coder.com&token=<redacted>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have to update our gateway module too.
Or should we create a new one to support this workflow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, probably a new one because I think we will have to maintain both standalone Gateway and Toolbox for a while.

I kept our core code intact as much as possible, but this is technically
an entirely different plugin now.
This way, we can show our status labels.
It looks like you have to use the per-environment listener.  My guess is
that they do not update an environment if the ID is the same.  I made
the environment comparable, which also lets use use a set instead.
The rest (publishing) is a todo.
You can now start, stop, and update workspaces.  Since you can start
workspaces yourself now, I marked non-ready states as unreachable, which
prevents JetBrains from overriding with their own text ("disconnected"
and "connected").  So now you will be able to see "stopped", "starting",
and so on.  For the ready states you will still see "disconnected" or
"connected" unfortunately.  Ideally this would be a completely separate
state displayed next to the workspace state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants