[develop | DONE | CHANGED] monitor component: handle the case the fos requests gets an error
This commit is contained in:
parent
7dbcaeea1b
commit
a834890ddb
|
@ -62,20 +62,9 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
|
||||||
}
|
}
|
||||||
this.subscriptions.push(this.searchResearchResultsService.advancedSearchResults("publication", null, 1, 0, null, this.properties,
|
this.subscriptions.push(this.searchResearchResultsService.advancedSearchResults("publication", null, 1, 0, null, this.properties,
|
||||||
"&refine=true&fields=fos&type=publications", ["fos"], customFilterParams).subscribe(res => {
|
"&refine=true&fields=fos&type=publications", ["fos"], customFilterParams).subscribe(res => {
|
||||||
this.filters = this.postProcessingFosFilters(res[2]);
|
this.init(res[2]);
|
||||||
this.title = this.stakeholder.name;
|
}, error =>{
|
||||||
this.description = this.stakeholder.name;
|
this.init(null)
|
||||||
this.subscriptions.push(this._route.params.subscribe(params => {
|
|
||||||
this.loading = true;
|
|
||||||
this.activeTopic = null;
|
|
||||||
this.activeCategory = null;
|
|
||||||
this.activeSubCategory = null;
|
|
||||||
this.numberResults = new Map<string, number>();
|
|
||||||
this.subscriptions.push(this._route.queryParams.subscribe(queryParams => {
|
|
||||||
this.handleQueryParams(queryParams, params);
|
|
||||||
this.setMetadata();
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -83,7 +72,22 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
init(fos){
|
||||||
|
this.filters = this.postProcessingFosFilters(fos);
|
||||||
|
this.title = this.stakeholder.name;
|
||||||
|
this.description = this.stakeholder.name;
|
||||||
|
this.subscriptions.push(this._route.params.subscribe(params => {
|
||||||
|
this.loading = true;
|
||||||
|
this.activeTopic = null;
|
||||||
|
this.activeCategory = null;
|
||||||
|
this.activeSubCategory = null;
|
||||||
|
this.numberResults = new Map<string, number>();
|
||||||
|
this.subscriptions.push(this._route.queryParams.subscribe(queryParams => {
|
||||||
|
this.handleQueryParams(queryParams, params);
|
||||||
|
this.setMetadata();
|
||||||
|
}));
|
||||||
|
}));
|
||||||
|
}
|
||||||
hasPermission(visibility: Visibility): boolean {
|
hasPermission(visibility: Visibility): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -95,20 +99,22 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
|
||||||
|
|
||||||
postProcessingFosFilters(refineFilters:Filter[]){
|
postProcessingFosFilters(refineFilters:Filter[]){
|
||||||
let filters:Filter[] = [];
|
let filters:Filter[] = [];
|
||||||
for(let filter of refineFilters){
|
if(refineFilters) {
|
||||||
if(filter.filterId == "fos"){
|
for (let filter of refineFilters) {
|
||||||
let fos: Filter ={...filter};
|
if (filter.filterId == "fos") {
|
||||||
fos.values = [];
|
let fos: Filter = {...filter};
|
||||||
for(let value of filter.values){
|
fos.values = [];
|
||||||
let code = value.id.split(" ")[0];
|
for (let value of filter.values) {
|
||||||
if(code.length <= 4){
|
let code = value.id.split(" ")[0];
|
||||||
fos.values.push(value);
|
if (code.length <= 4) {
|
||||||
|
fos.values.push(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fos.countAllValues = fos.values.length;
|
||||||
|
filters.push(fos);
|
||||||
|
} else {
|
||||||
|
filters.push(filter);
|
||||||
}
|
}
|
||||||
fos.countAllValues = fos.values.length;
|
|
||||||
filters.push(fos);
|
|
||||||
}else{
|
|
||||||
filters.push(filter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let publiclyFunded:Filter = new Filter();
|
let publiclyFunded:Filter = new Filter();
|
||||||
|
|
Loading…
Reference in New Issue