From ee58510ea514209765e058cf1c39dcc0e9b88770 Mon Sep 17 00:00:00 2001 From: Calvin Date: Thu, 18 Jul 2024 20:52:03 +0800 Subject: [PATCH 1/2] [bugfix] Unable to specify collector when creating a monitor --- .../routes/monitor/monitor-form/monitor-form.component.html | 1 + .../routes/monitor/monitor-form/monitor-form.component.ts | 5 +++++ .../routes/monitor/monitor-new/monitor-new.component.html | 1 + .../app/routes/monitor/monitor-new/monitor-new.component.ts | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html index c96cf1197a3..67a0cbe995f 100644 --- a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html +++ b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html @@ -107,6 +107,7 @@ [extra]="{collectors}" [name]="'collector'" [(ngModel)]="collector" + (ngModelChange)="onCollectorChange($event)" /> diff --git a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts index 963ed4fd305..784be250246 100644 --- a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts +++ b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts @@ -46,6 +46,7 @@ export class MonitorFormComponent implements OnChanges { @Output() readonly formCancel = new EventEmitter(); @Output() readonly formDetect = new EventEmitter(); @Output() readonly hostChange = new EventEmitter(); + @Output() readonly collectorChange = new EventEmitter(); hasAdvancedParams: boolean = false; @@ -137,6 +138,10 @@ export class MonitorFormComponent implements OnChanges { this.hostChange.emit(host); } + onCollectorChange(host: string) { + this.collectorChange.emit(host); + } + onParamBooleanChanged(booleanValue: boolean, field: string) { // 对SSL的端口联动处理, 不开启SSL默认80端口,开启SSL默认443 if (field === 'ssl') { diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html index 6e0c211cef5..a81d318cd5b 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html @@ -37,6 +37,7 @@ [advancedParamDefines]="advancedParamDefines" [collector]="collector" [collectors]="collectors" + (collectorChange)="onCollectorChange($event)" (hostChange)="onHostChange($event)" (formCancel)="onCancel()" (formSubmit)="onSubmit($event)" diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts index b9c896222c9..34c31113bfa 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts @@ -161,6 +161,10 @@ export class MonitorNewComponent implements OnInit { } } + onCollectorChange(collector: string) { + this.collector = collector; + } + onSubmit(info: any) { let addMonitor = { detected: this.detected, From cf36a436d0d4412f72422cf8054c21e685e69481 Mon Sep 17 00:00:00 2001 From: Calvin Date: Fri, 19 Jul 2024 21:43:30 +0800 Subject: [PATCH 2/2] [feature] remove collector change event --- .../routes/monitor/monitor-edit/monitor-edit.component.ts | 4 ++-- .../monitor/monitor-form/monitor-form.component.html | 1 - .../routes/monitor/monitor-form/monitor-form.component.ts | 8 ++------ .../routes/monitor/monitor-new/monitor-new.component.html | 1 - .../routes/monitor/monitor-new/monitor-new.component.ts | 8 ++------ 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts index 88a4afeb148..0cd0a391f8a 100644 --- a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts +++ b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts @@ -190,7 +190,7 @@ export class MonitorEditComponent implements OnInit { let addMonitor = { detected: this.detected, monitor: info.monitor, - collector: this.collector, + collector: info.collector, params: info.params.concat(info.advancedParams) }; if (this.detected) { @@ -220,7 +220,7 @@ export class MonitorEditComponent implements OnInit { let detectMonitor = { detected: this.detected, monitor: info.monitor, - collector: this.collector, + collector: info.collector, params: info.params.concat(info.advancedParams) }; this.spinningTip = this.i18nSvc.fanyi('monitors.spinning-tip.detecting'); diff --git a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html index 67a0cbe995f..c96cf1197a3 100644 --- a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html +++ b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.html @@ -107,7 +107,6 @@ [extra]="{collectors}" [name]="'collector'" [(ngModel)]="collector" - (ngModelChange)="onCollectorChange($event)" /> diff --git a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts index 784be250246..12d3a7e7f89 100644 --- a/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts +++ b/web-app/src/app/routes/monitor/monitor-form/monitor-form.component.ts @@ -98,7 +98,7 @@ export class MonitorFormComponent implements OnChanges { param.paramValue = (param.paramValue as string).trim(); } }); - this.formDetect.emit({ monitor: this.monitor, params: this.params, advancedParams: this.advancedParams }); + this.formDetect.emit({ monitor: this.monitor, params: this.params, advancedParams: this.advancedParams, collector: this.collector }); } onSubmit(formGroup: FormGroup) { @@ -127,7 +127,7 @@ export class MonitorFormComponent implements OnChanges { param.paramValue = (param.paramValue as string).trim(); } }); - this.formSubmit.emit({ monitor: this.monitor, params: this.params, advancedParams: this.advancedParams }); + this.formSubmit.emit({ monitor: this.monitor, params: this.params, advancedParams: this.advancedParams, collector: this.collector }); } onCancel() { @@ -138,10 +138,6 @@ export class MonitorFormComponent implements OnChanges { this.hostChange.emit(host); } - onCollectorChange(host: string) { - this.collectorChange.emit(host); - } - onParamBooleanChanged(booleanValue: boolean, field: string) { // 对SSL的端口联动处理, 不开启SSL默认80端口,开启SSL默认443 if (field === 'ssl') { diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html index a81d318cd5b..6e0c211cef5 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html @@ -37,7 +37,6 @@ [advancedParamDefines]="advancedParamDefines" [collector]="collector" [collectors]="collectors" - (collectorChange)="onCollectorChange($event)" (hostChange)="onHostChange($event)" (formCancel)="onCancel()" (formSubmit)="onSubmit($event)" diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts index 34c31113bfa..36a78fa9820 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts @@ -161,15 +161,11 @@ export class MonitorNewComponent implements OnInit { } } - onCollectorChange(collector: string) { - this.collector = collector; - } - onSubmit(info: any) { let addMonitor = { detected: this.detected, monitor: info.monitor, - collector: this.collector, + collector: info.collector, params: info.params.concat(info.advancedParams) }; if (this.detected) { @@ -199,7 +195,7 @@ export class MonitorNewComponent implements OnInit { let detectMonitor = { detected: true, monitor: info.monitor, - collector: this.collector, + collector: info.collector, params: info.params.concat(info.advancedParams) }; this.spinningTip = this.i18nSvc.fanyi('monitors.spinning-tip.detecting');