fix issue with selected types filter

This commit is contained in:
argirok 2022-04-21 16:35:34 +03:00
parent 020a947687
commit fc2fbb5ba0
1 changed files with 17 additions and 15 deletions

View File

@ -1468,23 +1468,25 @@ export class NewSearchPageComponent {
}*/ }*/
if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) { if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"}; this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
if (URLparams["type"]) { for (let typeOption of Object.keys(this.resultTypeOptions)) {
let types = URLparams["type"]; let type = typeOption;
types = Array.isArray(types) ? types.join(',').split(",") : types.split(","); if ( URLparams["type"] && URLparams["type"].indexOf(type)==-1 || !URLparams["type"]) {
for (let type of types) { this.resultTypes.values.push({
if (["publications", "datasets", "software", "other"].indexOf(StringUtils.unquote(type)) != -1 && this.resultTypeOptions[StringUtils.unquote(type)]) { name: this.resultTypeOptions[StringUtils.unquote(type)].name,
this.resultTypes.values.push({ id: StringUtils.unquote(type),
name: this.resultTypeOptions[StringUtils.unquote(type)].name, selected: false,
id: StringUtils.unquote(type), number: 0
selected: true, });
number: 0 }else{
}); this.resultTypes.values.push({
this.resultTypes.countSelectedValues++; name: this.resultTypeOptions[StringUtils.unquote(type)].name,
} id: StringUtils.unquote(type),
selected: true,
number: 0
});
this.resultTypes.countSelectedValues++;
} }
} }
} }
this.URLCreatedFilters = filters; this.URLCreatedFilters = filters;