Skip to content

feat: Update Endpoint Description in Settings #276

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

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FileFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

Expand Down Expand Up @@ -37,8 +40,8 @@ protected void createFieldEditors() {
setPreferenceStore(prefs.getInsecureStore());

// token field editor is configured to use a secure store
TokenFieldEditor tokenField = new TokenFieldEditor(prefs, Preferences.AUTH_TOKEN_KEY,
"Token:", getFieldEditorParent());
TokenFieldEditor tokenField = new TokenFieldEditor(prefs, Preferences.AUTH_TOKEN_KEY, "Token:",
getFieldEditorParent());

final var useTokenAuth = new BooleanFieldEditor(Preferences.USE_TOKEN_AUTH,
"Use token authentication. It is recommended to keep this turned off, as the default OAuth2 authentication is more secure.",
Expand All @@ -47,6 +50,16 @@ protected void createFieldEditors() {
addField(tokenField);

addField(new StringFieldEditor(Preferences.PATH_KEY, "Path:", 80, getFieldEditorParent()));
addField(new LabelFieldEditor("If you're using SSO with Snyk and OAuth2, the custom endpoint configuration is automatically populated.\n"
+ "Otherwise, for public regional instances, " + "see the docs: ", getFieldEditorParent()));
Link link = new Link(this.getFieldEditorParent(), SWT.NONE);

link.setText("<a>https://docs.snyk.io/working-with-snyk</a>");
link.addListener(SWT.Selection, event -> Program.launch(
"https://docs.snyk.io/working-with-snyk/regional-hosting-and-data-residency#available-snyk-regions"));

addField(new LabelFieldEditor("For private instances, contact your team or account manager.\n",
getFieldEditorParent()));
addField(new StringFieldEditor(Preferences.ENDPOINT_KEY, "Custom Endpoint:", 80, getFieldEditorParent()));
addField(new BooleanFieldEditor(Preferences.INSECURE_KEY, "Allow unknown certificate authorities",
getFieldEditorParent()));
Expand Down Expand Up @@ -124,12 +137,12 @@ private FieldEditor space() {
public boolean performOk() {
boolean superOK = super.performOk();
disableSnykCodeIfOrgDisabled();
CompletableFuture.runAsync(() -> {
SnykExtendedLanguageClient lc = SnykExtendedLanguageClient.getInstance();
CompletableFuture.runAsync(() -> {
SnykExtendedLanguageClient lc = SnykExtendedLanguageClient.getInstance();

lc.updateConfiguration();
lc.refreshFeatureFlags();
});
lc.refreshFeatureFlags();
});
return superOK;
}

Expand All @@ -152,7 +165,7 @@ private void disableSnykCodeIfOrgDisabled() {

@Override
public void run() {
checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue();
checkBoxValue = snykCodeSecurityCheckbox != null && snykCodeSecurityCheckbox.getBooleanValue();
if (checkBoxValue && !enabled) {
snykCodeSecurityCheckbox
.setLabelText(snykCodeSecurityCheckbox.getLabelText() + " (" + message + ")");
Expand Down