Skip to content

Commit

Permalink
set number as default value
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jan 28, 2025
1 parent 9c4f5a7 commit 92d4888
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FormGroup } from '@angular/forms';
import { KeyResultMetric } from '../../../shared/types/model/key-result-metric';
import { CheckInMin } from '../../../shared/types/model/check-in-min';
import { formInputCheck } from '../../../shared/common';
import { TranslateService } from '@ngx-translate/core';
import { CheckInMetricMin } from '../../../shared/types/model/check-in-metric-min';

@Component({
Expand All @@ -24,7 +23,7 @@ export class CheckInFormMetricComponent {

protected readonly formInputCheck = formInputCheck;

constructor(private translate: TranslateService) {}
constructor() {}

generateUnitLabel(): string {
switch (this.keyResult.unit.unitName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
>
<mat-option (click)="createNewUnit()" *ngIf="canCreate((this.filteredUnitOptions | async)!)">Create new</mat-option>
<mat-option *ngFor="let unit of this.filteredUnitOptions | async" [value]="unit">
{{unit.unitName}}
{{unit.unitName | translate}}
</mat-option>

</mat-autocomplete>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { map, Observable, startWith, Subject, tap } from 'rxjs';
import { UnitService } from '../../services/unit.service';
import { DialogService } from '../../services/dialog.service';
import { ManageUnitsDialogComponent } from '../manage-units-dialog/manage-units-dialog.component';
import { TranslateService } from '@ngx-translate/core';

export enum KeyResultMetricField {
BASELINE,
Expand Down Expand Up @@ -51,7 +52,9 @@ export class KeyResultTypeComponent implements AfterContentInit {

unitSearchTerm = '';

constructor(private parentF: FormGroupDirective, private unitService: UnitService, private dialogService: DialogService) {
constructor(
private parentF: FormGroupDirective, private unitService: UnitService, private dialogService: DialogService, private readonly translate: TranslateService
) {
this.childForm = this.parentF.form;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/shared/constant-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function getKeyResultForm(): FormGroup {
actionList: new FormArray<FormGroup<FormControlsOf<Item>>>([]),
keyResultType: new FormControl('metric'),
metric: new FormGroup({
unit: new FormControl<Unit | undefined>(undefined, [Validators.required]),
unit: new FormControl<Unit>({ unitName: 'NUMBER' } as Unit, [Validators.required]),
baseline: new FormControl(0, [Validators.required,
numberValidator(),
Validators.maxLength(20)]),
Expand Down

0 comments on commit 92d4888

Please sign in to comment.