feat: add tooltip support to jetbrains module (#421)

## Description

In this pull request we're updating the JetBrains module to support the
tooltip field added as requested in
https://github.com/coder/coder/pull/19781#pullrequestreview-3214217375

## Type of Change

- [ ] New module
- [ ] Bug fix
- [x] Feature/enhancement
- [ ] Documentation
- [ ] Other

## Module Information

<!-- Delete this section if not applicable -->

**Path:** `registry/coder/modules/jetbrains`  
**New version:** `v1.1.0`  
**Breaking change:** [ ] Yes [x] No

## Testing & Validation

- [x] Tests pass (`bun test`)
- [x] Code formatted (`bun run fmt`)
- [x] Changes tested locally

## Related Issues

https://github.com/coder/coder/issues/18431

---------

Co-authored-by: Benjamin Peinhardt <61021968+bcpeinhardt@users.noreply.github.com>
This commit is contained in:
Rafael Rodriguez 2025-09-22 13:29:12 -05:00 committed by GitHub
parent 6af8508bc0
commit f0045397d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 98 additions and 6 deletions

View File

@ -14,9 +14,10 @@ This module adds JetBrains IDE buttons to launch IDEs directly from the dashboar
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
# tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button." # Optional
}
```
@ -39,7 +40,7 @@ When `default` contains IDE codes, those IDEs are created directly without user
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
default = ["PY", "IU"] # Pre-configure GoLand and IntelliJ IDEA
@ -52,7 +53,7 @@ module "jetbrains" {
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
# Show parameter with limited options
@ -66,7 +67,7 @@ module "jetbrains" {
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
default = ["IU", "PY"]
@ -81,7 +82,7 @@ module "jetbrains" {
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/workspace/project"
@ -107,7 +108,7 @@ module "jetbrains" {
module "jetbrains_pycharm" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.0.3"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/workspace/project"
@ -119,6 +120,22 @@ module "jetbrains_pycharm" {
}
```
### Custom Tooltip
Add helpful tooltip text that appears when users hover over the IDE app buttons:
```tf
module "jetbrains" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/jetbrains/coder"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
default = ["IU", "PY"]
tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button."
}
```
## Behavior
### Parameter vs Direct Apps
@ -132,6 +149,13 @@ module "jetbrains_pycharm" {
- If the API is unreachable (air-gapped environments), the module automatically falls back to build numbers from `ide_config`
- `major_version` and `channel` control which API endpoint is queried (when API access is available)
### Tooltip
- **`tooltip`**: Optional markdown text displayed when hovering over IDE app buttons
- If not specified, no tooltip is shown
- Supports markdown formatting for rich text (bold, italic, links, etc.)
- All IDE apps created by this module will show the same tooltip text
## Supported IDEs
All JetBrains IDEs with remote development capabilities:

View File

@ -129,3 +129,34 @@ run "app_order_when_default_not_empty" {
error_message = "Expected coder_app order to be set to 10"
}
}
run "tooltip_when_provided" {
command = plan
variables {
agent_id = "foo"
folder = "/home/coder"
default = ["GO"]
tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button."
}
assert {
condition = anytrue([for app in values(resource.coder_app.jetbrains) : app.tooltip == "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button."])
error_message = "Expected coder_app tooltip to be set when provided"
}
}
run "tooltip_null_when_not_provided" {
command = plan
variables {
agent_id = "foo"
folder = "/home/coder"
default = ["GO"]
}
assert {
condition = anytrue([for app in values(resource.coder_app.jetbrains) : app.tooltip == null])
error_message = "Expected coder_app tooltip to be null when not provided"
}
}

View File

@ -276,6 +276,36 @@ describe("jetbrains", async () => {
);
expect(parameter?.instances[0].attributes.order).toBe(5);
});
it("should set tooltip when specified", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
folder: "/home/coder",
default: '["GO"]',
tooltip:
"You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button.",
});
const coder_app = state.resources.find(
(res) => res.type === "coder_app" && res.name === "jetbrains",
);
expect(coder_app?.instances[0].attributes.tooltip).toBe(
"You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button.",
);
});
it("should have null tooltip when not specified", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
folder: "/home/coder",
default: '["GO"]',
});
const coder_app = state.resources.find(
(res) => res.type === "coder_app" && res.name === "jetbrains",
);
expect(coder_app?.instances[0].attributes.tooltip).toBeNull();
});
});
// URL Generation Tests

View File

@ -59,6 +59,12 @@ variable "coder_parameter_order" {
default = null
}
variable "tooltip" {
type = string
description = "Markdown text that is displayed when hovering over workspace apps."
default = null
}
variable "major_version" {
type = string
description = "The major version of the IDE. i.e. 2025.1"
@ -232,6 +238,7 @@ resource "coder_app" "jetbrains" {
external = true
order = var.coder_app_order
group = var.group
tooltip = var.tooltip
url = join("", [
"jetbrains://gateway/coder?&workspace=", # requires 2.6.3+ version of Toolbox
data.coder_workspace.me.name,