Skip to content

Commit

Permalink
feat: updating the custom endpoint description
Browse files Browse the repository at this point in the history
  • Loading branch information
acke committed Nov 4, 2024
1 parent 7ee680b commit 5851776
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [2.11.0]
### Changed
- If $/snyk.hasAuthenticated transmits an API URL, this is saved in the settings.
- Added a description of custom endpoints to settings dialog.

## [2.10.0]
### Changed
Expand Down
33 changes: 26 additions & 7 deletions src/main/kotlin/io/snyk/plugin/ui/SnykSettingsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class SnykSettingsDialog(

/** General settings ------------------ */

val generalSettingsPanel = JPanel(UIGridLayoutManager(7, 3, JBUI.emptyInsets(), -1, -1))
val generalSettingsPanel = JPanel(UIGridLayoutManager(8, 3, JBUI.emptyInsets(), -1, -1))
generalSettingsPanel.border = IdeBorderFactory.createTitledBorder("General settings")

rootPanel.add(
Expand Down Expand Up @@ -293,6 +293,25 @@ class SnykSettingsDialog(
),
)

val endpointDescriptionLabel =
JLabel(
"<html>Sets API endpoint to use for Snyk requests. Useful for custom Snyk setups. <br/>" +
"E.g. `https://api.eu.snyk.io`.</html>",
).apply { font = FontUtil.minusOne(this.font) }

generalSettingsPanel.add(
endpointDescriptionLabel,
baseGridConstraints(
row = 4,
column = 1,
colSpan = 2,
indent = 0,
anchor = UIGridConstraints.ANCHOR_WEST,
fill = UIGridConstraints.FILL_NONE,
hSizePolicy = UIGridConstraints.SIZEPOLICY_CAN_SHRINK or UIGridConstraints.SIZEPOLICY_CAN_GROW,
),
)

val customEndpointLabel = JLabel("Custom endpoint:")
val customEndpointTooltip =
"The correct endpoint format is https://api.xxx.snyk[gov].io, e.g. https://api.eu.snyk.io"
Expand All @@ -302,15 +321,15 @@ class SnykSettingsDialog(
generalSettingsPanel.add(
customEndpointLabel,
baseGridConstraintsAnchorWest(
row = 4,
row = 5,
indent = 0,
),
)

generalSettingsPanel.add(
customEndpointTextField,
baseGridConstraints(
row = 4,
row = 5,
column = 1,
colSpan = 1,
anchor = UIGridConstraints.ANCHOR_WEST,
Expand All @@ -324,7 +343,7 @@ class SnykSettingsDialog(
generalSettingsPanel.add(
ignoreUnknownCACheckBox,
baseGridConstraints(
row = 5,
row = 6,
column = 1,
colSpan = 1,
anchor = UIGridConstraints.ANCHOR_WEST,
Expand All @@ -339,15 +358,15 @@ class SnykSettingsDialog(
generalSettingsPanel.add(
organizationLabel,
baseGridConstraintsAnchorWest(
row = 6,
row = 7,
indent = 0,
),
)

generalSettingsPanel.add(
organizationTextField,
baseGridConstraints(
row = 6,
row = 7,
column = 1,
colSpan = 1,
anchor = UIGridConstraints.ANCHOR_WEST,
Expand All @@ -368,7 +387,7 @@ class SnykSettingsDialog(
generalSettingsPanel.add(
organizationContextHelpLabel,
baseGridConstraintsAnchorWest(
row = 6,
row = 7,
column = 2,
indent = 0,
fill = UIGridConstraints.FILL_NONE,
Expand Down

0 comments on commit 5851776

Please sign in to comment.