From a340aa95647c18bbeb27f7bf233515ba577c2119 Mon Sep 17 00:00:00 2001 From: Matt LaPaglia Date: Thu, 1 Jul 2021 09:17:30 -0400 Subject: [PATCH] save on enable --- .../alerts/pushover/pushover.component.html | 13 ++++++++++--- .../settings/alerts/pushover/pushover.component.ts | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.html b/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.html index ae0e1258..0182aa11 100644 --- a/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.html +++ b/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.html @@ -5,7 +5,8 @@ https://pushover.net/ + [(ngModel)]="client.isEnabled" + (change)="onPushoverToggle($event)">
@@ -25,8 +26,14 @@
- - + + diff --git a/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.ts b/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.ts index 381ca964..17e7e2f3 100644 --- a/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.ts +++ b/OpenAlprWebhookProcessor/ClientApp/src/app/settings/alerts/pushover/pushover.component.ts @@ -1,5 +1,6 @@ import { animate, style, transition, trigger } from '@angular/animations'; import { Component, OnInit } from '@angular/core'; +import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { SnackbarService } from '@app/snackbar/snackbar.service'; import { SnackBarType } from '@app/snackbar/snackbartype'; import { Pushover } from './pushover'; @@ -59,4 +60,14 @@ export class PushoverComponent implements OnInit { this.isTesting = false; }); } + + public onPushoverToggle(event: MatSlideToggleChange) { + if (!event.checked) { + this.client.isEnabled = event.checked; + this.isSaving = true; + this.pushoverService.upsertPushover(this.client).subscribe(_ => { + this.isSaving = false; + }); + } + } }