Skip to content

Commit

Permalink
style: styled auth button, tidied up html for welcome panel and fixed…
Browse files Browse the repository at this point in the history
… some rendering issues on smaller screens.
  • Loading branch information
andrewrobinsonhodges-snyk committed Dec 18, 2024
1 parent 553c8d0 commit 54e1f11
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 36 deletions.
4 changes: 1 addition & 3 deletions plugin/OSGI-INF/l10n/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,4 @@ tooltip.showNetNewIssues=Show Only Net New Issues
scanWorkspace.name=snykWorkspaceScan
scanWorkspace.label=Snyk Test Workspace

snyk.trust.dialog.warning.text=When scanning project files for vulnerabilities, Snyk may automatically execute code such as invoking the package manager to get dependency information.<br><br>You should only scan projects you trust.


snyk.panel.auth.trust.warning.text=When scanning project files, Snyk may automatically execute code such as invoking the package manager to get dependency information. You should only scan projects you trust. <a href="https://docs.snyk.io/ide-tools/jetbrains-plugins/folder-trust">More info</a>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public String replaceCssVariables(String html) {
html = html.replace("var(--text-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR", "#000000"));
html = html.replace("var(--background-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END", "#FFFFFF"));
html = html.replace("var(--code-background-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));
html = html.replace("var(--button-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));
html = html.replace("var(--circle-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));

html = html.replace("var(--border-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_OUTER_KEYLINE_COLOR", "#CCCCCC"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function navigateToIssue(e, target) {
}
}
}
// Disable AIfix
if(document.getElementById('ai-fix-wrapper') && document.getElementById('no-ai-fix-wrapper')){
document.getElementById('ai-fix-wrapper').className = 'hidden';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ public static StaticPageHtmlProvider getInstance() {
return instance;
}


public String getInitHtml() {
String snykWarningText = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
"%snyk.trust.dialog.warning.text");
String snykWarningMoreInfoLabel = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
"%snyk.trust.dialog.warning.more.info.label");
"%snyk.panel.auth.trust.warning.text");

Bundle bundle = Platform.getBundle("io.snyk.eclipse.plugin");
String base64Image = ResourceUtils.getBase64Image(bundle, "logo_snyk.png");
Expand All @@ -38,51 +35,62 @@ public String getInitHtml() {
<title>Snyk for Eclipse</title>
<style>
body {
font-family: var(--default-font);
font-family: var(--default-font);
background-color: var(--background-color);
color: var(--text-color);
}
.container {
display: flex;
align-items: center;
}
.welcome-text {
width: 530px;
}
.logo {
margin-right: 20px;
}
a {
color: var(--link-color)
}
div {
padding: 20px
}
a {
color: var(--link-color);
}
div {
padding: 20px;
}
button {
text-align: center;
text-decoration: none;
background-color: var(--button-color);
display: inline-block;
border-color: var(--border-color);
border-style: solid;
border-radius: 5px;
font-family: inherit;
font-size: inherit;
color: inherit;
}
</style>
</head>
<body>
<div class="container">
<img src='data:image/png;base64,%s' alt='Snyk Logo'>
<div>
<div class="welcome-text">
<p><strong>Welcome to Snyk for Eclipse</strong></p>
<ol>
<li align="left">Authenticate to Snyk.io</li>
<li align="left">Analyze code for issues and vulnerabilities</li>
<li align="left">Improve your code and upgrade dependencies</li>
</ol>
<p>
<p>
%s <a href="https://docs.snyk.io/ide-tools/jetbrains-plugins/folder-trust">%s</a>
</p>
<button type="button" onclick="window.initiateLogin()">Trust project and scan</button>
<p>
By connecting your account with Snyk, you agree to<br>
the Snyk <a href="https://snyk.io/policies/privacy/">Privacy Policy</a>,
and the Snyk <a href="https://snyk.io/policies/terms-of-service/">Terms of Service</a>.
</p>
<li align="left">Authenticate to Snyk.io</li>
<li align="left">Analyze code for issues and vulnerabilities</li>
<li align="left">Improve your code and upgrade dependencies</li>
</ol>
<p>%s</p>
<button type="button" onclick="window.initiateLogin()">Trust project and scan</button>
<p>
By connecting your account with Snyk, you agree to
the Snyk <a href="https://snyk.io/policies/privacy/">Privacy Policy</a>,
and the Snyk <a href="https://snyk.io/policies/terms-of-service/">Terms of Service</a>.
</p>
</div>
</div>
</body>
</html>
""".formatted(base64Image, snykWarningText, snykWarningMoreInfoLabel);
""".formatted(base64Image, snykWarningText);
return replaceCssVariables(html);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;

import com.google.gson.Gson;

import io.snyk.eclipse.plugin.html.BaseHtmlProvider;
Expand Down Expand Up @@ -105,7 +103,6 @@ public void completed(ProgressEvent event) {
});

initBrowserText();

}

private record ErrorMessage(String error, String path) {
Expand Down Expand Up @@ -138,7 +135,6 @@ public CompletableFuture<Void> updateBrowserContent(TreeNode node) {
browser.setText(content);
});
});

}

private BaseHtmlProvider getHtmlProvider(TreeNode node) {
Expand Down

0 comments on commit 54e1f11

Please sign in to comment.