frontend: add filtering by protocol type to summary tables (#40)

* frontend: add option to filter by protocol type

Closes #33.

* frontend: use case insensitive comparisons for protocol filter
This commit is contained in:
James Lu
2021-09-07 13:17:16 -07:00
committed by GitHub
parent a64d839e2c
commit 2166d73b3d
4 changed files with 60 additions and 0 deletions

View File

@@ -156,6 +156,18 @@ func summaryParse(data string, serverName string) (TemplateSummary, error) {
}
if len(lineSplitted) >= 4 {
row.Proto = strings.TrimSpace(lineSplitted[3])
// Filter away unwanted protocol types, if setting.protocolFilter is non-empty
found := false
for _, protocol := range setting.protocolFilter {
if strings.EqualFold(row.Proto, protocol) {
found = true
break
}
}
if len(setting.protocolFilter) > 0 && !found {
continue
}
}
if len(lineSplitted) >= 6 {
row.Table = strings.TrimSpace(lineSplitted[5])