Skip to content

Commit

Permalink
add configurable paging size
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Aug 21, 2024
1 parent 1b97dcf commit f673c84
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion config/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type (

// report
Report struct {
Title string `long:"report.title" env:"REPORT_TITLE" description:"Report title"`
Title string `long:"report.title" env:"REPORT_TITLE" description:"Report title"`
PaginationSize int `long:"report.pagination.size" env:"REPORT_PAGINATION_SIZE" description:"Report pagination size" default:"50" choice:"5" choice:"10" choice:"25" choice:"50" choice:"100" choice:"250"`

Check failure on line 28 in config/opts.go

View workflow job for this annotation

GitHub Actions / release / lint

SA5008: duplicate struct tag "choice" (staticcheck)
}

// scrape times
Expand Down
30 changes: 16 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,23 @@ func startHttpServer() {
selectedReport := r.URL.Query().Get("report")

templatePayload := struct {
Nonce string
Config auditor.AuditConfig
ReportTitle string
ReportConfig *validator.AuditConfigValidation
Reports map[string]*auditor.AzureAuditorReport
ServerPathReport string
RequestReport string
Nonce string
Config auditor.AuditConfig
ReportTitle string
ReportConfig *validator.AuditConfigValidation
Reports map[string]*auditor.AzureAuditorReport
ServerPathReport string
RequestReport string
ReportPaginationSize int
}{
Nonce: cspNonce,
Config: azureAuditor.GetConfig(),
ReportTitle: Opts.Report.Title,
ReportConfig: nil,
Reports: azureAuditor.GetReport(),
ServerPathReport: Opts.Server.PathReport,
RequestReport: "",
Nonce: cspNonce,
Config: azureAuditor.GetConfig(),
ReportTitle: Opts.Report.Title,
ReportConfig: nil,
Reports: azureAuditor.GetReport(),
ServerPathReport: Opts.Server.PathReport,
RequestReport: "",
ReportPaginationSize: Opts.Report.PaginationSize,
}

reportInfo := strings.SplitN(selectedReport, ":", 2)
Expand Down
2 changes: 1 addition & 1 deletion templates/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ let table = new Tabulator("#report-table", {
renderHorizontal: "virtual",

pagination: true,
paginationSize: 10,
paginationSize: {{ $root.ReportPaginationSize | default "10" }},
paginationSizeSelector: [5, 10, 25, 50, 100, 250, true],

printHeader: $("#report-title").html(),
Expand Down

0 comments on commit f673c84

Please sign in to comment.