Skip to content

Commit 3af891d

Browse files
committed
feat(alerting): restored alert history
1 parent b0c7e61 commit 3af891d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pkg/services/sqlstore/annotation.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
5353
params = append(params, query.PanelId)
5454
}
5555

56-
sql.WriteString(` AND epoch BETWEEN ? AND ?`)
57-
params = append(params, query.From, query.To)
56+
if query.From > 0 && query.To > 0 {
57+
sql.WriteString(` AND epoch BETWEEN ? AND ?`)
58+
params = append(params, query.From, query.To)
59+
}
5860

5961
if query.Type != "" {
6062
sql.WriteString(` AND type = ?`)

public/app/features/alerting/alert_tab_ctrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class AlertTabCtrl {
8686
}
8787

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

public/app/features/alerting/partials/alert_tab.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@
2727
<div class="gf-form-group">
2828
<h5 class="section-heading">Alert Config</h5>
2929
<div class="gf-form">
30-
<span class="gf-form-label width-8">Name</span>
31-
<input type="text" class="gf-form-input width-25" ng-model="ctrl.alert.name">
32-
<span class="gf-form-label width-8">Evaluate every</span>
30+
<span class="gf-form-label width-6">Name</span>
31+
<input type="text" class="gf-form-input width-20" ng-model="ctrl.alert.name">
32+
<span class="gf-form-label">Evaluate every</span>
3333
<input class="gf-form-input max-width-5" type="text" ng-model="ctrl.alert.frequency"></input>
34-
</div>
3534
</div>
3635
</div>
3736

0 commit comments

Comments
 (0)