Skip to content

Commit

Permalink
Further enhance and refine the optimizations implemented in apache#2215.
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwin612 committed Jul 9, 2024
1 parent f90d1e6 commit 96c4194
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</ng-container>

<nz-collapse
*ngIf="advancedParamDefines && advancedParamDefines.length > 0"
*ngIf="hasAdvancedParams"
[nzGhost]="true"
style="background: ghostwhite; margin-bottom: 24px"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, Output, OnChanges, SimpleChanges } from '@angular/core';
import { FormGroup } from '@angular/forms';

import { Collector } from '../../../pojo/Collector';
Expand All @@ -29,7 +29,7 @@ import { ParamDefine } from '../../../pojo/ParamDefine';
templateUrl: './monitor-form.component.html',
styleUrls: ['./monitor-form.component.less']
})
export class MonitorFormComponent {
export class MonitorFormComponent implements OnChanges {
@Input() monitor!: any;
@Input() loading!: boolean;
@Input() loadingTip!: string;
Expand All @@ -46,8 +46,21 @@ export class MonitorFormComponent {
@Output() readonly formDetect = new EventEmitter<any>();
@Output() readonly hostChange = new EventEmitter<string>();

hasAdvancedParams: boolean = false;

constructor() {}

ngOnChanges(changes: SimpleChanges) {
if (changes.advancedParams && changes.advancedParams.currentValue !== changes.advancedParams.previousValue) {
for (const advancedParam of changes.advancedParams.currentValue) {
if (advancedParam.display !== false) {
this.hasAdvancedParams = true;
break;
}
}
}
}

onDetect(formGroup: FormGroup) {
if (formGroup.invalid) {
Object.values(formGroup.controls).forEach(control => {
Expand Down

0 comments on commit 96c4194

Please sign in to comment.