Envoy tweaks
* Fix ComposeChart yAxis yaml unmarshling. * Allow disabled AutomationWorkflows to be store unmarshled. * More tests.
This commit is contained in:
parent
cd2b0c8998
commit
0589c8e6fa
@ -135,7 +135,8 @@ func (df *DecodeFilter) automationFromResource(rr ...string) *DecodeFilter {
|
||||
switch strings.ToLower(r) {
|
||||
case "automation:workflow":
|
||||
df = df.AutomationWorkflows(&types.WorkflowFilter{
|
||||
Query: id,
|
||||
Query: id,
|
||||
Disabled: filter.StateInclusive,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,6 +160,11 @@ func (wrap *composeChartConfigReport) UnmarshalYAML(n *yaml.Node) error {
|
||||
|
||||
return y7s.EachMap(n, func(k, v *yaml.Node) (err error) {
|
||||
switch k.Value {
|
||||
case "y",
|
||||
"yAxis",
|
||||
"YAxis":
|
||||
wrap.report.YAxis = make(map[string]interface{})
|
||||
return v.Decode(&wrap.report.YAxis)
|
||||
case "module":
|
||||
// custom decoder for referenced module
|
||||
// we'll copy this to the dedicated prop of the wrapping structure
|
||||
|
||||
@ -220,6 +220,10 @@ func sTestComposeChart(ctx context.Context, t *testing.T, s store.Storer, nsID,
|
||||
{
|
||||
Filter: "filter",
|
||||
ModuleID: modID,
|
||||
YAxis: map[string]interface{}{
|
||||
"beginAtZero": true,
|
||||
"label": "Euro",
|
||||
},
|
||||
},
|
||||
},
|
||||
ColorScheme: "colorscheme",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
27
tests/envoy/testdata/base/charts_axis.yaml
vendored
Normal file
27
tests/envoy/testdata/base/charts_axis.yaml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
namespace: ns1
|
||||
charts:
|
||||
c1:
|
||||
name: c1 name
|
||||
config:
|
||||
reports:
|
||||
- dimensions:
|
||||
- conditions: {}
|
||||
field: Rating
|
||||
meta: {}
|
||||
modifier: (no grouping / buckets)
|
||||
skipMissing: true
|
||||
filter: ""
|
||||
metrics:
|
||||
- aggregate: AVG
|
||||
field: count
|
||||
fill: true
|
||||
fixTooltips: false
|
||||
label: Number of Accounts
|
||||
lineTension: 0.4
|
||||
type: line
|
||||
module: mod1
|
||||
renderer: {}
|
||||
yAxis:
|
||||
beginAtZero: true
|
||||
label: Euro
|
||||
colorScheme: tableau.Tableau10
|
||||
@ -206,6 +206,31 @@ func TestYamlStore_base(t *testing.T) {
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "charts; axis",
|
||||
file: "charts_axis",
|
||||
pre: func() (err error) {
|
||||
return collect(
|
||||
storeComposeNamespace(ctx, s, 100, "ns1"),
|
||||
storeComposeModule(ctx, s, 100, 200, "mod1"),
|
||||
)
|
||||
},
|
||||
check: func(req *require.Assertions) {
|
||||
chr, err := store.LookupComposeChartByNamespaceIDHandle(ctx, s, 100, "c1")
|
||||
req.NoError(err)
|
||||
req.NotNil(chr)
|
||||
|
||||
req.Equal("c1", chr.Handle)
|
||||
req.Equal("c1 name", chr.Name)
|
||||
|
||||
req.Len(chr.Config.Reports, 1)
|
||||
|
||||
rep := chr.Config.Reports[0]
|
||||
req.Equal("Euro", rep.YAxis["label"])
|
||||
req.Equal(true, rep.YAxis["beginAtZero"])
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "pages; no namespace",
|
||||
file: "pages_no_ns",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user