TSVB validation: Allow numeric values for axes (#63553)
This commit is contained in:
parent
d79e631d47
commit
45aa090e99
|
@ -36,6 +36,7 @@ const queryObject = Joi.object({
|
||||||
language: Joi.string().allow(''),
|
language: Joi.string().allow(''),
|
||||||
query: Joi.string().allow(''),
|
query: Joi.string().allow(''),
|
||||||
});
|
});
|
||||||
|
const stringOrNumberOptionalNullable = Joi.alternatives([stringOptionalNullable, numberOptional]);
|
||||||
const numberOptionalOrEmptyString = Joi.alternatives(numberOptional, Joi.string().valid(''));
|
const numberOptionalOrEmptyString = Joi.alternatives(numberOptional, Joi.string().valid(''));
|
||||||
|
|
||||||
const annotationsItems = Joi.object({
|
const annotationsItems = Joi.object({
|
||||||
|
@ -78,7 +79,7 @@ const metricsItems = Joi.object({
|
||||||
unit: stringOptionalNullable,
|
unit: stringOptionalNullable,
|
||||||
model_type: stringOptionalNullable,
|
model_type: stringOptionalNullable,
|
||||||
mode: stringOptionalNullable,
|
mode: stringOptionalNullable,
|
||||||
lag: numberOptional,
|
lag: numberOptionalOrEmptyString,
|
||||||
alpha: numberOptional,
|
alpha: numberOptional,
|
||||||
beta: numberOptional,
|
beta: numberOptional,
|
||||||
gamma: numberOptional,
|
gamma: numberOptional,
|
||||||
|
@ -130,8 +131,8 @@ const seriesItems = Joi.object({
|
||||||
aggregate_by: stringOptionalNullable,
|
aggregate_by: stringOptionalNullable,
|
||||||
aggregate_function: stringOptionalNullable,
|
aggregate_function: stringOptionalNullable,
|
||||||
axis_position: stringRequired,
|
axis_position: stringRequired,
|
||||||
axis_max: stringOptionalNullable,
|
axis_max: stringOrNumberOptionalNullable,
|
||||||
axis_min: stringOptionalNullable,
|
axis_min: stringOrNumberOptionalNullable,
|
||||||
chart_type: stringRequired,
|
chart_type: stringRequired,
|
||||||
color: stringRequired,
|
color: stringRequired,
|
||||||
color_rules: Joi.array()
|
color_rules: Joi.array()
|
||||||
|
@ -198,8 +199,8 @@ export const visPayloadSchema = Joi.object({
|
||||||
axis_formatter: stringRequired,
|
axis_formatter: stringRequired,
|
||||||
axis_position: stringRequired,
|
axis_position: stringRequired,
|
||||||
axis_scale: stringRequired,
|
axis_scale: stringRequired,
|
||||||
axis_min: stringOptionalNullable,
|
axis_min: stringOrNumberOptionalNullable,
|
||||||
axis_max: stringOptionalNullable,
|
axis_max: stringOrNumberOptionalNullable,
|
||||||
bar_color_rules: arrayNullable.optional(),
|
bar_color_rules: arrayNullable.optional(),
|
||||||
background_color: stringOptionalNullable,
|
background_color: stringOptionalNullable,
|
||||||
background_color_rules: Joi.array()
|
background_color_rules: Joi.array()
|
||||||
|
@ -221,9 +222,9 @@ export const visPayloadSchema = Joi.object({
|
||||||
.optional(),
|
.optional(),
|
||||||
gauge_width: [stringOptionalNullable, numberOptional],
|
gauge_width: [stringOptionalNullable, numberOptional],
|
||||||
gauge_inner_color: stringOptionalNullable,
|
gauge_inner_color: stringOptionalNullable,
|
||||||
gauge_inner_width: Joi.alternatives(stringOptionalNullable, numberIntegerOptional),
|
gauge_inner_width: stringOrNumberOptionalNullable,
|
||||||
gauge_style: stringOptionalNullable,
|
gauge_style: stringOptionalNullable,
|
||||||
gauge_max: stringOptionalNullable,
|
gauge_max: stringOrNumberOptionalNullable,
|
||||||
id: stringRequired,
|
id: stringRequired,
|
||||||
ignore_global_filters: numberOptional,
|
ignore_global_filters: numberOptional,
|
||||||
ignore_global_filter: numberOptional,
|
ignore_global_filter: numberOptional,
|
||||||
|
|
|
@ -41,5 +41,6 @@ export const tsvbTelemetrySavedObjectType: SavedObjectsType = {
|
||||||
},
|
},
|
||||||
migrations: {
|
migrations: {
|
||||||
'7.7.0': flow<SavedObjectMigrationFn>(resetCount),
|
'7.7.0': flow<SavedObjectMigrationFn>(resetCount),
|
||||||
|
'7.8.0': flow<SavedObjectMigrationFn>(resetCount),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue