Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wind widget path update issue and form validation #402

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export class BooleanMultiControlOptionsComponent implements OnInit, OnDestroy {
source: 'default',
pathType: 'boolean',
isPathConfigurable: true,
showPathSkUnitsFilter: false,
pathSkUnitsFilter: null,
convertUnitTo: 'unitless',
sampleTime: 500
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<mat-checkbox class="options-grid-span2" *ngIf="(widgetConfig.courseOverGroundEnable !== undefined)" name="courseOverGroundEnable" formControlName="courseOverGroundEnable" (change)="setPaths()">
Show Course Over Ground
</mat-checkbox>
<mat-checkbox class="options-grid-span2" *ngIf="(widgetConfig.waypointEnable !== undefined)" name="waypointEnable" formControlName="waypointEnable" (change)="setPaths()">
<mat-checkbox class="options-grid-span2" *ngIf="(widgetConfig.waypointEnable !== undefined)" name="waypointEnable" formControlName="waypointEnable">
Show Next Waypoint
</mat-checkbox>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ export class ModalWidgetConfigComponent implements OnInit {
}

private setFormOptions(): void {
if (this.formMaster.contains('waypointEnable')) {
const ctrlGrp = this.formMaster.get('paths.nextWaypointBearing');
this.formMaster.controls['waypointEnable'].value ? ctrlGrp.enable() : ctrlGrp.disable()
}

if (this.formMaster.contains('courseOverGroundEnable')) {
const ctrlGrp = this.formMaster.get('paths.courseOverGround');
this.formMaster.controls['courseOverGroundEnable'].value ? ctrlGrp.enable() : ctrlGrp.disable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class ModalPathControlConfigComponent implements OnInit, OnChanges, OnDes
} else {
this.disablePathFields();
}
this.pathFormGroup.updateValueAndValidity();
});
}

Expand Down Expand Up @@ -118,8 +119,10 @@ export class ModalPathControlConfigComponent implements OnInit, OnChanges, OnDes
let filteredPaths = this.availablePaths;

// If a unit filter is set, apply it first
if (this.pathSkUnitsFilterControl.value != null) {
filteredPaths = filteredPaths.filter(item => item.meta.units === this.pathSkUnitsFilterControl.value.unit);
if (this.pathSkUnitsFilterControl.value != null) {
filteredPaths = filteredPaths.filter(item =>
item.meta && item.meta.units && item.meta.units === this.pathSkUnitsFilterControl.value.unit
);
}

// Then filter based on string
Expand Down