Просмотр исходного кода

feat(alerting): adds default checkbox to ui

bergquist 9 лет назад
Родитель
Сommit
5d62c84a19

+ 12 - 9
pkg/services/sqlstore/alert_notification.go

@@ -155,15 +155,18 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
 			return err
 		}
 
-		alertNotification := &m.AlertNotification{}
-		alertNotification.Id = cmd.Id
-		alertNotification.OrgId = cmd.OrgID
-		alertNotification.Name = cmd.Name
-		alertNotification.Type = cmd.Type
-		alertNotification.Settings = cmd.Settings
-		alertNotification.Updated = time.Now()
-		alertNotification.Created = current.Created
-		alertNotification.AlwaysExecute = cmd.AlwaysExecute
+		alertNotification := &m.AlertNotification{
+			Id:            cmd.Id,
+			OrgId:         cmd.OrgID,
+			Name:          cmd.Name,
+			Type:          cmd.Type,
+			Settings:      cmd.Settings,
+			Updated:       time.Now(),
+			Created:       current.Created,
+			AlwaysExecute: cmd.AlwaysExecute,
+		}
+
+		sess.UseBool("always_execute")
 
 		var affected int64
 		affected, err = sess.Id(alertNotification.Id).Update(alertNotification)

+ 3 - 0
public/app/features/alerting/partials/notification_edit.html

@@ -21,6 +21,9 @@
 				</select>
 			</div>
 		</div>
+		<div class="gf-form">
+			<gf-form-switch class="gf-form" label-class="width-8" label="Always execute" checked="ctrl.notification.alwaysExecute" on-change=""></gf-form-switch>
+		</div>
 	</div>
 	<div class="gf-form-group section" ng-show="ctrl.notification.type === 'webhook'">
 		<div class="gf-form">