[Monitor Dashboard | Trunk]: wait property initialization on search and langind pages

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59106 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-07-14 10:01:01 +00:00
parent d767faeecd
commit 70397bb5e7
29 changed files with 231 additions and 84 deletions

View File

@ -89,18 +89,24 @@ export class AppComponent implements OnInit, OnDestroy {
if (!this.stakeholderService.stakeholder ||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
this.stakeholderService.setStakeholder(stakeholder);
this.layoutService.setOpen(true);
this.stakeholder = stakeholder;
LinksResolver.setProperties(this.stakeholder.alias);
if(isSearch) {
this.activeTopic = null;
} else if (params && params['topic'] && !this.activeTopic) {
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
if(stakeholder) {
this.stakeholder = stakeholder;
LinksResolver.setProperties(this.stakeholder.alias);
this.stakeholderService.setStakeholder(stakeholder);
this.layoutService.setOpen(true);
if (isSearch) {
this.activeTopic = null;
} else if (params && params['topic'] && !this.activeTopic) {
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
} else {
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
}
this.setSideBar();
} else {
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
this.stakeholderService.setStakeholder(null);
LinksResolver.resetProperties();
this.navigateToError();
}
this.setSideBar();
}, error => {
this.stakeholderService.setStakeholder(null);
LinksResolver.resetProperties();

View File

@ -20,7 +20,6 @@ import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/e
loadChildren: '../search/search.module#SearchModule',
resolve: {envSpecific: EnvironmentSpecificResolver}
},
{ path: ':stakeholder/project-report', loadChildren: '../search/landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{
path: ':stakeholder/:topic',
component: MonitorComponent,

View File

@ -1,11 +1,31 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-dataprovider',
template: `
<div id="page_content">
<dataprovider></dataprovider>
<dataprovider *ngIf="initialized"></dataprovider>
</div>`,
})
export class MonitorDataProviderComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -6,7 +6,7 @@ import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [DataProviderModule, DataProviderRoutingModule],
imports: [DataProviderModule, DataProviderRoutingModule, CommonModule],
declarations:[MonitorDataProviderComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorDataProviderComponent]

View File

@ -1,12 +1,33 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-dataset',
template: `
<div id="page_content">
<result-landing type="dataset"></result-landing>
<result-landing *ngIf="initialized" type="dataset"></result-landing>
</div>
`,
})
export class MonitorDatasetComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -4,11 +4,11 @@ import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {DatasetRoutingModule} from './dataset-routing.module';
import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module";
import {CommonModule} from "@angular/common";
@NgModule({
imports: [DatasetRoutingModule, ResultLandingModule],
declarations:[MonitorDatasetComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorDatasetComponent]
imports: [DatasetRoutingModule, ResultLandingModule, CommonModule],
declarations:[MonitorDatasetComponent],
providers:[FreeGuard, PreviousRouteRecorder, IsRouteEnabled],
exports:[MonitorDatasetComponent]
})
export class LibDatasetModule { }

View File

@ -1,16 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {MonitorHtmlProjectReportComponent} from './htmlProjectReport.component';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
RouterModule.forChild([
{path: '', component: MonitorHtmlProjectReportComponent, canDeactivate: [PreviousRouteRecorder]}
])
]
})
export class HtmlProjectReportRoutingModule {
}

View File

@ -1,11 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'monitor-htmlProjectReport',
template: `
<div id="page_content">
<htmlProjectReport></htmlProjectReport>
</div>`,
})
export class MonitorHtmlProjectReportComponent {
}

View File

@ -1,14 +0,0 @@
import {NgModule} from '@angular/core';
import {HtmlProjectReportModule} from '../../../openaireLibrary/landingPages/htmlProjectReport/htmlProjectReport.module';
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {MonitorHtmlProjectReportComponent} from './htmlProjectReport.component';
import {HtmlProjectReportRoutingModule} from './htmlProjectReport-routing.module';
@NgModule({
imports: [HtmlProjectReportModule, HtmlProjectReportRoutingModule],
declarations:[MonitorHtmlProjectReportComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorHtmlProjectReportComponent]
})
export class LibHtmlProjectReportModule { }

View File

@ -4,9 +4,10 @@ import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {MonitorOrganizationComponent} from './organization.component';
import {OrganizationRoutingModule} from './organization-routing.module';
import {CommonModule} from "@angular/common";
@NgModule({
imports: [OrganizationModule, OrganizationRoutingModule],
imports: [OrganizationModule, OrganizationRoutingModule, CommonModule],
declarations:[MonitorOrganizationComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorOrganizationComponent]

View File

@ -1,11 +1,31 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-organization',
template: `
<div id="page_content">
<organization></organization>
<organization *ngIf="initialized"></organization>
</div>`,
})
export class MonitorOrganizationComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -4,10 +4,11 @@ import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/
import {MonitorOrpComponent} from './orp.component';
import {OrpRoutingModule} from './orp-routing.module';
import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module";
import {CommonModule} from "@angular/common";
@NgModule({
imports: [
OrpRoutingModule, ResultLandingModule
OrpRoutingModule, ResultLandingModule, CommonModule
],
declarations: [
MonitorOrpComponent

View File

@ -1,13 +1,33 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-orp',
template: `
<div id="page_content">
<result-landing type="orp"></result-landing>
<result-landing *ngIf="initialized" type="orp"></result-landing>
</div>
`,
})
export class MonitorOrpComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -4,9 +4,10 @@ import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {MonitorProjectComponent} from './project.component';
import {ProjectRoutingModule} from './project-routing.module';
import {CommonModule} from "@angular/common";
@NgModule({
imports: [ProjectModule, ProjectRoutingModule],
imports: [ProjectModule, ProjectRoutingModule, CommonModule],
declarations:[MonitorProjectComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorProjectComponent]

View File

@ -1,11 +1,32 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-project',
template: `
<div id="page_content">
<project></project>
<project *ngIf="initialized"></project>
</div>`,
})
export class MonitorProjectComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -4,9 +4,10 @@ import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previo
import { MonitorPublicationComponent } from './publication.component';
import {PublicationRoutingModule} from './publication-routing.module';
import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module";
import {CommonModule} from "@angular/common";
@NgModule({
imports: [PublicationRoutingModule, ResultLandingModule],
imports: [PublicationRoutingModule, ResultLandingModule, CommonModule],
declarations:[MonitorPublicationComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorPublicationComponent]

View File

@ -1,12 +1,32 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-publication',
template: `
<div id="page_content">
<result-landing type="publication"></result-landing>
<result-landing *ngIf="initialized" type="publication"></result-landing>
</div>
`,
})
export class MonitorPublicationComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -4,9 +4,10 @@ import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previo
import {MonitorResultComponent} from './result.component';
import {ResultRoutingModule} from './result-routing.module';
import {ResultLandingModule} from "../../../openaireLibrary/landingPages/result/resultLanding.module";
import {CommonModule} from "@angular/common";
@NgModule({
imports: [ResultRoutingModule, ResultLandingModule],
imports: [ResultRoutingModule, ResultLandingModule, CommonModule],
declarations:[MonitorResultComponent],
providers:[FreeGuard, PreviousRouteRecorder],
exports:[MonitorResultComponent]

View File

@ -1,11 +1,31 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-result',
template: `
<div id="page_content">
<result-landing type="result"></result-landing>
<result-landing *ngIf="initialized" type="result"></result-landing>
</div>`,
})
export class MonitorResultComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -12,6 +12,7 @@ interface Links {
searchLinkToResults,
searchLinkToProjects,
searchLinkToDataProviders,
searchLinkToOrganizations,
searchLinkToAdvancedResults,
searchLinkToAdvancedProjects,
searchLinkToAdvancedDataProviders,
@ -32,6 +33,7 @@ export class LinksResolver {
searchLinkToResults: properties.searchLinkToResults,
searchLinkToDataProviders: properties.searchLinkToDataProviders,
searchLinkToProjects: properties.searchLinkToProjects,
searchLinkToOrganizations: properties.searchLinkToOrganizations,
searchLinkToAdvancedResults: properties.searchLinkToAdvancedResults,
searchLinkToAdvancedProjects: properties.searchLinkToAdvancedProjects,
searchLinkToAdvancedDataProviders: properties.searchLinkToAdvancedDataProviders,

View File

@ -40,8 +40,6 @@ export class MonitorAdvancedSearchDataprovidersComponent {
this.initialized = true;
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -1,13 +1,33 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-advanced-search-organizations',
template: `
<div id="page_content">
<search-organizations [simpleView]="false">
<search-organizations *ngIf="initialized" [simpleView]="false">
</search-organizations>
</div>
`
})
export class MonitorAdvancedSearchOrganizationsComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -43,8 +43,6 @@ export class MonitorAdvancedSearchProjectsComponent {
this.initialized = true;
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -43,8 +43,6 @@ export class MonitorAdvancedSearchResearchResultsComponent {
this.initialized = true;
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -40,8 +40,6 @@ export class MonitorSearchDataprovidersComponent {
this.initialized = true;
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -1,13 +1,33 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
@Component({
selector: 'monitor-search-organizations',
template: `
<div id="page_content">
<search-organizations>
<search-organizations *ngIf="initialized">
</search-organizations>
</div>
`
})
export class MonitorSearchOrganizationsComponent {
initialized: boolean = false;
constructor(private route: ActivatedRoute,
private router: Router,
private stakeholderService: StakeholderService) {
}
ngOnInit() {
this.route.params.subscribe(params => {
if (params['stakeholder']) {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) {
this.initialized = true;
}
});
}
});
}
}

View File

@ -44,8 +44,6 @@ export class MonitorSearchProjectsComponent {
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -43,8 +43,6 @@ export class MonitorSearchResearchResultsComponent {
this.initialized = true;
}
});
} else {
this.initialized = true;
}
});
}

View File

@ -57,4 +57,10 @@
.uk-alert.uk-grid {
display: flex;
}
.uk-alert-primary {
background: #fff;
color: #222080;
border-color: #222080;
}
}