mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-31 01:35:56 +08:00
fix(monitor): 仅在 From/To/Interval 为空时设置默认值 (#24398)
setDefaultValue 中 From、To、Interval 改为仅在当前值为空时 才用 inputQuery 覆盖,避免覆盖用户已指定的查询时间范围与间隔
This commit is contained in:
@@ -393,9 +393,15 @@ func setDefaultValue(
|
||||
inputQuery *monitor.MetricQueryInput,
|
||||
scope string, ownerId mcclient.IIdentityProvider,
|
||||
isAlert bool) {
|
||||
query.From = inputQuery.From
|
||||
query.To = inputQuery.To
|
||||
query.Model.Interval = inputQuery.Interval
|
||||
if query.From == "" {
|
||||
query.From = inputQuery.From
|
||||
}
|
||||
if query.To == "" {
|
||||
query.To = inputQuery.To
|
||||
}
|
||||
if query.Model.Interval == "" {
|
||||
query.Model.Interval = inputQuery.Interval
|
||||
}
|
||||
|
||||
metricMeasurement, _ := MetricMeasurementManager.GetCache().Get(query.Model.Measurement)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user