-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add misconfirations graph #62
base: main
Are you sure you want to change the base?
Conversation
* feat: replace js render to template * feat: add extra tables to template * ci: update release steps * test: add unit tests * ci: change test trigger branch * ci: change test trigger branch * fix: change path for testing * ci: add checkout * fix: add changes according PR reviews * test: update testdata * fix: add centering for fixed version * docs: update README.md * chore: add cmd short description
render/render.go
Outdated
@@ -14,6 +14,11 @@ import ( | |||
//go:embed template/html.tpl | |||
var htmlTmpl []byte | |||
|
|||
type Data struct { | |||
Results types.Results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the graph uses only the Results field from the report, you can change the js logic and pass only the results to the template
@olsova @afdesk The template becomes very large. What if we use the following approach? This will allow vendor files to be included in the binary. //go:embed templates/*
var templates embed.FS
func main() {
templateFS, err := fs.Sub(templates, "templates")
if err != nil {
panic(err)
}
t, err := template.ParseFS(templateFS, "*.js", "*.tpl", "*.css")
if err != nil {
panic(err)
}
if err := t.ExecuteTemplate(os.Stdout, "index.tpl", map[string]any{}); err != nil {
panic(err)
}
} We can include other templates (or just files) in the main template: ❯ cat templates/index.tpl
{{template "index.js" .}}% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of small comments
Maybe rename template to templates? |
No description provided.