Skip to content

Commit f004539

Browse files
Rafael Rodriguezbcpeinhardt
andauthored
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 coder/coder#19781 (review) ## 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 coder/coder#18431 --------- Co-authored-by: Benjamin Peinhardt <61021968+bcpeinhardt@users.noreply.github.com>
1 parent 6af8508 commit f004539

File tree

4 files changed

+98
-6
lines changed

4 files changed

+98
-6
lines changed

registry/coder/modules/jetbrains/README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ This module adds JetBrains IDE buttons to launch IDEs directly from the dashboar
1414
module "jetbrains" {
1515
count = data.coder_workspace.me.start_count
1616
source = "registry.coder.com/coder/jetbrains/coder"
17-
version = "1.0.3"
17+
version = "1.1.0"
1818
agent_id = coder_agent.example.id
1919
folder = "/home/coder/project"
20+
# tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button." # Optional
2021
}
2122
```
2223

@@ -39,7 +40,7 @@ When `default` contains IDE codes, those IDEs are created directly without user
3940
module "jetbrains" {
4041
count = data.coder_workspace.me.start_count
4142
source = "registry.coder.com/coder/jetbrains/coder"
42-
version = "1.0.3"
43+
version = "1.1.0"
4344
agent_id = coder_agent.example.id
4445
folder = "/home/coder/project"
4546
default = ["PY", "IU"] # Pre-configure GoLand and IntelliJ IDEA
@@ -52,7 +53,7 @@ module "jetbrains" {
5253
module "jetbrains" {
5354
count = data.coder_workspace.me.start_count
5455
source = "registry.coder.com/coder/jetbrains/coder"
55-
version = "1.0.3"
56+
version = "1.1.0"
5657
agent_id = coder_agent.example.id
5758
folder = "/home/coder/project"
5859
# Show parameter with limited options
@@ -66,7 +67,7 @@ module "jetbrains" {
6667
module "jetbrains" {
6768
count = data.coder_workspace.me.start_count
6869
source = "registry.coder.com/coder/jetbrains/coder"
69-
version = "1.0.3"
70+
version = "1.1.0"
7071
agent_id = coder_agent.example.id
7172
folder = "/home/coder/project"
7273
default = ["IU", "PY"]
@@ -81,7 +82,7 @@ module "jetbrains" {
8182
module "jetbrains" {
8283
count = data.coder_workspace.me.start_count
8384
source = "registry.coder.com/coder/jetbrains/coder"
84-
version = "1.0.3"
85+
version = "1.1.0"
8586
agent_id = coder_agent.example.id
8687
folder = "/workspace/project"
8788
@@ -107,7 +108,7 @@ module "jetbrains" {
107108
module "jetbrains_pycharm" {
108109
count = data.coder_workspace.me.start_count
109110
source = "registry.coder.com/coder/jetbrains/coder"
110-
version = "1.0.3"
111+
version = "1.1.0"
111112
agent_id = coder_agent.example.id
112113
folder = "/workspace/project"
113114
@@ -119,6 +120,22 @@ module "jetbrains_pycharm" {
119120
}
120121
```
121122

123+
### Custom Tooltip
124+
125+
Add helpful tooltip text that appears when users hover over the IDE app buttons:
126+
127+
```tf
128+
module "jetbrains" {
129+
count = data.coder_workspace.me.start_count
130+
source = "registry.coder.com/coder/jetbrains/coder"
131+
version = "1.1.0"
132+
agent_id = coder_agent.example.id
133+
folder = "/home/coder/project"
134+
default = ["IU", "PY"]
135+
tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button."
136+
}
137+
```
138+
122139
## Behavior
123140

124141
### Parameter vs Direct Apps
@@ -132,6 +149,13 @@ module "jetbrains_pycharm" {
132149
- If the API is unreachable (air-gapped environments), the module automatically falls back to build numbers from `ide_config`
133150
- `major_version` and `channel` control which API endpoint is queried (when API access is available)
134151

152+
### Tooltip
153+
154+
- **`tooltip`**: Optional markdown text displayed when hovering over IDE app buttons
155+
- If not specified, no tooltip is shown
156+
- Supports markdown formatting for rich text (bold, italic, links, etc.)
157+
- All IDE apps created by this module will show the same tooltip text
158+
135159
## Supported IDEs
136160

137161
All JetBrains IDEs with remote development capabilities:

registry/coder/modules/jetbrains/jetbrains.tftest.hcl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,34 @@ run "app_order_when_default_not_empty" {
129129
error_message = "Expected coder_app order to be set to 10"
130130
}
131131
}
132+
133+
run "tooltip_when_provided" {
134+
command = plan
135+
136+
variables {
137+
agent_id = "foo"
138+
folder = "/home/coder"
139+
default = ["GO"]
140+
tooltip = "You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button."
141+
}
142+
143+
assert {
144+
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."])
145+
error_message = "Expected coder_app tooltip to be set when provided"
146+
}
147+
}
148+
149+
run "tooltip_null_when_not_provided" {
150+
command = plan
151+
152+
variables {
153+
agent_id = "foo"
154+
folder = "/home/coder"
155+
default = ["GO"]
156+
}
157+
158+
assert {
159+
condition = anytrue([for app in values(resource.coder_app.jetbrains) : app.tooltip == null])
160+
error_message = "Expected coder_app tooltip to be null when not provided"
161+
}
162+
}

registry/coder/modules/jetbrains/main.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,36 @@ describe("jetbrains", async () => {
276276
);
277277
expect(parameter?.instances[0].attributes.order).toBe(5);
278278
});
279+
280+
it("should set tooltip when specified", async () => {
281+
const state = await runTerraformApply(import.meta.dir, {
282+
agent_id: "foo",
283+
folder: "/home/coder",
284+
default: '["GO"]',
285+
tooltip:
286+
"You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button.",
287+
});
288+
289+
const coder_app = state.resources.find(
290+
(res) => res.type === "coder_app" && res.name === "jetbrains",
291+
);
292+
expect(coder_app?.instances[0].attributes.tooltip).toBe(
293+
"You need to [Install Coder Desktop](https://coder.com/docs/user-guides/desktop#install-coder-desktop) to use this button.",
294+
);
295+
});
296+
297+
it("should have null tooltip when not specified", async () => {
298+
const state = await runTerraformApply(import.meta.dir, {
299+
agent_id: "foo",
300+
folder: "/home/coder",
301+
default: '["GO"]',
302+
});
303+
304+
const coder_app = state.resources.find(
305+
(res) => res.type === "coder_app" && res.name === "jetbrains",
306+
);
307+
expect(coder_app?.instances[0].attributes.tooltip).toBeNull();
308+
});
279309
});
280310

281311
// URL Generation Tests

registry/coder/modules/jetbrains/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ variable "coder_parameter_order" {
5959
default = null
6060
}
6161

62+
variable "tooltip" {
63+
type = string
64+
description = "Markdown text that is displayed when hovering over workspace apps."
65+
default = null
66+
}
67+
6268
variable "major_version" {
6369
type = string
6470
description = "The major version of the IDE. i.e. 2025.1"
@@ -232,6 +238,7 @@ resource "coder_app" "jetbrains" {
232238
external = true
233239
order = var.coder_app_order
234240
group = var.group
241+
tooltip = var.tooltip
235242
url = join("", [
236243
"jetbrains://gateway/coder?&workspace=", # requires 2.6.3+ version of Toolbox
237244
data.coder_workspace.me.name,

0 commit comments

Comments
 (0)