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

feat: add misconfirations graph #62

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

olsova
Copy link
Contributor

@olsova olsova commented Dec 19, 2024

No description provided.

afdesk and others added 7 commits November 27, 2024 15:38
* 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
Copy link
Collaborator

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 olsova requested a review from nikpivkin December 19, 2024 10:52
@nikpivkin
Copy link
Collaborator

@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" .}}%

render/render.go Outdated Show resolved Hide resolved
render/render.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@nikpivkin nikpivkin left a 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

render/render.go Outdated Show resolved Hide resolved
@nikpivkin
Copy link
Collaborator

Maybe rename template to templates?

@olsova olsova requested a review from nikpivkin December 25, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants