-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8330 from 5Amogh/RRHE-48
Issue #RRHE-48 feat:Customized configurable filters for filtered task detail report type
- Loading branch information
Showing
8 changed files
with
806 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,177 changes: 644 additions & 533 deletions
1,177
...les/program-dashboard/components/program-datasets/program-datasets.component.spec.data.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/app/client/src/app/modules/program-dashboard/shared/pd-filters/pd-filters.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<form class="d-flex flex-dr" [formGroup]="pdFiltersFormGroup"> | ||
<div class="d-flex flex-dc"> | ||
<label>{{ pdFilter.label }}</label> | ||
<ng-container *ngIf="pdFilter.controlType === 'number'"> | ||
<mat-form-field | ||
appearance="fill" | ||
class="sb-mat__dropdown custom_mat_dd" | ||
> | ||
<input | ||
matInput | ||
type="number" | ||
[formControlName]="pdFilter.reference" | ||
[value]="pdFilter.defaultValue" | ||
(input)="inputChange()" | ||
/> | ||
</mat-form-field> | ||
</ng-container> | ||
</div> | ||
</form> |
49 changes: 49 additions & 0 deletions
49
...p/client/src/app/modules/program-dashboard/shared/pd-filters/pd-filters.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { FormBuilder } from "@angular/forms"; | ||
import { PdFiltersComponent } from "./pd-filters.component"; | ||
|
||
describe("PdFiltersComponent", () => { | ||
let component: PdFiltersComponent; | ||
let formBuilder; | ||
|
||
beforeAll(() => { | ||
component = new PdFiltersComponent(formBuilder); | ||
component.pdFilter = { | ||
"label": "Minimum no. of tasks in the project", | ||
"controlType": "number", | ||
"reference": "task_count", | ||
"defaultValue": 5 | ||
} | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should call ngOnInit',() => { | ||
jest.spyOn(component,'ngOnInit'); | ||
component.fb = new FormBuilder; | ||
component.ngOnInit(); | ||
expect(component.ngOnInit).toHaveBeenCalled() | ||
}); | ||
|
||
it('should generate form',() => { | ||
jest.spyOn(component,'generateForm'); | ||
component.fb = new FormBuilder; | ||
component.generateForm(); | ||
expect(component.generateForm).toHaveBeenCalled() | ||
}); | ||
|
||
it('should call inputChange method', () => { | ||
jest.spyOn(component,'inputChange'); | ||
component.pdFiltersFormGroup.patchValue({ | ||
task_count:5 | ||
}); | ||
component.inputChange(); | ||
expect(component.inputChange).toHaveBeenCalled(); | ||
}); | ||
|
||
}); |
31 changes: 31 additions & 0 deletions
31
src/app/client/src/app/modules/program-dashboard/shared/pd-filters/pd-filters.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; | ||
import { FormBuilder, FormGroup } from "@angular/forms"; | ||
import * as _ from "lodash-es"; | ||
|
||
@Component({ | ||
selector: "app-pd-filters", | ||
templateUrl: "./pd-filters.component.html" | ||
}) | ||
export class PdFiltersComponent implements OnInit { | ||
@Input() pdFilter: any; | ||
@Output() filterChanged = new EventEmitter(); | ||
pdFiltersFormGroup: FormGroup; | ||
|
||
constructor(public fb: FormBuilder) {} | ||
|
||
ngOnInit(): void { | ||
this.generateForm(); | ||
} | ||
|
||
generateForm() { | ||
this.pdFiltersFormGroup = this.fb.group({}); | ||
this.pdFiltersFormGroup.addControl( | ||
_.get(this.pdFilter, "reference"), | ||
this.fb.control("") | ||
); | ||
} | ||
|
||
inputChange() { | ||
this.filterChanged.emit(this.pdFiltersFormGroup.value); | ||
} | ||
} |