Skip to content

Commit 54e1f11

Browse files
style: styled auth button, tidied up html for welcome panel and fixed some rendering issues on smaller screens.
1 parent 553c8d0 commit 54e1f11

5 files changed

Lines changed: 38 additions & 36 deletions

File tree

plugin/OSGI-INF/l10n/bundle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,4 @@ tooltip.showNetNewIssues=Show Only Net New Issues
5050
scanWorkspace.name=snykWorkspaceScan
5151
scanWorkspace.label=Snyk Test Workspace
5252

53-
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.
54-
55-
53+
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>

plugin/src/main/java/io/snyk/eclipse/plugin/html/BaseHtmlProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public String replaceCssVariables(String html) {
5656
html = html.replace("var(--text-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR", "#000000"));
5757
html = html.replace("var(--background-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END", "#FFFFFF"));
5858
html = html.replace("var(--code-background-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));
59+
html = html.replace("var(--button-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));
5960
html = html.replace("var(--circle-color)", getColorAsHex("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START", "#F0F0F0"));
6061

6162
html = html.replace("var(--border-color)", getColorAsHex("org.eclipse.ui.workbench.ACTIVE_TAB_OUTER_KEYLINE_COLOR", "#CCCCCC"));

plugin/src/main/java/io/snyk/eclipse/plugin/html/CodeHtmlProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ function navigateToIssue(e, target) {
4545
}
4646
}
4747
}
48-
4948
// Disable AIfix
5049
if(document.getElementById('ai-fix-wrapper') && document.getElementById('no-ai-fix-wrapper')){
5150
document.getElementById('ai-fix-wrapper').className = 'hidden';

plugin/src/main/java/io/snyk/eclipse/plugin/html/StaticPageHtmlProvider.java

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ public static StaticPageHtmlProvider getInstance() {
1919
return instance;
2020
}
2121

22-
2322
public String getInitHtml() {
2423
String snykWarningText = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
25-
"%snyk.trust.dialog.warning.text");
26-
String snykWarningMoreInfoLabel = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
27-
"%snyk.trust.dialog.warning.more.info.label");
24+
"%snyk.panel.auth.trust.warning.text");
2825

2926
Bundle bundle = Platform.getBundle("io.snyk.eclipse.plugin");
3027
String base64Image = ResourceUtils.getBase64Image(bundle, "logo_snyk.png");
@@ -38,51 +35,62 @@ public String getInitHtml() {
3835
<title>Snyk for Eclipse</title>
3936
<style>
4037
body {
41-
font-family: var(--default-font);
38+
font-family: var(--default-font);
4239
background-color: var(--background-color);
4340
color: var(--text-color);
4441
}
4542
.container {
4643
display: flex;
4744
align-items: center;
4845
}
46+
.welcome-text {
47+
width: 530px;
48+
}
4949
.logo {
5050
margin-right: 20px;
5151
}
52-
a {
53-
color: var(--link-color)
54-
}
55-
56-
div {
57-
padding: 20px
58-
}
52+
a {
53+
color: var(--link-color);
54+
}
55+
div {
56+
padding: 20px;
57+
}
58+
button {
59+
text-align: center;
60+
text-decoration: none;
61+
background-color: var(--button-color);
62+
display: inline-block;
63+
border-color: var(--border-color);
64+
border-style: solid;
65+
border-radius: 5px;
66+
font-family: inherit;
67+
font-size: inherit;
68+
color: inherit;
69+
}
5970
</style>
6071
</head>
6172
<body>
6273
<div class="container">
6374
<img src='data:image/png;base64,%s' alt='Snyk Logo'>
64-
<div>
75+
<div class="welcome-text">
6576
<p><strong>Welcome to Snyk for Eclipse</strong></p>
6677
<ol>
67-
<li align="left">Authenticate to Snyk.io</li>
68-
<li align="left">Analyze code for issues and vulnerabilities</li>
69-
<li align="left">Improve your code and upgrade dependencies</li>
70-
</ol>
71-
<p>
72-
<p>
73-
%s <a href="https://docs.snyk.io/ide-tools/jetbrains-plugins/folder-trust">%s</a>
74-
</p>
75-
<button type="button" onclick="window.initiateLogin()">Trust project and scan</button>
76-
<p>
77-
By connecting your account with Snyk, you agree to<br>
78-
the Snyk <a href="https://snyk.io/policies/privacy/">Privacy Policy</a>,
79-
and the Snyk <a href="https://snyk.io/policies/terms-of-service/">Terms of Service</a>.
80-
</p>
78+
<li align="left">Authenticate to Snyk.io</li>
79+
<li align="left">Analyze code for issues and vulnerabilities</li>
80+
<li align="left">Improve your code and upgrade dependencies</li>
81+
</ol>
82+
<p>%s</p>
83+
<button type="button" onclick="window.initiateLogin()">Trust project and scan</button>
84+
<p>
85+
By connecting your account with Snyk, you agree to
86+
the Snyk <a href="https://snyk.io/policies/privacy/">Privacy Policy</a>,
87+
and the Snyk <a href="https://snyk.io/policies/terms-of-service/">Terms of Service</a>.
88+
</p>
8189
</div>
8290
</div>
8391
</body>
8492
</html>
85-
""".formatted(base64Image, snykWarningText, snykWarningMoreInfoLabel);
93+
""".formatted(base64Image, snykWarningText);
8694
return replaceCssVariables(html);
8795
}
8896
}

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BrowserHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import org.eclipse.swt.browser.ProgressEvent;
1919
import org.eclipse.swt.program.Program;
2020
import org.eclipse.swt.widgets.Display;
21-
import org.eclipse.ui.PlatformUI;
22-
2321
import com.google.gson.Gson;
2422

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

107105
initBrowserText();
108-
109106
}
110107

111108
private record ErrorMessage(String error, String path) {
@@ -138,7 +135,6 @@ public CompletableFuture<Void> updateBrowserContent(TreeNode node) {
138135
browser.setText(content);
139136
});
140137
});
141-
142138
}
143139

144140
private BaseHtmlProvider getHtmlProvider(TreeNode node) {

0 commit comments

Comments
 (0)