Merge pull request #11017 from maxunbearable/fix/3865-default-values-grcp-custom
Removed toggle 'fill configuration with default values'
This commit is contained in:
commit
a327f0b99b
@ -84,7 +84,8 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tb-form-row column-xs" fxLayoutAlign="space-between center">
|
||||
<div *ngIf="connectorForm.get('type').value !== connectorType.GRPC && connectorForm.get('type').value !== connectorType.CUSTOM"
|
||||
class="tb-form-row column-xs" fxLayoutAlign="space-between center">
|
||||
<mat-slide-toggle class="mat-slide fixed-title-width" formControlName="useDefaults">
|
||||
<mat-label tb-hint-tooltip-icon="{{ 'gateway.fill-connector-defaults-hint' | translate }}">
|
||||
{{ 'gateway.fill-connector-defaults' | translate }}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
/// limitations under the License.
|
||||
///
|
||||
|
||||
import { Component, Inject, OnDestroy } from '@angular/core';
|
||||
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState } from '@core/core.state';
|
||||
@ -33,6 +33,7 @@ import {
|
||||
} from '@home/components/widget/lib/gateway/gateway-widget.models';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ResourcesService } from '@core/services/resources.service';
|
||||
import { takeUntil, tap } from "rxjs/operators";
|
||||
|
||||
@Component({
|
||||
selector: 'tb-add-connector-dialog',
|
||||
@ -40,7 +41,7 @@ import { ResourcesService } from '@core/services/resources.service';
|
||||
styleUrls: ['./add-connector-dialog.component.scss'],
|
||||
providers: [],
|
||||
})
|
||||
export class AddConnectorDialogComponent extends DialogComponent<AddConnectorDialogComponent, BaseData<HasId>> implements OnDestroy {
|
||||
export class AddConnectorDialogComponent extends DialogComponent<AddConnectorDialogComponent, BaseData<HasId>> implements OnInit, OnDestroy {
|
||||
|
||||
connectorForm: UntypedFormGroup;
|
||||
|
||||
@ -71,6 +72,10 @@ export class AddConnectorDialogComponent extends DialogComponent<AddConnectorDia
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.observeTypeChange();
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
@ -120,4 +125,18 @@ export class AddConnectorDialogComponent extends DialogComponent<AddConnectorDia
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
private observeTypeChange(): void {
|
||||
this.connectorForm.get('type').valueChanges.pipe(
|
||||
tap((type: ConnectorType) => {
|
||||
const useDefaultControl = this.connectorForm.get('useDefaults');
|
||||
if (type === ConnectorType.GRPC || type === ConnectorType.CUSTOM) {
|
||||
useDefaultControl.setValue(false);
|
||||
} else if (!useDefaultControl.value) {
|
||||
useDefaultControl.setValue(true);
|
||||
}
|
||||
}),
|
||||
takeUntil(this.destroy$),
|
||||
).subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user