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

MOSIP-26354 : PMP UI: All active policies should be display in Policy group dropdown #150

Merged
merged 6 commits into from
Feb 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 @@ -53,15 +53,17 @@
placeholder="{{ field.label[primaryLang] }}"
required
>
<input placeholder="Search..." matInput type="text" (keyup)="onKey($event.target.value)" class="search-input" >
<mat-option
*ngFor="let data of dropDownValues[field.name]"
*ngFor="let data of searchResult"
(onSelectionChange)="
captureDropDownValue($event, field.name, 'primary')
"
[id]="data.fieldCode"
[value]="data.fieldCode"
panelMaxHeight="500px"
[id]="data.fieldValue"
[value]="data.fieldValue"
>
{{ data.fieldValue }}
{{ data.fieldCode }}
</mat-option>
</mat-select>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ mat-form-field{

.mat-card-content>:first-child {
margin-top: 14px;
}

.search-input {
height: 35px;
width: 50px;
}
GOKULRAJ136 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
disableForms: boolean;
copyPrimaryWord: any;
copySecondaryWord: any;
searchResult: any[] = [];

@Input() primaryData: any = {};
@Input() secondaryData: any;
Expand Down Expand Up @@ -131,12 +132,12 @@ export class MaterDataCommonBodyComponent implements OnInit {
else if(url === "datasharepolicy"){
this.pageName = "Data Share Policy";
this.primaryData = {"name": "", "desc": "", "policies": "", "policyGroupName": "", "policyType": "DataShare", "version": "1.1"};
this.getPolicyGroup("policyGroupName");
this.getPolicyGroup();
}
else if(url === "authpolicy"){
this.pageName = "Auth Policy";
this.primaryData = {"name": "", "desc": "", "policies": "", "policyGroupName": "", "policyType": "Auth", "version": "1.1"};
this.getPolicyGroup("policyGroupName");
this.getPolicyGroup();
}
else if(url === "policymapping"){
this.pageName = "Map Policy";
Expand Down Expand Up @@ -456,16 +457,27 @@ export class MaterDataCommonBodyComponent implements OnInit {
});
}

getPolicyGroup(key) {
const filterObject = new FilterValuesModel('name', 'unique', '');
onKey(value) {
this.searchResult = this.search(value);
}

search(value: string) {
let filter = value.toLowerCase();
return this.dropDownValues.partnerTypeCode.primary.filter(option => option.fieldCode.toLowerCase().startsWith(filter));
}

getPolicyGroup() {
const filterObject = new FilterValuesModel('id', 'unique', '');
let optinalFilterObject = new OptionalFilterValuesModel('isActive', 'equals', 'true');
let filterRequest = new FilterRequest([filterObject], this.primaryLang, [optinalFilterObject]);
filterRequest["purpose"] = "REGISTRATION";
let request = new RequestModel('', null, filterRequest);
this.dataStorageService
.getFiltersForAllDropDown('policymanager/policies/group', request)
.subscribe(response => {
this.dropDownValues[key] = response.response.filters;
if(response.response.filters)
this.searchResult = response.response.filters.sort((a, b) => (a.id && b.id) ? a.id.localeCompare(b.id) : 0);
this.dropDownValues.partnerTypeCode.primary = response.response.filters.sort((a, b) => (a.id && b.id) ? a.id.localeCompare(b.id) : 0);
});
}

Expand Down
Loading