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

feat!(jetbrains-gateway): enable multiple IDE buttons #339

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

matifali
Copy link
Member

@matifali matifali commented Nov 14, 2024

Add support for specifying a list of default IDEs to be displayed on the Workspace page. This allows users to see multiple IDE options simultaneously.

Closes #338

Caution

This introduces a few breaking changes in the module

  1. The input default is now a list(string) instead of string, e.g.
 - default = "GO"
 + default = ["GO"]
  1. All outputs are now of type list(string)
  2. We hide the user choice coder_parameter when there are multiple items in default.

Add support for specifying a list of default IDEs to be displayed on
the Workspace page. This allows users to see multiple IDE options
simultaneously. Ensure no duplicates are included and validate
provided IDE codes against allowed set. Adjust logic to dynamically
render IDE buttons based on specified defaults, improving flexibility
in user interface setup.
- Allow creation of links with multiple IDEs.
- Ensure outputs handle arrays for identifying multiple IDEs.
- Update runTerraformApply to handle array values as JSON strings.
This change improves URL uniqueness by appending a lowercase IDE
identifier to the slug, ensuring distinct slugs for each default IDE.
@matifali matifali requested a review from sreya November 14, 2024 15:02
Comment on lines +203 to 205
// Convert arrays to JSON strings
combinedEnv[`TF_VAR_${key}`] = Array.isArray(value) ? JSON.stringify(value) : String(value);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was needed to support list(string) inputs for tests.

@matifali matifali requested a review from phorcys420 November 14, 2024 15:52
@phorcys420
Copy link
Member

phorcys420 commented Nov 14, 2024

Works on my end, tested using the following snippet:

module "jetbrains_gateway" {
  count  = data.coder_workspace.me.start_count
  source = "git::https://github.com/coder/modules.git//jetbrains-gateway?ref=atif/multi-gateway"

  # JetBrains IDEs to make available for the user to select
  jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
  default        = ["IU", "PY"]

  # Default folder to open when starting a JetBrains IDE
  folder = "/home/coder"

  agent_id   = coder_agent.dev[0].id
  agent_name = "dev"
  order      = 2
}

image

https://dev.coder.com/templates/coder/aws-linux/versions/strange_goldstine7

@matifali matifali linked an issue Nov 15, 2024 that may be closed by this pull request
@matifali matifali changed the title feat: enable multiple IDE buttons in JetBrains feat(jetbrains-gateway): enable multiple IDE, bump to 2024.3 and enable fetching latest Nov 26, 2024
@matifali matifali changed the title feat(jetbrains-gateway): enable multiple IDE, bump to 2024.3 and enable fetching latest feat!(jetbrains-gateway): enable multiple IDE, bump to 2024.3 and enable fetching latest Nov 26, 2024
@matifali matifali requested a review from bpmct November 26, 2024 08:53
@matifali matifali changed the title feat!(jetbrains-gateway): enable multiple IDE, bump to 2024.3 and enable fetching latest feat!(jetbrains-gateway): enable multiple IDE buttons Nov 27, 2024
@@ -14,12 +14,12 @@ This module adds a JetBrains Gateway Button to open any workspace with a single
```tf
module "jetbrains_gateway" {
source = "registry.coder.com/modules/jetbrains-gateway/coder"
version = "1.0.23"
version = "1.0.24"
Copy link
Member

Choose a reason for hiding this comment

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

is there any way to make this ver 1.1.0?
This will immediately break templates using the latest version (version = ">= 1.0.0").
We can fix this by doing version = "~> 1.0.0", which will only update 1.0.x versions, but we don't currently follow semver so that sucks.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Holding it untill we have #157

@sreya sreya removed their request for review November 27, 2024 15:01
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.

Allow multiple IDEs buttons for the jetbrains-gateway module
2 participants