-
Notifications
You must be signed in to change notification settings - Fork 35
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 #648 from snyk/feat/scan-summary-panel
feat: scan summary panel [IDE-894]
- Loading branch information
Showing
23 changed files
with
408 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Static Resource Checking | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
|
||
jobs: | ||
static-resource-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch Sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check Static Resources | ||
run: | | ||
declare -A resources | ||
# Add each resource as a kay, value pair, mapping the local resource to the reference wile (which should be stored in the lanaguage server repository). For example: | ||
# resources["<path_to_local_file>"]="<url_of_reference_file>" | ||
resources["src/main/resources/html/ScanSummaryInit.html"]="https://raw.githubusercontent.com/snyk/snyk-ls/refs/heads/main/shared_ide_resources/ui/html/ScanSummaryInit.html" | ||
for key in ${!resources[@]}; do | ||
candidate=$(sha512sum $key | awk {'print $1'}) | ||
candidate=${candidate:="null"} | ||
reference=$(curl -s ${resources[$key]} | sha512sum | awk {'print $1'}) | ||
echo "Candidate file $key has sha512sum $candidate" | ||
echo "Reference file ${resources[$key]} has sha512sum $reference" | ||
[[ $candidate == $reference ]] | ||
done | ||
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
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/io/snyk/plugin/events/SnykScanSummaryListenerLS.kt
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,13 @@ | ||
package io.snyk.plugin.events | ||
|
||
import com.intellij.util.messages.Topic | ||
import snyk.common.lsp.SnykScanSummaryParams | ||
|
||
interface SnykScanSummaryListenerLS { | ||
companion object { | ||
val SNYK_SCAN_SUMMARY_TOPIC = | ||
Topic.create("Snyk scan summary LS", SnykScanSummaryListenerLS::class.java) | ||
} | ||
|
||
fun onSummaryReceived(summaryParams: SnykScanSummaryParams) {} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/io/snyk/plugin/ui/jcef/ToggleDeltaHandler.kt
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,39 @@ | ||
package io.snyk.plugin.ui.jcef | ||
|
||
import com.intellij.ui.jcef.JBCefBrowserBase | ||
import com.intellij.ui.jcef.JBCefJSQuery | ||
import io.snyk.plugin.pluginSettings | ||
import io.snyk.plugin.runInBackground | ||
import org.cef.browser.CefBrowser | ||
import org.cef.browser.CefFrame | ||
import org.cef.handler.CefLoadHandlerAdapter | ||
import snyk.common.lsp.LanguageServerWrapper | ||
|
||
class ToggleDeltaHandler { | ||
fun generate(jbCefBrowser: JBCefBrowserBase): CefLoadHandlerAdapter { | ||
val toggleDeltaQuery = JBCefJSQuery.create(jbCefBrowser) | ||
toggleDeltaQuery.addHandler {deltaEnabled -> | ||
pluginSettings().setDeltaEnabled(deltaEnabled.toBoolean()) | ||
runInBackground("Snyk: updating configuration") { | ||
LanguageServerWrapper.getInstance().updateConfiguration() | ||
} | ||
return@addHandler JBCefJSQuery.Response("success") | ||
} | ||
|
||
return object : CefLoadHandlerAdapter() { | ||
override fun onLoadEnd(browser: CefBrowser, frame: CefFrame, httpStatusCode: Int) { | ||
if (frame.isMain) { | ||
val script = """ | ||
(function() { | ||
if (window.toggleDeltaQuery) { | ||
return; | ||
} | ||
window.toggleDeltaQuery = function(isEnabled) { ${toggleDeltaQuery.inject("isEnabled")} }; | ||
})() | ||
""".trimIndent() | ||
browser.executeJavaScript(script, browser.url, 0) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.