diff --git a/registry/coder/modules/jetbrains/README.md b/registry/coder/modules/jetbrains/README.md index 5a9bd7ae7..ef19ec20c 100644 --- a/registry/coder/modules/jetbrains/README.md +++ b/registry/coder/modules/jetbrains/README.md @@ -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: diff --git a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl index e5c00a78e..7676c34f7 100644 --- a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl +++ b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl @@ -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" + } +} diff --git a/registry/coder/modules/jetbrains/main.test.ts b/registry/coder/modules/jetbrains/main.test.ts index 73f7650d8..0acf2ec2b 100644 --- a/registry/coder/modules/jetbrains/main.test.ts +++ b/registry/coder/modules/jetbrains/main.test.ts @@ -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 diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index e4f5ec356..d33fc6b2c 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -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,