Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use scss for open source #627

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GenerateAIFixHandler() {
val aiFixQuery = JBCefJSQuery.create(jbCefBrowser)

aiFixQuery.addHandler { value ->
val params = value.split(":")
val params = value.split("@|@")
val folderURI = params[0]
val fileURI = params[1]
val issueID = params[2]
Expand Down Expand Up @@ -54,15 +54,15 @@ class GenerateAIFixHandler() {
const filePath = aiFixButton.getAttribute('file-path');

aiFixButton.addEventListener('click', () => {
window.aiFixQuery(folderPath + ":" + filePath + ":" + issueId);
window.aiFixQuery(folderPath + "@|@" + filePath + "@|@" + issueId);
});

retryFixButton.addEventListener('click', () => {
window.aiFixQuery(folderPath + ":" + filePath + ":" + issueId);
window.aiFixQuery(folderPath + "@|@" + filePath + "@|@" + issueId);
});

retryFixButton.addEventListener('click', () => {
window.aiFixQuery(folderPath + ":" + filePath + ":" + issueId);
window.aiFixQuery(folderPath + "@|@" + filePath + "@|@" + issueId);
});
})();
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,16 @@ class SnykToolWindowSnykScanListenerLS(
}

val settings = pluginSettings()
var text = "✅ Congrats! No vulnerabilities found!"
var text = "✅ Congrats! No issues found!"
val issuesCount = issues.size
val ignoredIssuesCount = issues.count { it.isIgnored() }
if (issuesCount != 0) {
val plural = if (issuesCount == 1) {
"y"
val plural = if (issuesCount > 1) {
"s"
} else {
"ies"
""
}
text = "✋ $issuesCount vulnerabilit$plural found by Snyk"
text = "✋ $issuesCount issue$plural found by Snyk"
if (pluginSettings().isGlobalIgnoresFeatureEnabled) {
text += ", $ignoredIssuesCount ignored"
}
Expand All @@ -361,13 +361,13 @@ class SnykToolWindowSnykScanListenerLS(
if (fixableIssuesCount > 0) {
rootNode.add(
InfoTreeNode(
"⚡ $fixableIssuesCount vulnerabilities can be fixed automatically",
"⚡ $fixableIssuesCount issues can be fixed automatically",
project,
),
)
} else {
rootNode.add(
InfoTreeNode("There are no vulnerabilities automatically fixable", project),
InfoTreeNode("There are no issues automatically fixable", project),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class SuggestionDescriptionPanelFromLS(
// TODO: remove custom stylesheets, deliver variables from LS, replace variables with colors
val ideStyle: String = when (issue.filterableIssueType) {
ScanIssue.CODE_SECURITY, ScanIssue.CODE_QUALITY -> SnykStylesheets.SnykCodeSuggestion
ScanIssue.OPEN_SOURCE -> SnykStylesheets.SnykOSSSuggestion
else -> ""
}

Expand All @@ -178,17 +177,22 @@ class SuggestionDescriptionPanelFromLS(
html = html.replace("--default-font: ", "--default-font: \"${JBUI.Fonts.label().asPlain().family}\", ")
html = html.replace("var(--text-color)", UIUtil.getLabelForeground().toHex())
html = html.replace("var(--background-color)", UIUtil.getPanelBackground().toHex())
html =
html.replace("var(--border-color)", JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground().toHex())
val borderColor = JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground().toHex()
html = html.replace("var(--border-color)", borderColor)
html = html.replace("var(--horizontal-border-color)", borderColor)
html = html.replace("var(--link-color)", JBUI.CurrentTheme.Link.Foreground.ENABLED.toHex())

val editorBackground =
editorUiTheme.getColor(EditorColors.GUTTER_BACKGROUND)?.toHex() ?: editorUiTheme.defaultBackground.toHex()
html = html.replace(
"var(--horizontal-border-color)",
JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground().toHex()
"var(--code-background-color)",
editorBackground
)
html = html.replace(
"var(--code-background-color)",
editorUiTheme.getColor(EditorColors.GUTTER_BACKGROUND)?.toHex() ?: editorUiTheme.defaultBackground.toHex()
"var(--container-background-color)",
editorBackground
)

return html
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/stylesheets/snyk_code_suggestion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

html, body {
height: 100%;
font-size: 16px;
display: flex;
flex-direction: column;
margin: 0;
Expand All @@ -18,7 +17,6 @@ html, body {
body {
color: var(--text-color);
font-weight: 400;
font-size: 0.875rem;
}

a,
Expand Down Expand Up @@ -52,11 +50,9 @@ a,
.ai-fix-header,
.example-fixes-header,
.overview-text > h2 {
font-size: 0.85rem;
}

.severity-type-container {
font-size: 0.85rem;
}

.data-flow-clickable-row {
Expand All @@ -68,7 +64,6 @@ a,
}

.tab-item {
font-size: 0.85rem;
}

.tab-item-icon path {
Expand Down
69 changes: 0 additions & 69 deletions src/main/resources/stylesheets/snyk_oss_suggestion.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ class SnykToolWindowSnykScanListenerLSTest : BasePlatformTestCase() {
TestCase.assertEquals(rootTreeNode.children().toList()[1].toString(), " Code Security")
TestCase.assertEquals(rootTreeNode.children().toList()[2].toString(), " Code Quality")
TestCase.assertEquals(
"✋ 1 vulnerability found by Snyk, 0 ignored",
"✋ 1 issue found by Snyk, 0 ignored",
rootTreeNode.children().toList()[4].toString(),
)
TestCase.assertEquals(
rootTreeNode.children().toList()[5].toString(),
"⚡ 1 vulnerabilities can be fixed automatically",
"⚡ 1 issues can be fixed automatically",
bastiandoetsch marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand Down
Loading