mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #11522 from zhaoxiangchun/bugfix/zxc-monitor-resouceName
fix(monitor): update alert panel scope by alert dashboard
This commit is contained in:
@@ -4,6 +4,7 @@ import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type AlertPanelCreateInput struct {
|
||||
apis.ScopedResourceInput
|
||||
apis.ProjectizedResourceListInput
|
||||
|
||||
CommonMetricInputQuery
|
||||
AlertCreateInput
|
||||
|
||||
@@ -158,14 +158,13 @@ func (panel *SAlertPanel) CustomizeCreate(
|
||||
query jsonutils.JSONObject,
|
||||
data jsonutils.JSONObject,
|
||||
) error {
|
||||
err := panel.SScopedResourceBase.CustomizeCreate(ctx, userCred, ownerId, query, data)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "alertPanel SScopedResourceBase CustomizeCreate error")
|
||||
}
|
||||
dashboardId, err := data.GetString("dashboard_id")
|
||||
if len(dashboardId) == 0 {
|
||||
return errors.Wrap(err, "panel CustomizeCreate can not get dashboard_id")
|
||||
}
|
||||
dash, _ := AlertDashBoardManager.getDashboardByid(dashboardId)
|
||||
panel.ProjectId = dash.ProjectId
|
||||
panel.DomainId = dash.DomainId
|
||||
return panel.attachDashboard(ctx, dashboardId)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user