[Monitor Dashboard | Trunk]
code cleaning: -remove unused imports, files - add unsubscribe calls git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59847 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
e839c41b49
commit
5404b8575a
|
@ -112,7 +112,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
if (params && params['stakeholder']) {
|
||||
this.stakeholder = this.stakeholderService.stakeholder;
|
||||
if (!this.stakeholder || this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
LinksResolver.setProperties(this.stakeholder.alias);
|
||||
|
@ -137,7 +137,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.navigateToError();
|
||||
this.buildMenu();
|
||||
this.loading = false;
|
||||
});
|
||||
}));
|
||||
} else {
|
||||
this.buildMenu();
|
||||
if (isSearch) {
|
||||
|
@ -177,6 +177,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
value.unsubscribe();
|
||||
}
|
||||
});
|
||||
this.userManagementService.clearSubscriptions();
|
||||
this.layoutService.clearSubscriptions();
|
||||
this.stakeholderService.clearSubscriptions();
|
||||
}
|
||||
|
||||
private navigateToError() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {HttpClientModule} from "@angular/common/http";
|
||||
import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http";
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {AppComponent} from './app.component';
|
||||
|
@ -14,13 +14,13 @@ import {ErrorModule} from './openaireLibrary/error/error.module';
|
|||
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
|
||||
|
||||
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
|
||||
import {SubscribeModule} from './utils/subscribe/subscribe.module';
|
||||
import {UserMiniModule} from "./openaireLibrary/login/userMiniModule.module";
|
||||
import {SideBarModule} from "./openaireLibrary/dashboard/sharedComponents/sidebar/sideBar.module";
|
||||
import {SharedModule} from "./openaireLibrary/shared/shared.module";
|
||||
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
|
||||
import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-verification.module";
|
||||
import {LoadingModule} from "./openaireLibrary/utils/loading/loading.module";
|
||||
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
|
||||
|
||||
@NgModule({
|
||||
|
||||
|
@ -34,14 +34,15 @@ import {LoadingModule} from "./openaireLibrary/utils/loading/loading.module";
|
|||
NavigationBarModule,
|
||||
BottomModule,
|
||||
CookieLawModule,
|
||||
SubscribeModule.forRoot(),
|
||||
BrowserModule.withServerTransition({appId: 'my-app'}),
|
||||
AppRoutingModule,
|
||||
UserMiniModule, SideBarModule, Schema2jsonldModule, RoleVerificationModule, LoadingModule
|
||||
],
|
||||
declarations: [AppComponent, OpenaireErrorPageComponent],
|
||||
exports: [AppComponent],
|
||||
providers: [EnvironmentSpecificResolver],
|
||||
providers: [EnvironmentSpecificResolver,
|
||||
[{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }],
|
||||
[{ provide: DEFAULT_TIMEOUT, useValue: 30000 }]],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
//
|
||||
|
|
|
@ -3,7 +3,7 @@ import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder";
|
|||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {StakeholderUtils} from "../../utils/indicator-utils";
|
||||
import {Option} from "../../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {Subscription} from "rxjs";
|
||||
import {Subscriber, Subscription} from "rxjs";
|
||||
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
|
@ -242,7 +242,7 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
|
||||
public save(callback: Function, errorCallback: Function = null) {
|
||||
if (this.file) {
|
||||
this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/stakeholder/" + encodeURIComponent(this.stakeholderFb.value.alias), this.file).subscribe(res => {
|
||||
this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/stakeholder/" + encodeURIComponent(this.stakeholderFb.value.alias), this.file).subscribe(res => {
|
||||
this.deletePhoto();
|
||||
this.removePhoto();
|
||||
this.stakeholderFb.get('logoUrl').setValue(res.filename);
|
||||
|
@ -250,7 +250,7 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
}, error => {
|
||||
this.uploadError = "An error has been occurred during upload your image. Try again later";
|
||||
this.saveStakeholder(callback, errorCallback);
|
||||
});
|
||||
}));
|
||||
} else if (this.deleteCurrentPhoto) {
|
||||
this.deletePhoto();
|
||||
this.saveStakeholder(callback, errorCallback);
|
||||
|
@ -267,7 +267,7 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
(stakeholder ? stakeholder.topics : [])));
|
||||
}
|
||||
this.removePhoto();
|
||||
this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL,
|
||||
this.subscriptions.push(this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL,
|
||||
this.stakeholderFb.value).subscribe(stakeholder => {
|
||||
UIkit.notification(stakeholder.name + '\'s has been successfully created', {
|
||||
status: 'success',
|
||||
|
@ -284,14 +284,14 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
if (errorCallback) {
|
||||
errorCallback(error)
|
||||
}
|
||||
});
|
||||
}));
|
||||
} else {
|
||||
this.stakeholderFb.get('type').enable();
|
||||
this.stakeholderFb.get('alias').enable();
|
||||
this.stakeholderFb.get('index_id').enable();
|
||||
this.stakeholderFb.get('index_name').enable();
|
||||
this.stakeholderFb.get('index_shortName').enable();
|
||||
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.value).subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.stakeholderFb.value).subscribe(stakeholder => {
|
||||
UIkit.notification(stakeholder.name + '\'s has been successfully saved', {
|
||||
status: 'success',
|
||||
timeout: 3000,
|
||||
|
@ -304,7 +304,7 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ export class EditStakeholderComponent implements OnDestroy {
|
|||
|
||||
public deletePhoto() {
|
||||
if (this.stakeholder.logoUrl) {
|
||||
this.utilsService.deletePhoto(this.properties.utilsService + '/delete/stakeholder/' + this.stakeholder.logoUrl).subscribe();
|
||||
this.subscriptions.push(this.utilsService.deletePhoto(this.properties.utilsService + '/delete/stakeholder/' + this.stakeholder.logoUrl).subscribe());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
import {Component, OnDestroy, OnInit, ViewChild} from "@angular/core";
|
||||
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
|
||||
import {EnvironmentSpecificService} from "../openaireLibrary/utils/properties/environment-specific.service";
|
||||
import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {Subscriber, Subscription, zip} from "rxjs";
|
||||
import {StakeholderUtils} from "../utils/indicator-utils";
|
||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
|
||||
import {Option} from "../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {Title} from "@angular/platform-browser";
|
||||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {Session} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {UtilitiesService} from "../openaireLibrary/services/utilities.service";
|
||||
import { Subscription, zip} from "rxjs";
|
||||
import {EditStakeholderComponent} from "./edit-stakeholder/edit-stakeholder.component";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
|
@ -29,10 +20,10 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
|||
public loading: boolean = false;
|
||||
private subscriptions: any[] = [];
|
||||
@ViewChild('editStakeholderComponent') editStakeholderComponent: EditStakeholderComponent;
|
||||
|
||||
|
||||
constructor(private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
|
@ -51,12 +42,12 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
public reset() {
|
||||
this.editStakeholderComponent.init(this.stakeholder, this.stakeholders, this.defaultStakeholders, this.stakeholder.defaultId == null, false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public save() {
|
||||
this.loading = true;
|
||||
this.editStakeholderComponent.save((stakeholder) => {
|
||||
|
@ -67,7 +58,7 @@ export class GeneralComponent implements OnInit, OnDestroy {
|
|||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if(subscription instanceof Subscription) {
|
||||
|
|
|
@ -11,6 +11,6 @@ import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
|
|||
CommonModule, RouterModule,
|
||||
NewPageHelpContentRoutingModule, NewPageHelpContentModule
|
||||
],
|
||||
providers: [ AdminDashboardGuard],
|
||||
providers: [AdminDashboardGuard],
|
||||
})
|
||||
export class MonitorNewPageHelpContentModule { }
|
||||
|
|
|
@ -9,12 +9,11 @@ import { UserModule} from '../openaireLibrary/login/user.module';
|
|||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import { SubscribeService } from '../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||
import {SubscribeModule} from "../utils/subscribe/subscribe.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
UserRoutingModule, UserModule, SubscribeModule
|
||||
UserRoutingModule, UserModule
|
||||
],
|
||||
providers:[PreviousRouteRecorder, SubscribeService, EmailService],
|
||||
declarations: [
|
||||
|
|
|
@ -1,106 +1,10 @@
|
|||
import {Component, ElementRef, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
import {UserComponent} from '../openaireLibrary/login/user.component';
|
||||
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {EmailService} from "../openaireLibrary/utils/email/email.service";
|
||||
import {Email} from "../openaireLibrary/utils/email/email";
|
||||
|
||||
import {Session} from '../openaireLibrary/login/utils/helper.class';
|
||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
|
||||
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-user',
|
||||
template: `
|
||||
<div id="tm-main" class="uk-section uk-margin-small-top tm-middle">
|
||||
|
||||
<user [mainComponent]=false></user>
|
||||
<div *ngIf="!server" class=" uk-container uk-container-small uk-position-relative">
|
||||
|
||||
<div *ngIf="usercomponent.errorCode == '6' && !isSubscribed" class="uk-alert uk-alert-warning">
|
||||
<span *ngIf="!isSubscribed ">For this action you have to <span *ngIf="!loggedIn">login and</span> subscribe to the research community.
|
||||
<span *ngIf="subscribe && !subscribeLoading "> <span *ngIf="!loggedIn">Login and </span>Subscribe <a [class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()" > here</a>.</span>
|
||||
</span>
|
||||
<span *ngIf="subscribeLoading ">Subscribing to community....</span>
|
||||
<span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span>
|
||||
|
||||
</div>
|
||||
<div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning">
|
||||
This action requires authentication.
|
||||
<span *ngIf="!loggedIn">
|
||||
Please <a class="" (click)="login()" > sign in</a> to continue.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
|
||||
`
|
||||
template: `<user></user>`
|
||||
})
|
||||
|
||||
export class OpenaireUserComponent {
|
||||
@ViewChild(UserComponent) usercomponent:UserComponent;
|
||||
@ViewChild(SubscribeComponent) subscribe:SubscribeComponent;
|
||||
properties:EnvProperties;
|
||||
communityId = null;
|
||||
subscribeLoading:boolean = false;
|
||||
subscribeError:boolean = false;
|
||||
isSubscribed:boolean = false;
|
||||
public server: boolean = true;
|
||||
loggedIn:boolean = false;
|
||||
constructor(private _subscribeService: SubscribeService,
|
||||
private _emailService: EmailService, private route: ActivatedRoute){}
|
||||
public ngOnInit() {
|
||||
if( typeof document !== 'undefined') {
|
||||
this.server = false;
|
||||
this.loggedIn = Session.isLoggedIn();
|
||||
}
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: any }) => {
|
||||
this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = communityId['communityId'];
|
||||
}
|
||||
if(this.subscribe.subscribed){
|
||||
this.usercomponent.redirect();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
login(){
|
||||
this.usercomponent.logIn();
|
||||
|
||||
}
|
||||
subscribeTo(){
|
||||
if(this.subscribe && this.communityId){
|
||||
this.subscribeLoading = true;
|
||||
this.subscribe.subscribe();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
afterSubscibeEvent($event){
|
||||
var res = $event.value;
|
||||
this.subscribeLoading = false;
|
||||
this.isSubscribed = this.subscribe.subscribed;
|
||||
if(res == "ok"){
|
||||
this.isSubscribed = true;
|
||||
this.usercomponent.redirect();
|
||||
}else{
|
||||
this.subscribeError = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {Title} from "@angular/platform-browser";
|
|||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {Session} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {EditStakeholderComponent} from "../general/edit-stakeholder/edit-stakeholder.component";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -66,25 +66,23 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.buildFilters();
|
||||
this.propertiesService.loadEnvironment()
|
||||
.then(properties => {
|
||||
this.properties = properties;
|
||||
this.title.setTitle('Manage profiles');
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
let data = zip(
|
||||
this.stakeholderService.getDefaultStakeholders(this.properties.monitorServiceAPIURL),
|
||||
this.stakeholderService.getMyStakeholders(this.properties.monitorServiceAPIURL)
|
||||
);
|
||||
data.subscribe(res => {
|
||||
this.defaultStakeholders = res[0];
|
||||
this.stakeholders = res[1];
|
||||
this.displayDefaultStakeholders = res[0];
|
||||
this.displayStakeholders = res[1];
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
this.properties = properties;
|
||||
this.title.setTitle('Manage profiles');
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
}));
|
||||
let data = zip(
|
||||
this.stakeholderService.getDefaultStakeholders(this.properties.monitorServiceAPIURL),
|
||||
this.stakeholderService.getMyStakeholders(this.properties.monitorServiceAPIURL)
|
||||
);
|
||||
this.subscriptions.push(data.subscribe(res => {
|
||||
this.defaultStakeholders = res[0];
|
||||
this.stakeholders = res[1];
|
||||
this.displayDefaultStakeholders = res[0];
|
||||
this.displayStakeholders = res[1];
|
||||
this.loading = false;
|
||||
}));
|
||||
|
||||
this.subscriptions.push(UIkit.util.on(document, 'hidden', '#edit_modal', (): void => {
|
||||
this.editStakeholderComponent.removePhoto();
|
||||
}));
|
||||
|
@ -204,7 +202,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
this.index = (this.stakeholder) ? this.stakeholders.findIndex(value => value._id === this.stakeholder._id) : -1;
|
||||
}
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, [this.stakeholder._id]).subscribe(() => {
|
||||
this.subscriptions.push(this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, [this.stakeholder._id]).subscribe(() => {
|
||||
UIkit.notification(this.stakeholder.name+ ' has been successfully deleted', {
|
||||
status: 'success',
|
||||
timeout: 3000,
|
||||
|
@ -221,14 +219,14 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
changeStakeholderStatus(stakeholder: Stakeholder, visibility: Visibility) {
|
||||
let path = [
|
||||
stakeholder._id
|
||||
];
|
||||
this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
this.subscriptions.push(this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
stakeholder.visibility = visibility;
|
||||
UIkit.notification(stakeholder.name+ '\'s status has been successfully changed to ' + stakeholder.visibility.toLowerCase(), {
|
||||
status: 'success',
|
||||
|
@ -241,7 +239,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public isManager(): boolean {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {MonitorComponent} from "./monitor.component";
|
||||
import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/environmentSpecificResolver";
|
||||
|
@ -12,7 +11,6 @@ import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/e
|
|||
{
|
||||
path: ':stakeholder',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
|
@ -23,19 +21,16 @@ import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/e
|
|||
{
|
||||
path: ':stakeholder/:topic',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
path: ':stakeholder/:topic/:category',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
path: ':stakeholder/:topic/:category/:subCategory',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
}
|
||||
])
|
||||
|
|
|
@ -22,11 +22,11 @@ import {StatisticsService} from "../utils/services/statistics.service";
|
|||
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
|
||||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {FormBuilder, FormControl} from "@angular/forms";
|
||||
import {Subscription} from "rxjs";
|
||||
import {Session, User} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {Subscriber, Subscription} from "rxjs";
|
||||
import {User} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {RangeFilter} from "../openaireLibrary/utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||
import {Filter, Value} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
|
||||
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
|
||||
import {Location} from "@angular/common";
|
||||
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
@ -76,8 +76,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
private layoutService: LayoutService,
|
||||
private seoService: SEOService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private sanitizer: DomSanitizer, private _fb: FormBuilder, private router: Router,
|
||||
private location: Location) {
|
||||
private sanitizer: DomSanitizer, private _fb: FormBuilder, private router: Router) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.errorMessages = new ErrorMessagesComponent();
|
||||
this.status = this.errorCodes.LOADING;
|
||||
|
@ -85,83 +84,83 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
|
||||
public ngOnInit() {
|
||||
this.keyword = this._fb.control('');
|
||||
this.keyword.valueChanges.subscribe(value => {
|
||||
this.subscriptions.push(this.keyword.valueChanges.subscribe(value => {
|
||||
console.log("Keyword Changed!");
|
||||
//TODO do a real action
|
||||
});
|
||||
let subscription: Subscription;
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
}));
|
||||
let subscription: Subscription;
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
||||
this.route.params.subscribe(params => {
|
||||
this.loading = true;
|
||||
this.activeTopic = null;
|
||||
this.activeCategory = null;
|
||||
this.activeSubCategory = null;
|
||||
this.filterToggle = false;
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
var url = properties.domain + properties.baseLink + this._router.url;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.queryParams = Object.assign({}, params);
|
||||
this.isViewPublic = (params['view'] == 'public');
|
||||
});
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.numberResults = new Map<string, number>();
|
||||
this.chartsActiveType = new Map<string, IndicatorPath>();
|
||||
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
// add fl0 filter only for EC
|
||||
if(this.stakeholder.index_id == "ec__________::EC"){
|
||||
this.filters.push({title: "Funding Stream",filterId: "relfundinglevel0_id",originalFilterId: "relfundinglevel0_id", countSelectedValues: 0,
|
||||
values:[{name: "EC|FP7", id: "ec__________::EC::FP7", selected: false, number: 0}, {name: "EC|H2020", id: "ec__________::EC::H2020", selected: false, number: 0}]
|
||||
,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
|
||||
}
|
||||
if(this.stakeholder.type == "funder"){
|
||||
// this.filters.push({title: "Co-funded research outcomes",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
|
||||
// values:[{name: "true", id: "co-funded", selected: false, number: 0}, {name: "false", id: "no-co-funded", selected: false, number: 0}]
|
||||
// ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
|
||||
this.filters.push({title: "Co-funded",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
|
||||
values:[{name: "Co-funded research output", id: "co-funded-results", selected: false, number: 0}]
|
||||
,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
|
||||
}
|
||||
this.initializeFilters();
|
||||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
var description = "Monitor Dashboard | " + this.stakeholder.name;
|
||||
var title = "Monitor Dashboard | " + this.stakeholder.name;
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
this._title.setTitle(title);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, title, this.properties.piwikSiteId).subscribe();
|
||||
}
|
||||
if(this.isPublicOrIsMember(stakeholder.visibility)) {
|
||||
//this.getDivContents();
|
||||
// this.getPageContents();
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.setView(params);
|
||||
} else {
|
||||
this.privateStakeholder = true;
|
||||
// this.navigateToError();
|
||||
if(subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.subscriptions.push(subscription);
|
||||
} else {
|
||||
console.debug(" stakeholder is already available")
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
this.loading = true;
|
||||
this.activeTopic = null;
|
||||
this.activeCategory = null;
|
||||
this.activeSubCategory = null;
|
||||
this.filterToggle = false;
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
var url = properties.domain + properties.baseLink + this._router.url;
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||
this.queryParams = Object.assign({}, params);
|
||||
this.isViewPublic = (params['view'] == 'public');
|
||||
}));
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.numberResults = new Map<string, number>();
|
||||
this.chartsActiveType = new Map<string, IndicatorPath>();
|
||||
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
// add fl0 filter only for EC
|
||||
if(this.stakeholder.index_id == "ec__________::EC"){
|
||||
this.filters.push({title: "Funding Stream",filterId: "relfundinglevel0_id",originalFilterId: "relfundinglevel0_id", countSelectedValues: 0,
|
||||
values:[{name: "EC|FP7", id: "ec__________::EC::FP7", selected: false, number: 0}, {name: "EC|H2020", id: "ec__________::EC::H2020", selected: false, number: 0}]
|
||||
,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
|
||||
}
|
||||
if(this.stakeholder.type == "funder"){
|
||||
// this.filters.push({title: "Co-funded research outcomes",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
|
||||
// values:[{name: "true", id: "co-funded", selected: false, number: 0}, {name: "false", id: "no-co-funded", selected: false, number: 0}]
|
||||
// ,filterOperator: "or", valueIsExact: true, filterType: "radio", radioValue:""});
|
||||
this.filters.push({title: "Co-funded",filterId: "co-funded",originalFilterId: "co-funded", countSelectedValues: 0,
|
||||
values:[{name: "Co-funded research output", id: "co-funded-results", selected: false, number: 0}]
|
||||
,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
|
||||
}
|
||||
this.initializeFilters();
|
||||
this.setView(params);
|
||||
this.seoService.createLinkForCanonicalURL(url, false);
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
var description = "Monitor Dashboard | " + this.stakeholder.name;
|
||||
var title = "Monitor Dashboard | " + this.stakeholder.name;
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
this._title.setTitle(title);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, title, this.properties.piwikSiteId).subscribe());
|
||||
}
|
||||
if(this.isPublicOrIsMember(stakeholder.visibility)) {
|
||||
//this.getDivContents();
|
||||
// this.getPageContents();
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.setView(params);
|
||||
} else {
|
||||
this.privateStakeholder = true;
|
||||
// this.navigateToError();
|
||||
if(subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
this.subscriptions.push(subscription);
|
||||
} else {
|
||||
console.debug(" stakeholder is already available")
|
||||
this.initializeFilters();
|
||||
this.setView(params);
|
||||
}
|
||||
}));
|
||||
}));
|
||||
|
||||
}
|
||||
private initializeFilters(){
|
||||
|
@ -245,15 +244,15 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.helper.getPageHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
|
||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.helper.getDivHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
|
||||
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private setView(params: Params) {
|
||||
|
@ -379,7 +378,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
urls.forEach((indexes, pair) => {
|
||||
pair = JSON.parse(pair);
|
||||
this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
||||
this.subscriptions.push(this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
||||
indexes.forEach(([i, j]) => {
|
||||
let result = JSON.parse(JSON.stringify(response));
|
||||
this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
|
||||
|
@ -389,7 +388,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
this.numberResults.set(i + '-' + j, result);
|
||||
});
|
||||
})
|
||||
}));
|
||||
});
|
||||
this.activeSubCategory.charts.forEach((section, i) => {
|
||||
section.indicators.forEach((indicator, j) => {
|
||||
|
@ -433,6 +432,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
|
|||
if (this.piwiksub) {
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public isPublicOrIsMember(visibility: Visibility): boolean {
|
||||
|
|
|
@ -3,7 +3,6 @@ import {CommonModule} from '@angular/common';
|
|||
import {FormsModule} from '@angular/forms';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||
|
@ -33,7 +32,7 @@ import {PageContentModule} from "../openaireLibrary/dashboard/sharedComponents/p
|
|||
MonitorComponent
|
||||
],
|
||||
providers: [
|
||||
FreeGuard, PreviousRouteRecorder,
|
||||
PreviousRouteRecorder,
|
||||
PiwikService,
|
||||
StatisticsService
|
||||
],
|
||||
|
|
|
@ -3,11 +3,12 @@ import {RouterModule} from '@angular/router';
|
|||
import {PagesComponent} from "../openaireLibrary/dashboard/page/pages.component";
|
||||
import {IsCommunityOrAdmin} from "../openaireLibrary/connect/communityGuard/isCommunityOrAdmin";
|
||||
import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
|
||||
import {LoginGuard} from "../openaireLibrary/login/loginGuard.guard";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', canActivate: [IsCommunityOrAdmin, AdminDashboardGuard], component: PagesComponent}
|
||||
{ path: '', canActivate: [LoginGuard,IsCommunityOrAdmin, AdminDashboardGuard], component: PagesComponent}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-dataprovider',
|
||||
|
@ -16,16 +17,23 @@ export class MonitorDataProviderComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,13 @@ import { NgModule} from '@angular/core';
|
|||
import { DataProviderModule } from '../../../openaireLibrary/landingPages/dataProvider/dataProvider.module';
|
||||
import { MonitorDataProviderComponent } from './dataProvider.component';
|
||||
import {DataProviderRoutingModule} from './dataProvider-routing.module';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {CommonModule} from "@angular/common";
|
||||
|
||||
@NgModule({
|
||||
imports: [DataProviderModule, DataProviderRoutingModule, CommonModule],
|
||||
declarations:[MonitorDataProviderComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[ PreviousRouteRecorder],
|
||||
exports:[MonitorDataProviderComponent]
|
||||
})
|
||||
export class LibDataProviderModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-dataset',
|
||||
|
@ -17,17 +18,24 @@ export class MonitorDatasetComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {MonitorDatasetComponent} from './dataset.component';
|
||||
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";
|
||||
|
@ -9,7 +8,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [DatasetRoutingModule, ResultLandingModule, CommonModule],
|
||||
declarations:[MonitorDatasetComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[PreviousRouteRecorder],
|
||||
exports:[MonitorDatasetComponent]
|
||||
})
|
||||
export class LibDatasetModule { }
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {OrganizationModule} from '../../../openaireLibrary/landingPages/organization/organization.module';
|
||||
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';
|
||||
|
@ -9,7 +8,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [OrganizationModule, OrganizationRoutingModule, CommonModule],
|
||||
declarations:[MonitorOrganizationComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[ PreviousRouteRecorder],
|
||||
exports:[MonitorOrganizationComponent]
|
||||
})
|
||||
export class LibOrganizationModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-organization',
|
||||
|
@ -16,16 +17,23 @@ export class MonitorOrganizationComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {MonitorOrpComponent} from './orp.component';
|
||||
import {OrpRoutingModule} from './orp-routing.module';
|
||||
|
@ -14,7 +13,7 @@ import {CommonModule} from "@angular/common";
|
|||
MonitorOrpComponent
|
||||
],
|
||||
providers: [
|
||||
FreeGuard, PreviousRouteRecorder
|
||||
PreviousRouteRecorder
|
||||
],
|
||||
exports: [
|
||||
MonitorOrpComponent
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-orp',
|
||||
|
@ -18,16 +19,23 @@ export class MonitorOrpComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {ProjectModule} from '../../../openaireLibrary/landingPages/project/project.module';
|
||||
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';
|
||||
|
@ -9,7 +8,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [ProjectModule, ProjectRoutingModule, CommonModule],
|
||||
declarations:[MonitorProjectComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[PreviousRouteRecorder],
|
||||
exports:[MonitorProjectComponent]
|
||||
})
|
||||
export class LibProjectModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-project',
|
||||
|
@ -16,17 +17,24 @@ export class MonitorProjectComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import { MonitorPublicationComponent } from './publication.component';
|
||||
import {PublicationRoutingModule} from './publication-routing.module';
|
||||
|
@ -9,7 +8,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [PublicationRoutingModule, ResultLandingModule, CommonModule],
|
||||
declarations:[MonitorPublicationComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[PreviousRouteRecorder],
|
||||
exports:[MonitorPublicationComponent]
|
||||
})
|
||||
export class LibPublicationModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-publication',
|
||||
|
@ -17,16 +18,23 @@ export class MonitorPublicationComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {MonitorResultComponent} from './result.component';
|
||||
import {ResultRoutingModule} from './result-routing.module';
|
||||
|
@ -9,7 +8,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [ResultRoutingModule, ResultLandingModule, CommonModule],
|
||||
declarations:[MonitorResultComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[PreviousRouteRecorder],
|
||||
exports:[MonitorResultComponent]
|
||||
})
|
||||
export class LibResultModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-result',
|
||||
|
@ -16,16 +17,23 @@ export class MonitorResultComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import { MonitorSoftwareComponent } from './software.component';
|
||||
import {SoftwareRoutingModule} from './software-routing.module';
|
||||
|
@ -8,7 +7,7 @@ import {CommonModule} from "@angular/common";
|
|||
@NgModule({
|
||||
imports: [SoftwareRoutingModule, ResultLandingModule, CommonModule],
|
||||
declarations:[MonitorSoftwareComponent],
|
||||
providers:[FreeGuard, PreviousRouteRecorder],
|
||||
providers:[ PreviousRouteRecorder],
|
||||
exports:[MonitorSoftwareComponent]
|
||||
})
|
||||
export class LibSoftwareModule { }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-software',
|
||||
|
@ -17,16 +18,23 @@ export class MonitorSoftwareComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-advanced-search-dataproviders',
|
||||
|
@ -22,11 +23,19 @@ export class MonitorAdvancedSearchDataprovidersComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "organization") {
|
||||
let value = stakeholder.index_id;
|
||||
|
@ -45,12 +54,9 @@ export class MonitorAdvancedSearchDataprovidersComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
navigateToError() {
|
||||
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-advanced-search-organizations',
|
||||
|
@ -20,11 +21,19 @@ export class MonitorAdvancedSearchOrganizationsComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
||||
|
@ -41,8 +50,8 @@ export class MonitorAdvancedSearchOrganizationsComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-advanced-search-projects',
|
||||
|
@ -23,11 +24,19 @@ export class MonitorAdvancedSearchProjectsComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
||||
|
@ -48,12 +57,9 @@ export class MonitorAdvancedSearchProjectsComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
navigateToError() {
|
||||
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-advanced-search-results',
|
||||
|
@ -22,11 +23,19 @@ export class MonitorAdvancedSearchResearchResultsComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
||||
|
@ -46,8 +55,8 @@ export class MonitorAdvancedSearchResearchResultsComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-search-dataproviders',
|
||||
|
@ -22,11 +23,19 @@ export class MonitorSearchDataprovidersComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
this.navigateToError();
|
||||
|
@ -40,9 +49,9 @@ export class MonitorSearchDataprovidersComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
navigateToError() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-search-organizations',
|
||||
|
@ -18,16 +19,24 @@ export class MonitorSearchOrganizationsComponent {
|
|||
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;
|
||||
}
|
||||
});
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.initialized = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-search-projects',
|
||||
|
@ -23,11 +24,19 @@ export class MonitorSearchProjectsComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
||||
|
@ -45,9 +54,9 @@ export class MonitorSearchProjectsComponent {
|
|||
this.initialized = true;
|
||||
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
navigateToError() {
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'monitor-search-results',
|
||||
|
@ -22,11 +23,19 @@ export class MonitorSearchResearchResultsComponent {
|
|||
private router: Router,
|
||||
private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscriptions = [];
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscriber) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
if (stakeholder.type === "funder") {
|
||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
||||
|
@ -46,8 +55,8 @@ export class MonitorSearchResearchResultsComponent {
|
|||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,10 +108,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
}));
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
if (this.stakeholder) {
|
||||
this.buildFilters();
|
||||
|
@ -120,7 +120,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.filterNumbers();
|
||||
this.setPreview();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
@ -131,6 +131,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
value();
|
||||
}
|
||||
});
|
||||
this.urlSubscriptions.forEach(value => {
|
||||
if (value instanceof Subscriber) {
|
||||
value.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
@ -163,7 +168,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
});
|
||||
urls.forEach((indexes, pair) => {
|
||||
pair = JSON.parse(pair);
|
||||
this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
||||
this.subscriptions.push(this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => {
|
||||
indexes.forEach(([i, j]) => {
|
||||
let result = JSON.parse(JSON.stringify(response));
|
||||
this.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
|
||||
|
@ -173,7 +178,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
});
|
||||
this.numberResults.set(i + '-' + j, result);
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -427,7 +432,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
let indicatorPath: FormGroup = <FormGroup>this.numberIndicatorPaths.at(index);
|
||||
this.getJsonPath(index).disable();
|
||||
indicatorPath.get('result').setErrors({validating: true});
|
||||
this.statisticsService.getNumbers(null, indicatorPath.get('url').value).subscribe(response => {
|
||||
this.subscriptions.push(this.statisticsService.getNumbers(null, indicatorPath.get('url').value).subscribe(response => {
|
||||
let result = JSON.parse(JSON.stringify(response));
|
||||
this.getJsonPath(index).controls.forEach(jsonPath => {
|
||||
if (result) {
|
||||
|
@ -448,7 +453,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
indicatorPath.get('result').setValue(null);
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public getJsonPath(index: number): FormArray {
|
||||
|
@ -746,7 +751,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||
this.section._id
|
||||
];
|
||||
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.indicator, path).subscribe(indicator => {
|
||||
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.indicator, path).subscribe(indicator => {
|
||||
if (this.index !== -1) {
|
||||
this.section.indicators[this.index] = indicator;
|
||||
} else {
|
||||
|
@ -773,7 +778,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
reorderIndicators(sectionId: string, type: IndicatorType, indicatorIds: string[]) {
|
||||
|
@ -785,7 +790,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||
sectionId
|
||||
];
|
||||
this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, indicatorIds, type).subscribe(indicators => {
|
||||
this.subscriptions.push(this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, indicatorIds, type).subscribe(indicators => {
|
||||
if (type === 'chart') {
|
||||
this.charts.find(section => section._id === sectionId).indicators = indicators;
|
||||
this.filterCharts();
|
||||
|
@ -794,7 +799,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.filterNumbers();
|
||||
}
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
hasDifference(index: number): boolean {
|
||||
|
@ -851,7 +856,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.section._id,
|
||||
this.indicator._id
|
||||
];
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.indicatorChildrenActionOnDelete).subscribe(() => {
|
||||
this.subscriptions.push(this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.indicatorChildrenActionOnDelete).subscribe(() => {
|
||||
if (this.indicator.type === 'chart') {
|
||||
this.charts.find(section => section._id === this.section._id).indicators.splice(this.index, 1);
|
||||
this.filterCharts();
|
||||
|
@ -872,7 +877,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
changeIndicatorStatus(sectionId: string, indicator: Indicator, visibility: Visibility) {
|
||||
|
@ -885,7 +890,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
sectionId,
|
||||
indicator._id
|
||||
];
|
||||
this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
this.subscriptions.push(this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
indicator.visibility = visibility;
|
||||
UIkit.notification('Indicator has been successfully changed to ' + indicator.visibility.toLowerCase(), {
|
||||
status: 'success',
|
||||
|
@ -900,7 +905,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
/*toggleIndicatorAccess(sectionId: string, indicator: Indicator) {
|
||||
|
@ -939,7 +944,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]._id,
|
||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id
|
||||
];
|
||||
this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, section, path, index).subscribe(section => {
|
||||
this.subscriptions.push(this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, section, path, index).subscribe(section => {
|
||||
if (type === 'chart') {
|
||||
this.charts[index] = section;
|
||||
this.filterCharts();
|
||||
|
@ -961,7 +966,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
createSection(index = -1, type: IndicatorType = 'chart') {
|
||||
|
@ -973,7 +978,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]._id,
|
||||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id
|
||||
];
|
||||
this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, this.section, path, index).subscribe(section => {
|
||||
this.subscriptions.push(this.stakeholderService.saveSection(this.properties.monitorServiceAPIURL, this.section, path, index).subscribe(section => {
|
||||
if (type === 'chart') {
|
||||
if (index !== -1) {
|
||||
this.charts.splice(index, 0, section);
|
||||
|
@ -1003,7 +1008,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
// deleteNumberSectionOpen(section: Section, index: number) {
|
||||
|
@ -1052,7 +1057,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id,
|
||||
this.section._id
|
||||
];
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.sectionChildrenActionOnDelete).subscribe(() => {
|
||||
this.subscriptions.push(this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.sectionChildrenActionOnDelete).subscribe(() => {
|
||||
if (this.sectionTypeToDelete === "chart") {
|
||||
this.charts.splice(this.index, 1);
|
||||
this.filterCharts();
|
||||
|
@ -1074,6 +1079,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
pos: 'top-left'
|
||||
});
|
||||
this.editing = false;
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {DomSanitizer, Title} from '@angular/platform-browser';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
||||
import {
|
||||
Category,
|
||||
Section,
|
||||
Stakeholder,
|
||||
SubCategory,
|
||||
Topic,
|
||||
|
@ -20,6 +19,7 @@ import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
|||
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
|
||||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Option} from "../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -31,7 +31,6 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
public subscriptions: any[] = [];
|
||||
public properties: EnvProperties;
|
||||
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
||||
public loading: boolean = true;
|
||||
public stakeholder: Stakeholder;
|
||||
/**
|
||||
|
@ -78,11 +77,9 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.properties = properties;
|
||||
let subscription: Subscription;
|
||||
this.route.params.subscribe(params => {
|
||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
|
@ -110,11 +107,16 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
}
|
||||
});
|
||||
this.subscriptions.push(subscription);
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.forEach(value => {
|
||||
if (value instanceof Subscriber) {
|
||||
value.unsubscribe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
canExit():boolean {
|
||||
|
@ -463,7 +465,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
}
|
||||
|
||||
private save(message: string, path: string[], saveElement: any, callback: Function, redirect = false) {
|
||||
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
|
||||
this.subscriptions.push(this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
|
||||
callback(saveElement);
|
||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||
UIkit.notification(message, {
|
||||
|
@ -482,11 +484,11 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private delete(message: string, path: string[], callback: Function, redirect = false) {
|
||||
this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.elementChildrenActionOnDelete).subscribe(() => {
|
||||
this.subscriptions.push(this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path, this.elementChildrenActionOnDelete).subscribe(() => {
|
||||
callback();
|
||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||
UIkit.notification(message, {
|
||||
|
@ -503,7 +505,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public toggleStatusByIndex(index: number, visibility:Visibility, type) {
|
||||
|
@ -518,7 +520,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
}
|
||||
|
||||
private changeStatus(element: Topic | Category | SubCategory, path: string[], visibility:Visibility) {
|
||||
this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
this.subscriptions.push(this.stakeholderService.changeVisibility(this.properties.monitorServiceAPIURL, path, visibility).subscribe(visibility => {
|
||||
element.visibility = visibility;
|
||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||
UIkit.notification(StringUtils.capitalize(this.type) + ' has been successfully changed to ' + element.visibility.toLowerCase(), {
|
||||
|
@ -532,7 +534,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
|||
timeout: 3000,
|
||||
pos: 'top-left'
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
back() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {Component, OnInit} from "@angular/core";
|
||||
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'users',
|
||||
|
@ -16,10 +17,15 @@ export class UsersComponent implements OnInit{
|
|||
|
||||
constructor(private stakeholderService: StakeholderService) {
|
||||
}
|
||||
|
||||
subscription;
|
||||
ngOnDestroy() {
|
||||
if (this.subscription instanceof Subscriber) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
ngOnInit() {
|
||||
this.loading = true;
|
||||
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
this.subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if(stakeholder) {
|
||||
this.alias = stakeholder.alias;
|
||||
this.name = stakeholder.name;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
import {filter, map, mergeMap} from "rxjs/operators";
|
||||
import {map, take, tap} from "rxjs/operators";
|
||||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {LoginErrorCodes} from "../openaireLibrary/login/utils/guardHelper.class";
|
||||
import {Session} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {of} from "rxjs";
|
||||
import {zip} from "rxjs";
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class AdminDashboardGuard implements CanActivate {
|
||||
|
@ -20,26 +20,18 @@ export class AdminDashboardGuard implements CanActivate {
|
|||
|
||||
check(path: string, alias: string): Observable<boolean> | boolean {
|
||||
if (Session.isLoggedIn()) {
|
||||
const obs = this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
if(user) {
|
||||
return this.stakeholderService.getStakeholder(alias).pipe(map(stakeholder => {
|
||||
if(stakeholder) {
|
||||
return (Session.isPortalAdministrator(user) ||
|
||||
Session.isCurator(stakeholder.type, user) || Session.isManager(stakeholder.type, stakeholder.alias, user));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
return of(false);
|
||||
return zip(
|
||||
this.userManagementService.getUserInfo(false)
|
||||
,this.stakeholderService.getStakeholder(alias)
|
||||
).pipe(take(1),map(res =>{
|
||||
return res[0] && res[1] && (Session.isPortalAdministrator(res[0]) ||
|
||||
Session.isCurator(res[1].type, res[0]) || Session.isManager(res[1].type, res[1].alias, res[0]));
|
||||
}),tap(authorized => {
|
||||
if(!authorized){
|
||||
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_ADMIN, 'redirectUrl':path}});
|
||||
}
|
||||
}), mergeMap( authorized => {
|
||||
return authorized;
|
||||
}));
|
||||
obs.pipe(filter(isManager => !isManager)).subscribe(() => {
|
||||
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_ADMIN, 'redirectUrl':path}});
|
||||
});
|
||||
return obs;
|
||||
|
||||
} else {
|
||||
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_LOGIN, 'redirectUrl':path}});
|
||||
return false;
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
export class PiwikHelper{
|
||||
public static siteIDs={
|
||||
"connect": 80,
|
||||
"dh-ch":81,
|
||||
"ee":82,
|
||||
"egi":83,
|
||||
"elixir-gr":84,
|
||||
"fam":85,
|
||||
"instruct":86,
|
||||
"mes":87,
|
||||
"ni":88,
|
||||
"oa-pg":89,
|
||||
"rda":90,
|
||||
"aginfra":93,
|
||||
"clarin":100,
|
||||
"dariah":103
|
||||
};
|
||||
public static siteIDsProduction={
|
||||
"connect": 112,
|
||||
"dh-ch":198,
|
||||
"ee":200,
|
||||
"egi":'',
|
||||
"elixir-gr":'',
|
||||
"fam":197,
|
||||
"instruct":'',
|
||||
"mes":196,
|
||||
"ni":199,
|
||||
"oa-pg":'',
|
||||
"rda":'',
|
||||
"aginfra":'',
|
||||
"clarin":'',
|
||||
"dariah":''
|
||||
};
|
||||
public static getSiteId(communityId:string, environment:string){
|
||||
if(environment == 'production'){
|
||||
return this.siteIDsProduction[communityId];
|
||||
}
|
||||
return this.siteIDs[communityId];
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {EnvironmentSpecificService} from "../../openaireLibrary/utils/properties/environment-specific.service";
|
||||
import {Observable} from "rxjs";
|
||||
import {SourceType} from "../../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {el} from "@angular/platform-browser/testing/src/browser_util";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
|
||||
@Injectable({
|
||||
|
@ -14,8 +13,7 @@ export class StatisticsService {
|
|||
numberSources: Map<SourceType, string[]> = new Map<SourceType, string[]>();
|
||||
chartSources: Map<SourceType, string[]> = new Map<SourceType, string[]>();
|
||||
|
||||
constructor(private http:HttpClient, private environmentSpecificService: EnvironmentSpecificService) {
|
||||
this.environmentSpecificService.subscribeEnvironment().subscribe(properties => {
|
||||
constructor(private http:HttpClient) {
|
||||
this.numberSources.set('statistics', [properties.statisticsAPIURL]);
|
||||
this.numberSources.set('search', [properties.searchAPIURLLAst]);
|
||||
this.numberSources.set('metrics', [properties.metricsAPIURL]);
|
||||
|
@ -24,7 +22,6 @@ export class StatisticsService {
|
|||
this.chartSources.set('old', [properties.statisticsFrameAPIURL]);
|
||||
this.chartSources.set('metrics', [properties.metricsAPIURL]);
|
||||
this.chartSources.set('image', [""]);
|
||||
})
|
||||
}
|
||||
getSourceType(source:string):SourceType{
|
||||
let sourceType: SourceType = 'search';
|
||||
|
|
|
@ -1,242 +0,0 @@
|
|||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
|
||||
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
|
||||
import {Session, User} from '../../openaireLibrary/login/utils/helper.class';
|
||||
|
||||
import {Email} from "../../openaireLibrary/utils/email/email";
|
||||
import {Composer} from "../../openaireLibrary/utils/email/composer";
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
@Component({
|
||||
selector: 'subscribe',
|
||||
template: `
|
||||
|
||||
<span *ngIf="subscribed != null && !showNumbers && showTemplate">
|
||||
<div *ngIf="!subscribed && showLoginAlert" class="uk-alert-warning uk-animation-slide-bottom" uk-alert="">
|
||||
<a class="uk-alert-close" uk-close></a>
|
||||
<p>Please login first to subscribe</p>
|
||||
</div>
|
||||
<button *ngIf="!subscribed" [class]="'uk-button uk-button-primary' + (loading ? ' uk-disabled' : '')"
|
||||
(click)="subscribe()"> Subscribe</button>
|
||||
<button *ngIf="subscribed" [class]="'uk-button uk-button-primary' + (loading ? ' uk-disabled' : '')"
|
||||
(click)="confirmOpen()"> Unsubscribe</button>
|
||||
</span>
|
||||
|
||||
<span *ngIf="showNumbers && subscribers !=null && subscribers > 0 && showTemplate">
|
||||
<span class="lowOpacityColor"> Members</span> {{subscribers}}
|
||||
</span>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
`
|
||||
})
|
||||
|
||||
export class SubscribeComponent {
|
||||
// @Input() showSubscribe:boolean = true;
|
||||
@Input() showNumbers: boolean;
|
||||
@Input() communityId: string;
|
||||
@Input() showTemplate: boolean = true;
|
||||
@Output() subscribeEvent = new EventEmitter();
|
||||
|
||||
public community = null;
|
||||
public emailToInformManagers: Email;
|
||||
|
||||
loading: boolean = false;
|
||||
subscribed: boolean = null;
|
||||
properties: EnvProperties;
|
||||
subscribers: number = null;
|
||||
showLoginAlert: Boolean = false;
|
||||
@ViewChild(AlertModal) alert;
|
||||
private user: User;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _subscribeService: SubscribeService,
|
||||
private _emailService: EmailService,
|
||||
private _communityService: CommunityService,
|
||||
private router: Router,
|
||||
private userManagementService: UserManagementService
|
||||
) {
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
if (!this.showNumbers) {
|
||||
let email = (this.user)?this.user.email:null;
|
||||
if (email == null) {
|
||||
this.subscribed = false;
|
||||
} else {
|
||||
if (this.communityId) {
|
||||
this._subscribeService.isSubscribedToCommunity(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.subscribed = res;
|
||||
if (this.subscribed) {
|
||||
this.subscribeEvent.emit({
|
||||
value: "ok"
|
||||
});
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting response if email: " + email + " is subscribed to community with id: " + this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.communityId) {
|
||||
this._subscribeService.getCommunitySubscribers(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.subscribers = (res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0;
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.communityId) {
|
||||
this.emailToInformManagers = {body: "", subject: "", recipients: []};
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
this.community = community;
|
||||
},
|
||||
error => {
|
||||
//console.log('System error retrieving community profile', error)
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
subscribe() {
|
||||
var email = (this.user)?this.user.email:null;
|
||||
if (email == null) {
|
||||
this.subscribed = false;
|
||||
// this.showLoginAlert = true;
|
||||
this.router.navigate(['/user-info'], {
|
||||
queryParams: {
|
||||
"errorCode": LoginErrorCodes.ACTION_REQUIRES_LOGIN,
|
||||
"redirectUrl": this.properties.baseLink + this.router.url
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.loading = true;
|
||||
this.showLoginAlert = false;
|
||||
this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.loading = false;
|
||||
if (res.status && res.status != 200) {
|
||||
this.subscribeEvent.emit({
|
||||
value: "error"
|
||||
});
|
||||
UIkit.notification({
|
||||
message: '<strong>An error occured. Please try again!<strong>',
|
||||
status: 'warning',
|
||||
timeout: 3000,
|
||||
pos: 'top-center'
|
||||
});
|
||||
} else {
|
||||
if (!this.subscribed) {
|
||||
this.subscribed = true;
|
||||
this.subscribeEvent.emit({
|
||||
value: "ok"
|
||||
});
|
||||
this._emailService.sendEmail(this.properties,
|
||||
Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers, email, this.properties.adminPortalURL)).subscribe(
|
||||
res => {
|
||||
//console.log("The email has been sent successfully!")
|
||||
},
|
||||
error => {
|
||||
//console.log(error)
|
||||
this.handleError("Error notifying managers about new subscribers for community with id: " + this.communityId, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.loading = false;
|
||||
this.subscribeEvent.emit({
|
||||
value: "error"
|
||||
});
|
||||
UIkit.notification({
|
||||
message: '<strong>An error occured. Please try again!<strong>',
|
||||
status: 'warning',
|
||||
timeout: 3000,
|
||||
pos: 'top-center'
|
||||
});
|
||||
//console.log(error)
|
||||
this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
unsubscribe() {
|
||||
var email = (this.user)?this.user.email:null;
|
||||
if (email == null) {
|
||||
this.subscribed = false;
|
||||
} else {
|
||||
this.loading = true;
|
||||
//this.properties.adminToolsAPIURL
|
||||
this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.loading = false;
|
||||
if (res.status && res.status != 200) {
|
||||
UIkit.notification({
|
||||
message: '<strong>An error occured. Please try again!<strong>',
|
||||
status: 'warning',
|
||||
timeout: 3000,
|
||||
pos: 'top-center'
|
||||
});
|
||||
} else {
|
||||
//console.log(res);
|
||||
if (this.subscribed) {
|
||||
console.log('here')
|
||||
this.subscribed = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.loading = false;
|
||||
UIkit.notification({
|
||||
message: '<strong>An error occured. Please try again!<strong>',
|
||||
status: 'warning',
|
||||
timeout: 3000,
|
||||
pos: 'top-center'
|
||||
});
|
||||
//console.log(error)
|
||||
this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
confirmOpen() {
|
||||
|
||||
this.alert.cancelButton = true;
|
||||
this.alert.okButton = true;
|
||||
this.alert.alertTitle = "Unsubscribe community ";
|
||||
this.alert.message = "Do you want to proceed? ";
|
||||
this.alert.okButtonText = "Yes";
|
||||
this.alert.cancelButtonText = "No";
|
||||
this.alert.open();
|
||||
}
|
||||
|
||||
confirmClose(data) {
|
||||
this.unsubscribe();
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Subscribe (component): " + message, error);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
import {ModuleWithProviders, NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
|
||||
|
||||
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
|
||||
import {SubscribeComponent} from './subscribe.component';
|
||||
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, RouterModule, AlertModalModule
|
||||
],
|
||||
declarations: [
|
||||
SubscribeComponent
|
||||
],
|
||||
exports: [
|
||||
SubscribeComponent
|
||||
]
|
||||
})
|
||||
export class SubscribeModule {
|
||||
static forRoot(): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: SubscribeModule,
|
||||
providers: [
|
||||
SubscribeService, EmailService, CommunityService
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
User-Agent: *
|
||||
Disallow: /cache
|
||||
Disallow: /upload
|
||||
Disallow: /
|
||||
Disallow: /admin
|
||||
Crawl-delay: 30
|
||||
|
|
Loading…
Reference in New Issue