|
@@ -1,7 +1,7 @@
|
|
|
import { Component, ElementRef, Input, OnInit, QueryList, ViewChildren } from '@angular/core';
|
|
import { Component, ElementRef, Input, OnInit, QueryList, ViewChildren } from '@angular/core';
|
|
|
import { FormControl, FormGroup, FormArray, FormBuilder } from '@angular/forms';
|
|
import { FormControl, FormGroup, FormArray, FormBuilder } from '@angular/forms';
|
|
|
import { faMinusSquare, faPlusSquare } from '@fortawesome/free-solid-svg-icons';
|
|
import { faMinusSquare, faPlusSquare } from '@fortawesome/free-solid-svg-icons';
|
|
|
-import { AdminPanelService } from '../../services/admin-panel.service';
|
|
|
|
|
|
|
+import { ServiceApiService } from '../../services/service-api.service';
|
|
|
import { deepCopy } from '../../../../../common/util/object-utils';
|
|
import { deepCopy } from '../../../../../common/util/object-utils';
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
@@ -32,7 +32,7 @@ export class ServiceCheckFormComponent implements OnInit {
|
|
|
checks: this.formBuilder.array([])
|
|
checks: this.formBuilder.array([])
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- constructor(private formBuilder: FormBuilder, private checkService: AdminPanelService) {}
|
|
|
|
|
|
|
+ constructor(private formBuilder: FormBuilder, private serviceApi: ServiceApiService) {}
|
|
|
|
|
|
|
|
get checks(): FormArray {
|
|
get checks(): FormArray {
|
|
|
return this.serviceCheckForm.controls['checks'] as FormArray;
|
|
return this.serviceCheckForm.controls['checks'] as FormArray;
|
|
@@ -64,7 +64,7 @@ export class ServiceCheckFormComponent implements OnInit {
|
|
|
this.serviceCheckForm.updateValueAndValidity();
|
|
this.serviceCheckForm.updateValueAndValidity();
|
|
|
const copy = deepCopy(this.serviceCheckForm.value as HttpCheckConfig);
|
|
const copy = deepCopy(this.serviceCheckForm.value as HttpCheckConfig);
|
|
|
copy.checks = this.checks.controls.map(e => e.value).reverse();
|
|
copy.checks = this.checks.controls.map(e => e.value).reverse();
|
|
|
- const savedCheck = await this.checkService.saveServiceCheck(this.serviceCheck.serverId as number, copy);
|
|
|
|
|
|
|
+ const savedCheck = await this.serviceApi.saveServiceCheck(this.serviceCheck.serverId as number, copy);
|
|
|
this.patchForm(savedCheck);
|
|
this.patchForm(savedCheck);
|
|
|
} catch (error: any) {
|
|
} catch (error: any) {
|
|
|
console.error(error);
|
|
console.error(error);
|