From aec12f511bd9d66ebee0dd6aac2a26917b9ff400 Mon Sep 17 00:00:00 2001 From: Teodora Sandu Date: Mon, 10 Jun 2024 10:53:14 +0100 Subject: [PATCH] refactor: modularise svg icon --- infrastructure/code/code_html.go | 9 +++++++++ infrastructure/code/template/details.html | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/infrastructure/code/code_html.go b/infrastructure/code/code_html.go index 49d6b8597..4a623ad69 100644 --- a/infrastructure/code/code_html.go +++ b/infrastructure/code/code_html.go @@ -105,6 +105,7 @@ func getCodeDetailsHtml(issue snyk.Issue) string { "LessonIcon": getLessonIconSvg(), "IgnoreLineAction": getLineToIgnoreAction(issue), "HasAIFix": additionalData.HasAIFix, + "ExternalIcon": getExternalIconSvg(), } if issue.IsIgnored { @@ -229,6 +230,14 @@ func formatDate(date time.Time) string { return fmt.Sprintf("%s %02d, %d", month, date.Day(), date.Year()) } +func getExternalIconSvg() template.HTML { + return template.HTML(` + + + `) +} + func getSeverityIconSvg(issue snyk.Issue) template.HTML { switch issue.Severity { case snyk.Critical: diff --git a/infrastructure/code/template/details.html b/infrastructure/code/template/details.html index adf808ce7..ba97d86b8 100644 --- a/infrastructure/code/template/details.html +++ b/infrastructure/code/template/details.html @@ -118,6 +118,11 @@ padding-right: 12px; } + .is-external-icon { + margin-bottom: 8px; + margin-left: 2px; + } + .styled-link { text-decoration: none; } @@ -663,10 +668,7 @@

{{.IssueTitle}}

Learn about this vulnerability - - - - + {{.ExternalIcon}} {{end}}