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

Add veneers for panel overrides #244

Open
K-Phoen opened this issue Feb 12, 2024 · 0 comments
Open

Add veneers for panel overrides #244

K-Phoen opened this issue Feb 12, 2024 · 0 comments

Comments

@K-Phoen
Copy link
Member

K-Phoen commented Feb 12, 2024

Overrides can be quite tedious to define. See:

cog/examples/_go/disk.go

Lines 138 to 177 in fa1fbdc

// Overrides configuration
WithOverride(
dashboard.MatcherConfig{Id: "byName", Options: "Mounted on"},
[]dashboard.DynamicConfigValue{
{Id: "custom.width", Value: 260},
},
).
WithOverride(
dashboard.MatcherConfig{Id: "byName", Options: "Size"},
[]dashboard.DynamicConfigValue{
{Id: "custom.width", Value: 93},
},
).
WithOverride(
dashboard.MatcherConfig{Id: "byName", Options: "Used"},
[]dashboard.DynamicConfigValue{
{Id: "custom.width", Value: 72},
},
).
WithOverride(
dashboard.MatcherConfig{Id: "byName", Options: "Available"},
[]dashboard.DynamicConfigValue{
{Id: "custom.width", Value: 88},
},
).
WithOverride(
dashboard.MatcherConfig{Id: "byName", Options: "Used, %"},
[]dashboard.DynamicConfigValue{
{Id: "unit", Value: "percentunit"},
{Id: "custom.cellOptions", Value: struct {
Mode string `json:"mode"`
Type string `json:"type"`
}{
Mode: "gradient",
Type: "gauge",
}},
{Id: "min", Value: 0},
{Id: "max", Value: 1},
},
)

They could use some veneers to make them easier to discover and use. The matcher argument seems like a good candidate for pre-built matchers such as dashboard.MatchByName("Size") or dashboard.MatchByRegex("/ io time/")

Defining veneers for the second argument – []DynamicConfigValue – would be great but seems a bit harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant