-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from snyk/feat/scan-summary-panel
feat: handle summary panel notification and render it in toolwindow [IDE-893]
- Loading branch information
Showing
18 changed files
with
358 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
Snyk.VisualStudio.Extension.2022/Resources/LoadingSummary.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv='Content-Type' content='text/html; charset=unicode' /> | ||
<meta http-equiv='X-UA-Compatible' content='IE=edge' /> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Security-Policy" | ||
content="style-src 'self' 'nonce-${nonce}' 'nonce-ideNonce' https://fonts.googleapis.com; | ||
script-src 'nonce-${nonce}' https://fonts.googleapis.com; | ||
font-src 'self' https://fonts.gstatic.com;" /> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap'); | ||
|
||
:root { | ||
font-size: var(--main-font-size); | ||
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif; | ||
--ide-background-color: var(--vscode-sideBar-background); | ||
--text-color: var(--vscode-foreground); | ||
--input-border: var(--vscode-input-border); | ||
} | ||
|
||
p { | ||
font-size: 1.3rem; | ||
margin: .8rem 0; | ||
} | ||
|
||
hr { | ||
margin: 2rem 0; | ||
} | ||
|
||
body { | ||
background-color: var(--ide-background-color); | ||
color: var(--text-color); | ||
font-family: var(--default-font); | ||
} | ||
|
||
.snx-loader { | ||
display: inline-block; | ||
width: 12px; | ||
height: 12px; | ||
border: 2px solid rgba(125,125,125,.65); | ||
border-bottom-color: transparent; | ||
border-radius: 50%; | ||
margin-right: .8rem; | ||
animation: spin 1s linear infinite; | ||
} | ||
|
||
.size-s { | ||
width: 12px; | ||
height: 12px; | ||
border-width: 2px | ||
} | ||
|
||
@keyframes spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.snx-h1 { | ||
font-size: 2rem; | ||
font-weight: 600; | ||
margin: .8rem 0; | ||
} | ||
|
||
.snx-status { | ||
display: flex; | ||
align-items: center; | ||
padding: .4rem 1.2rem; | ||
background-color: rgba(255,255,255,.1); | ||
border-radius: 1rem; | ||
} | ||
|
||
.snx-header { | ||
display: flex; | ||
gap: 1.6rem; | ||
} | ||
|
||
.snx-message { | ||
display: flex; | ||
align-items: center | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="snx-header"> | ||
<h1 class="snx-title snx-h1">Snyk Security is loading...</h1> | ||
</div> | ||
<div class="snx-summary"> | ||
<div class="snx-status"> | ||
<span class="snx-loader size-s"></span> | ||
<p class="snx-message">Waiting for the Snyk CLI to be downloaded and the Language Server to be initialized. </p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
namespace Snyk.VisualStudio.Extension.Theme | ||
using System.Windows.Media; | ||
|
||
namespace Snyk.VisualStudio.Extension.Theme | ||
{ | ||
public static class ColorExtension | ||
{ | ||
public static System.Windows.Media.SolidColorBrush ToBrush(this System.Drawing.Color color) | ||
public static SolidColorBrush ToBrush(this System.Drawing.Color color) | ||
{ | ||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B)); | ||
return new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, color.B)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Snyk.VisualStudio.Extension.2022/UI/Html/StaticHtmlProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Microsoft.VisualStudio.Shell; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace Snyk.VisualStudio.Extension.UI.Html | ||
{ | ||
public class StaticHtmlProvider : BaseHtmlProvider | ||
{ | ||
private static StaticHtmlProvider _instance; | ||
|
||
public static StaticHtmlProvider Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
{ | ||
_instance = new StaticHtmlProvider(); | ||
} | ||
return _instance; | ||
} | ||
} | ||
public override string GetInitScript() | ||
{ | ||
return @""; | ||
} | ||
|
||
public async Task<string> GetInitHtmlAsync() | ||
{ | ||
return await ThreadHelper.JoinableTaskFactory.RunAsync(async () => | ||
{ | ||
var assemblyLocation = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); | ||
if (assemblyLocation == null) return string.Empty; | ||
var path = Path.Combine(assemblyLocation, "Resources", "LoadingSummary.html"); | ||
using (var stream = new StreamReader(path)) | ||
{ | ||
var html = await stream.ReadToEndAsync(); | ||
return html; | ||
} | ||
}); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Snyk.VisualStudio.Extension.2022/UI/Html/SummaryHtmlProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Microsoft.VisualStudio.PlatformUI; | ||
using System; | ||
|
||
namespace Snyk.VisualStudio.Extension.UI.Html | ||
{ | ||
public class SummaryHtmlProvider : BaseHtmlProvider | ||
{ | ||
private static SummaryHtmlProvider _instance; | ||
|
||
public static SummaryHtmlProvider Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
{ | ||
_instance = new SummaryHtmlProvider(); | ||
} | ||
return _instance; | ||
} | ||
} | ||
public override string ReplaceCssVariables(string html) | ||
{ | ||
html = html.Replace("${ideFunc}", "window.external.EnableDelta(isEnabled);"); | ||
html = base.ReplaceCssVariables(html); | ||
|
||
return html; | ||
} | ||
|
||
public override string GetCss() | ||
{ | ||
return @" | ||
body { overflow: hidden; } | ||
.body-padding { padding: 0px 4px 8px 4px; } | ||
"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.