mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): update paths for alert state
This commit is contained in:
parent
26941284da
commit
27274f37e8
@ -239,14 +239,15 @@ func Register(r *macaron.Macaron) {
|
||||
r.Get("/metrics/test", GetTestMetrics)
|
||||
|
||||
r.Group("/alerts", func() {
|
||||
r.Get("/events/:alertId", wrap(GetAlertState))
|
||||
r.Put("/events/:alertId", bind(m.UpdateAlertStateCommand{}), wrap(PutAlertState))
|
||||
r.Get("/changes", wrap(GetAlertChanges))
|
||||
r.Get("/", wrap(GetAlerts))
|
||||
r.Get("/:alertId/states", wrap(GetAlertState))
|
||||
r.Put("/:alertId/state", bind(m.UpdateAlertStateCommand{}), wrap(PutAlertState))
|
||||
r.Get("/:alertId", ValidateOrgAlert, wrap(GetAlert))
|
||||
r.Get("/", wrap(GetAlerts))
|
||||
r.Delete("/:alertId", ValidateOrgAlert, wrap(DelAlert))
|
||||
})
|
||||
|
||||
r.Get("/alert-changes", wrap(GetAlertChanges))
|
||||
|
||||
r.Get("/alerts-dashboard/:dashboardId", wrap(GetAlertsForDashboard))
|
||||
r.Get("/alerts-dashboard/:dashboardId/:panelId", wrap(GetAlertsForPanel))
|
||||
|
||||
|
@ -82,6 +82,7 @@ func TestAlertRuleChangesDataAccess(t *testing.T) {
|
||||
SaveAlertChange("UPDATED", items[0], sess)
|
||||
SaveAlertChange("UPDATED", items[0], sess)
|
||||
SaveAlertChange("UPDATED", items[0], sess)
|
||||
sess.Commit()
|
||||
|
||||
Convey("query for max one change", func() {
|
||||
query := &m.GetAlertChangesQuery{OrgId: FakeOrgId, Limit: 1}
|
||||
|
@ -22,7 +22,7 @@ export class AlertLogCtrl {
|
||||
}
|
||||
|
||||
loadAlertLogs() {
|
||||
this.backendSrv.get('/api/alerts/events/' + this.alertId).then(result => {
|
||||
this.backendSrv.get(`/api/alerts/${this.alertId}/states/`).then(result => {
|
||||
this.alertLogs = _.map(result, log => {
|
||||
log.iconCss = alertDef.getCssForState(log.newState);
|
||||
log.humanTime = moment(log.created).format("YYYY-MM-DD HH:mm:ss");
|
||||
@ -30,7 +30,7 @@ export class AlertLogCtrl {
|
||||
});
|
||||
});
|
||||
|
||||
this.backendSrv.get('/api/alerts/' + this.alertId).then(result => {
|
||||
this.backendSrv.get(`api/alerts/${this.alertId}`).then(result => {
|
||||
this.alert = result;
|
||||
});
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ export class AlertTabCtrl {
|
||||
panelCtrl: any;
|
||||
alerting: any;
|
||||
metricTargets = [{ refId: '- select query -' } ];
|
||||
operators = ['>', '<', '<=', '>='];
|
||||
aggregators = ['avg', 'sum', 'min', 'max', 'median'];
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, private $timeout) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
Warn level
|
||||
</span>
|
||||
<div class="gf-form-select-wrapper max-width-10">
|
||||
<select class="gf-form-input" ng-model="ctrl.panel.alerting.warnOperator" ng-options="oper as oper for oper in ['>', '<', '<=', '>=']"></select>
|
||||
<select class="gf-form-input" ng-model="ctrl.panel.alerting.warnOperator" ng-options="oper as oper for oper in alertTab.operators"></select>
|
||||
</div>
|
||||
<input class="gf-form-input max-width-7" type="number" ng-model="ctrl.panel.alerting.warnLevel" ng-change="alertTab.thresholdsUpdated()"></input>
|
||||
</div>
|
||||
@ -27,7 +27,7 @@
|
||||
Critical level
|
||||
</span>
|
||||
<div class="gf-form-select-wrapper max-width-10">
|
||||
<select class="gf-form-input" ng-model="ctrl.panel.alerting.critOperator" ng-options="oper as oper for oper in ['>', '<', '<=', '>=']"></select>
|
||||
<select class="gf-form-input" ng-model="ctrl.panel.alerting.critOperator" ng-options="oper as oper for oper in alertTab.operators"></select>
|
||||
</div>
|
||||
<input class="gf-form-input max-width-7" type="number" ng-model="ctrl.panel.alerting.critLevel" ng-change="alertTab.thresholdsUpdated()"></input>
|
||||
</div>
|
||||
@ -40,7 +40,7 @@
|
||||
<div class="gf-form-select-wrapper max-width-10">
|
||||
<select class="gf-form-input"
|
||||
ng-model="ctrl.panel.alerting.aggregator"
|
||||
ng-options="oper as oper for oper in ['avg', 'sum', 'min', 'max', 'median']"></select>
|
||||
ng-options="oper as oper for oper in alertTab.aggregators"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user