Skip to content

Commit 58542b7

Browse files
fix/styles-for-details (#706)
Co-authored-by: Abdelrahman Shawki Hassan <[email protected]>
1 parent 8de0306 commit 58542b7

File tree

10 files changed

+149
-47
lines changed

10 files changed

+149
-47
lines changed

application/config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (c *CliSettings) CliPathFileInfo() (os.FileInfo, error) {
113113
defer c.cliPathAccessMutex.RUnlock()
114114
stat, err := os.Stat(c.cliPath)
115115
if err == nil {
116-
c.C.Logger().Debug().Str("method", "config.cliSettings.Installed").Msgf("CLI path: %s, Size: %d, Perm: %s",
116+
c.C.Logger().Trace().Str("method", "config.cliSettings.Installed").Msgf("CLI path: %s, Size: %d, Perm: %s",
117117
c.cliPath,
118118
stat.Size(),
119119
stat.Mode().Perm())

application/server/server.go

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ func initializedHandler(srv *jrpc2.Server) handler.Func {
385385
c := config.CurrentConfig()
386386
initialLogger := c.Logger()
387387
initialLogger.Info().Msg("snyk-ls: " + config.Version + " (" + util.Result(os.Executable()) + ")")
388+
initialLogger.Info().Msgf("CLI Path: %s", c.CliSettings().Path())
389+
initialLogger.Info().Msgf("CLI Installed? %t", c.CliSettings().Installed())
388390
initialLogger.Info().Msg("platform: " + runtime.GOOS + "/" + runtime.GOARCH)
389391
initialLogger.Info().Msg("https_proxy: " + os.Getenv("HTTPS_PROXY"))
390392
initialLogger.Info().Msg("http_proxy: " + os.Getenv("HTTP_PROXY"))

infrastructure/cli/initializer.go

-5
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ func NewInitializer(errorReporter error_reporting.ErrorReporter,
5151
notifier: notifier,
5252
cli: cli,
5353
}
54-
settings := config.CurrentConfig().CliSettings()
55-
if settings.Installed() {
56-
i.logCliVersion(settings.Path())
57-
}
5854
return i
5955
}
6056

@@ -66,7 +62,6 @@ func (i *Initializer) Init() error {
6662
logger := config.CurrentConfig().Logger().With().Str("method", "cli.Init").Logger()
6763
cliSettings := c.CliSettings()
6864
cliInstalled := cliSettings.Installed()
69-
logger.Debug().Str("cliPath", cliPathInConfig()).Msgf("CLI installed: %v", cliInstalled)
7065
if !c.ManageCliBinariesAutomatically() {
7166
if !cliSettings.IsPathDefined() {
7267
i.notifier.SendShowMessage(sglsp.Warning,

infrastructure/code/code_html.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func parseExampleCommitsToTemplateJS(fixes []ExampleCommit, logger *zerolog.Logg
252252

253253
func getIssueType(additionalData snyk.CodeIssueData) string {
254254
if additionalData.IsSecurityType {
255-
return "Vulnerability"
255+
return "Issue"
256256
}
257257
return "Quality Issue"
258258
}

infrastructure/code/template/details.html

+55-13
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,25 @@
2121
<meta charset="utf-8" />
2222
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2323
<meta http-equiv="Content-Security-Policy"
24-
content="default-src 'none'; style-src 'self' 'nonce-${nonce}'; script-src 'nonce-${nonce}';" />
24+
content="style-src 'self' 'nonce-${nonce}' 'nonce-ideNonce' https://fonts.googleapis.com;
25+
script-src 'nonce-${nonce}' https://fonts.googleapis.com;
26+
font-src 'self' https://fonts.gstatic.com;" />
2527

2628
<style nonce="${nonce}">
29+
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
2730
:root {
28-
--default-font: ui-sans-serif, "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif;
31+
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif;
32+
--background-color: var();
33+
--text-color: var();
34+
--link-color: var();
35+
--scroll-bar-hover-background-color: #595a5c;
36+
--horizontal-border-color: var();
37+
--code-background-color: var(--vscode-editor-background);
38+
--tab-active-background-color: var(--vscode-tab-activeBackground);
39+
}
40+
41+
section {
42+
padding: 20px;
2943
}
3044

3145
::-webkit-scrollbar {
@@ -37,7 +51,7 @@
3751
}
3852

3953
::-webkit-scrollbar-thumb:hover {
40-
background: #595a5c;
54+
background: var(--scroll-bar-hover-background-color);
4155
}
4256

4357
*,
@@ -46,15 +60,31 @@
4660
box-sizing: border-box;
4761
}
4862

63+
a, .link {
64+
color: var(--link-color);
65+
cursor: pointer;
66+
text-decoration: none;
67+
}
68+
4969
body {
70+
background-color: var(--background-color);
5071
font-family: var(--default-font);
72+
font-size: 0.8rem;
73+
font-weight: 400;
74+
color: var(--text-color);
5175
overflow-y: auto;
5276
overflow-x: hidden;
5377
}
5478

5579
h2 {
56-
font-weight: 600;
57-
margin-bottom: 10px;
80+
margin: initial;
81+
}
82+
83+
h2, h3 {
84+
font-size: 1rem;
85+
margin-block-start: 0;
86+
margin-block-end: 0.4rem;
87+
font-weight: 700;
5888
}
5989

6090
main {
@@ -77,6 +107,8 @@
77107
.panel-header {
78108
display: flex;
79109
flex-direction: column;
110+
background-image: linear-gradient(0, transparent, var(--vscode-tab-activeBackground));
111+
margin: inherit;
80112
}
81113

82114
.code-issue-panel {
@@ -90,27 +122,30 @@
90122
.ai-fix-header,
91123
.overview-text>h2 {
92124
line-height: 1.25rem;
93-
font-size: 1.2rem;
125+
font-size: 1rem;
94126
margin-bottom: 10px;
95127
}
96128

97129
.severity-title {
98130
padding-left: 8px;
131+
font-size: 1.4rem;
99132
}
100133

101134
.severity-container {
102135
display: flex;
103136
flex-direction: row;
104137
align-items: center;
105-
margin-bottom: 3px;
138+
padding-bottom: 20px;
139+
padding-top: 20px;
106140
}
107141

108142
.severity-type-container {
109143
display: flex;
110144
flex-direction: row;
111145
align-items: center;
112-
margin-bottom: 1em;
113-
line-height: 1em;
146+
margin-bottom: 1rem;
147+
line-height: 1rem;
148+
font-size: 1rem;
114149
}
115150

116151
.lesson-container {
@@ -183,9 +218,12 @@
183218
border: 1px solid #E27122;
184219
}
185220

221+
.example {
222+
background-color: var(--code-background-color);
223+
}
224+
186225
.data-flow-file {
187226
font-weight: bold;
188-
font-size: 1em;
189227
display: flex;
190228
align-items: center;
191229
margin-top: 5px;
@@ -202,6 +240,7 @@
202240
}
203241

204242
.data-flow-table {
243+
background-color: var(--code-background-color);
205244
margin-top: 5px;
206245
margin-left: 15px;
207246
}
@@ -235,9 +274,12 @@
235274
word-break: break-all;
236275
}
237276

277+
code {
278+
background-color: var(--code-background-color);
279+
}
280+
238281
.data-flow-text code {
239-
background: none;
240-
background-color: transparent;
282+
background: transparent none;
241283
}
242284

243285
.data-flow-delimiter {
@@ -762,7 +804,7 @@ <h2 class="severity-title">{{.IssueTitle}}</h2>
762804
</span>
763805
{{if .IssueOverview}}
764806
<span data-tab="vuln-overview" id="vuln-overview-tab" class="tab-item sn-vuln-overview vuln-overview-tab">
765-
Vulnerability Overview
807+
Issue Overview
766808
</span>
767809
{{end}}
768810
</div>

infrastructure/iac/template/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h2 class="severity-title">{{.Issue.AdditionalData.Title}}</h2>
5858
<div class="summary-item impact">
5959
<div class="label">Impact</div>
6060
<div class="content">
61-
{{.Issue.AdditionalData.Impact}}
61+
<p>{{.Issue.AdditionalData.Impact}}</p>
6262
</div>
6363
</div>
6464
<div class="summary-item path">

infrastructure/iac/template/styles.css

+46-15
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,36 @@
2323
background: var(--scroll-bar-hover-background-color);
2424
}
2525

26-
html, body {
27-
font-size: 16px;
26+
*,
27+
*:before,
28+
*:after {
29+
box-sizing: border-box;
2830
}
2931

3032
body {
3133
background-color: var(--background-color);
3234
font-family: var(--default-font);
33-
font-size: 0.85rem;
35+
font-size: 0.8rem;
3436
font-weight: 400;
3537
color: var(--text-color);
38+
overflow-y: auto;
39+
overflow-x: hidden;
40+
}
41+
42+
body > *, form > * {
43+
margin-block-start: 0;
44+
}
45+
46+
47+
h2 {
48+
margin: initial;
49+
}
50+
51+
h2, h3 {
52+
font-size: 1rem;
53+
margin-block-start: 0;
54+
margin-block-end: 0.4rem;
55+
font-weight: 700;
3656
}
3757

3858
section {
@@ -56,16 +76,11 @@ code {
5676
background-color: var(--code-background-color);
5777
padding: 1px 3px;
5878
border-radius: 4px;
59-
font-size: 0.85rem;
60-
}
61-
62-
h2 {
63-
font-weight: 600;
64-
margin-bottom: 10px;
79+
font-size: 0.8rem;
6580
}
6681

6782
section {
68-
padding: 0px 20px 5px 20px;
83+
padding: 20px;
6984
}
7085

7186
.styled-link {
@@ -85,11 +100,13 @@ section {
85100
flex-direction: column;
86101
width: 100%;
87102
height: 100%;
103+
margin-block-start: 0;
88104
}
89105

90106
.suggestion .suggestion-text {
107+
margin-top: 0;
91108
margin-bottom: 0.8rem;
92-
font-size: 0.85rem;
109+
font-size: 0.8rem;
93110
font-weight: 400;
94111
line-height: 2.4rem;
95112
}
@@ -117,17 +134,27 @@ section {
117134
vertical-align: middle;
118135
}
119136

137+
.sn-fix-wrapper {
138+
background-color: var(--code-background-color);
139+
}
140+
120141
.summary .summary-item {
121142
display: flex;
122143
margin: 0.3em 0 0.3em 0;
123144
}
124145

146+
.summary-item p {
147+
margin: 0 0 2rem 0;
148+
}
149+
125150
.summary .label {
126151
width: 160px;
152+
margin: inherit;
127153
}
128154

129155
.summary .content {
130156
flex: 70%;
157+
margin: inherit;
131158
}
132159

133160
.summary .summary-item.path pre {
@@ -145,7 +172,7 @@ div.remediation {
145172
}
146173

147174
div.remediation p {
148-
margin-bottom: 0;
175+
margin: 0;
149176
}
150177

151178
header {
@@ -155,24 +182,28 @@ header {
155182
.panel-header {
156183
display: flex;
157184
flex-direction: column;
185+
background-image: linear-gradient(0, transparent, var(--vscode-tab-activeBackground));
186+
margin: inherit;
158187
}
159188

160189
.severity-container {
161190
display: flex;
162191
flex-direction: row;
163192
align-items: center;
164193
margin-bottom: 3px;
194+
padding-top: 20px;
165195
}
166196

167197
.severity-title {
168198
padding-left: 8px;
169-
font-size: 1.2rem;
199+
font-size: 1.4rem;
170200
}
171201

172202
.severity-type-container {
173203
display: flex;
174204
flex-direction: row;
175205
align-items: center;
176-
margin-bottom: 1em;
177-
line-height: 1em;
206+
margin-bottom: 1rem;
207+
line-height: 1rem;
208+
font-size: 1rem;
178209
}

infrastructure/oss/oss_html.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func getIssueType(issue snyk.OssIssueData) string {
142142
return "License"
143143
}
144144

145-
return "Vulnerability"
145+
return "Issue"
146146
}
147147

148148
func getExploitMaturity(issue snyk.OssIssueData) string {

infrastructure/oss/oss_html_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func Test_OssDetailsPanel_html_noLearn(t *testing.T) {
7777
assert.True(t, strings.Contains(issueDetailsPanelHtml, strings.Join(issueAdditionalData.From, " &gt; ")))
7878
assert.True(t, strings.Contains(issueDetailsPanelHtml, strings.Join(issue2.From, " &gt; ")))
7979
assert.True(t, strings.Contains(issueDetailsPanelHtml, "<li>list</li>"))
80-
assert.False(t, strings.Contains(issueDetailsPanelHtml, "Learn about this vulnerability"))
80+
assert.False(t, strings.Contains(issueDetailsPanelHtml, "Learn about this issue"))
8181
}
8282

8383
func Test_OssDetailsPanel_html_withLearn(t *testing.T) {
@@ -104,7 +104,7 @@ func Test_OssDetailsPanel_html_withLearn(t *testing.T) {
104104
assert.NoError(t, err)
105105
issueDetailsPanelHtml := htmlRenderer.GetDetailsHtml(issue)
106106

107-
assert.True(t, strings.Contains(issueDetailsPanelHtml, "Learn about this vulnerability"))
107+
assert.True(t, strings.Contains(issueDetailsPanelHtml, "Learn about this issue"))
108108
}
109109

110110
func Test_OssDetailsPanel_html_withLearn_withCustomEndpoint(t *testing.T) {
@@ -205,7 +205,7 @@ func Test_OssDetailsPanel_html_moreDetailedPaths(t *testing.T) {
205205
assert.True(t, strings.Contains(issueDetailsPanelHtml, strings.Join(issueAdditionalData.From, " &gt; ")))
206206
assert.True(t, strings.Contains(issueDetailsPanelHtml, strings.Join(issue2.From, " &gt; ")))
207207
assert.True(t, strings.Contains(issueDetailsPanelHtml, "<li>list</li>"))
208-
assert.False(t, strings.Contains(issueDetailsPanelHtml, "Learn about this vulnerability"))
208+
assert.False(t, strings.Contains(issueDetailsPanelHtml, "Learn about this issue"))
209209
assert.True(t, strings.Contains(issueDetailsPanelHtml, "...and"))
210210
assert.True(t, strings.Contains(issueDetailsPanelHtml, "https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H/E:P"))
211211
}

0 commit comments

Comments
 (0)