[Library|Trunk]

code clean up:
-remove app.* files from library
-remove unused imports, code, files (Old search pages for results, dataproviders, map search page, etc)
-remove Freeguard from modules
-unsubscribe all subscriptions
-Services: configuration, isvocabularies, user management: unsubscribe from app component or the component that uses them (clearSubscriptions())
-Fetchers: unsubscribe from  the component that uses them (clearSubscriptions())




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59816 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-11 14:43:13 +00:00
parent 72cd3c9c43
commit 1d5c753ff6
178 changed files with 833 additions and 7753 deletions

View File

@ -1,93 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {IsRouteEnabled} from './error/isRouteEnabled.guard';
import {EnvironmentSpecificResolver} from './utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService } from './utils/properties/environment-specific.service';
import { ErrorPageComponent } from './error/errorPage.component';
import {SearchComponent} from './searchPages/find/search.component';
import {ResultLandingComponent} from "./landingPages/result/resultLanding.component";
import {DataProviderComponent} from './landingPages/dataProvider/dataProvider.component';
import {ProjectComponent} from './landingPages/project/project.component';
import {OrganizationComponent} from './landingPages/organization/organization.component';
import {SearchResearchResultsComponent} from './searchPages/simple/searchResearchResults.component';
import {SearchDataprovidersComponent} from './searchPages/simple/searchDataproviders.component';
import {SearchProjectsComponent} from './searchPages/simple/searchProjects.component';
import {SearchOrganizationsComponent} from './searchPages/simple/searchOrganizations.component';
import {AdvancedSearchResearchResultsComponent} from './searchPages/advanced/advancedSearchResearchResults.component';
import {AdvancedSearchDataProvidersComponent} from './searchPages/advanced/advancedSearchDataProviders.component';
import {AdvancedSearchProjectsComponent} from './searchPages/advanced/advancedSearchProjects.component';
import {AdvancedSearchOrganizationsComponent} from './searchPages/advanced/advancedSearchOrganizations.component';
import {SearchEntityRegistriesComponent} from './searchPages/dataProviders/entityRegistries.component';
import {SearchEntityRegistriesTableComponent} from './searchPages/dataProviders/entityRegistriesTable.component';
import {SearchJournalsTableComponent} from './searchPages/dataProviders/journalsTable.component';
import {SearchJournalsComponent} from './searchPages/dataProviders/journals.component';
import {SearchCompatibleDataprovidersComponent} from './searchPages/dataProviders/compatibleDataProviders.component';
import {SearchCompatibleDataprovidersTableComponent} from './searchPages/dataProviders/compatibleDataProvidersTable.component';
import {ClaimsAdminComponent} from './claims/claimsAdmin/claimsAdmin.component';
import {MyClaimsComponent} from './claims/myClaims/myClaims.component';
import {ClaimsByTokenComponent} from './claims/claimsByToken/claimsByToken.component';
import {DirectLinkingComponent} from './claims/directLinking/directLinking.component';
import {LinkingGenericComponent} from './claims/linking/linkingGeneric.component';
import{ HtmlProjectReportComponent} from './landingPages/htmlProjectReport/htmlProjectReport.component';
const routes: Routes = [
{ path: '', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate: [ ]},
{ path: 'home', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/publication', component: ResultLandingComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/dataset', component: ResultLandingComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/software', component: ResultLandingComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/other', component: ResultLandingComponent, resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'search/project', component: ProjectComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/dataprovider', component: DataProviderComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/organization', component: OrganizationComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/publications', component: SearchResearchResultsComponent , resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate: [ ] },
{ path: 'search/find/datasets', component:SearchResearchResultsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/software', component:SearchResearchResultsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/other', component:SearchResearchResultsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/projects', component:SearchProjectsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/dataproviders', component:SearchDataprovidersComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/find/organizations', component:SearchOrganizationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/content-providers', component: SearchCompatibleDataprovidersComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/content-providers-table', component: SearchCompatibleDataprovidersTableComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/entity-registries',component: SearchEntityRegistriesComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/entity-registries-table', component: SearchEntityRegistriesTableComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/journals', component: SearchJournalsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/journals-table', component: SearchJournalsTableComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/publications', component: AdvancedSearchResearchResultsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/datasets', component: AdvancedSearchResearchResultsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/software', component: AdvancedSearchResearchResultsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/other', component: AdvancedSearchResearchResultsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/organizations',component: AdvancedSearchOrganizationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/dataproviders', component: AdvancedSearchDataProvidersComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'search/advanced/projects', component: AdvancedSearchProjectsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'project-report', component: HtmlProjectReportComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'myclaims',component: MyClaimsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'claims', component: ClaimsAdminComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'participate/claim', component: LinkingGenericComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'participate/direct-claim',component: DirectLinkingComponent, resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'claims-project-manager', component: ClaimsByTokenComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'reload', loadChildren: './reload/reload.module#ReloadModule' , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'user-info', loadChildren: './login/user.module#UserModule' , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: 'error', component: ErrorPageComponent , resolve: { envSpecific: EnvironmentSpecificResolver } },
{ path: '**',pathMatch: 'full',component: ErrorPageComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
providers: [EnvironmentSpecificResolver, EnvironmentSpecificService, IsRouteEnabled]
})
export class AppRoutingModule { }

View File

@ -1,110 +0,0 @@
import { Component, Directive, ElementRef, Renderer2, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { ConfigurationService } from './utils/configuration/configuration.service';
import {Observable} from 'rxjs';
import { EnvProperties } from './utils/properties/env-properties';
import {ActivatedRoute} from '@angular/router';
import{EnvironmentSpecificService} from './utils/properties/environment-specific.service';
import{MenuItem,RootMenuItem} from './sharedComponents/menu';
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
//encapsulation: ViewEncapsulation.Emulated,
selector: 'app-root',
styles: [`
`],
template: `
<navbar *ngIf= "properties" portal="explore" [properties]=properties [onlyTop]=false [userMenu]=true [communityId]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems ></navbar>
<h1>Openaire Lib Component</h1>
<!--div id="tm-main" class=" uk-section uk-margin-large-top tm-middle custom-main-content" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "-->
<div class="custom-main-content" >
<main>
<router-outlet></router-outlet>
</main>
</div>
<!--/div>
</div>
</div-->
<!--feedback *ngIf= "isClient"></feedback-->
<cookie-law *ngIf= "isClient" position="bottom">
OpenAIRE uses cookies in order to function properly.<br>
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a href="http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf= "isClient && properties" [assetsPath]=assetsPath [properties]=properties></bottom>
`
})
export class AppComponent {
isClient:boolean = false;
public properties:EnvProperties = null;
constructor(private config: ConfigurationService, private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) {
}
assetsPath = "assets/";
userMenuItems:MenuItem[] = [ new MenuItem("","My profile","","",false,[],[],{}),
new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}),
new MenuItem("","Manage all claims","","/claims",true,[],["/claims"],{})]
menuItems:RootMenuItem [] = [
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}),
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{}),
new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],{}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{}),
new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{})
]},
{
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets"],{}),
items: [new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],{}),
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],{})]
},
{
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],{}),
items: []
},
{
rootItem: new MenuItem("datasources","Content Providers","","",false,["datasource"],[],{}),
items: [new MenuItem("","Data Policies","https://beta.openaire.eu/oa-policies-mandates","",false,["datasource"],[],{}),
new MenuItem("","Repositories","","/search/content-providers",false,["datasource"],["/search/content-providers"],{}),
new MenuItem("","Journals","","/search/journals",false,["datasource"],["/search/journals"],{}),
new MenuItem("","Registries","","/search/entity-registries",false,["datasource"],["/search/entity-registries"],{}),
new MenuItem("","Browse all","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{})]
}
];
ngOnInit() {
this.propertiesService.loadEnvironment()
.then(es => {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
}, error => {
console.log("App couldn't fetch properties");
console.log(error);
});
if (typeof document !== 'undefined') {
try{
this.isClient = true;
}catch (e) {
}
}
}
}

View File

@ -1,83 +0,0 @@
import {NgModule} from '@angular/core';
import {SharedModule} from './shared/shared.module';
import {BrowserModule} from '@angular/platform-browser';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {CommonModule} from '@angular/common';
import {HttpClientModule} from '@angular/common/http';
import {AppComponent} from './app.component';
import {NavigationBarModule} from './sharedComponents/navigationBar.module';
import {CookieLawModule} from './sharedComponents/cookie-law/cookie-law.module';
import {BottomModule} from './sharedComponents/bottom.module';
// import { ErrorModule } from './error/error.module';
import {ConfigurationService} from './utils/configuration/configuration.service';
import {MainSearchModule} from './searchPages/find/mainSearch.module';
import {ResultLandingModule} from "./landingPages/result/resultLanding.module";
import {DataProviderModule} from './landingPages/dataProvider/dataProvider.module';
import {ProjectModule} from './landingPages/project/project.module';
import {OrganizationModule} from './landingPages/organization/organization.module';
import {ErrorModule} from './error/error.module';
import {SearchResearchResultsModule} from './searchPages/simple/searchResearchResults.module';
import {SearchDataProvidersModule} from './searchPages/simple/searchDataProviders.module';
import {SearchProjectsModule} from './searchPages/simple/searchProjects.module';
import {SearchOrganizationsModule} from './searchPages/simple/searchOrganizations.module';
import {AdvancedSearchResearchResultsModule} from './searchPages/advanced/advancedSearchResearchResults.module';
import {AdvancedSearchDataProvidersModule} from './searchPages/advanced/advancedSearchDataProviders.module';
import {AdvancedSearchProjectsModule} from './searchPages/advanced/advancedSearchProjects.module';
import {AdvancedSearchOrganizationsModule} from './searchPages/advanced/advancedSearchOrganizations.module';
import {EntityRegistriesModule} from './searchPages/dataProviders/entityRegistries.module';
import {EntityRegistriesTableModule} from './searchPages/dataProviders/entityRegistriesTable.module';
import {JournalsTableModule} from './searchPages/dataProviders/journalsTable.module';
import {JournalsModule} from './searchPages/dataProviders/journals.module';
import {CompatibleDataProvidersModule} from './searchPages/dataProviders/compatibleDataProviders.module';
import {CompatibleDataProvidersTableModule} from './searchPages/dataProviders/compatibleDataProvidersTable.module';
import {ClaimsAdminModule} from './claims/claimsAdmin/claimsAdmin.module';
import {MyClaimsModule} from './claims/myClaims/myClaims.module';
import {ClaimsByTokenModule} from './claims/claimsByToken/claimsByToken.module';
import {DirectLinkingModule} from './claims/directLinking/directLinking.module';
import {LinkingGenericModule} from './claims/linking/linkingGeneric.module';
import {HtmlProjectReportModule} from './landingPages/htmlProjectReport/htmlProjectReport.module';
import {AppRoutingModule} from './app-routing.module';
@NgModule({
imports: [
SharedModule,
NoopAnimationsModule,
CommonModule,
CookieLawModule,
BottomModule,
HttpClientModule,
NavigationBarModule,
MainSearchModule,
ErrorModule,
SearchResearchResultsModule, SearchDataProvidersModule, SearchProjectsModule, SearchOrganizationsModule,
AdvancedSearchResearchResultsModule, AdvancedSearchDataProvidersModule, AdvancedSearchProjectsModule, AdvancedSearchOrganizationsModule,
ResultLandingModule, DataProviderModule, OrganizationModule, ProjectModule,
EntityRegistriesModule, CompatibleDataProvidersModule, JournalsModule,
JournalsTableModule, EntityRegistriesTableModule, CompatibleDataProvidersTableModule,
ClaimsAdminModule, MyClaimsModule, ClaimsByTokenModule, LinkingGenericModule, DirectLinkingModule,
HtmlProjectReportModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
AppRoutingModule
],
declarations: [ AppComponent ],
exports: [ AppComponent ],
providers:[ ConfigurationService],
bootstrap: [AppComponent]
})
export class AppModule {}
/*
, canActivate: [ IsRouteEnabled], data: {
redirect: '/error'
}
*/

View File

@ -1,20 +0,0 @@
import {NgModule} from '@angular/core';
import {ServerModule} from '@angular/platform-server';
import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';
import {AppModule} from './app.module';
import {AppComponent} from './app.component';
@NgModule({
imports: [
// The AppServerModule should import your AppModule followed
// by the ServerModule from @angular/platform-server.
AppModule,
ServerModule,
ModuleMapLoaderModule,
],
// Since the bootstrapped component is not inherited from your
// imported AppModule, it needs to be repeated here.
bootstrap: [AppComponent],
})
export class AppServerModule {}

View File

