Skip to content

Commit 83f5133

Browse files
committed
one bug fix, but still in progress
1 parent 91e0240 commit 83f5133

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

src/app/routes/browse/form/form.component.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
inject,
88
input,
99
linkedSignal,
10+
OnInit,
1011
signal,
1112
viewChild,
1213
} from '@angular/core';
@@ -56,7 +57,7 @@ import { MatCardModule } from '@angular/material/card';
5657
templateUrl: './form.component.html',
5758
styleUrl: './form.component.scss',
5859
})
59-
export class FormComponent {
60+
export class FormComponent implements OnInit {
6061
versionsService = inject(VersionsService);
6162
browseService = input.required<BrowseService>();
6263
version = this.versionsService.versionReadOnly();
@@ -83,7 +84,7 @@ export class FormComponent {
8384
Validators.min(0),
8485
Validators.max(100),
8586
]),
86-
minDegree: new FormControl<number>(1, [
87+
minDegree: new FormControl<number>(0, [
8788
Validators.min(0),
8889
Validators.max(100),
8990
]),
@@ -114,6 +115,17 @@ export class FormComponent {
114115

115116
protected readonly capitalize = _.capitalize;
116117

118+
ngOnInit() {
119+
// if specific defaults are set (eg spongeffects)
120+
this.formGroup.patchValue({
121+
minDegree: this.defaultMinDegree(),
122+
minBetweenness: this.defaultMinBetweenness() ?? 0.05,
123+
minEigen: this.defaultMinEigen() ?? 0.1,
124+
maxPValue: this.defaultMaxPValue() ?? 0.05,
125+
minMscor: this.defaultMinMscor() ?? 0.1,
126+
});
127+
}
128+
117129
constructor(private cdr: ChangeDetectorRef) {
118130
const formSignal = signal(this.formGroup.value);
119131
this.formGroup.valueChanges.subscribe((val) => {
@@ -153,24 +165,6 @@ export class FormComponent {
153165
this.infoService.renderMscorEquation(this.mscorEquation$()!);
154166
});
155167
}
156-
ngOnInit() {
157-
// Always set the form control values from the inputs
158-
if (this.defaultMinBetweenness() !== undefined) {
159-
this.formGroup.get('minBetweenness')?.setValue(this.defaultMinBetweenness() ?? null);
160-
}
161-
if (this.defaultMinDegree() !== undefined) {
162-
this.formGroup.get('minDegree')?.setValue(this.defaultMinDegree() ?? null);
163-
}
164-
if (this.defaultMinEigen() !== undefined) {
165-
this.formGroup.get('minEigen')?.setValue(this.defaultMinEigen() ?? null);
166-
}
167-
if (this.defaultMaxPValue() !== undefined) {
168-
this.formGroup.get('maxPValue')?.setValue(this.defaultMaxPValue() ?? null);
169-
}
170-
if (this.defaultMinMscor() !== undefined) {
171-
this.formGroup.get('minMscor')?.setValue(this.defaultMinMscor() ?? null);
172-
}
173-
}
174168

175169
getKeys(enumType: any): string[] {
176170
return Object.keys(enumType);

src/app/routes/spongeffects/explore/explore.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<hr style="margin: 266.5px 0 20px 0; width: 100%;" />
66
<app-form
77
[browseService]="browseService"
8-
[fixedDataset]="exploreService.selectedDiseaseObject$()">
8+
[fixedDataset]="exploreService.selectedDiseaseObject$()"
99
[defaultMinBetweenness]="0"
1010
[defaultMinDegree]="1"
1111
[defaultMinEigen]="0"
12-
[defaultMaxPValue]="1"
13-
[defaultMinMscor]="0"
12+
[defaultMaxPValue]="0.2"
13+
[defaultMinMscor]="0.1"
1414
>
1515
</app-form>
1616
}

0 commit comments

Comments
 (0)