Skip to content

Commit

Permalink
fix(pkger): relax chart validation on query values
Browse files Browse the repository at this point in the history
this fixes a bug where we are trying to export a dashboard that has chart
with unexpected missign queries. the root cause of these issues is uknown
but the fix here is to remove the strict requirement. a user can still
delete any unexpected cell if they deem necessary after the export.
  • Loading branch information
jsteenb2 committed May 27, 2020
1 parent b7b1113 commit bfc27a9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 403 deletions.
29 changes: 0 additions & 29 deletions pkger/parser_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,6 @@ func (c chart) validProperties() []validationErr {

validatorFns := []func() []validationErr{
c.validBaseProps,
c.Queries.valid,
c.Colors.valid,
}
for _, validatorFn := range validatorFns {
Expand Down Expand Up @@ -960,34 +959,6 @@ func (q queries) influxDashQueries() []influxdb.DashboardQuery {
return iQueries
}

func (q queries) valid() []validationErr {
var fails []validationErr
if len(q) == 0 {
fails = append(fails, validationErr{
Field: fieldChartQueries,
Msg: "at least 1 query must be provided",
})
}

for i, qq := range q {
qErr := validationErr{
Field: fieldChartQueries,
Index: intPtr(i),
}
if qq.Query == "" {
qErr.Nested = append(fails, validationErr{
Field: fieldQuery,
Msg: "a query must be provided",
})
}
if len(qErr.Nested) > 0 {
fails = append(fails, qErr)
}
}

return fails
}

const (
fieldAxisBase = "base"
fieldAxisLabel = "label"
Expand Down
Loading

0 comments on commit bfc27a9

Please sign in to comment.