feat(alerting): restored alert history

This commit is contained in:
Torkel Ödegaard 2016-09-13 16:13:41 +02:00
parent b0c7e61ef8
commit 3af891d023
3 changed files with 8 additions and 7 deletions

View File

@ -53,8 +53,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
params = append(params, query.PanelId)
}
sql.WriteString(` AND epoch BETWEEN ? AND ?`)
params = append(params, query.From, query.To)
if query.From > 0 && query.To > 0 {
sql.WriteString(` AND epoch BETWEEN ? AND ?`)
params = append(params, query.From, query.To)
}
if query.Type != "" {
sql.WriteString(` AND type = ?`)

View File

@ -86,7 +86,7 @@ export class AlertTabCtrl {
}
getAlertHistory() {
this.backendSrv.get(`/api/alert-history?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`).then(res => {
this.backendSrv.get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`).then(res => {
this.alertHistory = _.map(res, ah => {
ah.time = moment(ah.timestamp).format('MMM D, YYYY HH:mm:ss');
ah.stateModel = alertDef.getStateDisplayModel(ah.newState);

View File

@ -27,11 +27,10 @@
<div class="gf-form-group">
<h5 class="section-heading">Alert Config</h5>
<div class="gf-form">
<span class="gf-form-label width-8">Name</span>
<input type="text" class="gf-form-input width-25" ng-model="ctrl.alert.name">
<span class="gf-form-label width-8">Evaluate every</span>
<span class="gf-form-label width-6">Name</span>
<input type="text" class="gf-form-input width-20" ng-model="ctrl.alert.name">
<span class="gf-form-label">Evaluate every</span>
<input class="gf-form-input max-width-5" type="text" ng-model="ctrl.alert.frequency"></input>
</div>
</div>
</div>