Skip to content

Commit

Permalink
TSVB: Add validation support for legacy filter values (#58436) (#59202)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Mar 4, 2020
1 parent db4a61b commit b334f67
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/plugins/vis_type_timeseries/server/routes/post_vis_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const backgroundColorRulesItems = Joi.object({

const gaugeColorRulesItems = Joi.object({
gauge: stringOptionalNullable,
text: stringOptionalNullable,
id: stringOptionalNullable,
operator: stringOptionalNullable,
value: Joi.number(),
Expand Down Expand Up @@ -95,6 +96,18 @@ const metricsItems = Joi.object({
})
)
.optional(),
percentiles: Joi.array()
.items(
Joi.object({
id: stringRequired,
field: stringOptionalNullable,
mode: Joi.string().allow('line', 'band'),
shade: Joi.alternatives(numberOptional, stringOptionalNullable),
value: Joi.alternatives(numberOptional, stringOptionalNullable),
percentile: stringOptionalNullable,
})
)
.optional(),
type: stringRequired,
value: stringOptionalNullable,
values: Joi.array()
Expand Down Expand Up @@ -132,10 +145,13 @@ const seriesItems = Joi.object({
)
.optional(),
fill: numberOptionalOrEmptyString,
filter: Joi.object({
query: stringRequired,
language: stringOptionalNullable,
}).optional(),
filter: Joi.alternatives(
Joi.object({
query: stringRequired,
language: stringOptionalNullable,
}).optional(),
Joi.string().valid('')
),
formatter: stringRequired,
hide_in_legend: numberIntegerOptional,
hidden: Joi.boolean().optional(),
Expand Down

0 comments on commit b334f67

Please sign in to comment.