feat(api): custom_metrics support metric_format
feat(api): custom_metrics metric_value accept wrong values
This commit is contained in:
parent
8c151e5bea
commit
fb72c2894b
1 changed files with 9 additions and 0 deletions
|
|
@ -778,6 +778,15 @@ class CreateCustomMetricsSchema(CustomMetricChartPayloadSchema):
|
|||
metric_format: Optional[str] = Field(None)
|
||||
|
||||
# metricFraction: float = Field(None, gt=0, lt=1)
|
||||
# This is used to handle wrong values sent by the UI
|
||||
@root_validator(pre=True)
|
||||
def remove_metric_value(cls, values):
|
||||
if values.get("metric_type") == MetricType.timeseries \
|
||||
or values.get("metric_type") == MetricType.table \
|
||||
and values.get("metric_of") != TableMetricOfType.issues:
|
||||
values["metric_of"] = []
|
||||
return values
|
||||
|
||||
@root_validator
|
||||
def validator(cls, values):
|
||||
if values.get("metric_type") == MetricType.table:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue