add loading in monitor, avoid no monitor yet when not loaded yet, avoid double setView, call fos refine once.

This commit is contained in:
argirok 2024-01-18 11:48:55 +02:00
parent 3811d6a24f
commit 68fc70162b
3 changed files with 36 additions and 42 deletions

View File

@ -13,7 +13,8 @@
</div>
</div>
<div inner>
<div *ngIf="!activeSubCategory" class="message">
<loading *ngIf="loading" class="uk-margin-top"></loading>
<div *ngIf="!activeSubCategory && !loading" class="message">
No {{entities.stakeholder}} yet.
</div>
<div *ngIf="activeSubCategory" class="uk-section">

View File

@ -15,7 +15,6 @@ import {SearchResearchResultsService} from "../../openaireLibrary/services/searc
import {CustomFilterService} from "../../openaireLibrary/shared/customFilter.service";
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
import {Filter, Value} from "../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {RefineResultsUtils} from "../../openaireLibrary/services/servicesUtils/refineResults.class";
import {SearchFields} from "../../openaireLibrary/utils/properties/searchFields";
@Component({
@ -46,18 +45,10 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
this.requireLogin = false;
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
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.chartsActiveType = new Map<string, IndicatorPath>();
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.loading = true;
this.stakeholder = stakeholder;
this.subscriptions.push(this.customFilterService.getCustomFilterAsObservable().subscribe(filters => {
if (filters) {
let customFilterParams = "";
@ -71,21 +62,22 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
this.filters = this.postProcessingFosFilters(res[2]);
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.chartsActiveType = new Map<string, IndicatorPath>();
this.subscriptions.push(this._route.queryParams.subscribe(queryParams => {
this.handleQueryParams(queryParams, params);
this.setMetadata();
this.setView(params);
}));
}));
}
}));
// } else {
// this.navigateToError();
}
}));
}
}));
}));
}

View File

@ -12,6 +12,7 @@ import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/
import {IconsService} from "../../openaireLibrary/utils/icons/icons.service";
import {filters} from "../../openaireLibrary/utils/icons/icons";
import {SliderUtilsModule} from "../../openaireLibrary/sharedComponents/slider-utils/slider-utils.module";
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
@NgModule({
imports: [CommonModule, RouterModule.forChild([
@ -19,7 +20,7 @@ import {SliderUtilsModule} from "../../openaireLibrary/sharedComponents/slider-u
{path: ':topic/', component: MonitorComponent},
{path: ':topic/:category', component: MonitorComponent},
{path: ':topic/:category/:subCategory', component: MonitorComponent}
]), PageContentModule, SliderTabsModule, NumberRoundModule, IconsModule, ClickModule, RangeFilterModule, SearchFilterModule, SliderUtilsModule],
]), PageContentModule, SliderTabsModule, NumberRoundModule, IconsModule, ClickModule, RangeFilterModule, SearchFilterModule, SliderUtilsModule, LoadingModule],
declarations: [MonitorComponent],
exports: [MonitorComponent]
})