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: enable multiple IDE buttons in JetBrains #339

Open
wants to merge 6 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.

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.

@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
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