Annotations: Exclude internal dashboard id when saved via UID (#111535)
This commit is contained in:
@@ -299,16 +299,13 @@ func (r *xormRepositoryImpl) Get(ctx context.Context, query annotations.ItemQuer
|
||||
params = append(params, query.AlertUID, query.OrgID)
|
||||
}
|
||||
|
||||
// nolint: staticcheck
|
||||
if query.DashboardID != 0 {
|
||||
sql.WriteString(` AND a.dashboard_id = ?`)
|
||||
params = append(params, query.DashboardID)
|
||||
}
|
||||
|
||||
// note: orgID is already required above
|
||||
if query.DashboardUID != "" {
|
||||
sql.WriteString(` AND a.dashboard_uid = ?`)
|
||||
params = append(params, query.DashboardUID)
|
||||
} else if query.DashboardID != 0 { // nolint: staticcheck
|
||||
sql.WriteString(` AND a.dashboard_id = ?`)
|
||||
params = append(params, query.DashboardID) // nolint: staticcheck
|
||||
}
|
||||
|
||||
if query.PanelID != 0 {
|
||||
|
||||
@@ -111,26 +111,26 @@ func (i Item) TableName() string {
|
||||
|
||||
// swagger:model Annotation
|
||||
type ItemDTO struct {
|
||||
ID int64 `json:"id" xorm:"id"`
|
||||
AlertID int64 `json:"alertId" xorm:"alert_id"`
|
||||
AlertName string `json:"alertName"`
|
||||
ID int64 `json:"id,omitempty" xorm:"id"`
|
||||
AlertID int64 `json:"alertId,omitempty" xorm:"alert_id"`
|
||||
AlertName string `json:"alertName,omitempty"`
|
||||
// Deprecated: Use DashboardUID and OrgID instead
|
||||
DashboardID int64 `json:"dashboardId" xorm:"dashboard_id"`
|
||||
DashboardUID *string `json:"dashboardUID" xorm:"dashboard_uid"`
|
||||
PanelID int64 `json:"panelId" xorm:"panel_id"`
|
||||
UserID int64 `json:"userId" xorm:"user_id"`
|
||||
NewState string `json:"newState"`
|
||||
PrevState string `json:"prevState"`
|
||||
Created int64 `json:"created"`
|
||||
Updated int64 `json:"updated"`
|
||||
Time int64 `json:"time"`
|
||||
TimeEnd int64 `json:"timeEnd"`
|
||||
Text string `json:"text"`
|
||||
Tags []string `json:"tags"`
|
||||
Login string `json:"login"`
|
||||
Email string `json:"email"`
|
||||
AvatarURL string `json:"avatarUrl" xorm:"avatar_url"`
|
||||
Data *simplejson.Json `json:"data"`
|
||||
DashboardID int64 `json:"dashboardId,omitempty" xorm:"dashboard_id"`
|
||||
DashboardUID *string `json:"dashboardUID,omitempty" xorm:"dashboard_uid"`
|
||||
PanelID int64 `json:"panelId,omitempty" xorm:"panel_id"`
|
||||
UserID int64 `json:"userId,omitempty" xorm:"user_id"`
|
||||
NewState string `json:"newState,omitempty"`
|
||||
PrevState string `json:"prevState,omitempty"`
|
||||
Created int64 `json:"created,omitempty"`
|
||||
Updated int64 `json:"updated,omitempty"`
|
||||
Time int64 `json:"time,omitempty"`
|
||||
TimeEnd int64 `json:"timeEnd,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
Login string `json:"login,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
AvatarURL string `json:"avatarUrl,omitempty" xorm:"avatar_url"`
|
||||
Data *simplejson.Json `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type SortedItems []*ItemDTO
|
||||
|
||||
Reference in New Issue
Block a user