Merge pull request #11522 from zhaoxiangchun/bugfix/zxc-monitor-resouceName

fix(monitor): update alert panel scope by  alert dashboard
This commit is contained in:
Zexi Li
2021-06-30 10:30:47 +08:00
committed by GitHub
2 changed files with 4 additions and 4 deletions
+1
View File
@@ -4,6 +4,7 @@ import "yunion.io/x/onecloud/pkg/apis"
type AlertPanelCreateInput struct {
apis.ScopedResourceInput
apis.ProjectizedResourceListInput
CommonMetricInputQuery
AlertCreateInput
+3 -4
View File
@@ -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)
}