瀏覽代碼

Merge branch 'feature/admin-panel'

Christian Kahlau 2 年之前
父節點
當前提交
6ad7724763

+ 5 - 5
ng/src/app/components/admin/admin-panel/admin-panel.component.html

@@ -7,11 +7,11 @@
         <ngb-accordion #acc="ngbAccordion">
           <ngb-panel *ngFor="let serviceCheck of serviceChecks; let i = index">
             <ng-template ngbPanelHeader let-opened="opened">
-              <div class="accordion-button custom-header justify-content-between" [class.collapsed]="!opened">
-                <p class="m-0">{{ serviceCheck.title }}</p>
-                <button (click)="saveServiceCheck(i)" *ngIf="opened"><fa-icon [icon]="fa.save"></fa-icon></button>
-                <button ngbPanelToggle class="accordion-button"></button>
-              </div>
+              <button class="accordion-button" ngbPanelToggle [class.collapsed]="!opened">
+                <p class="flex-fill m-0">{{ serviceCheck.title }}</p>
+
+                <fa-icon class="me-1" (click)="saveServiceCheck(i, $event)" *ngIf="opened" [icon]="fa.save"></fa-icon>
+              </button>
             </ng-template>
             <ng-template ngbPanelContent>
               <app-service-check-form [serviceCheck]="serviceCheck"></app-service-check-form>

+ 2 - 1
ng/src/app/components/admin/admin-panel/admin-panel.component.ts

@@ -29,7 +29,8 @@ export class AdminPanelComponent implements OnInit {
     }
   }
 
-  saveServiceCheck(index: number) {
+  saveServiceCheck(index: number, event: Event) {
+    event.stopPropagation();
     this.formChilds.get(index)?.save();
   }
 

+ 13 - 1
ng/src/app/components/service-check-form/service-check-form.component.html

@@ -7,7 +7,7 @@
       </div>
     </div>
     <div class="row mb-2">
-      <label class="col-sm-3 form-check-label" [for]="'Active_' + serviceCheck.id"> Active </label>
+      <label class="col-sm-3 form-check-label" [for]="'Active_' + serviceCheck.id">Active</label>
       <div class="col-sm-9">
         <input class="form-check-input" formControlName="active" type="checkbox" value="" [id]="'Active_' + serviceCheck.id" />
       </div>
@@ -30,6 +30,18 @@
         <input type="text" formControlName="url" class="form-control" [id]="'Url_' + serviceCheck.id" />
       </div>
     </div>
+    <div class="row mb-2">
+      <label [for]="'Notify_' + serviceCheck.id" class="col-sm-3 col-form-label">Notify</label>
+      <div class="col-sm-9">
+        <input type="checkbox" formControlName="notify" class="form-check-input" [id]="'Notify_' + serviceCheck.id" />
+      </div>
+    </div>
+    <div class="row mb-2">
+      <label [for]="'NotifyThreshold_' + serviceCheck.id" class="col-sm-3 col-form-label">Notify Threshold</label>
+      <div class="col-sm-9">
+        <input type="number" formControlName="notifyThreshold" class="form-control" [id]="'NotifyThreshold_' + serviceCheck.id" />
+      </div>
+    </div>
   </div>
   <div class="col-5 h-100 overflow-auto">
     <ul formArrayName="checks" class="list-group">

+ 2 - 2
ng/src/app/components/service-check-form/service-check-form.component.scss

@@ -1,4 +1,4 @@
 .form-row-service-check {
-  max-height: 220px;
-  height: 220px;
+  max-height: 320px;
+  height: 320px;
 }

+ 3 - 1
ng/src/app/components/service-check-form/service-check-form.component.ts

@@ -29,7 +29,9 @@ export class ServiceCheckFormComponent implements OnInit {
     url: '', //constant for defaultValues
     interval: 10, //constant for defaultValues
     timeout: 10, //constant for defaultValuess
-    checks: this.formBuilder.array([])
+    checks: this.formBuilder.array([]),
+    notify: true,
+    notifyThreshold: 3
   });
 
   constructor(private formBuilder: FormBuilder, private serviceApi: ServiceApiService) {}

+ 14 - 0
server/docs/idee_oder-checks.ts

@@ -0,0 +1,14 @@
+type CheckDisjunction = Array<string | string[] | { and: string[] }>;
+const bla: CheckDisjunction = [{ and: ['adefag', 'daefag'] }, 'bla', ['sdgdrs', 'aefawg'], { and: [''] }];
+
+const blubb: CheckDisjunction = [
+  {
+    and: ['coachingsamtherz', 'coachingsamtherz\\.de', '<title>[^<]*(coaching\\s*samt\\s*herz)[^<]*</title>']
+  },
+  {
+    and: ['Maintenance', 'Login']
+  },
+  {
+    and: ['Down', 'NSA hacked this site']
+  }
+];