mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): only expose DTO info when requesting all notifications
This commit is contained in:
parent
96e5ad3f5c
commit
0c5da9155f
@ -166,7 +166,19 @@ func GetAlertNotifications(c *middleware.Context) Response {
|
|||||||
return ApiError(500, "Failed to get alert notifications", err)
|
return ApiError(500, "Failed to get alert notifications", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(200, query.Result)
|
var result []dtos.AlertNotificationDTO
|
||||||
|
|
||||||
|
for _, notification := range query.Result {
|
||||||
|
result = append(result, dtos.AlertNotificationDTO{
|
||||||
|
Id: notification.Id,
|
||||||
|
Name: notification.Name,
|
||||||
|
Type: notification.Type,
|
||||||
|
Created: notification.Created,
|
||||||
|
Updated: notification.Updated,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return Json(200, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAlertNotificationById(c *middleware.Context) Response {
|
func GetAlertNotificationById(c *middleware.Context) Response {
|
||||||
|
@ -263,7 +263,7 @@ func Register(r *macaron.Macaron) {
|
|||||||
r.Delete("/:notificationId", wrap(DeleteAlertNotification))
|
r.Delete("/:notificationId", wrap(DeleteAlertNotification))
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Get("/changes", wrap(GetAlertChanges))
|
//r.Get("/changes", wrap(GetAlertChanges))
|
||||||
})
|
})
|
||||||
|
|
||||||
// error test
|
// error test
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package dtos
|
package dtos
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
type AlertRuleDTO struct {
|
type AlertRuleDTO struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
DashboardId int64 `json:"dashboardId"`
|
DashboardId int64 `json:"dashboardId"`
|
||||||
@ -19,3 +21,11 @@ type AlertRuleDTO struct {
|
|||||||
|
|
||||||
DashbboardUri string `json:"dashboardUri"`
|
DashbboardUri string `json:"dashboardUri"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AlertNotificationDTO struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Created time.Time `json:"created"`
|
||||||
|
Updated time.Time `json:"updated"`
|
||||||
|
}
|
||||||
|
@ -109,8 +109,11 @@
|
|||||||
<div class="gf-form-inline">
|
<div class="gf-form-inline">
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label">Groups</span>
|
<span class="gf-form-label">Groups</span>
|
||||||
|
<input class="gf-form-input max-width-7" type="text" ng-model="ctrl.alert.notify"></input>
|
||||||
|
<!--
|
||||||
<bootstrap-tagsinput ng-model="ctrl.alert.notify" tagclass="label label-tag" placeholder="add tags">
|
<bootstrap-tagsinput ng-model="ctrl.alert.notify" tagclass="label label-tag" placeholder="add tags">
|
||||||
</bootstrap-tagsinput>
|
</bootstrap-tagsinput>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user