Commit 3af891d0 by Torkel Ödegaard

feat(alerting): restored alert history

parent b0c7e61e
...@@ -53,8 +53,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I ...@@ -53,8 +53,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
params = append(params, query.PanelId) params = append(params, query.PanelId)
} }
sql.WriteString(` AND epoch BETWEEN ? AND ?`) if query.From > 0 && query.To > 0 {
params = append(params, query.From, query.To) sql.WriteString(` AND epoch BETWEEN ? AND ?`)
params = append(params, query.From, query.To)
}
if query.Type != "" { if query.Type != "" {
sql.WriteString(` AND type = ?`) sql.WriteString(` AND type = ?`)
......
...@@ -86,7 +86,7 @@ export class AlertTabCtrl { ...@@ -86,7 +86,7 @@ export class AlertTabCtrl {
} }
getAlertHistory() { 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 => { this.alertHistory = _.map(res, ah => {
ah.time = moment(ah.timestamp).format('MMM D, YYYY HH:mm:ss'); ah.time = moment(ah.timestamp).format('MMM D, YYYY HH:mm:ss');
ah.stateModel = alertDef.getStateDisplayModel(ah.newState); ah.stateModel = alertDef.getStateDisplayModel(ah.newState);
......
...@@ -27,11 +27,10 @@ ...@@ -27,11 +27,10 @@
<div class="gf-form-group"> <div class="gf-form-group">
<h5 class="section-heading">Alert Config</h5> <h5 class="section-heading">Alert Config</h5>
<div class="gf-form"> <div class="gf-form">
<span class="gf-form-label width-8">Name</span> <span class="gf-form-label width-6">Name</span>
<input type="text" class="gf-form-input width-25" ng-model="ctrl.alert.name"> <input type="text" class="gf-form-input width-20" ng-model="ctrl.alert.name">
<span class="gf-form-label width-8">Evaluate every</span> <span class="gf-form-label">Evaluate every</span>
<input class="gf-form-input max-width-5" type="text" ng-model="ctrl.alert.frequency"></input> <input class="gf-form-input max-width-5" type="text" ng-model="ctrl.alert.frequency"></input>
</div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment