mirror of https://github.com/grafana/grafana.git
feat(alerting): Save As removes alerts from panels, closes #5965
This commit is contained in:
parent
2ca7284a56
commit
6b17cdbca6
|
|
@ -74,7 +74,10 @@ export class AlertTabCtrl {
|
|||
this.alertNotifications.push(model);
|
||||
}
|
||||
});
|
||||
}).then(() => {
|
||||
});
|
||||
}
|
||||
|
||||
getAlertHistory() {
|
||||
this.backendSrv.get(`/api/alert-history?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}`).then(res => {
|
||||
this.alertHistory = _.map(res, ah => {
|
||||
ah.time = moment(ah.timestamp).format('MMM D, YYYY HH:mm:ss');
|
||||
|
|
@ -87,7 +90,6 @@ export class AlertTabCtrl {
|
|||
return ah;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getNotificationIcon(type) {
|
||||
|
|
@ -125,7 +127,11 @@ export class AlertTabCtrl {
|
|||
}
|
||||
|
||||
initModel() {
|
||||
var alert = this.alert = this.panel.alert = this.panel.alert || {};
|
||||
var alert = this.alert = this.panel.alert = this.panel.alert || {enabled: false};
|
||||
|
||||
if (!this.alert.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
alert.conditions = alert.conditions || [];
|
||||
if (alert.conditions.length === 0) {
|
||||
|
|
@ -145,11 +151,9 @@ export class AlertTabCtrl {
|
|||
return memo;
|
||||
}, []);
|
||||
|
||||
if (this.alert.enabled) {
|
||||
this.panelCtrl.editingThresholds = true;
|
||||
}
|
||||
|
||||
ThresholdMapper.alertToGraphThresholds(this.panel);
|
||||
|
||||
this.panelCtrl.editingThresholds = true;
|
||||
this.panelCtrl.render();
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +177,10 @@ export class AlertTabCtrl {
|
|||
}
|
||||
|
||||
validateModel() {
|
||||
if (!this.alert.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
let firstTarget;
|
||||
var fixed = false;
|
||||
let foundTarget = null;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@
|
|||
<metric-segment-model property="conditionModel.evaluator.type" options="ctrl.evalFunctions" custom="false" css-class="query-keyword" on-change="ctrl.evaluatorTypeChanged(conditionModel.evaluator)"></metric-segment-model>
|
||||
<input class="gf-form-input max-width-7" type="number" ng-hide="conditionModel.evaluator.params.length === 0" ng-model="conditionModel.evaluator.params[0]" ng-change="ctrl.evaluatorParamsChanged()"></input>
|
||||
<label class="gf-form-label query-keyword" ng-show="conditionModel.evaluator.params.length === 2">TO</label>
|
||||
<input class="gf-form-input max-width-7" type="number" ng-if="conditionModel.evaluator.params.length === 2" ng-model="conditionModel.evaluator.params[1]" ng-change="ctrl.evaluatorParamsChanged()"></input>
|
||||
</div>
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label">
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@ function (angular) {
|
|||
$scope.clone.id = null;
|
||||
$scope.clone.editable = true;
|
||||
$scope.clone.title = $scope.clone.title + " Copy";
|
||||
|
||||
// remove alerts
|
||||
$scope.clone.rows.forEach(function(row) {
|
||||
row.panels.forEach(function(panel) {
|
||||
delete panel.alert;
|
||||
});
|
||||
});
|
||||
|
||||
// remove auto update
|
||||
delete $scope.clone.autoUpdate;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue