Skip to content

Commit c508552

Browse files
authored
fix: Unsquish the loading spinner [IDE-1101] (#361)
The spinner is displayed while waiting for the LS to load. Refactored the CSS and HTML. Renamed the file to be in sync with the other IDEs.
1 parent 68773a6 commit c508552

File tree

5 files changed

+55
-58
lines changed

5 files changed

+55
-58
lines changed

.github/workflows/resource-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
declare -A resources
1717
# Add each resource as a key, value pair, mapping the local resource to the reference file (which should be stored in the language server repository). For example:
1818
# resources["<path_to_local_file>"]="<url_of_reference_file>"
19-
resources["Snyk.VisualStudio.Extension.2022/Resources/LoadingSummary.html"]="https://raw.githubusercontent.com/snyk/snyk-ls/refs/heads/main/shared_ide_resources/ui/html/ScanSummaryInit.html"
19+
resources["Snyk.VisualStudio.Extension.2022/Resources/ScanSummaryInit.html"]="https://raw.githubusercontent.com/snyk/snyk-ls/refs/heads/main/shared_ide_resources/ui/html/ScanSummaryInit.html"
2020
for key in ${!resources[@]}; do
2121
candidate=$(sha512sum $key | awk {'print $1'})
2222
candidate=${candidate:="null"}

Snyk.VisualStudio.Extension.2022/Resources/LoadingSummary.html

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv='Content-Type' content='text/html; charset=unicode' />
5+
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
6+
<meta charset="utf-8" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<meta http-equiv="Content-Security-Policy"
9+
content="style-src 'self' 'nonce-${nonce}' 'nonce-ideNonce' https://fonts.googleapis.com;
10+
script-src 'nonce-${nonce}' https://fonts.googleapis.com;
11+
font-src 'self' https://fonts.gstatic.com;" />
12+
<style nonce=${nonce}>
13+
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
14+
15+
:root {
16+
font-size: var(--main-font-size);
17+
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif;
18+
--ide-background-color: var(--vscode-sideBar-background);
19+
--text-color: var(--vscode-foreground);
20+
--input-border: var(--vscode-input-border);
21+
}
22+
p { font-size:1.3rem; margin: .8rem 0; }
23+
hr { margin: 2rem 0; }
24+
body { background-color:var(--ide-background-color); color: var(--text-color); font-family: var(--default-font); }
25+
26+
.snx-loader { flex: none; display: inline-block; width: 10px; height: 10px; border: 2px solid rgba(125,125,125,.65); border-bottom-color: transparent; border-radius: 50%; margin-right:.8rem; animation: spin 1s linear infinite; }
27+
@keyframes spin {
28+
from { transform: rotate(0deg); }
29+
to { transform: rotate(360deg); }
30+
}
31+
32+
.snx-h1 { font-size: 1.6rem; font-weight: 400; margin: .4rem 0; }
33+
34+
.snx-status { display:flex; align-items:center; padding: .4rem 1.2rem; background-color: rgba(255,255,255,.1); border-radius: 1rem; }
35+
36+
.snx-header { display: flex; gap:1.6rem; }
37+
.snx-status .snx-message { display: flex; align-items: center }
38+
</style>
39+
${ideStyle}
40+
</head>
41+
<body>
42+
<div class="snx-header">
43+
<h1 class="snx-title snx-h1">Snyk Security is loading...</h1>
44+
</div>
45+
<div class="snx-summary">
46+
<div class="snx-status">
47+
<span class="snx-loader"></span>
48+
<p class="snx-message">Waiting for the Snyk CLI to be downloaded and the Language Server to be initialized. </p>
49+
</div>
50+
</div>
51+
</body>
52+
</html>

Snyk.VisualStudio.Extension.2022/Snyk.VisualStudio.Extension.2022.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<Resource Include="Resources\branch-dark.png">
118118
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
119119
</Resource>
120-
<Content Include="Resources\LoadingSummary.html">
120+
<Content Include="Resources\ScanSummaryInit.html">
121121
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
122122
<IncludeInVSIX>true</IncludeInVSIX>
123123
</Content>

Snyk.VisualStudio.Extension.2022/UI/Html/StaticHtmlProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task<string> GetInitHtmlAsync()
3636
{
3737
var assemblyLocation = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
3838
if (assemblyLocation == null) return string.Empty;
39-
var path = Path.Combine(assemblyLocation, "Resources", "LoadingSummary.html");
39+
var path = Path.Combine(assemblyLocation, "Resources", "ScanSummaryInit.html");
4040
using (var stream = new StreamReader(path))
4141
{
4242
var html = await stream.ReadToEndAsync();

0 commit comments

Comments
 (0)