@ -1,10 +1,11 @@
import {Component, Input} from '@angular/core';
import {Router} from '@angular/router';
import {ContextsService} from './service/contexts.service';
import {ClaimContext, ClaimEntity} from './claimHelper.class';
import {ClaimEntity} from './claimHelper.class';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Subscriber} from "rxjs";
declare var UIkit: any;
@ -39,11 +40,17 @@ export class ClaimContextSearchFormComponent {
@Input() localStoragePrefix: string = "";
keyword = "";
subscriptions = [];
ngOnInit() {
this.getCommunities();
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
constructor(private _contextService: ContextsService, private router: Router) {
}
@ -114,7 +121,7 @@ export class ClaimContextSearchFormComponent {
} else {
this.loading = true;
this._contextService.getPublicCommunitiesByState().subscribe(
this.subscriptions.push(this._contextService.getPublicCommunitiesByState().subscribe(
data => {
this.communities = data;
if (this.communities.length > 0) {
@ -143,7 +150,7 @@ export class ClaimContextSearchFormComponent {
this.loading = false;
this.error = true;
}
);
));
}
}
@ -160,7 +167,7 @@ export class ClaimContextSearchFormComponent {
this.loading = false;
return;
}
this._contextService.getCategories(this.selectedCommunityId, this.properties.contextsAPI).subscribe(
this.subscriptions.push(this._contextService.getCategories(this.selectedCommunityId, this.properties.contextsAPI).subscribe(
data => {
this.categories[this.selectedCommunityId] = data;
@ -176,7 +183,7 @@ export class ClaimContextSearchFormComponent {
ClaimContextSearchFormComponent.handleError("Error getting categories for community with id: " + this.selectedCommunityId, err);
this.loading = false;
}
);
));
}
}
}
@ -272,7 +279,7 @@ export class ClaimContextSearchFormComponent {
}
this.conceptsClass[categoryId] = [];
this.conceptsCategoryLoading[categoryId] = true;
this._contextService.getConcepts(categoryId, "", false, this.properties.contextsAPI).subscribe(
this.subscriptions.push(this._contextService.getConcepts(categoryId, "", false, this.properties.contextsAPI).subscribe(
data => {
// var concepts = data;
this.conceptsClass[categoryId] = [];
@ -290,7 +297,7 @@ export class ClaimContextSearchFormComponent {
ClaimContextSearchFormComponent.handleError("Error getting concepts for category with id: " + this.selectedCategoryId, err);
this.conceptsCategoryLoading[categoryId] = false;
}
);
));
}
}
@ -298,7 +305,7 @@ export class ClaimContextSearchFormComponent {
browseSubConcepts(categoryId, conceptId) {
this.conceptsCategoryLoading[categoryId] = true;
this._contextService.getSubConcepts(conceptId, "", false, this.properties.contextsAPI).subscribe(
this.subscriptions.push(this._contextService.getSubConcepts(conceptId, "", false, this.properties.contextsAPI).subscribe(
data => {
const concepts = data[0];
this.conceptsClass[categoryId].push(concepts);
@ -309,7 +316,7 @@ export class ClaimContextSearchFormComponent {
ClaimContextSearchFormComponent.handleError("Error getting subconcepts for concept with id: " + conceptId, err);
this.conceptsCategoryLoading[categoryId] = false;
}
);
));
}

View File

@ -9,6 +9,7 @@ import {Filter, Value} from "../../searchPages/searchUtils/searchHelperClasses.c
import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class";
import {SearchFields} from "../../utils/properties/searchFields";
import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component";
import {Subscriber} from "rxjs";
declare var UIkit:any;
@ -67,7 +68,12 @@ export class ClaimProjectsSearchFormComponent {
this.rangeFilters = RangeFilter.parse(this.rangeFields,"project");
}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
search(page,size) {
if(this.keyword.length == 0){
@ -80,7 +86,7 @@ export class ClaimProjectsSearchFormComponent {
this.prevFilters = this.filters;
//searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any {
this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
data => {
if(data != null) {
this.openaireResultsPage=page;

View File

@ -8,11 +8,10 @@ import {ClaimEntity, ClaimResult} from './claimHelper.class';
import {DOI, StringUtils} from '../../utils/string-utils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Filter, Value} from "../../searchPages/searchUtils/searchHelperClasses.class";
import {Observable, forkJoin} from "rxjs";
import {Observable, Subscriber} from "rxjs";
import 'rxjs/add/observable/forkJoin'
import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component";
import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class";
import {SearchUtilsClass} from "../../searchPages/searchUtils/searchUtils.class";
import {SearchFields} from "../../utils/properties/searchFields";
@Component({
selector: 'claim-result-search-form',
@ -122,7 +121,14 @@ export class ClaimResultSearchFormComponent {
this.search(false);
}
}
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
search(keywordChanged) {
//uncomment to disable search with no keyword
if (this.keyword.length == 0) {
@ -187,14 +193,14 @@ export class ClaimResultSearchFormComponent {
this.crossrefStatus = this.errorCodes.LOADING;
// this.crossrefResultsNum = null;
if (this.DOIs.length > 0) {
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs, this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs, this.properties, true).subscribe(
data => {
if (data != null) {
this.crossrefResults = data[1];
this.crossrefPage = page;
this.crossrefResultsNum = data[0];
if (this.crossrefResultsNum == 0) {
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
data => {
if (data != null) {
this.crossrefResults = data[1];
@ -215,7 +221,7 @@ export class ClaimResultSearchFormComponent {
ClaimResultSearchFormComponent.handleError("Error getting crossref results for term: " + term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
));
} else {
this.crossrefStatus = this.errorCodes.DONE;
}
@ -224,7 +230,7 @@ export class ClaimResultSearchFormComponent {
err => {
ClaimResultSearchFormComponent.handleError("Error getting crossref by DOIs: " + JSON.stringify(this.DOIs), err);
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
data => {
this.crossrefResults = data[1];
this.crossrefPage = page;
@ -237,14 +243,14 @@ export class ClaimResultSearchFormComponent {
ClaimResultSearchFormComponent.handleError("Error getting crossref results for term: " + term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
));
}
);
));
} else {
this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
data => {
if (data != null) {
this.crossrefResults = data[1];
@ -264,7 +270,7 @@ export class ClaimResultSearchFormComponent {
ClaimResultSearchFormComponent.handleError("Error getting crossref results for term: " + term, err);
this.crossrefStatus = this.errorCodes.ERROR;
}
);
));
}
}
@ -294,14 +300,14 @@ export class ClaimResultSearchFormComponent {
this.openaireResultsStatus = this.errorCodes.LOADING;
this.openaireResultsPrevFilters = this.openaireResultsfilters;
this.openaireResultsNum = 0;
this._searchResearchResultsService.advancedSearchResults('publication', this.createOpenaireQueryParams(), page, size, null, this.properties, this.createOpenaireRefineQueryParams(), (page==1 ?this.openaireRefineFields:[]), (page==1 ?this.openaireRefineFieldsQuery:null)).subscribe(
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults('publication', this.createOpenaireQueryParams(), page, size, null, this.properties, this.createOpenaireRefineQueryParams(), (page==1 ?this.openaireRefineFields:[]), (page==1 ?this.openaireRefineFieldsQuery:null)).subscribe(
data => {
this.setOpenaireResults(data, mainResults, page, type);
},
err => {
this.setOpenaireResultsError(mainResults, term, err);
}
);
));
}
public setOpenaireResults(data, mainResults: boolean, page, type) {
@ -379,7 +385,7 @@ export class ClaimResultSearchFormComponent {
private getOrcidAuthor(term: string, addId) {
this.orcidResultsNum = null;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthor(StringUtils.URIEncode(term.replace(/\s/g, "")), this.authorIds,
this.subscriptions.push(this._searchOrcidService.searchOrcidAuthor(StringUtils.URIEncode(term.replace(/\s/g, "")), this.authorIds,
this.authors, this.properties, addId).subscribe(
data => {
if (data != null && data == true && addId) {
@ -391,7 +397,7 @@ export class ClaimResultSearchFormComponent {
},
err => this.errorHandler(err, term)
);
));
}
private errorHandler(err: any, term: string) {
@ -409,7 +415,7 @@ export class ClaimResultSearchFormComponent {
this.selectAuthorId = "0";
this.orcidStatus = this.errorCodes.LOADING;
//passing structures in order to fill them in service
this._searchOrcidService.searchOrcidAuthors(StringUtils.URIEncode(term), this.properties).subscribe(
this.subscriptions.push(this._searchOrcidService.searchOrcidAuthors(StringUtils.URIEncode(term), this.properties).subscribe(
data => {
this.authorIds = data;
if (data != null) {
@ -430,7 +436,7 @@ export class ClaimResultSearchFormComponent {
//console.log(err.status);
ClaimResultSearchFormComponent.handleError("Error getting orcid authors for term: " + term + " and ids: " + JSON.stringify(this.authorIds), err);
}
);
));
}
@ -447,7 +453,7 @@ export class ClaimResultSearchFormComponent {
this.authorFamilyName = this.authors[index].authorFamilyName;
this.authorId = this.authors[index].id;
this.orcidStatus = this.errorCodes.LOADING;
this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties, true).subscribe(
this.subscriptions.push(this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties, true).subscribe(
data => {
if (data != null) {
this.orcidResults = data;
@ -487,7 +493,7 @@ export class ClaimResultSearchFormComponent {
ClaimResultSearchFormComponent.handleError("Error getting orcid publications for author id: " + this.authors[index].id, err);
this.orcidStatus = this.errorCodes.ERROR;
}
);
));
}
@ -495,7 +501,7 @@ export class ClaimResultSearchFormComponent {
private enhanceInfoFromDOI(entity: ClaimEntity) {
if (entity.result.DOI != null) {
this._searchCrossrefService.searchCrossrefByDOIs([entity.result.DOI], this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOIs([entity.result.DOI], this.properties, true).subscribe(
data => {
if (data != null && data[0] > 0 && data[1]) {
let crossrefResult: ClaimEntity = data[1][0];
@ -524,7 +530,7 @@ export class ClaimResultSearchFormComponent {
err => {
ClaimResultSearchFormComponent.handleError("Error getting crossref by DOIs: " + entity['DOI'], err);
}
);
));
}
}
@ -683,7 +689,7 @@ export class ClaimResultSearchFormComponent {
doiObservables.push(ob);
}
Observable.forkJoin(doiObservables).subscribe(
this.subscriptions.push(Observable.forkJoin(doiObservables).subscribe(
data => {
//if DOI not found or an error occured the result will be null -- remove null values
for(let result of data){
@ -695,7 +701,7 @@ export class ClaimResultSearchFormComponent {
this.dataciteResultsNum = this.dataciteResults.length;
this.dataciteStatus = this.errorCodes.DONE;
if (this.dataciteResultsNum == 0) {
this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
this.subscriptions.push(this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
data => {
this.dataciteResults = data[1];
this.datacitePage = page;
@ -712,15 +718,15 @@ export class ClaimResultSearchFormComponent {
console.log(err);
ClaimResultSearchFormComponent.handleError("Error getting datacite results for term: " + term, err);
});
}));
}
}
);
));
} else {
this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
this.subscriptions.push(this._searchDataciteService.searchDataciteResults(StringUtils.URIEncode(term), size, page, this.properties, true).subscribe(
data => {
this.dataciteResults = data[1];
this.datacitePage = page;
@ -737,7 +743,7 @@ export class ClaimResultSearchFormComponent {
//console.log(err);
ClaimResultSearchFormComponent.handleError("Error getting datacite results for term: " + term, err);
}
);
));
}
}

View File

@ -1,6 +1,5 @@
import {Component, Input} from '@angular/core';
import {ClaimEntity} from './claimHelper.class';
import {HelperFunctions} from "../../utils/HelperFunctions.class";
declare var UIkit: any;

View File

@ -1,7 +1,7 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router';
import {Subject} from 'rxjs';
import {Subject, Subscriber} from 'rxjs';
import {debounceTime, distinctUntilChanged} from 'rxjs/operators';
import {ClaimsService} from '../service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
@ -28,11 +28,9 @@ import {properties} from "../../../../../environments/environment";
export class DisplayClaimsComponent {
@Input() piwikSiteId = null;
@Input() title: string = "";
piwiksub: any;
properties: EnvProperties;
public searchTermStream = new Subject<string>();
sub: any;
subscriptions: any = [];
//string because comes as input from component directive
@Input() enableDelete: boolean = false;
@Input() showUserEmail: boolean = true;
@ -99,16 +97,16 @@ export class DisplayClaimsComponent {
this.updateDescription(description);
this.updateUrl(this.url);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
}
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {
}));
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {
this.lastIndexDate = res;
});
this.sub = this.route.queryParams.subscribe(params => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.seoService.createLinkForCanonicalURL(this.url, false);
if (this.myClaims) {
@ -133,26 +131,26 @@ export class DisplayClaimsComponent {
this.setTypes(params['types']); // check the appropriate checkboxes
this.setSortby(params['sort']);
this.getClaims();
this.searchTermStream
this.subscriptions.push(this.searchTermStream
.pipe(debounceTime(300), distinctUntilChanged())
.subscribe((term: string) => {
this.keyword = term;
this.page = 1;
this.goTo();
});
}));
});
}));
}
ngOnDestroy() {
this.sub.unsubscribe();
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
//this.searchTermStreamSub.unsubscribe();
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
getClaims() {
@ -174,7 +172,7 @@ export class DisplayClaimsComponent {
}
this.pageLoading = true;
if (this.fetchBy == "Project") {
this._claimService.getClaimsByProject(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.getClaimsByProject(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
data => {
this.manageAPIData(data);
this.pageLoading = false;
@ -182,9 +180,9 @@ export class DisplayClaimsComponent {
err => {
this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId);
}
);
));
} else if (this.fetchBy == "User") {
this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
data => {
this.manageAPIData(data);
this.pageLoading = false;
@ -193,9 +191,9 @@ export class DisplayClaimsComponent {
this.handleErrors(err, "Error getting claims for user with id: " + this.fetchId);
this.pageLoading = false;
}
);
));
} else if (this.fetchBy == "Result") {
this._claimService.getClaimsByResult(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.getClaimsByResult(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
data => {
this.manageAPIData(data);
this.pageLoading = false;
@ -204,9 +202,9 @@ export class DisplayClaimsComponent {
this.handleErrors(err, "Error getting claims for entity with id: " + this.fetchId);
this.pageLoading = false;
}
);
));
} else if (this.fetchBy == "Context") {
this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
data => {
this.manageAPIData(data);
this.pageLoading = false;
@ -215,9 +213,9 @@ export class DisplayClaimsComponent {
this.handleErrors(err, "Error getting claims for context with id: " + this.fetchId);
this.pageLoading = false;
}
);
));
} else {
this._claimService.getClaims(this.size, this.page, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.getClaims(this.size, this.page, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
data => {
this.manageAPIData(data);
this.pageLoading = false;
@ -226,7 +224,7 @@ export class DisplayClaimsComponent {
this.handleErrors(err, "Error getting claims");
this.pageLoading = false;
}
);
));
}
}
}
@ -547,7 +545,7 @@ export class DisplayClaimsComponent {
});
} else {
//console.warn("Deleting claim with ids:"+ids);
this._claimService.deleteBulk(ids, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this._claimService.deleteBulk(ids, this.properties.claimsAPIURL).subscribe(
res => {
//console.info('Delete response'+res.code );
//console.warn("Deleted ids:"+ res.deletedIds);
@ -588,7 +586,7 @@ export class DisplayClaimsComponent {
this.showErrorMessage = true;
this.loading.close();
});
}));
}
}

View File

@ -1,6 +1,5 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {ProjectTitleFormatter} from './projectTitleFormatter.component';

View File

@ -57,6 +57,9 @@ export class ContextsService {
}
await this.promise;
if(this.sub){
this.sub.unsubscribe();
}
if(getAll) {
return this.communitiesSubject.getValue();
} else {
@ -102,7 +105,7 @@ export class ContextsService {
.pipe(map(res => (parsing)?this.parse(res):res));
}
public getSubConcepts(subConceptID :string, keyword: string, parsing:boolean, apiUrl:string):any {
//console.info('ContextsService: request sub concept for concept with id '+subConceptID + ' and keyword '+ keyword);
//console.info('ContextsService: request subscriptions concept for concept with id '+subConceptID + ' and keyword '+ keyword);
let url= apiUrl + '/category/concept/' + subConceptID;
let key = url+"_parsing="+parsing;

View File

@ -1,4 +1,4 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Component, Input, ViewChild} from '@angular/core';
import {AlertModal} from '../../utils/modal/alert';

View File

@ -1,9 +1,10 @@
import {Component, Input} from '@angular/core';
import {Title, Meta} from '@angular/platform-browser';
import {Session, User} from "../../login/utils/helper.class";
import {User} from "../../login/utils/helper.class";
import {UserManagementService} from "../../services/user-management.service";
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
import {Router} from "@angular/router";
import {Subscriber} from "rxjs";
@Component({
@ -45,7 +46,7 @@ export class ClaimsAdminComponent {
@Input() claimsInfoURL: string;
@Input() userInfoURL: string;
public user: User = null;
sub;
constructor(private _meta: Meta, private _title: Title,
private userManagementService: UserManagementService, private _router: Router) {
var titleConnect = "OpenAIRE Connect | Manage links ";
@ -59,9 +60,13 @@ export class ClaimsAdminComponent {
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.userManagementService.getUserInfo().subscribe(user => {
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if (!user) {
this._router.navigate(['/user-info'], {

View File

@ -1,17 +1,13 @@
import {Component, ViewChild, ViewChildren, QueryList, Input, ViewEncapsulation} from '@angular/core';
import {Location} from '@angular/common';
import {Component, ViewChild, ViewChildren, QueryList, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {DataTableDirective} from 'angular-datatables';
import {Observable, Subject } from 'rxjs';
import {Subject, Subscriber} from 'rxjs';
import{EnvProperties} from '../../utils/properties/env-properties';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
import {RouterHelper} from '../../utils/routerHelper.class';
import {ModalSelect} from '../../utils/modal/selectModal.component';
@ -39,7 +35,7 @@ import {properties} from "../../../../environments/environment";
})
export class ClaimsByTokenComponent {
public openaireId: string = "";
public sub: any;
public subscriptions: any =[];
public project: any;
private claims:any = [];
public pending_claims: any = [];
@ -96,7 +92,7 @@ export class ClaimsByTokenComponent {
this.curated_status = this.errorCodes.LOADING;
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.mode = "pending";
this.openaireId = params['openaireId'];
this.selectedRight_PendingMode = new Set<string>();
@ -107,7 +103,7 @@ export class ClaimsByTokenComponent {
this.validateJWTandToken();
this.updateTitle("Claims For Project Managers");
}
);
));
this.dtOptions[0] = {
//"paging": false,
@ -161,6 +157,11 @@ export class ClaimsByTokenComponent {
// Do not forget to unsubscribe the event
this.dtTrigger[0].unsubscribe();
this.dtTrigger[1].unsubscribe();
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
/*
@ -272,7 +273,7 @@ export class ClaimsByTokenComponent {
this.activeCuratedPage.page = 1;
this.totalCuratedResults.count = 0;
this.claimsByTokenService.getClaims(this.openaireId, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.claimsByTokenService.getClaims(this.openaireId, this.properties.claimsAPIURL).subscribe(
data => {
//this.closeLoading();
this.accessStatus = "valid";
@ -347,7 +348,7 @@ export class ClaimsByTokenComponent {
this.accessStatus = "invalid";
//console.log(err);
}
);
));
} else {
this.accessStatus = "invalid";
}
@ -463,7 +464,7 @@ export class ClaimsByTokenComponent {
} else {
let claimCurationInfo: {"id": string, "approved": boolean} = {"id": claim.id, "approved": approved};
this.claimsByTokenService.updateClaimCuration(claimCurationInfo, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.claimsByTokenService.updateClaimCuration(claimCurationInfo, this.properties.claimsAPIURL).subscribe(
data => {
this.selectedRight_CuratedMode.delete(claim.id);
this.selectedWrong_CuratedMode.delete(claim.id);
@ -476,7 +477,7 @@ export class ClaimsByTokenComponent {
this.handleError("Error updating claim curation: "+JSON.stringify(claimCurationInfo), err);
this.curated_status = this.errorCodes.NOT_SAVED;
}
);
));
}
}
}
@ -488,7 +489,7 @@ export class ClaimsByTokenComponent {
this.pending_status = this.errorCodes.LOADING;
//this.openLoading();
//console.info("Changes Saved!, right-wrong", this.selectedRight_PendingMode, this.selectedWrong_PendingMode);
this.claimsByTokenService.updateClaimsCuration(this.selectedRight_PendingMode, this.selectedWrong_PendingMode, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.claimsByTokenService.updateClaimsCuration(this.selectedRight_PendingMode, this.selectedWrong_PendingMode, this.properties.claimsAPIURL).subscribe(
data => {
//this.closeLoading();
this.mode = "curated";
@ -501,7 +502,7 @@ export class ClaimsByTokenComponent {
this.handleError("Error updating claims: right: "+JSON.stringify(this.selectedRight_PendingMode)+" and wrong: "+JSON.stringify(this.selectedWrong_PendingMode), err);
this.pending_status = this.errorCodes.NOT_SAVED;
}
);
));
}
}

View File

@ -1,6 +1,5 @@
import {Injectable} from '@angular/core';
import {RequestOptions, Headers} from '@angular/http';
import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http";
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {throwError} from 'rxjs';

View File

@ -1,13 +1,12 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ClaimEntity, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {LinkingGenericComponent} from "../linking/linkingGeneric.component";
import {ClaimResultSearchFormComponent} from "../claim-utils/claimResultSearchForm.component";
import {Subscriber} from "rxjs";
@Component({
@ -31,21 +30,27 @@ export class DirectLinkingComponent {
validEntityTypes = ["dataset", "publication", "software", "orp", "project", "context"];
sources: ClaimEntity[] = [];
inlineEntity: ClaimEntity = null;
sub: any = null;
validInput: boolean = null;//'true;
properties: EnvProperties;
@Input() communityId: string = null;
localStoragePrefix: string = "";
constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService,
private _searchResearchResultsService: SearchResearchResultsService) {}
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
}));
this.sub = this.route.queryParams.subscribe(params => {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.id = params['id'];
this.type = params['type'];
this.showOptions.linkTo = params['linkTo'];
@ -104,7 +109,7 @@ export class DirectLinkingComponent {
}
});
}));
}
isValidInput(result: ClaimEntity) {
@ -122,7 +127,7 @@ export class DirectLinkingComponent {
}
getProjectById(id: string) {
this.sub = this.entitySearch.fetchByType(id,"project", this.properties).subscribe(
this.subscriptions.push(this.entitySearch.fetchByType(id,"project", this.properties).subscribe(
data => {
this.createClaimEntity(data, "project");
},
@ -130,18 +135,18 @@ export class DirectLinkingComponent {
this.validInput = this.isValidInput(null);
//console.log("An error occured")
this.handleError("Error getting project by id: " + id, err);
});
}));
}
getResearchResultById(resultType: string, id: string) {
this.sub = this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => {
this.subscriptions.push(this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => {
this.createClaimEntity(data, resultType);
},
err => {
this.validInput = this.isValidInput(null);
//console.log("An error occured")
this.handleError("Error getting "+this.getEntityName(resultType, false, true)+" by id: " + id, err);
});
}));
}
createClaimEntity(data, type: string) {

View File

@ -6,6 +6,7 @@ import {ModalLoading} from '../../../utils/modal/loading.component';
import {Dates, DOI} from '../../../utils/string-utils.class';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {ClaimEntity} from "../../claim-utils/claimHelper.class";
import {Subscriber} from "rxjs";
declare var UIkit: any;
@ -123,7 +124,14 @@ export class BulkClaimComponent {
ngOnInit() {
}
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
upload() {
this.enableUpload = false;
this.showReport = false;
@ -238,7 +246,7 @@ export class BulkClaimComponent {
}
fetchResult(id: string, accessMode: string, date: string, row: number) {
this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties, true).subscribe(
this.subscriptions.push(this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties, true).subscribe(
data => {
const result:ClaimEntity = data[1][0];
@ -264,11 +272,11 @@ export class BulkClaimComponent {
this.notFoundIdsRow.push(row);
this.endOfFetching();
}
);
));
}
searchInDatacite(id: string, accessMode: string, date: string, row: number) {
this._searchDataciteService.getDataciteResultByDOI(id, this.properties, true).subscribe(
this.subscriptions.push(this._searchDataciteService.getDataciteResultByDOI(id, this.properties, true).subscribe(
result => {
if (result) {
@ -293,7 +301,7 @@ export class BulkClaimComponent {
this.notFoundIdsRow.push(row);
this.endOfFetching();
}
);
));
}
endOfFetching() {

View File

@ -9,7 +9,7 @@ import {HelperModule} from '../../../utils/helper/helper.module';
@NgModule({
imports: [
SharedModule, LoadingModalModule, SearchCrossrefServiceModule, HelperModule
SharedModule, LoadingModalModule, SearchCrossrefServiceModule,SearchDataciteServiceModule, HelperModule
],
declarations: [
BulkClaimComponent

View File

@ -4,7 +4,6 @@ import {ClaimsService} from '../../claim-utils/service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert';
import {Md5} from 'ts-md5/dist/md5';
import {Session, User} from '../../../login/utils/helper.class';
import {LoginErrorCodes} from '../../../login/utils/guardHelper.class';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {
@ -15,6 +14,7 @@ import {
Message
} from "../../claim-utils/claimHelper.class";
import {UserManagementService} from "../../../services/user-management.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'claim-insert',
@ -55,12 +55,19 @@ export class ClaimInsertComponent {
constructor(private claimService: ClaimsService, private _router: Router, private route: ActivatedRoute,
private userManagementService: UserManagementService) {
}
ngOnInit() {
this.route.queryParams.subscribe(params => {
this.params = params;
subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
ngOnInit() {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.params = params;
}));
}
params = {};
@ -106,7 +113,7 @@ export class ClaimInsertComponent {
this.errorInClaims = [];
this.insertedRecords = [];
this.errorInRecords = [];
this.userManagementService.getUserInfo().subscribe(user => {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
if (!user) {
this.saveAndNavigate();
} else {
@ -178,7 +185,7 @@ export class ClaimInsertComponent {
// console.log("directclaims");
// console.log(directclaims);
if (directclaims.length > 0 && this.properties.environment != "development"){
this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe(
data => {
this.insertedRecords = data.insertedIds;
@ -200,19 +207,19 @@ export class ClaimInsertComponent {
ClaimInsertComponent.handleError("Error inserting direct records: " + JSON.stringify(directclaims), err);
}
);
));
} else {
this.isertBulkClaims(claims);
}
}
});
}));
}
private isertBulkClaims(claims: ClaimRecord2Insert[]) {
console.log("claims");
console.log(claims);
this.errors.splice(0, this.errors.length);
this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe(
data => {
this.insertedClaims = data.insertedIds;
this.errorInClaims = data.errorInClaims;
@ -265,7 +272,7 @@ export class ClaimInsertComponent {
ClaimInsertComponent.handleError("Error inserting bulk claims: " + JSON.stringify(claims), err);
}
);
));
}
createErrorMessagesPerEntity(applyToAll: boolean) {

View File

@ -9,6 +9,7 @@ import {AlertModal} from "../../utils/modal/alert";
import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {HelperService} from "../../utils/helper/helper.service";
import {PiwikService} from "../../utils/piwik/piwik.service";
import {Subscriber} from "rxjs";
declare var UIkit:any;
@ -36,7 +37,6 @@ export class LinkingGenericComponent {
// show linkToEntities /values: result, project, context
@Input() sources:ClaimEntity[] =[];
sub:any =null;
properties:EnvProperties;
@Input() localStoragePrefix:string = "linking_";
url=null;
@ -48,6 +48,8 @@ export class LinkingGenericComponent {
private _meta: Meta, private _title: Title, private _piwikService:PiwikService,
private seoService: SEOService, private helper: HelperService ) {
}
subscriptions = [];
ngOnInit() {
this.showOptions.show = 'source';
if(this.inlineEntity){
@ -55,7 +57,7 @@ export class LinkingGenericComponent {
this.showOptions.basketShowLinksTo = true;
this.showOptions.show = this.showOptions.linkTo;
}
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.url = this.properties.domain + this.properties.baseLink+this._router.url;
@ -68,14 +70,14 @@ export class LinkingGenericComponent {
this.seoService.createLinkForCanonicalURL(this.url, false);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe());
}
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
});
}));
if( typeof localStorage !== 'undefined') {
this.localStoragePrefix +=(this.communityId?this.communityId+"_":"");
if(localStorage.getItem(this.localStoragePrefix + "results")){
@ -89,9 +91,11 @@ export class LinkingGenericComponent {
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
openSelectionModal() {

View File

@ -5,7 +5,6 @@ import { SharedModule } from '../../shared/shared.module';
import {SelectedProjectsModule} from './selected/selectedProjects.module';
import {SelectedContextsModule} from './selected/selectedContexts.module';
import {SelectedPublicationsModule} from './selected/selectedResults.module';
import {InsertClaimsModule} from './insertClaim/insertClaim.module';
import {LinkingGenericComponent} from './linkingGeneric.component';
import {StartOverModule} from '../claim-utils/startOver.module';
import {LoginGuard} from'../../login/loginGuard.guard';

View File

@ -1,6 +1,5 @@
import {Component, Input} from '@angular/core';
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
import {StringUtils} from "../../../utils/string-utils.class";
@Component({
selector: 'claim-project-metadata',

View File

@ -1,6 +1,5 @@
import {Component, Input} from '@angular/core';
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
import {StringUtils} from "../../../utils/string-utils.class";
@Component({
selector: 'claim-result-metadata',
@ -51,10 +50,6 @@ export class ClaimEntityResultMetadataComponent {
return array.join("; ");
}
addStringToNumber(str: string, num: number) {
return (+str) + num;
}
getProjectDurationMessage(result: ClaimEntity) {
if(!result.warningMessages){
return null;
@ -67,13 +62,5 @@ export class ClaimEntityResultMetadataComponent {
return null;
}
// getEmbargoEndDateMessage(result: ClaimEntity) {
// for (var message of result.warningMessages) {
// if (message.type == "embargoEndDate") {
// return "Embargo end date must be later than published date";
// }
// }
// return null;
// }
}

View File

@ -63,28 +63,4 @@ export class ClaimEntityTitleComponent {
return mystr;
}
addStringToNumber(str: string, num: number) {
return (+str) + num;
}
getProjectDurationMessage(result: ClaimEntity) {
for (let message of result.warningMessages) {
if (message.type == "projectDuration") {
return "Should be from " + message.projectInfo.startDate + ((message.projectInfo.endDate) ? (" to " + ((5 + +message.projectInfo.endDate))) : "");
}
}
return null;
}
getEmbargoEndDateMessage(result: ClaimEntity) {
for (var message of result.warningMessages) {
if (message.type == "embargoEndDate") {
return "Embargo end date must be later than published date";
}
}
return null;
}
}

View File

@ -50,7 +50,6 @@ export class ClaimSelectedContextsComponent {
//The following need to be kept in case we have to save the current state
@Input() public projects;
@Input() public results;
// @Input() public inlineEntity;
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
@Input() show='home';
@Input() title='Communities';
@ -65,16 +64,6 @@ export class ClaimSelectedContextsComponent {
todayDate = '';
nextDate = '';
showType(type){
if(type != this.show){
this.show = type;
this.showChange.emit({
value: this.show
});
}
}
removeContext(item:any){
var index:number =this.contexts.indexOf(item);
if (index > -1) {
@ -85,8 +74,5 @@ export class ClaimSelectedContextsComponent {
}
}
contextSelected($event) {
// this.showsearch = false;
}
}

View File

@ -2,12 +2,10 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedContextsComponent} from './selectedContexts.component';
// import {ClaimContextSearchFormModule} from '../../claim-utils/claimContextSearchForm.module';
@NgModule({
imports: [
SharedModule,
// ClaimContextSearchFormModule
SharedModule
],
declarations: [
ClaimSelectedContextsComponent

View File

@ -72,19 +72,4 @@ export class ClaimSelectedProjectsComponent {
value: this.projects
});
}
showType(type) {
if (type != this.show) {
this.show = type;
this.showChange.emit({
value: this.show
});
}
}
projectSelected($event) {
// this.showsearch = false;
}
}

View File

@ -4,12 +4,10 @@ import { RouterModule } from '@angular/router';
import { SharedModule } from '../../../shared/shared.module';
import {ClaimSelectedProjectsComponent} from './selectedProjects.component';
// import {ClaimProjectsSearchFormModule} from '../../claim-utils/claimProjectSearchForm.module';
@NgModule({
imports: [
SharedModule, RouterModule,
// ClaimProjectsSearchFormModule
],
declarations: [
ClaimSelectedProjectsComponent

View File

@ -27,10 +27,4 @@ export class ClaimSelectedResultsComponent {
}
sliceString(mystr, size: number): string {
const sliced = String(mystr).substr(0, size);
return sliced + (String(mystr).length > size ? '...' : '');
}
}

View File

@ -1,9 +1,9 @@
import {Component, Input} from '@angular/core';
import {Meta, Title} from '@angular/platform-browser';
import {User} from "../../login/utils/helper.class";
import {UserManagementService} from "../../services/user-management.service";
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
import {Router} from "@angular/router";
import {Subscriber} from "rxjs";
@Component({
selector: 'my-claims',
@ -42,8 +42,14 @@ export class MyClaimsComponent {
constructor(private userManagementService: UserManagementService, private _router: Router) {}
sub;
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.userManagementService.getUserInfo().subscribe(user => {
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if (!user) {
this._router.navigate(['/user-info'], {

View File

@ -1,4 +1,4 @@
import {map, filter, mergeMap} from 'rxjs/operators';
import {map, filter, mergeMap, take} from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {
Router,
@ -30,7 +30,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanLoad {
check(community: string, path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_LOGIN;
let email = null;
const authorized = this.userManagementService.getUserInfo(false).pipe(map(user => {
const authorized = this.userManagementService.getUserInfo(false).pipe(take(1),map(user => {
if (user) {
email = user.email;
if (Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager('community', community, user)) {
@ -38,7 +38,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanLoad {
} else {
errorCode = LoginErrorCodes.NOT_ADMIN;
return this.communityService.isCommunityManagerByState(properties, properties['communityAPI'] + community,
email);
email).pipe(take(1));
}
} else {
return of(false);

View File

@ -1,22 +1,18 @@
import {filter, map, mergeMap} from 'rxjs/operators';
import { Injectable } from '@angular/core';
import {take, tap} from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {
Router,
CanActivate,
ActivatedRouteSnapshot,
RouterStateSnapshot,
CanLoad,
Route
} from '@angular/router';
import {Observable, Subscription} from 'rxjs';
import {CommunityService} from '../community/community.service';
import { EnvironmentSpecificService} from '../../utils/properties/environment-specific.service';
import {ConnectHelper} from '../connectHelper';
import {properties} from "../../../../environments/environment";
@Injectable()
export class ConnectCommunityGuard implements CanActivate {
export class ConnectCommunityGuard implements CanActivate {
sub: Subscription = null;
constructor(private router: Router,
@ -24,11 +20,10 @@ export class ConnectCommunityGuard implements CanActivate {
}
check(community: string): Observable<boolean> | boolean {
return this.communityService.isCommunityTypeByState(properties, properties['communityAPI'] + community).pipe(map(isCommunity => {
if(!isCommunity) {
return this.communityService.isCommunityTypeByState(properties, properties['communityAPI'] + community).pipe(take(1), tap(isCommunity => {
if (!isCommunity) {
this.router.navigate(['errorcommunity']);
}
return isCommunity;
}));
}

View File

@ -1,5 +1,4 @@
import {filter, mergeMap} from 'rxjs/operators';
import {tap} from 'rxjs/operators';
import { Injectable } from '@angular/core';
import {
Router,
@ -25,13 +24,12 @@ export class ConnectRIGuard implements CanActivate, CanLoad {
}
check(community: string): Observable<boolean> | boolean {
const obs = this.communityService.isRITypeByState(properties, properties['communityAPI'] + community);
this.sub = obs.pipe(filter(enabled => !enabled))
.subscribe(() => this.router.navigate(['errorcommunity']));
return obs;
return this.communityService.isRITypeByState(properties, properties['communityAPI'] + community).pipe(tap(authorized => {
if (!authorized) {
this.router.navigate(['errorcommunity']);
}
}));
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(route.queryParams['communityId']);
}

View File

@ -1,11 +1,10 @@
import {filter, map, mergeMap} from 'rxjs/operators';
import {filter, map, mergeMap, take, tap} from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router';
import {Observable, of} from 'rxjs';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {CommunityService} from '../community/community.service';
import {EnvironmentSpecificService} from '../../utils/properties/environment-specific.service';
import {ConnectHelper} from '../connectHelper';
import {UserManagementService} from "../../services/user-management.service";
import {SubscribeService} from "../../utils/subscribe/subscribe.service";
@ -16,14 +15,13 @@ export class ConnectSubscriberGuard implements CanActivate {
constructor(private router: Router,
private communityService: CommunityService,
private subscribeService: SubscribeService,
private userManagementService: UserManagementService,
private propertiesService: EnvironmentSpecificService) {
private userManagementService: UserManagementService) {
}
check(community: string, path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_LOGIN;
let email = null;
const subscribed = this.userManagementService.getUserInfo(false).pipe(map(user => {
const subscribed = this.userManagementService.getUserInfo(false).pipe(take(1),map(user => {
if (user) {
errorCode = LoginErrorCodes.NOT_SUBSCRIBER;
email = user.email;
@ -34,7 +32,7 @@ export class ConnectSubscriberGuard implements CanActivate {
if (Session.isSubscribedTo('community', community, user)) {
return of(true);
}
return this.subscribeService.isSubscribedToCommunity(properties, community)
return this.subscribeService.isSubscribedToCommunity(properties, community).pipe(take(1));
} else {
return of(false);
}

View File

@ -8,6 +8,8 @@ import {RouterHelper} from "../utils/routerHelper.class";
import {SEOService} from "../sharedComponents/SEO/SEO.service";
import {Meta, Title} from "@angular/platform-browser";
import {Breadcrumb} from "../utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
selector: 'deposit-first-page',
@ -212,7 +214,6 @@ export class DepositFirstPageComponent {
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@Input() piwikSiteId = null;
piwiksub:any;
@Input() communityId = null;
@ -226,6 +227,7 @@ export class DepositFirstPageComponent {
public routerHelper:RouterHelper = new RouterHelper();
@Input() showBreadcrumb:boolean = false;
breadcrumbs:Breadcrumb[] = [];
subscriptions = [];
constructor (private route: ActivatedRoute, private _piwikService:PiwikService,
private helper: HelperService,
private _router: Router,
@ -235,9 +237,7 @@ export class DepositFirstPageComponent {
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.properties = properties;
this.url = this.properties.domain+this.properties.baseLink + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url, false);
@ -260,28 +260,29 @@ export class DepositFirstPageComponent {
}
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
}
this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: null});
});
}
public getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}));
}
public getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}));
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private updateDescription(description:string) {

View File

@ -126,7 +126,7 @@ export class SearchDataprovidersToDepositComponent {
// this.searchPage.keywordFields = this.keywordFields;
// var firstLoad =true;
//
// this.sub = this.route.queryParams.subscribe(params => {
// this.subscriptions = this.route.queryParams.subscribe(params => {
// this.loadPaging = true;
// if(params['page'] && this.searchUtils.page != params['page']) {
// this.loadPaging = false;

View File

@ -9,8 +9,6 @@ import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.mod
import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module';
// import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module';
import {FreeGuard} from'../login/freeGuard.guard';
import {IsRouteEnabled} from '../error/isRouteEnabled.guard';
import {SearchDataProvidersModule} from "../searchPages/searchDataProviders.module";
import {BreadcrumbsModule} from "../utils/breadcrumbs/breadcrumbs.module";
@ -26,7 +24,7 @@ import {BreadcrumbsModule} from "../utils/breadcrumbs/breadcrumbs.module";
declarations: [
SearchDataprovidersToDepositComponent
],
providers:[FreeGuard, IsRouteEnabled],
providers:[ IsRouteEnabled],
exports: [
SearchDataprovidersToDepositComponent
]

View File

@ -6,6 +6,7 @@ import {EnvProperties} from '../utils/properties/env-properties';
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
import {ActivatedRoute} from "@angular/router";
import {ResultPreview} from "../utils/result-preview/result-preview";
import {Subscriber} from "rxjs";
@Component({
selector: 'deposit-result',
@ -26,9 +27,13 @@ export class SearchResultsInDepositComponent {
public errorMessage: string = "No results found";
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
sub;
constructor (private route: ActivatedRoute) {}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
ngOnInit() {
if(this.type == "publication") {
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedPublications;
@ -53,7 +58,7 @@ export class SearchResultsInDepositComponent {
this.urlParam = "datasourceId";
}
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;

View File

@ -1,9 +1,8 @@
import {Component, Inject, Input, Optional} from '@angular/core';
import {Component, Inject, Optional} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {RESPONSE} from "@nguniversal/express-engine/tokens";
import {EnvProperties} from "../utils/properties/env-properties";
import {SEOService} from "../sharedComponents/SEO/SEO.service";
import {properties} from "../../../environments/environment";

View File

@ -1,32 +1,24 @@
import {of as observableOf, Observable, Subject, Subscription} from 'rxjs';
import {map, filter, mergeMap, tap} from 'rxjs/operators';
import {Observable, Subscription} from 'rxjs';
import {tap, take} from 'rxjs/operators';
import { Injectable } from '@angular/core';
import {
Router,
CanActivate,
CanLoad,
ActivatedRouteSnapshot,
RouterStateSnapshot,
Route, Data
Data
} from '@angular/router';
import { ConfigurationService } from '../utils/configuration/configuration.service';
import { EnvironmentSpecificService} from '../utils/properties/environment-specific.service';
import {ConnectHelper} from '../connect/connectHelper';
import {properties} from "../../../environments/environment";
import {LoginErrorCodes} from "../login/utils/guardHelper.class";
import {of} from 'rxjs';
import {Page} from "../utils/entities/adminTool/page";
@Injectable()
export class IsRouteEnabled implements CanActivate {
sub: Subscription = null;
constructor(private router: Router,
private config: ConfigurationService,
private propertiesService: EnvironmentSpecificService) {}
private config: ConfigurationService) {}
// check(data: Data, community: string, path: string): Observable<boolean> | boolean {
// const customRedirect = data['redirect'];
@ -72,27 +64,16 @@ export class IsRouteEnabled implements CanActivate {
community = properties.adminToolsCommunity;
}
const obs =
//this.config.isPageEnabled(properties, community, '/' + path);
this.config.isPageEnabledByState(properties, community, '/'+path);
this.sub = obs
//.pipe(tap((enabled) => console.log("aaa: "+enabled)))
.pipe(filter(enabled => !enabled))
.subscribe(() => {
this.router.navigate([redirect], {queryParams: {'page': path}});
});
return this.config.isPageEnabledByState(properties, community, '/'+path).pipe(take(1),tap((enabled) => {
if(!enabled){
this.router.navigate([redirect], {queryParams: {'page': path}});
}
}));
return obs;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(route.data, route.queryParams['communityId'], state.url);
}
canDeactivate() {
if(this.sub) {
this.sub.unsubscribe();
}
return true;
}
}

View File

@ -159,13 +159,13 @@ export class AnnotationComponent implements OnInit, OnDestroy {
if(!this.annotations || this.annotations.length === 0) {
this.loading = true;
}
this.annotationService.getAllAnnotations(this.properties, this.pid).subscribe(annotations => {
this.subscriptions.push(this.annotationService.getAllAnnotations(this.properties, this.pid).subscribe(annotations => {
this.annotations = annotations;
this.annotations.forEach(annotation => {
annotation.urlSize = 3;
});
this.loading = false;
});
}));
}
ngOnDestroy(): void {

View File

@ -3,8 +3,6 @@ import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {EnvProperties} from "../../utils/properties/env-properties";
import {map} from "rxjs/operators";
import {response} from "express";
import {el} from "@angular/platform-browser/testing/src/browser_util";
export interface Annotation {
text: string;

View File

@ -1,4 +1,3 @@
import {merge as observableMerge} from 'rxjs';
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
@ -26,6 +25,7 @@ import {SearchResult} from "../../utils/entities/searchResult";
import {ResultPreview} from "../../utils/result-preview/result-preview";
import {IndexInfoService} from "../../utils/indexInfo.service";
import {properties} from "../../../../environments/environment";
import {Subscriber} from "rxjs";
@Component({
@ -43,11 +43,7 @@ export class DataProviderComponent {
public warningMessage = "";
public errorMessage = "";
public showLoading: boolean = true;
// Variable to specify requests with either collectedFrom or hostedBy
public paramsForSearchLink = {};
public resultParamsForSearchLink = {};
// Metrics tab variables
public metricsClicked: boolean;
public viewsFrameUrl: string;
@ -58,11 +54,6 @@ export class DataProviderComponent {
// Statistics tab variables
public statsClicked: boolean = false;
public docsTimelineUrl: string;
public docsTypesUrl: string;
public docsFunderUrl: string;
public dataProjectsUrl: string;
public pubsProjectsUrl: string;
@ViewChild('statisticsModal') statisticsModal;
@ViewChild('relatedDatasourcesModal') relatedDatasourcesModal;
@ -74,10 +65,6 @@ export class DataProviderComponent {
public fetchOrps: FetchResearchResults;
public fetchProjects: FetchProjects;
public fetchDataproviders: FetchDataproviders;
public fetchAggregatorsPublications: FetchResearchResults;
public fetchAggregatorsDatasets: FetchResearchResults;
public fetchAggregatorsSoftware: FetchResearchResults;
public fetchAggregatorsOrps: FetchResearchResults;
public fetchAggregatorsResults: FetchResearchResults;
public searchNumber: number = 5;
@ -89,7 +76,6 @@ export class DataProviderComponent {
public activeTab: string = "";
public showTabs: boolean = false;
public firstTab: string = "";
public _numberOfTabs: number = 0;
public tabsAreInitialized: boolean = false;
@ -123,10 +109,7 @@ export class DataProviderComponent {
public showFeedback: boolean = false;
public feedbackFields: string [] = ['Name', 'Organizations', 'Country', 'Other'];
sub: any;
piwiksub: any;
subInfo: any;
relatedDatasourcesSub: any;
subscriptions = [];
properties: EnvProperties = properties;
constructor(private _dataproviderService: DataProviderService,
@ -153,16 +136,16 @@ export class DataProviderComponent {
ngOnInit() {
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}
});
}));
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
this.sub = this.route.queryParams.subscribe(data => {
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.updateTitle("Content provider");
this.updateDescription("");
this.datasourceId = data['datasourceId'];
@ -180,7 +163,7 @@ export class DataProviderComponent {
}
HelperFunctions.scroll();
});
}));
}
public initializeValues() {
@ -205,31 +188,29 @@ export class DataProviderComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
})
}));
}
private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
})
}));
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
}
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
if (this.subInfo) {
this.subInfo.unsubscribe();
}
if (this.relatedDatasourcesSub) {
this.relatedDatasourcesSub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.fetchDatasets.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
this.fetchSoftware.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
this.fetchDataproviders.clearSubscriptions();
this.fetchProjects.clearSubscriptions();
}
private getDataProviderInfo(id: string) {
@ -244,7 +225,7 @@ export class DataProviderComponent {
this.showLoading = false;
this.warningMessage = "No valid datasource id";
} else {
this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
this.subscriptions.push(this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
data => {
this.dataProviderInfo = data;
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
@ -260,7 +241,7 @@ export class DataProviderComponent {
this.updateTitle(this.dataProviderInfo.title.name);
this.updateDescription("Content provider, " + this.dataProviderInfo.title.name);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe());
}
this.showLoading = false;
@ -284,12 +265,12 @@ export class DataProviderComponent {
this.showLoading = false;
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToDataProviders);
}
);
));
}
}
private getDataProviderAggregationStatus(originalId: string) {
this.subInfo = this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe(
this.subscriptions.push(this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe(
data => {
this.dataProviderInfo.aggregationStatus = data;
},
@ -300,7 +281,7 @@ export class DataProviderComponent {
() => {
this.aggregationStatusIsInitialized = true;
}
);
));
}
private updateDescription(description: string) {
@ -340,49 +321,13 @@ export class DataProviderComponent {
this.metricsClicked = false;
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"' + this.datasourceId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
/*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
*/
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"' + this.datasourceId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
/*
this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
*/
//if({"name": "Publications", "content": "publicationsTab"} in this.dataProviderInfo.tabs) {
//if(this.dataProviderInfo.tabs.some(function (tab) {
// return tab.name === 'Publications';
//})) {
// this.relatedDataprovidersResultsType = 'publications';
// this.fetchAggregatorsPublications = new FetchResearchResults(this._searchResearchResultsService);
// //} else {
// // this.relatedDataprovidersResultsType = 'datasets';
// this.fetchAggregatorsDatasets = new FetchResearchResults(this._searchResearchResultsService);
// //}
// this.fetchAggregatorsSoftware = new FetchResearchResults(this._searchResearchResultsService);
// this.fetchAggregatorsOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchAggregatorsResults = new FetchResearchResults(this._searchResearchResultsService);
//}
// if (this.dataProviderInfo.resultsBy == "collectedFrom") {
// //this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and";
// this.paramsForSearchLink = this.routerHelper.createQueryParams(['f0', 'fv0'], ["collectedfromdatasourceid", this.datasourceId]);
// this.resultParamsForSearchLink = this.routerHelper.createQueryParams(['collectedFrom', 'cl', 'qf'], [this.datasourceId, 'and', 'false']);
// } else if (this.dataProviderInfo.resultsBy == "hostedBy") {
// //this.paramsForSearchLink = "?hostedBy="+this.datasourceId+"&ho=and";
// this.paramsForSearchLink = this.routerHelper.createQueryParams(['f0', 'fv0'], ["resulthostingdatasourceid", this.datasourceId]);
// this.resultParamsForSearchLink = this.routerHelper.createQueryParams(['hostedBy', 'hs', 'qf'], [this.datasourceId, 'and', 'false']);
// }
}
public getParamsForSearchLink(type: string = "") {
let resultsBy: string = "";
// if(this.dataProviderInfo.resultsBy == "collectedFrom") {
// resultsBy = "collectedfromdatasourceid"
// } else if (this.dataProviderInfo.resultsBy == "hostedBy") {
// resultsBy = "resulthostingdatasourceid";
// }
if (type) {
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1', 'type', 'qf', 'sortBy'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId, type, "false", 'resultdateofacceptance,descending']);
} else {
@ -391,25 +336,14 @@ export class DataProviderComponent {
}
private count(page: number, size: number) {
//for (let i = 0; i < this.dataProviderInfo.tabs.length; i++) {
//let content: string = this.dataProviderInfo.tabs[i].content;
//if (content == 'publicationsTab') {
this.countPublications(page, size);
//} else if (content == 'datasetsTab') {
this.countDatasets(page, size);
//} else if (content == 'softwareTab') {
this.countSoftware(page, size);
//} else if (content == 'orpsTab') {
this.countOrps(page, size);
//} else if (content == 'projectsTab') {
this.countProjects(page, size);
//} else if (content == 'datasourcesTab') {
this.countDatasources(page, size);
//}// else if(content=='relatedDatasourcesTab') {
// this.countRelatedDatasources(page, size);
//}
//}
}
public search(content: string, page: number, size: number) {
@ -560,7 +494,7 @@ export class DataProviderComponent {
(this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.DONE && this.fetchAggregatorsResults.searchUtils.totalResults > 0)
)
) {
this.relatedDatasourcesSub = this.fetchAggregatorsResults.requestComplete.subscribe(
this.subscriptions.push(this.fetchAggregatorsResults.requestComplete.subscribe(
data => {
},
err => {
@ -570,7 +504,7 @@ export class DataProviderComponent {
this.dataProviderInfo.relatedDatasources = this.fetchAggregatorsResults.results;
this.loadingRelatedDatasources = false;
}
);
));
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties);
} else {
@ -582,79 +516,9 @@ export class DataProviderComponent {
}
private countRelatedDatasources(page: number, size: number) {
// this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties);
// this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties);
// this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties);
// this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties);
}
// private preprocessRelatedDatasources() {
// if (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE ||
// this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ||
// this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE ||
// this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE) {
// this.dataProviderInfo.relatedDatasources = new Map<string, { "name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string }>();
// }
// for (let result of this.fetchAggregatorsPublications.results) {
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) {
// this.dataProviderInfo.relatedDatasources.set(result.id, {
// "name": result.name,
// "countPublications": result.count,
// "countDatasets": "0",
// "countSoftware": "0",
// "countOrps": "0"
// });
// } else {
// this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count) + "";
// }
// }
//
// for (let result of this.fetchAggregatorsDatasets.results) {
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) {
// this.dataProviderInfo.relatedDatasources.set(result.id, {
// "name": result.name,
// "countPublications": "0",
// "countDatasets": result.count,
// "countSoftware": "0",
// "countOrps": "0"
// });
// } else {
// this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count) + "";
// }
// }
//
// for (let result of this.fetchAggregatorsSoftware.results) {
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) {
// this.dataProviderInfo.relatedDatasources.set(result.id, {
// "name": result.name,
// "countPublications": "0",
// "countDatasets": "0",
// "countSoftware": result.count,
// "countOrps": "0"
// });
// } else {
// this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count) + "";
// }
// }
//
// for (let result of this.fetchAggregatorsOrps.results) {
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) {
// this.dataProviderInfo.relatedDatasources.set(result.id, {
// "name": result.name,
// "countPublications": "0",
// "countDatasets": "0",
// "countSoftware": "0",
// "countOrps": result.count
// });
// } else {
// this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count) + "";
// }
// }
// this.loadingRelatedDatasources = false;
// }
public metricsResults($event) {
this.totalViews = $event.totalViews;
this.totalDownloads = $event.totalDownloads;
@ -776,74 +640,5 @@ export class DataProviderComponent {
|| !!this.dataProviderInfo.oaiPmhURL || !!this.dataProviderInfo.openDoarId || !!this.dataProviderInfo.r3DataId
);
}
// public numberOfTabs(): number {
// if(this.tabsAreInitialized) {
// return this._numberOfTabs;
// }
//
// // if(!this.dataProviderInfo || !this.aggregationStatusIsInitialized
// // || this.fetchProjects.searchUtils.status == this.errorCodes.LOADING
// // || this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING
// // || this.fetchPublications.searchUtils.status == this.errorCodes.LOADING
// // || this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING
// // || this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING
// // || this.fetchOrps.searchUtils.status == this.errorCodes.LOADING) {
// // return 0;
// // }
//
// if(this.dataProviderInfo
// && this.fetchProjects.searchUtils.status != this.errorCodes.LOADING
// && this.fetchDataproviders.searchUtils.status != this.errorCodes.LOADING
// && this.fetchPublications.searchUtils.status != this.errorCodes.LOADING
// && this.fetchDatasets.searchUtils.status != this.errorCodes.LOADING
// && this.fetchSoftware.searchUtils.status != this.errorCodes.LOADING
// && this.fetchOrps.searchUtils.status != this.errorCodes.LOADING) {
// this.tabsAreInitialized = true;
// }
//
// this._numberOfTabs = 0;
// //if (this.hasPrimaryInfo || this.hasSecondaryInfo) {
// this.firstTab = "summary";
// this._numberOfTabs++;
// //}
// if(this.fetchProjects.searchUtils.totalResults > 0) {
// /*if( this._numberOfTabs == 0) {
// this.firstTab = "projects";
// this.searchProjects(1, this.searchNumber);
// }*/
// this._numberOfTabs++;
// }
// if(this.fetchDataproviders.searchUtils.totalResults > 0) {
// /*if( this._numberOfTabs == 0) {
// this.firstTab = "datasources";
// this.searchDatasources(1, this.searchNumber);
// }*/
// this._numberOfTabs++;
// }
// if(this.fetchPublications.searchUtils.totalResults > 0 || this.fetchDatasets.searchUtils.totalResults > 0
// || this.fetchSoftware.searchUtils.totalResults > 0 || this.fetchOrps.searchUtils.totalResults > 0) {
// /*if( this._numberOfTabs == 0) {
// this.firstTab = "relatedDatasources";
// this.searchRelatedDatasources(1, this.searchNumber);
// }*/
// this._numberOfTabs += 2;
//
// if(this.fetchPublications.searchUtils.totalResults > 0) {
// this._numberOfTabs++;
// }
// if(this.fetchDatasets.searchUtils.totalResults > 0) {
// this._numberOfTabs++;
// }
// if(this.fetchSoftware.searchUtils.totalResults > 0) {
// this._numberOfTabs++;
// }
// if(this.fetchOrps.searchUtils.totalResults > 0) {
// this._numberOfTabs++;
// }
// }
// //this.activeTab = this.firstTab;
// //this.tabsAreInitialized = true;
// return this._numberOfTabs;
// }
}

View File

@ -5,7 +5,6 @@ import { RouterModule } from '@angular/router';
import {IFrameModule} from '../../utils/iframe.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
// import { ResultLandingModule } from '../resultLanding.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {MetricsModule} from '../landing-utils/metrics/metrics.module';
import {LandingModule} from '../landing-utils/landing.module';
@ -27,8 +26,6 @@ import {DataProvidersServiceModule} from '../../services/dataProvidersService.mo
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {ShowPublisherModule} from "../landing-utils/showPublisher.module";
@ -54,7 +51,7 @@ import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module";
RelatedDatasourcesTabComponent, DataProviderComponent, SoftwareTabComponent, OrpsTabComponent
],
providers:[
DataProviderService, FreeGuard, IsRouteEnabled],
DataProviderService],
exports: [
DataProviderComponent
]

View File

@ -1,11 +1,7 @@
import {Injectable} from '@angular/core';
import {Http, Response,Headers, RequestOptions} from '@angular/http';
import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http";
import {Observable, throwError} from 'rxjs';
import {throwError} from 'rxjs';
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
import{EnvProperties} from '../../utils/properties/env-properties';
import {map} from "rxjs/operators";

View File

@ -36,6 +36,4 @@ export class OrpsTabComponent {
ngOnInit() {
this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps;
}
ngOnDestroy() {}
}

View File

@ -37,5 +37,4 @@ export class SoftwareTabComponent {
this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware;
}
ngOnDestroy() {}
}

View File

@ -4,6 +4,7 @@ import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResear
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from "../../utils/string-utils.class";
import {Subscriber} from "rxjs";
@Component({
selector: 'statisticsTab',
@ -67,10 +68,11 @@ export class StatisticsTabComponent {
private pubsProjectsUrl:string;
public errorCodes:ErrorCodes = new ErrorCodes();
properties:EnvProperties;
sub;
constructor (private route: ActivatedRoute) {}
ngOnInit() {
this.route.data
this.sub = this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
@ -95,5 +97,8 @@ export class StatisticsTabComponent {
});
}
ngOnDestroy() {}
}
ngOnDestroy() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}}

View File

@ -19,6 +19,7 @@ import {ProjectInfo} from "../../utils/entities/projectInfo";
import {DataProviderInfo} from "../../utils/entities/dataProviderInfo";
import {EmailService} from "../../utils/email/email.service";
import {Composer} from "../../utils/email/composer";
import {Subscriber} from "rxjs";
@Component({
selector: 'feedback',
@ -44,11 +45,17 @@ export class FeedbackComponent implements OnInit, OnChanges {
public form: FormGroup;
public url: string = null;
public recipients: string[] = [];
subscriptions =[];
constructor(private fb: FormBuilder,
private emailService: EmailService) {
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
ngOnInit(): void {
if(typeof window !== "undefined") {
this.url = window.location.href;
@ -117,17 +124,17 @@ export class FeedbackComponent implements OnInit, OnChanges {
public sendReport() {
this.sending = true;
this.emailService.contact(this.properties,
this.subscriptions.push(this.emailService.contact(this.properties,
Composer.composeEmailForFeedback(this.form.value, this.recipients), this.form.get('recaptcha').value).subscribe(sent => {
this.error = !sent;
if(sent) {
if(this.form.get('email').value !== '') {
this.emailService.contact(this.properties,
this.subscriptions.push(this.emailService.contact(this.properties,
Composer.composeEmailForUserAfterFeedback([this.form.get('email').value])).subscribe(sent => {
if(sent) {
//console.log('An email has been sent to user ' + this.form.get('email').value);
}
})
}));
}
this.init();
this.sent = true;
@ -137,6 +144,6 @@ export class FeedbackComponent implements OnInit, OnChanges {
console.log(error);
this.error = true;
this.sending = false;
});
}));
}
}
}

View File

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

View File

@ -9,6 +9,7 @@ import {ProjectService} from '../project/project.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
import {HelperService} from "../../utils/helper/helper.service";
import {Subscriber} from "rxjs";
declare var UIkit: any;
@ -62,10 +63,7 @@ export class HtmlProjectReportComponent {
public header2: string = "";
public htmlResult: string = "";
public sub: any;
piwiksub: any;
public subHTML: any;
public subHTMLInfo: any;
subscriptions = [];
public warningMessage: string = "";
public errorMessage: string = "";
@ -86,7 +84,7 @@ export class HtmlProjectReportComponent {
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
//this.getDivContents();
@ -94,8 +92,8 @@ export class HtmlProjectReportComponent {
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url);
});
this.sub = this.route.queryParams.subscribe(params => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.projectId = params['projectId'];
if (params['size'] == parseInt(params['size'], 10)) {
@ -136,40 +134,35 @@ export class HtmlProjectReportComponent {
this.warningMessage = "No valid project id";
}
}
});
}));
}
private getPageContents() {
if(this.communityId) {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}));
}
}
private getDivContents() {
if(this.communityId) {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}));
}
}
ngOnDestroy() {
this.sub.unsubscribe();
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
if (this.subHTML) {
this.subHTML.unsubscribe();
}
if (this.subHTMLInfo) {
this.subHTMLInfo.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
private createHeaders() {
this.subHTMLInfo = this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe(
this.subscriptions.push(this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe(
data => {
this.createHeader1(data);
if (data.acronym) {
@ -178,7 +171,7 @@ export class HtmlProjectReportComponent {
this.updateTitle(data.title + " " + this.resultsType + " report");
}
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report", this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report", this.piwikSiteId).subscribe());
}
},
err => {
@ -186,7 +179,7 @@ export class HtmlProjectReportComponent {
//console.log(err);
this.createClipboard();
}
);
));
if (this.resultsType == "publication") {
this.header2 += this.totalResults.toLocaleString('en-US') + " publications";
@ -207,7 +200,7 @@ export class HtmlProjectReportComponent {
intro += '</head>';
if (typeof window !== 'undefined') {
this.subHTML = this.htmlService.getHTML(this.projectId, this.resultsType, this.properties.csvAPIURL).subscribe(
this.subscriptions.push(this.htmlService.getHTML(this.projectId, this.resultsType, this.properties.csvAPIURL).subscribe(
data => {
//let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>';
let body: string = intro + '<body><h1>' + this.header1 + '</h1><h2>' + this.header2 + '</h2>';
@ -238,7 +231,7 @@ export class HtmlProjectReportComponent {
this.errorMessage = 'Service not available';
this.showLoading = false;
}
);
));
}
}

View File

@ -7,8 +7,6 @@ import { ProjectServiceModule} from '../project/projectService.module';
import {HtmlProjectReportService} from './htmlProjectReport.service';
import {HtmlProjectReportComponent} from './htmlProjectReport.component';
// import { HtmlProjectReportRoutingModule } from './htmlProjectReport-routing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {HelperModule} from "../../utils/helper/helper.module";
@ -23,7 +21,7 @@ import {RouterModule} from '@angular/router';
HtmlProjectReportComponent
],
providers:[
HtmlProjectReportService, FreeGuard
HtmlProjectReportService
],
exports: [
HtmlProjectReportComponent

View File

@ -21,12 +21,16 @@ declare var addthis: addthis;
`
})
export class AddThisComponent implements OnInit {
sub;
constructor(private route: ActivatedRoute, @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {}
ngOnDestroy() {
if(this.sub) {
this.sub.unsubscribe();
}
}
ngOnInit() {
this.route.queryParams.subscribe(data => {
this.sub = this.route.queryParams.subscribe(data => {
try {
if (!this.document.getElementById('addThisScript') && typeof document !== 'undefined') {
// console.log(" create script AddThis");

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
import {
Component,
ElementRef,
Inject,
Input,
OnDestroy,
@ -8,7 +7,6 @@ import {
RendererFactory2,
ViewEncapsulation
} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Citation, CitationData} from './citation.class';
import {ResultLandingInfo} from "../../../utils/entities/resultLandingInfo";
import {DOCUMENT} from "@angular/common";
@ -55,6 +53,7 @@ export class CiteThisComponent implements OnInit, OnDestroy {
public citeproc;
public data;
public clipboard;
timeout;
constructor( @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2){
@ -78,7 +77,7 @@ export class CiteThisComponent implements OnInit, OnDestroy {
renderer.setAttribute(script, "type", "text/javascript");
renderer.appendChild(head, script);
}
setTimeout(() => {
this.timeout = setTimeout(() => {
this.parseData();
this.selectedStyle = this.citation.templates[0];
this.updateCitation();
@ -92,6 +91,7 @@ export class CiteThisComponent implements OnInit, OnDestroy {
ngOnDestroy() {
delete this.clipboard;
clearTimeout(this.timeout);
}
private createClipboard() {

View File

@ -8,8 +8,6 @@ import {ErrorCodes} from '../../utils/properties/errorCodes';
import {StringUtils} from '../../utils/string-utils.class';
import {RouterHelper} from '../../utils/routerHelper.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ResultPreview} from "../../utils/result-preview/result-preview";
import {SearchResult} from "../../utils/entities/searchResult";
import {AlertModal} from "../../utils/modal/alert";
@Component({

View File

@ -4,8 +4,6 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {PagingModule} from '../../utils/paging.module';
//import {ShowAuthorsComponent} from './showAuthors.component';
import {ShowIdentifiersComponent} from './showIdentifiers.component';
import {ShowSubjectsComponent} from './showSubjects.component';
import {FundedByComponent} from './fundedBy.component';

View File

@ -44,18 +44,6 @@ export class ShowTitleComponent {
@Input() iconClass:string;
@Input() classNames: string = "";
sub: any;
constructor () {}
constructor (private route: ActivatedRoute) {}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(
params => {
}
);
}
ngOnDestroy() {
this.sub.unsubscribe();
}
}

View File

@ -1,6 +1,5 @@
import {Component, Input} from '@angular/core';
import {RouterHelper} from '../../utils/routerHelper.class';
//import {PagingModule} from '../utils/paging.module';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {ElementRef, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
@ -8,9 +8,9 @@ import {RouterHelper} from '../../../utils/routerHelper.class';
import {ErrorCodes} from '../../../utils/properties/errorCodes';
import {OrganizationsDeletedByInferenceService} from './deletedByInference.service';
import {ResultLandingInfo} from "../../../utils/entities/resultLandingInfo";
import {ResultPreview} from "../../../utils/result-preview/result-preview";
import {AlertModal} from "../../../utils/modal/alert";
import {Subscriber} from "rxjs";
@Component({
selector: 'organizationsDeletedByInference',
@ -48,36 +48,40 @@ export class OrganizationsDeletedByInferenceComponent {
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
sub: any;
subscriptions = [];
properties:EnvProperties;
constructor ( private element: ElementRef,
private _deletedByInferenceService: OrganizationsDeletedByInferenceService,
private route: ActivatedRoute,
private _router: Router) {
private route: ActivatedRoute) {
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
this.sub = this.route.queryParams.subscribe(data => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.errorCodes = new ErrorCodes();
this.status = this.errorCodes.LOADING;
this.getDeletedByInference();
});
}));
}
ngOnDestroy() {}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
getDeletedByInference() {
this.results = [];
this.status = this.errorCodes.LOADING;
this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
data => {
this.results = data;
this.status = this.errorCodes.DONE;
@ -91,7 +95,7 @@ export class OrganizationsDeletedByInferenceComponent {
this.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
));
}
public getResultPreview(result: OrganizationInfo): ResultPreview {

View File

@ -1,18 +0,0 @@
// import { NgModule } from '@angular/core';
// import { RouterModule } from '@angular/router';
//
// import { OrganizationComponent } from './organization.component';
// import {FreeGuard} from'../../login/freeGuard.guard';
// import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
// import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
//
// @NgModule({
// imports: [
// RouterModule.forChild([
// { path: '', component: OrganizationComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
// redirect: '/error'
// },canDeactivate: [PreviousRouteRecorder] }
// ])
// ]
// })
// export class OrganizationRoutingModule { }

View File

@ -22,6 +22,7 @@ import {Location} from "@angular/common";
import {FetchResearchResults} from "../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {FetchDataproviders} from "../../utils/fetchEntitiesClasses/fetchDataproviders.class";
import {IndexInfoService} from "../../utils/indexInfo.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'organization',
@ -62,11 +63,7 @@ export class OrganizationComponent {
// Active tab variable for responsiveness
public activeTab: string = "";
public firstTab: string = "";
public _numberOfTabs: number = 0;
public tabsAreInitialized: boolean = false;
@ViewChild('downloadReportModal') downloadReportModal;
@ViewChild('downloadFunderReportModal') downloadFunderReportModal;
@ -93,14 +90,7 @@ export class OrganizationComponent {
public funder: any = "";
private funderId: string;
private funderCount: number;
sub: any;
infoSub: any;
piwiksub: any;
downloadFileSub: any;
downloadFilePiwikSub: any;
countProjectsSub: any;
countPublSub: any;
downloadProjectPublSub: any;
subscriptions = [];
properties: EnvProperties;
public indexUpdateDate: Date;
public showFeedback: boolean = false;
@ -110,8 +100,7 @@ export class OrganizationComponent {
@ViewChild('projectsModal') projectsModal;
public deleteByInferenceOpened: boolean = false;
//private ngUnsubscribe: Subject<void> = new Subject<void>();
constructor(private element: ElementRef,
private _organizationService: OrganizationService,
private _piwikService: PiwikService,
@ -136,21 +125,21 @@ export class OrganizationComponent {
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}
});
}));
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
});
this.sub = this.route.queryParams.subscribe(params => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.organizationInfo = null;
this.updateTitle("Organization");
this.updateDescription("");
@ -174,7 +163,7 @@ export class OrganizationComponent {
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
});
}));
this.downloadURLAPI = this.properties.csvAPIURL;
//this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))";
@ -184,53 +173,34 @@ export class OrganizationComponent {
private getPageContents() {
if(this.communityId) {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}));
}
}
private getDivContents() {
if(this.communityId) {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}));
}
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
}
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
if (this.infoSub) {
this.infoSub.unsubscribe();
}
if (this.downloadFileSub) {
this.downloadFileSub.unsubscribe();
}
if (this.downloadFilePiwikSub) {
this.downloadFilePiwikSub.unsubscribe();
}
if (this.countProjectsSub) {
this.countProjectsSub.unsubscribe();
}
if (this.countPublSub) {
this.countPublSub.unsubscribe();
}
if (this.downloadProjectPublSub) {
this.downloadProjectPublSub.unsubscribe();
}
/*
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
*/
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.fetchDatasets.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
this.fetchSoftware.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
this.fetchDataproviders.clearSubscriptions();
this.fetchProjects.clearSubscriptions();
}
private getTotalResearchResults() {
this.fetchPublications.getNumForEntity('publication', 'organization', this.organizationId, this.properties);
this.fetchDatasets.getNumForEntity('dataset', 'organization', this.organizationId, this.properties);
@ -319,8 +289,8 @@ export class OrganizationComponent {
this.showLoading = true;
this.organizationInfo = null;
this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe(
this.subscriptions.push(this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe(
data => {
if (data == null) {
this.showLoading = false;
@ -340,7 +310,7 @@ export class OrganizationComponent {
((this.organizationInfo.title.name && this.organizationInfo.title.name != this.organizationInfo.name) ? (', ') : '') +
(this.organizationInfo.name?this.organizationInfo.name:''));
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe());
}
var refineFields: string [] = ["funder"];
@ -368,14 +338,14 @@ export class OrganizationComponent {
this.errorMessage = 'No organization found';
this.showLoading = false;
}
);
));
}
public downloadFile(url: string, filename: string) {
this.openLoading();
this.setMessageLoading("Downloading CSV file");
this.downloadFileSub = this._reportsService.downloadCSVFile(url).subscribe(
this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe(
data => {
this.closeLoading();
@ -391,7 +361,7 @@ export class OrganizationComponent {
//window.open(window.URL.createObjectURL(data));
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe());
}
},
err => {
@ -402,7 +372,7 @@ export class OrganizationComponent {
this.confirmOpenCsvError();
}/*,
() => console.log('Completed file download.')*/
);
));
}
private downloadFileByFunder() {
@ -418,12 +388,12 @@ export class OrganizationComponent {
let title_index: number = 0;
let filename: string = 'funder-project-' + this.funderContentType + '-report';
this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe(
data => {
projects = data[1];
for (let index = 0; index < projects.length; index++) {
this.countPublSub = this._searchResearchResultsService.numOfEntityResults(this.funderContentType, projects[index].id, "project", this.properties).subscribe(
this.subscriptions.push(this._searchResearchResultsService.numOfEntityResults(this.funderContentType, projects[index].id, "project", this.properties).subscribe(
data => {
//if(data == 0 && title) { // if no publications for this project
if (data == 0 && (counter > 1 || title)) { // if no publications for this project
@ -464,8 +434,8 @@ export class OrganizationComponent {
url = this.downloadURLAPI + '?format=csv-special-notitle&' + this.getTypeParam(this.funderContentType) + '&fq=((relprojectid exact "' + projects[index].id + '"))';
}
title = true;
this.downloadProjectPublSub = this._reportsService.getCSVResponse(url).subscribe(
this.subscriptions.push(this._reportsService.getCSVResponse(url).subscribe(
data => {
counter--;
response[index] = data;
@ -502,12 +472,12 @@ export class OrganizationComponent {
this.confirmOpenCsvError();
}/*,
() => console.log('Completed file download.')*/
);
) );
}
},
err => {
this.handleError("Error getting number of publications for project with id: " + projects[index].id, err);
});
}));
}
},
err => {
@ -516,7 +486,7 @@ export class OrganizationComponent {
this.closeLoading();
this.confirmOpenCsvError();
}
);
));
}
private updateDescription(description: string) {

View File

@ -17,8 +17,7 @@ import {SearchResearchResultsServiceModule} from '../../services/searchResearchR
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {ProjectsInModalModule} from '../landing-utils/projects-in-modal.module';
import {FreeGuard} from '../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module';
import {HelperModule} from "../../utils/helper/helper.module";
@ -51,9 +50,7 @@ import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module";
declarations: [
OrganizationComponent,
],
providers: [
FreeGuard, IsRouteEnabled
],
providers: [],
exports: [
OrganizationComponent
]

View File

@ -22,10 +22,10 @@ import {HelperService} from "../../utils/helper/helper.service";
import {Location} from "@angular/common";
import {HtmlProjectReportService} from "../htmlProjectReport/htmlProjectReport.service";
import {StringUtils} from "../../utils/string-utils.class";
import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo";
import {ResultPreview} from "../../utils/result-preview/result-preview";
import {SearchResult} from "../../utils/entities/searchResult";
import {IndexInfoService} from "../../utils/indexInfo.service";
import {Subscriber} from "rxjs";
@Component({
selector: 'project',
@ -75,12 +75,7 @@ export class ProjectComponent {
// Active tab variable for responsiveness
public activeTab: string = "";
public firstTab: string = "";
public _numberOfTabs: number = 0;
public tabsAreInitialized: boolean = false;
@ViewChild('statisticsModal') statisticsModal;
@ViewChild('linkProjectModal') linkProjectModal;
@ViewChild('shareResultsModal') shareResultsModal;
@ViewChild('downloadReportModal') downloadReportModal;
@ -125,15 +120,9 @@ export class ProjectComponent {
public thresholdOrganizations: number = 20;
public showNumOrganizations: number = 20;
sub: any;
piwiksub: any;
infoSub: any;
downloadFilePiwikSub: any;
downloadHtmlFilePiwikSub: any;
subscriptions = [];
properties: EnvProperties;
public subHTML: any;
constructor(private route: ActivatedRoute,
private _router: Router,
private _location: Location,
@ -149,22 +138,22 @@ export class ProjectComponent {
private indexInfoService: IndexInfoService) {}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}
});
}));
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
});
this.sub = this.route.queryParams.subscribe(params => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.metricsClicked = false;
this.statsClicked = false;
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
@ -200,7 +189,7 @@ export class ProjectComponent {
this.createClipboard();
HelperFunctions.scroll();
});
}));
}
public getFileNameType(type: string) {
@ -227,17 +216,17 @@ export class ProjectComponent {
private getPageContents() {
if(this.communityId) {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}));
}
}
private getDivContents() {
if(this.communityId) {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}));
}
}
@ -267,21 +256,15 @@ export class ProjectComponent {
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
}
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
if (this.infoSub) {
this.infoSub.unsubscribe();
}
if (this.downloadFilePiwikSub) {
this.downloadFilePiwikSub.unsubscribe();
}
if(this.downloadHtmlFilePiwikSub) {
this.downloadHtmlFilePiwikSub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.fetchDatasets.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
this.fetchSoftware.clearSubscriptions();
this.fetchPublications.clearSubscriptions();
}
private createClipboard() {
@ -344,7 +327,7 @@ export class ProjectComponent {
this.projectInfo = null;
this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe(
this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe(
data => {
this.projectInfo = data;
@ -360,7 +343,7 @@ export class ProjectComponent {
this.errorMessage = 'No project found';
this.showLoading = false;
}
);
));
}
private getProjectInfoByGrantId(grantId: string, funder: string) {
@ -370,7 +353,7 @@ export class ProjectComponent {
this.projectInfo = null;
this._projectService.getProjectInfoByGrantId(grantId, funder, this.properties).subscribe(
this.subscriptions.push(this._projectService.getProjectInfoByGrantId(grantId, funder, this.properties).subscribe(
data => {
this.projectInfo = data;
@ -389,7 +372,7 @@ export class ProjectComponent {
this.errorMessage = 'No project found';
this.showLoading = false;
}
);
));
}
actionsAfterGettingProjectInfo() {
@ -401,7 +384,7 @@ export class ProjectComponent {
this.updateTitle(this.projectName);
this.updateDescription(this.projectInfo.description?this.projectInfo.description: ("project" + (this.projectInfo.title?"," + this.projectInfo.title:"") + (this.projectInfo.funding && this.projectInfo.funding.funderName?", funder: " + this.projectInfo.funding.funderName:"") + (this.projectInfo.acronym?"," + this.projectInfo.acronym:"")));
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe());
}
this.project = {
@ -441,7 +424,7 @@ export class ProjectComponent {
this.openLoading();
this.setMessageLoading("Downloading CSV file");
this._reportsService.downloadCSVFile(url).subscribe(
this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe(
data => {
this.closeLoading();
@ -449,7 +432,7 @@ export class ProjectComponent {
this.download(url, filename+".csv");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe();
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url).subscribe());
}
},
error => {
@ -460,7 +443,7 @@ export class ProjectComponent {
this.confirmOpenFileDownloadError("CSV");
}/*,
() => console.log('Completed file download.')*/
);
));
}
public metricsResults($event) {
@ -541,7 +524,7 @@ export class ProjectComponent {
intro += '</head>';
if (typeof window !== 'undefined') {
this.subHTML = this.htmlService.getHTML(this.projectId, type, this.properties.csvAPIURL).subscribe(
this.subscriptions.push(this.htmlService.getHTML(this.projectId, type, this.properties.csvAPIURL).subscribe(
data => {
//console.info(data);
this.htmlResultDownload = intro + '<body><div>' + this.header1 + '</div><div><h4>' + this.header2 + '</h4></div>';
@ -555,7 +538,7 @@ export class ProjectComponent {
this.download(url, filename+".html");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.downloadHtmlFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe();
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url).subscribe());
}
},
err => {
@ -564,7 +547,7 @@ export class ProjectComponent {
this.closeLoading();
this.confirmOpenFileDownloadError("HTML");
}
);
));
} else {
this.closeLoading();
this.confirmOpenFileDownloadError("HTML");
@ -657,20 +640,6 @@ export class ProjectComponent {
a.remove(); // remove the element
}
// copyToClipboard(element: HTMLElement) {
// if (typeof document !== 'undefined') {
// if (window.getSelection) {
// const selection = window.getSelection();
// const range = document.createRange();
// range.selectNodeContents(element);
// selection.removeAllRanges();
// selection.addRange(range);
// document.execCommand('copy');
// } else {
// console.warn("Could not select text in node: Unsupported browser.");
// }
// }
// }
public onSelectActiveTab(activeTabId) {
if(this.activeTab != activeTabId) { // tab really changed

View File

@ -21,8 +21,6 @@ import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {HelperModule} from "../../utils/helper/helper.module";
import {IFrameModule} from '../../utils/iframe.module';
import {FreeGuard} from '../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module';
import {FeedbackModule} from "../feedback/feedback.module";
@ -44,7 +42,7 @@ import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module";
ProjectComponent
],
providers:[
FreeGuard, IsRouteEnabled, HtmlProjectReportService
HtmlProjectReportService
],
exports: [
ProjectComponent

View File

@ -1,7 +1,6 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {Observable, throwError} from 'rxjs';
import {throwError} from 'rxjs';
import {ProjectInfo} from '../../utils/entities/projectInfo';

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {ElementRef, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
@ -8,9 +8,9 @@ import {RouterHelper} from '../../../utils/routerHelper.class';
import {ErrorCodes} from '../../../utils/properties/errorCodes';
import {DeletedByInferenceService} from './deletedByInference.service';
import {SearchResult} from "../../../utils/entities/searchResult";
import {ResultPreview} from "../../../utils/result-preview/result-preview";
import {AlertModal} from "../../../utils/modal/alert";
import {Subscriber} from "rxjs";
@Component({
selector: 'deletedByInference',
@ -49,7 +49,7 @@ export class DeletedByInferenceComponent {
public routerHelper: RouterHelper = new RouterHelper();
public errorCodes: ErrorCodes = new ErrorCodes();
sub: any;
subscriptions = [];
properties: EnvProperties;
constructor(private element: ElementRef,
@ -59,26 +59,31 @@ export class DeletedByInferenceComponent {
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
this.sub = this.route.queryParams.subscribe(data => {
}));
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.errorCodes = new ErrorCodes();
this.status = this.errorCodes.LOADING;
this.getDeletedByInference();
});
}));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
getDeletedByInference() {
this.results = [];
this.status = this.errorCodes.LOADING;
this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
data => {
this.results = data;
this.status = this.errorCodes.DONE;
@ -92,7 +97,7 @@ export class DeletedByInferenceComponent {
this.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
));
}
public getResultPreview(result: ResultLandingInfo): ResultPreview {

View File

@ -19,6 +19,7 @@ import {FormBuilder} from "@angular/forms";
import {StringUtils} from "../../utils/string-utils.class";
import {properties} from "../../../../environments/environment";
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
import {Subscriber} from "rxjs";
@Component({
@ -37,7 +38,6 @@ export class ResultLandingComponent {
public deleteByInferenceOpened: boolean = false;
public resultLandingInfo: ResultLandingInfo;
public relatedResults: RelationResult[];
public supplementaryResults: RelationResult[];
public relation: string = 'trust';
public id: string;
@ -78,8 +78,7 @@ export class ResultLandingComponent {
// Map counting variables
public bioentitiesNum: number = 0;
public relatedResultsNum: number = 0;
public supplementaryResultsNum: number = 0;
// Message variables
public warningMessage = "";
public errorMessage = "";
@ -89,9 +88,7 @@ export class ResultLandingComponent {
public routerHelper: RouterHelper = new RouterHelper();
public activeTab: string = null;
private doi: string;
sub: any;
piwiksub: any;
infoSub: any;
subscriptions = [];
properties: EnvProperties = properties;
public indexUpdateDate: Date;
public pageContents = null;
@ -121,16 +118,16 @@ export class ResultLandingComponent {
ngOnInit() {
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}
});
}));
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
this.sub = this.route.queryParams.subscribe(data => {
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.resultLandingInfo = null;
if (data['articleId']) {
this.type = "publication";
@ -189,35 +186,32 @@ export class ResultLandingComponent {
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
this.scroll();
});
}));
}
private getPageContents() {
if (this.communityId) {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}));
}
}
private getDivContents() {
if (this.communityId) {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}));
}
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
}
if (this.piwiksub) {
this.piwiksub.unsubscribe();
}
if (this.infoSub) {
this.infoSub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this._vocabulariesService.clearSubscriptions();
}
public getTypeName(): string {
@ -244,14 +238,14 @@ export class ResultLandingComponent {
}
private getOpenCitations() {
this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe(
this.subscriptions.push(this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe(
data => {
this.resultLandingInfo.openCitations = data[1];
},
err => {
this.handleError("Error getting open citation for " + this.type + " with id: " + this.id, err);
}
);
));
}
private getProvenanceVocabularyAndResultLandingInfo() {
@ -262,14 +256,14 @@ export class ResultLandingComponent {
this.resultLandingInfo = null;
if (typeof document !== 'undefined') {
this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
provenanceActionVocabulary => {
this.getResultLandingInfo(provenanceActionVocabulary);
}, err => {
this.getResultLandingInfo(null);
this.handleError("Error getting provenance action vocabulary for " + this.type + " with id: " + this.id, err);
}
);
));
} else {
this.getResultLandingInfo(null);
}
@ -315,7 +309,7 @@ export class ResultLandingComponent {
// }
private getResultLandingInfo(provenanceActionVocabulary: any) {
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe(
this.subscriptions.push(this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
@ -331,7 +325,7 @@ export class ResultLandingComponent {
this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title)));
}
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe();
this.subscriptions.push(this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe());
}
let bioentitiesNum = 0;
@ -344,11 +338,11 @@ export class ResultLandingComponent {
if (typeof document !== 'undefined') {
if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) {
this.doi = this.resultLandingInfo.identifiers.get('doi')[0];
this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => {
this.subscriptions.push(this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => {
this.hasAltMetrics = hasAltMetrics;
}, error => {
this.hasAltMetrics = false;
});
}));
}
}
this.showLoading = false;
@ -371,7 +365,7 @@ export class ResultLandingComponent {
this.showLoading = false;
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
}
);
));
}
public metricsResults($event) {

View File

@ -11,8 +11,6 @@ import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {PagingModule} from '../../utils/paging.module';
import {FreeGuard} from '../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {ResultLandingService} from './resultLanding.service';
import {ResultLandingComponent} from './resultLanding.component';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
@ -42,7 +40,7 @@ import {LoadingModule} from "../../utils/loading/loading.module";
ResultLandingComponent
],
providers: [
ResultLandingService, FreeGuard, IsRouteEnabled
ResultLandingService
],
exports: [
ResultLandingComponent

View File

@ -4,7 +4,7 @@ import {throwError} from 'rxjs';
import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
import {map, tap} from "rxjs/operators";
import {map} from "rxjs/operators";
import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview";
import {Dates} from "../../utils/string-utils.class";

View File

@ -4,7 +4,7 @@ import {Observable} from 'rxjs';
import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class';
import {UserManagementService} from "../services/user-management.service";
import {filter, map} from "rxjs/operators";
import {map, tap} from "rxjs/operators";
@Injectable()
export class AdminLoginGuard implements CanActivate {
@ -15,21 +15,22 @@ export class AdminLoginGuard implements CanActivate {
check(path: string): Observable<boolean> {
let errorCode = LoginErrorCodes.NOT_LOGIN;
const obs = this.userManagementService.getUserInfo(false).pipe(map(user => {
return this.userManagementService.getUserInfo(false).pipe(map(user => {
if (user) {
errorCode = LoginErrorCodes.NOT_ADMIN;
}
return Session.isPortalAdministrator(user);
}),tap(isAdmin => {
if(!isAdmin) {
this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
}
});
}
}));
obs.pipe(filter(isAdmin => !isAdmin)).subscribe(() => {
this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
}
});
});
return obs;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {

View File

@ -3,7 +3,7 @@ import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '
import {Observable} from 'rxjs';
import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class';
import {filter, map} from "rxjs/operators";
import {map, tap} from "rxjs/operators";
import {UserManagementService} from "../services/user-management.service";
@Injectable()
@ -15,21 +15,21 @@ export class ClaimsCuratorGuard implements CanActivate {
check(path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_LOGIN;
const obs = this.userManagementService.getUserInfo(false).pipe(map(user => {
return this.userManagementService.getUserInfo(false).pipe(map(user => {
if (user) {
errorCode = LoginErrorCodes.NOT_ADMIN;
}
return Session.isClaimsCurator(user) || Session.isPortalAdministrator(user);
}),tap(isAdmin => {
if(!isAdmin) {
this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
}
});
}
}));
obs.pipe(filter(isAdmin => !isAdmin)).subscribe(() => {
this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
}
});
});
return obs;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {

View File

@ -4,8 +4,6 @@ import {
CanActivate,
ActivatedRouteSnapshot,
RouterStateSnapshot,
Route,
CanLoad
} from '@angular/router';
import {Observable} from 'rxjs';
import {LoginErrorCodes} from './utils/guardHelper.class';

View File

@ -3,7 +3,7 @@ import {ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterState
import {Observable} from 'rxjs/Observable';
import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class';
import {filter, map} from "rxjs/operators";
import {map, tap} from "rxjs/operators";
import {UserManagementService} from "../services/user-management.service";
@Injectable()
@ -15,13 +15,18 @@ export class LoginGuard implements CanActivate, CanLoad {
check(path: string): Observable<boolean> | boolean {
if (Session.isLoggedIn()) {
const obs = this.userManagementService.getUserInfo(false).pipe(map(user => {
return this.userManagementService.getUserInfo(false).pipe(map(user => {
return user !== null;
}),tap(isLoggedIn => {
if(!isLoggedIn) {
this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': LoginErrorCodes.NOT_LOGIN,
'redirectUrl': path
}
});
}
}));
obs.pipe(filter(isLoggedIn => !isLoggedIn)).subscribe(() => {
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_LOGIN,'redirectUrl': path}});
});
return obs;
} else {
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_LOGIN, 'redirectUrl':path}});
return false;

View File

@ -8,6 +8,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
import {EnvProperties} from '../utils/properties/env-properties';
import {UserManagementService} from "../services/user-management.service";
import {properties} from "../../../environments/environment";
import {Subscriber} from "rxjs";
import {StringUtils} from "../utils/string-utils.class";
@Component({
@ -21,8 +22,7 @@ export class UserComponent {
public server: boolean = true;
public errorMessage: string = "";
public password: string = "";
private sub: any;
private sublogin: any;
private subscriptions = [];
public errorCode: string = "";
public redirectUrl: string = "";
public routerHelper: RouterHelper = new RouterHelper();
@ -41,38 +41,37 @@ export class UserComponent {
}
ngOnInit() {
this.route.data
this.subscriptions.push(this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.loginUrl = this.properties.loginUrl;
});
}));
if (typeof document !== 'undefined') {
this.server = false;
this.userManagementsService.getUserInfo().subscribe(user => {
this.subscriptions.push(this.userManagementsService.getUserInfo().subscribe(user => {
this.user = user;
this.loggedIn = !!this.user;
this.errorMessage = "";
this.sub = this.route.queryParams.subscribe(params => {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.errorCode = params["errorCode"];
this.redirectUrl = params["redirectUrl"];
this.errorMessage = "";
if (this.loggedIn && this.errorCode == '1') {
this.redirect();
}
});
});
}));
}));
}
}
ngOnDestroy() {
if(this.sub) {
this.sub.unsubscribe();
}
if (this.sublogin) {
this.sublogin.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
redirect() {

View File

@ -8,15 +8,13 @@ import {UserRoutingModule} from './user-routing.module';
import {UserComponent} from './user.component';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
import {FreeGuard} from './freeGuard.guard';
import {LoginGuard} from './loginGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule, UserRoutingModule, RouterModule
],
providers: [
PreviousRouteRecorder, FreeGuard, LoginGuard
PreviousRouteRecorder
],
declarations: [
UserComponent

View File

@ -1,11 +1,10 @@
import {Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
import {Location} from '@angular/common';
import {User, Session} from './utils/helper.class';
import {RouterHelper} from '../utils/routerHelper.class';
import {StringUtils} from '../utils/string-utils.class';
import {EnvProperties} from '../utils/properties/env-properties';
import {properties} from "../../../environments/environment";
import {Subscriber} from "rxjs";
// declare var logoutClicked;
@Component({
@ -180,23 +179,23 @@ export class UserMiniComponent implements OnInit, OnChanges {
@Input() redirectUrl: string;
@Input() dark: boolean = false;
search: string = '';
sub: any;
subscriptions = [];
constructor(private router: Router, private route: ActivatedRoute) {
this.router.events.forEach(event => {
this.subscriptions.push(this.router.events.forEach(event => {
if (event instanceof NavigationStart) {
this.initialize(event.url);
}
});
}));
}
ngOnInit() {
if (typeof document !== 'undefined') {
this.server = false;
}
this.sub = this.route.queryParams.subscribe(params => {
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.initialize();
});
}));
}
ngOnChanges(changes: SimpleChanges): void {
@ -204,11 +203,13 @@ export class UserMiniComponent implements OnInit, OnChanges {
this.initialize();
}
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
}
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
}
initialize(url: string = null) {

View File

@ -2,13 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import{ReloadComponent} from './reload.component';
import {FreeGuard} from'../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ReloadComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: ReloadComponent, canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -7,7 +7,6 @@ import{ReloadRoutingModule } from './reload-routing.module';
import{ReloadComponent} from './reload.component';
import {FreeGuard} from'../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({
@ -20,7 +19,7 @@ import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard'
ReloadComponent
],
providers:[
FreeGuard, PreviousRouteRecorder
PreviousRouteRecorder
],
exports: [
ReloadComponent

View File

@ -172,33 +172,33 @@ export class RoleVerificationComponent implements OnInit, OnDestroy {
public verifyManager() {
this.loading = true;
this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
this.subs.push(this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
this.loading = false;
this.managerModal.cancel();
this.error = null;
this.userManagementService.getUserInfo(false).subscribe(user => {
this.subs.push(this.userManagementService.getUserInfo(false).subscribe(user => {
this.user = user;
this.router.navigate(['/admin/' + this.verification.entity]);
});
}));
}, error => {
this.loading = false;
this.error = 'The verification code is invalid';
});
}));
}
public verifyMember() {
this.loading = true;
this.userRegistryService.verify(this.verification.id, this.code.value, "member").subscribe(() => {
this.subs.push(this.userRegistryService.verify(this.verification.id, this.code.value, "member").subscribe(() => {
this.loading = false;
this.error = null;
this.userManagementService.getUserInfo(false).subscribe(user => {
this.subs.push(this.userManagementService.getUserInfo(false).subscribe(user => {
this.user = user;
this.memberModal.cancel();
});
}));
}, error => {
this.loading = false;
this.error = 'The verification code is invalid';
});
}));
}
public reset() {

View File

@ -1,176 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'advanced-search-dataprovider',
template: `
<advanced-search-page pageTitle="Advanced Search for Content Providers" entityType="dataprovider"
type = "content providers"
[(results)] = "results"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(searchUtils)] = "searchUtils"
[csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId
searchFormClass="datasourcesSearchForm">
</advanced-search-page>
`
})
export class AdvancedSearchDataProvidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() customFilter:SearchCustomFilter= null;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.DATASOURCE_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "(oaftype exact datasource)";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
public isPiwikEnabled;
properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
//console.info("Con -base url:"+this.searchUtils.baseUrl );
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
});
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.customFilter = this.customFilter;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number){
if(page > this.pagingLimit ) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
if(parameters!= null && parameters != '' ) {
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
}else{
this.csvParams ="&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
//console.log(err);
this.handleError("Error getting content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
private handleError(message: string, error) {
console.error("Content Providers advanced Search Page: "+message, error);
}
}

View File

@ -1,28 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
AdvancedSearchPageModule
],
declarations: [
AdvancedSearchDataProvidersComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchDataProvidersComponent
]
})
export class AdvancedSearchDataProvidersModule { }

View File

@ -1,181 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'advanced-search-organizations',
template: `
<advanced-search-page pageTitle="Advanced Search for Organizations" entityType="organization"
type = "organizations"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId
searchFormClass="organizationsSearchForm">
</advanced-search-page>
`
})
export class AdvancedSearchOrganizationsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
properties:EnvProperties;
@Input() piwikSiteId = null;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.ORGANIZATION_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.ORGANIZATION_FIELDS;
public selectedFields:AdvancedField[] = [];
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
public isPiwikEnabled;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@Input() customFilter:SearchCustomFilter= null;
public resourcesQuery = "(oaftype exact organization)";
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedOrganizations;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
});
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.customFilter = this.customFilter;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number){
if(page > this.pagingLimit) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
if(parameters!= null && parameters != '' ) {
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
}else{
this.csvParams ="&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Organizations: Execute search query "+parameters);
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
//console.log(err);
this.handleError("Error getting organizations", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
private setFilters(){
//TODO set filters from
}
private handleError(message: string, error) {
console.error("Organizations advanced Search Page: "+message, error);
}
}

View File

@ -1,28 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
OrganizationsServiceModule,
AdvancedSearchPageModule
],
declarations: [
AdvancedSearchOrganizationsComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchOrganizationsComponent
]
})
export class AdvancedSearchOrganizationsModule { }

View File

@ -1,180 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'advanced-search-projects',
template: `
<advanced-search-page pageTitle="Advanced Search for Projects" entityType="project"
type = "projects"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId
searchFormClass="projectsSearchForm">
</advanced-search-page>
`
})
export class AdvancedSearchProjectsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() customFilter:SearchCustomFilter= null;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
public selectedFields:AdvancedField[] = [];
properties:EnvProperties;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "(oaftype exact project)";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
public isPiwikEnabled;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedProjects;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
});
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.customFilter = this.customFilter;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number){
if(page > this.pagingLimit) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
if(parameters!= null && parameters != '' ) {
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
}else{
this.csvParams ="&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Publications: Execute search query "+parameters);
this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
//console.log(err);
this.handleError("Error getting projects", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
private handleError(message: string, error) {
console.error("Projects advanced Search Page: "+message, error);
}
}

View File

@ -1,28 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
ProjectsServiceModule,
AdvancedSearchPageModule
],
declarations: [
AdvancedSearchProjectsComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchProjectsComponent
]
})
export class AdvancedSearchProjectsModule { }

View File

@ -1,213 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'advanced-search-research-results',
template: `
<advanced-search-page
pageTitle="Advanced Search for {{ getEntityName(resultType, true, true) | titlecase }}"
[entityType]="resultType"
[type]="getEntityName(resultType, true, true)"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
[simpleSearchLink]="simpleSearchLink"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[(openaireLink)]=openaireLink
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
searchFormClass="publicationsSearchForm"
[(sort)]=sort >
</advanced-search-page>
`
})
export class AdvancedSearchResearchResultsComponent {
@Input() resultType: string = "publication";
public simpleSearchLink: string = "";
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() hasPrefix: boolean = true;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact "+this.resultType+"))";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@Input() openaireLink: string ;
@Input() customFilter:SearchCustomFilter= null;
public pagingLimit: number = 0;
public isPiwikEnabled;
public sort: boolean = true;
properties:EnvProperties;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
if(this.resultType == "publication") {
this.simpleSearchLink = this.properties.searchLinkToPublications;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedPublications;
} else if(this.resultType == "dataset") {
this.simpleSearchLink = this.properties.searchLinkToDatasets;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedDatasets;
} else if(this.resultType == "software") {
this.simpleSearchLink = this.properties.searchLinkToSoftware;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedSoftware;
} else if(this.resultType == "other") {
this.simpleSearchLink = this.properties.searchLinkToOrps;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedOrps;
}
});
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchUtils.sortBy = (params['sortBy'])?params['sortBy']:'';
if(this.searchUtils.sortBy && this.searchUtils.sortBy != "resultdateofacceptance,descending" && this.searchUtils.sortBy != "resultdateofacceptance,ascending") {
this.searchUtils.sortBy = "";
}
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.customFilter = this.customFilter;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number, sortBy: string){
if(page > this.pagingLimit) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
if(parameters!= null && parameters != '' ) {
this.csvParams ="&fq=("+this.resourcesQuery +" and (" + parameters + "))";
}else{
this.csvParams ="&fq="+this.resourcesQuery;
}
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this._searchResearchResultsService.advancedSearch(this.resultType, parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
this.handleError("Error getting "+this.getEntityName(this.resultType, true, true), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
private handleError(message: string, error) {
console.error(this.getEntityName(this.resultType, true, true)+" advanced Search Page: "+message, error);
}
public getEntityName (entityType:string, plural:boolean, full:boolean): string {
if(entityType == "publication") {
return "publication" + (plural ? "s" : "");
} else if(entityType == "dataset") {
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
} else if(entityType == "software") {
return "software";
} else if(entityType == "other") {
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
}
}
}

View File

@ -1,27 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {AdvancedSearchResearchResultsComponent} from './advancedSearchResearchResults.component';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],
declarations: [
AdvancedSearchResearchResultsComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchResearchResultsComponent
]
})
export class AdvancedSearchResearchResultsModule { }

View File

@ -1,206 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Location} from '@angular/common';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-content-providers',
template: `
<search-page pageTitle="OpenAIRE Content Providers"
formPlaceholderText = "Search for OpenAIRE Content Providers"
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[tableViewLink]="'/search/content-providers-table'"
searchFormClass="compatibleDatasourcesSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'repositories'"
[newQueryButton]="false">
</search-page>
`
})
export class SearchCompatibleDataprovidersComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
public _prefixQuery: string = "";
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
public csvParams: string;
public disableForms: boolean = false;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="
+ this._prefixQueryFields[i].values[j] + "&" +
this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue;
}
}
this._prefixQuery+="&";
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToCompatibleDataProviders
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
var csvParameters = this.searchPage.getQueryParametersFromUrl(params);
//console.info("|"+queryParameters+"|");
this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){
if(csv_parameters.indexOf("fq=") != -1) {
this.csvParams = csv_parameters+" and "+this.resourcesQuery;
} else {
this.csvParams = csv_parameters+"&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
err => {
//console.log(err);
this.handleError("Error getting compatible content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
private setFilters(){
//TODO set filters from
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
"Institutional Repositories Aggregators",
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
*/
[
"Institutional Repository", "Thematic Repository", "Publication Repository",
"Institutional Repository Aggregator",
"Thematic Repository Aggregator", "Publication Repository Aggregator",
"Data Repository", "Data Repository Aggregator", "CRIS System", "Publication Catalogue",
"Software Repository", "Software Repository Aggregator"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional","aggregator::pubsrepository::thematic","aggregator::pubsrepository::unknown",
"datarepository::unknown", "aggregator::datarepository", "crissystem", "pubscatalogue::unknown", "softwarerepository", "aggregator::softwarerepository"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Compatible Content Providers (Repositories) Search Page: "+message, error);
}
}

View File

@ -1,27 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [
SearchCompatibleDataprovidersComponent
],
exports: [
SearchCompatibleDataprovidersComponent
]
})
export class CompatibleDataProvidersModule { }

View File

@ -1,262 +0,0 @@
import {Component, ViewChild} from '@angular/core';
import {Location} from '@angular/common';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-content-providers-table',
template: `
<search-page-table pageTitle="OpenAIRE Content Providers Table"
type="content providers" entityType="dataprovider" [filters] = "filters"
[results] = "results" [searchUtils] = "searchUtils"
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/content-providers'"
searchFormClass="compatibleDatasourcesTableSearchForm"
formPlaceholderText="Search for OpenAIRE Content Providers"
[mapUrl]="mapUrl" [mapTooltipType]="'repositories'">
</search-page-table>
`
})
export class SearchCompatibleDataprovidersTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
public mapUrl: string;
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public CSVDownloaded = false;
public csvParams: string;
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/
public disableForms: boolean = false;
public enableSearchView: boolean = true;
properties:EnvProperties;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProvidersTable;
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
this._getResults(params);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(params){
//this.csvParams = this.resourcesQuery+"&type=datasources";
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
let size: number = 0;
this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable(this.properties).subscribe(
data => {
size = data;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, [],this.properties).subscribe(
data => {
this.filters = this.createFilters(data[1], params);
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results, this.searchUtils);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
//console.log(err);
this.handleError("Error getting compatible content providers", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
} else {
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.enableSearchView = true;
}
},
err => {
//console.log(err);
this.handleError("Error getting compatible content providers (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
}
private setFilters(){
//TODO set filters from
}
private createFilters(data, params):Filter[] {
let length = Array.isArray(data) ? data.length : 1;
var filter_names=["Type","Compatibility","Country"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname","datasourcecountryname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
filter_original_ids.push("datasourcecountryname");
var filter_valueIsExact = [true, true, false];
//this.refineFields = ["relfunder"];
//this.searchPage.refineFields = this.refineFields;
this.searchPage.getParametersFromUrl(params);
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
"Institutional Repositories Aggregators",
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
*/
[
"Institutional Repository", "Thematic Repository", "Publication Repository",
"Institutional Repository Aggregator",
"Thematic Repository Aggregator", "Publication Repository Aggregator",
"Data Repository", "Data Repository Aggregator", "CRIS Systems", "Publication Catalogue",
"Software Repository", "Software Repository Aggregator"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional","aggregator::pubsrepository::thematic","aggregator::pubsrepository::unknown",
"datarepository::unknown", "aggregator::datarepository", "cris", "pubscatalogue::unknown", "softwarerepository", "aggregator::softwarerepository"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var countries = new Set<String>();
var value_name = [];
var value_original_id = [];
let i, j;
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
let length2 = Array.isArray(resData.countries) ? resData.countries.length : 1;
for(j=0; j<length2; j++) {
let datasourceCountry = Array.isArray(resData.countries) ? resData.countries[j] : resData.countries;
if(!countries.has(datasourceCountry)) {
countries.add(datasourceCountry);
value_name.push(datasourceCountry);
value_original_id.push(datasourceCountry.trim());
}
}
}
}
value_names.push(value_name);
value_original_ids.push(value_original_id);
var filters: Filter[] =[];
for(i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i], filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Compatible Content Providers (Repositories) Search Page - Table view: "+message, error);
}
}

View File

@ -1,26 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchPageTableViewModule
],
declarations: [
SearchCompatibleDataprovidersTableComponent
],
exports: [
SearchCompatibleDataprovidersTableComponent
]
})
export class CompatibleDataProvidersTableModule { }

View File

@ -1,196 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-entity-registries',
template: `
<search-page pageTitle="Registries/ Databases"
formPlaceholderText = "Search for Registries/ Databases"
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[tableViewLink]="'/search/entity-registries-table'"
searchFormClass="entityRegistriesSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'registries'"
[newQueryButton]="false">
</search-page>
`
})
export class SearchEntityRegistriesComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
public _prefixQuery: string = "";
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public disableForms: boolean = false;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
public resourcesQuery = "((oaftype exact datasource) and(datasourcetypeuiid = other))";
public csvParams: string;
public mapUrl: string;
properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="
+ this._prefixQueryFields[i].values[j] + "&" +
this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue;
}
}
this._prefixQuery+="&";
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
var csvParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){
if(csv_parameters.indexOf("fq=") != -1) {
this.csvParams = csv_parameters+" and "+this.resourcesQuery;
} else {
this.csvParams = csv_parameters+"&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
err => {
//console.log(err);
this.handleError("Error getting entity registries", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
private setFilters(){
//TODO set filters from
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
var value_names=[
["Funder","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Entity Registries Search Page: "+message, error);
}
}

View File

@ -1,25 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchEntityRegistriesComponent} from './entityRegistries.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [
SearchEntityRegistriesComponent
],
exports: [
SearchEntityRegistriesComponent
]
})
export class EntityRegistriesModule { }

View File

@ -1,267 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-entity-registries-table',
template: `
<search-page-table pageTitle="Registries/ Databases"
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/entity-registries'"
searchFormClass="entityRegistriesTableSearchForm"
formPlaceholderText="Search for Registries/ Databases"
[mapUrl]="mapUrl" [mapTooltipType]="'registries'">
</search-page-table>
`
})
export class SearchEntityRegistriesTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
public disableForms: boolean = false;
public enableSearchView: boolean = true;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
//this.filters = this.createFilters();
//this.searchPage.getParametersFromUrl(params);
this._getResults(params, false, this.searchUtils.page);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(params,refine:boolean, page: number){
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
let size: number = 0;
this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable(this.properties).subscribe(
data => {
size = data;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, [],this.properties).subscribe(
data => {
this.filters = this.createFilters(data[1], params);
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results, this.searchUtils);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
//console.log(err);
this.handleError("Error getting entity registries", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
} else {
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.enableSearchView = true;
}
},
err => {
//console.log(err);
this.handleError("Error getting entity registries (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
/*
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
*/
}
private setFilters(){
//TODO set filters from
}
private createFilters(data, params):Filter[] {
let length = Array.isArray(data) ? data.length : 1;
var filter_names=["Type","Compatibility","Country"];
var filter_ids=["datasourcetypename","datasourcecompatibilityname","datasourcecountryname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
filter_original_ids.push("datasourcecountryname");
var filter_valueIsExact = [true, true, false];
this.searchPage.getParametersFromUrl(params);
var value_names=[
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var countries = new Set<String>();
var value_name = [];
var value_original_id = [];
let i, j;
for(i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i] : data;
if(resData.countries) {
let length2 = Array.isArray(resData.countries) ? resData.countries.length : 1;
for(j=0; j<length2; j++) {
let datasourceCountry = Array.isArray(resData.countries) ? resData.countries[j] : resData.countries;
if(!countries.has(datasourceCountry)) {
countries.add(datasourceCountry);
value_name.push(datasourceCountry);
value_original_id.push(datasourceCountry.trim());
}
}
}
}
value_names.push(value_name);
value_original_ids.push(value_original_id);
var filters: Filter[] =[];
for(i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i], filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Entity Registries Search Page - Table view: "+message, error);
}
}

View File

@ -1,24 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchPageTableViewModule
],
declarations: [
SearchEntityRegistriesTableComponent
],
exports: [
SearchEntityRegistriesTableComponent
]
})
export class EntityRegistriesTableModule { }

View File

@ -1,200 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-journals',
template: `
<search-page pageTitle="OpenAIRE Journals"
formPlaceholderText = "Search for OpenAIRE Journals"
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
searchFormClass="journalsSearchForm"
[mapUrl]="mapUrl" [mapTooltipType]="'journals'"
[newQueryButton]="false">
</search-page>
<!--[tableViewLink]="'/search/journals-table'"-->
`
})
export class SearchJournalsComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.JOURNAL_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
public _prefixQuery: string = "";
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
//"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
public csvParams: string;
public disableForms: boolean = false;
public mapUrl: string;
properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="
+ this._prefixQueryFields[i].values[j] + "&" +
this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue;
}
}
this._prefixQuery+="&";
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournals;
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
//console.info("|"+queryParameters+"|");
var csvParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){
if(csv_parameters.indexOf("fq=") != -1) {
this.csvParams = csv_parameters+" and "+this.resourcesQuery;
} else {
this.csvParams = csv_parameters+"&fq="+this.resourcesQuery;
}
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchDataprovidersService.searchJournals(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
},
err => {
//console.log(err);
this.handleError("Error getting journals", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
private setFilters(){
//TODO set filters from
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.JOURNAL_FIELDS;
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
"Institutional Repositories Aggregators",
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
*/
["Journal", "Journal Aggregator\/Publisher"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["pubsrepository::journal", "aggregator::pubsrepository::journals"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Journals Search Page: "+message, error);
}
}

View File

@ -1,27 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchJournalsComponent} from './journals.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [
SearchJournalsComponent
],
exports: [
SearchJournalsComponent
]
})
export class JournalsModule { }

View File

@ -1,222 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component';
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-journals-table',
template: `
<search-page-table pageTitle="OpenAIRE Journals Table"
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[columnNames]="columnNames"
[showResultCount]=false
[disableForms]="disableForms"
[enableSearchView]="enableSearchView"
[searchViewLink]="'/search/journals'"
searchFormClass="journalsTableSearchForm"
formPlaceholderText="Search for Journals"
[mapUrl]="mapUrl" [mapTooltipType]="'journals'">
</search-page-table>
`
})
export class SearchJournalsTableComponent {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public filters =[];
public columnNames = ["Name", "Type", "Country", "Institution", "Compatibility"];
public baseUrl:string;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.JOURNAL_FIELDS;
public mapUrl: string;
properties:EnvProperties;
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public CSVDownloaded = false;
public csvParams: string;
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/
public disableForms: boolean = false;
public enableSearchView: boolean = true;
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournalsTable;
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
//this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.filters = this.createFilters();
this.searchPage.getParametersFromUrl(params);
this._getResults();
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
}
}
private _getResults(){
//this.csvParams = this.resourcesQuery+"&type=datasources";
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
let size: number = 0;
this.subResults = this._searchDataprovidersService.searchJournalsTable(this.properties).subscribe(
data => {
size = data;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchJournals("", null, 1, size, [],this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
} else {
this.searchPage.triggerInitialLoad();
this.searchPage.transform(this.results, this.searchUtils);
this.disableForms = false;
}
this.enableSearchView = true;
},
err => {
//console.log(err);
this.handleError("Error getting journals", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
} else {
this.searchPage.checkSelectedFilters(this.filters);
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.enableSearchView = true;
}
},
err => {
//console.log(err);
this.handleError("Error getting journals (size=0)", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.enableSearchView = true;
}
);
}
private setFilters(){
//TODO set filters from
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.JOURNAL_FIELDS;
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
"Institutional Repositories Aggregators",
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
*/
["Journal", "Journal Aggregator\/Publisher"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["pubsrepository::journal", "aggregator::pubsrepository::journals"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
private handleError(message: string, error) {
console.error("Journals Search Page - Table view: "+message, error);
}
}

View File

@ -1,25 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchJournalsTableComponent} from './journalsTable.component';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DataProvidersServiceModule,
SearchFormModule, SearchPageTableViewModule
],
declarations: [
SearchJournalsTableComponent
],
exports: [
SearchJournalsTableComponent
]
})
export class JournalsTableModule { }

Some files were not shown because too many files have changed in this diff Show More