Skip to content

Commit

Permalink
When too many panels are in top row, put them in
Browse files Browse the repository at this point in the history
an Overview section
  • Loading branch information
jotak committed Apr 8, 2024
1 parent c7ad582 commit 796064e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/dashboards/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func rearrangeRows(rows []*Row, mapTopPanels, mapBodyPanels map[string][]Panel)
}
rows[i].Panels = topPanels
rows[i].Panels = append(rows[i].Panels, bodyPanels...)
if rows[i].Title == "" && len(rows[i].Panels) > 8 {
// When top row has many panels, create a collapsable section
rows[i].Title = "Overview"
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboards/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestCreateFlowMetricsDashboard_All(t *testing.T) {

assert.Equal("NetObserv / Main", d.Title)

assert.Equal([]string{"", "Traffic rates", "TCP latencies", "Byte and packet drops", "DNS"}, d.Titles())
assert.Equal([]string{"Overview", "Traffic rates", "TCP latencies", "Byte and packet drops", "DNS"}, d.Titles())

assert.Len(d.Rows[0].Panels, 16)
assert.Len(d.Rows[1].Panels, 20)
Expand Down

0 comments on commit 796064e

Please sign in to comment.