Commiting first draft of openaire library for angular portals
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@50169 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
commit
86e750754b
|
@ -0,0 +1,56 @@
|
|||
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
||||
import { ConfigurationService } from './utils/configuration/configuration.service';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Component({
|
||||
//changeDetection: ChangeDetectionStrategy.Default,
|
||||
//encapsulation: ViewEncapsulation.Emulated,
|
||||
selector: 'app-root',
|
||||
styles: [`
|
||||
`],
|
||||
template: `
|
||||
<h1>Openaire Lib Component</h1>
|
||||
<!--navbar></navbar-->
|
||||
|
||||
|
||||
<!--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="//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"></bottom-->
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class AppComponent {
|
||||
isClient:boolean = false;
|
||||
constructor(private config: ConfigurationService) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
try{
|
||||
this.isClient = true;
|
||||
}catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SharedModule } from './shared/shared.module';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { APP_BASE_HREF, CommonModule } from '@angular/common';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AppComponent } from './app.component';
|
||||
import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar
|
||||
import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module';
|
||||
import {Meta} from '../angular2-meta';
|
||||
// import { ErrorModule } from './error/error.module';
|
||||
import { ConfigurationService } from './utils/configuration/configuration.service';
|
||||
import { ErrorPageComponent } from './error/errorPage.component';
|
||||
import {SearchComponent} from './searchPages/find/search.component';
|
||||
import {MainSearchModule} from './searchPages/find/mainSearch.module';
|
||||
import {PublicationComponent} from './landingPages/publication/publication.component';
|
||||
import {PublicationModule} from './landingPages/publication/publication.module';
|
||||
import {DatasetComponent} from './landingPages/dataset/dataset.component';
|
||||
import {DatasetModule} from './landingPages/dataset/dataset.module';
|
||||
import {SoftwareComponent} from './landingPages/software/software.component';
|
||||
import {SoftwareModule} from './landingPages/software/software.module';
|
||||
import {DataProviderComponent} from './landingPages/dataProvider/dataProvider.component';
|
||||
import {DataProviderModule} from './landingPages/dataProvider/dataProvider.module';
|
||||
import {ProjectComponent} from './landingPages/project/project.component';
|
||||
import {ProjectModule} from './landingPages/project/project.module';
|
||||
import {OrganizationComponent} from './landingPages/organization/organization.component';
|
||||
import {OrganizationModule} from './landingPages/organization/organization.module';
|
||||
import {ReloadModule} from './reload/reload.module';
|
||||
import {ErrorModule} from './error/error.module';
|
||||
import {DepositDatasetsModule} from './deposit/datasets/depositDatasets.module';
|
||||
import {DepositDatasetsComponent} from './deposit/datasets/depositDatasets.component';
|
||||
import {DepositDatasetsResultsModule} from './deposit/datasets/depositDatasetsResults.module';
|
||||
import {DepositDatasetsResultComponent} from './deposit/datasets/depositDatasetsResult.component';
|
||||
import {DepositBySubjectResultsModule} from './deposit/datasets/depositBySubjectResults.module';
|
||||
import {DepositBySubjectResultComponent} from './deposit/datasets/depositBySubjectResult.component';
|
||||
import {DepositPublicationsModule} from './deposit/publications/depositPublications.module';
|
||||
import {DepositPublicationsComponent} from './deposit/publications/depositPublications.component';
|
||||
import {DepositPublicationsResultsModule} from './deposit/publications/depositPublicationsResults.module';
|
||||
import {DepositPublicationsResultComponent} from './deposit/publications/depositPublicationsResult.component';
|
||||
|
||||
import {SearchPublicationsModule} from './searchPages/simple/searchPublications.module';
|
||||
import {SearchPublicationsComponent} from './searchPages/simple/searchPublications.component';
|
||||
import {SearchDatasetsModule} from './searchPages/simple/searchDatasets.module';
|
||||
import {SearchDatasetsComponent} from './searchPages/simple/searchDatasets.component';
|
||||
import {SearchSoftwareModule} from './searchPages/simple/searchSoftware.module';
|
||||
import {SearchSoftwareComponent} from './searchPages/simple/searchSoftware.component';
|
||||
import {SearchDataProvidersModule} from './searchPages/simple/searchDataProviders.module';
|
||||
import {SearchDataprovidersComponent} from './searchPages/simple/searchDataproviders.component';
|
||||
import {SearchProjectsModule} from './searchPages/simple/searchProjects.module';
|
||||
import {SearchProjectsComponent} from './searchPages/simple/searchProjects.component';
|
||||
import {SearchOrganizationsModule} from './searchPages/simple/searchOrganizations.module';
|
||||
import {SearchOrganizationsComponent} from './searchPages/simple/searchOrganizations.component';
|
||||
|
||||
import {AdvancedSearchPublicationsModule} from './searchPages/advanced/advancedSearchPublications.module';
|
||||
import {AdvancedSearchPublicationsComponent} from './searchPages/advanced/advancedSearchPublications.component';
|
||||
import {AdvancedSearchDatasetsModule} from './searchPages/advanced/advancedSearchDatasets.module';
|
||||
import {AdvancedSearchDatasetsComponent} from './searchPages/advanced/advancedSearchDatasets.component';
|
||||
import {AdvancedSearchSoftwareModule} from './searchPages/advanced/advancedSearchSoftware.module';
|
||||
import {AdvancedSearchSoftwareComponent} from './searchPages/advanced/advancedSearchSoftware.component';
|
||||
import {AdvancedSearchDataProvidersModule} from './searchPages/advanced/advancedSearchDataProviders.module';
|
||||
import {AdvancedSearchDataProvidersComponent} from './searchPages/advanced/advancedSearchDataProviders.component';
|
||||
import {AdvancedSearchProjectsModule} from './searchPages/advanced/advancedSearchProjects.module';
|
||||
import {AdvancedSearchProjectsComponent} from './searchPages/advanced/advancedSearchProjects.component';
|
||||
import {AdvancedSearchOrganizationsModule} from './searchPages/advanced/advancedSearchOrganizations.module';
|
||||
import {AdvancedSearchOrganizationsComponent} from './searchPages/advanced/advancedSearchOrganizations.component';
|
||||
|
||||
|
||||
import {EntityRegistriesModule} from './searchPages/dataProviders/entityRegistries.module';
|
||||
import {SearchEntityRegistriesComponent} from './searchPages/dataProviders/entityRegistries.component';
|
||||
|
||||
import {CompatibleDataProvidersModule} from './searchPages/dataProviders/compatibleDataProviders.module';
|
||||
import {SearchCompatibleDataprovidersComponent} from './searchPages/dataProviders/compatibleDataProviders.component';
|
||||
|
||||
@NgModule({
|
||||
|
||||
imports: [
|
||||
SharedModule,
|
||||
NoopAnimationsModule,
|
||||
CommonModule,
|
||||
HttpModule,
|
||||
SharedComponentsModule,
|
||||
CookieLawModule,
|
||||
MainSearchModule,
|
||||
ErrorModule,
|
||||
DepositDatasetsModule,DepositDatasetsResultsModule, DepositBySubjectResultsModule,DepositPublicationsModule , DepositPublicationsResultsModule,
|
||||
SearchPublicationsModule,SearchDatasetsModule, SearchSoftwareModule, SearchDataProvidersModule, SearchProjectsModule, SearchOrganizationsModule,
|
||||
AdvancedSearchPublicationsModule,AdvancedSearchDatasetsModule, AdvancedSearchSoftwareModule, AdvancedSearchDataProvidersModule, AdvancedSearchProjectsModule, AdvancedSearchOrganizationsModule,
|
||||
PublicationModule, DatasetModule, DataProviderModule, OrganizationModule, ProjectModule, SoftwareModule,
|
||||
EntityRegistriesModule,CompatibleDataProvidersModule,
|
||||
BrowserModule.withServerTransition({appId: 'my-app'}),
|
||||
RouterModule.forRoot([
|
||||
{ path: '', component: SearchComponent},
|
||||
{ path: 'home', component: SearchComponent},
|
||||
{ path: 'search/publication', component: PublicationComponent },
|
||||
{ path: 'search/dataset', component: DatasetComponent},
|
||||
{ path: 'search/software', component: SoftwareComponent},
|
||||
{ path: 'search/project', component: ProjectComponent },
|
||||
{ path: 'search/dataprovider', component: DataProviderComponent },
|
||||
{ path: 'search/organization', component: OrganizationComponent },
|
||||
{ path: 'participate/deposit-datasets', component: DepositDatasetsComponent },
|
||||
{ path: 'participate/deposit-datasets-result', component: DepositDatasetsResultComponent},
|
||||
{ path: 'participate/deposit-subject-result', component: DepositBySubjectResultComponent },
|
||||
{ path: 'participate/deposit-publications', component: DepositPublicationsComponent },
|
||||
{ path: 'participate/deposit-publications-result', component: DepositPublicationsResultComponent},
|
||||
{ path: 'search/find', component: SearchComponent},
|
||||
{ path: 'search/find/publications', component: SearchPublicationsComponent },
|
||||
{ path: 'search/find/datasets', component:SearchDatasetsComponent},
|
||||
{ path: 'search/find/software', component:SearchSoftwareComponent},
|
||||
{ path: 'search/find/projects', component:SearchProjectsComponent},
|
||||
{ path: 'search/find/dataproviders', component:SearchDataprovidersComponent },
|
||||
{ path: 'search/find/organizations', component:SearchOrganizationsComponent },
|
||||
{ path: 'search/content-providers', component: SearchCompatibleDataprovidersComponent},
|
||||
{ path: 'search/content-providers-table', loadChildren: './searchPages/dataProviders/compatibleDataProvidersTable.module#CompatibleDataProvidersTableModule' },
|
||||
{ path: 'search/entity-registries',component: SearchEntityRegistriesComponent},
|
||||
{ path: 'search/entity-registries-table', loadChildren: './searchPages/dataProviders/entityRegistriesTable.module#EntityRegistriesTableModule' },
|
||||
{ path: 'search/journals', loadChildren: './searchPages/dataProviders/journals.module#JournalsModule' },
|
||||
{ path: 'search/journals-table', loadChildren: './searchPages/dataProviders/journalsTable.module#JournalsTableModule' },
|
||||
{ path: 'search/advanced/publications', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/datasets', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/software', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/organizations',component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/dataproviders', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/projects', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'project-report', loadChildren: './landingPages/htmlProjectReport/htmlProjectReport.module#HtmlProjectReportModule' },
|
||||
{ path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#MyClaimsModule' },
|
||||
{ path: 'claims', loadChildren: './claims/claimsAdmin/claimsAdmin.module#ClaimsAdminModule' },
|
||||
{ path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LinkingGenericModule' },
|
||||
{ path: 'participate/direct-claim', loadChildren: './claims/directLinking/directLinking.module#DirectLinkingModule' },
|
||||
{ path: 'claims-project-manager', loadChildren: './claims/claimsByToken/claimsByToken.module#ClaimsByTokenModule' },
|
||||
{ path: 'reload', loadChildren: './reload/reload.module#ReloadModule' },
|
||||
{ path: 'user-info', loadChildren: './login/user.module#UserModule' },
|
||||
{ path: 'error', component: ErrorPageComponent },
|
||||
{ path: '**',pathMatch: 'full',component: ErrorPageComponent }
|
||||
|
||||
|
||||
]),
|
||||
],
|
||||
declarations: [ AppComponent ],
|
||||
exports: [ AppComponent ],
|
||||
providers:[ Meta, ConfigurationService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {}
|
|
@ -0,0 +1,20 @@
|
|||
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 {}
|
|
@ -0,0 +1,15 @@
|
|||
export class Claim {
|
||||
id: string;
|
||||
sourceType: string;
|
||||
targetType: string;
|
||||
sourceId: string;
|
||||
targetId: string;
|
||||
date: string;
|
||||
DOI: string;
|
||||
project: Project
|
||||
userMail: string;
|
||||
|
||||
}
|
||||
export class Project{
|
||||
|
||||
}
|
|
@ -0,0 +1,367 @@
|
|||
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Router} from '@angular/router';
|
||||
import {ContextsService} from './service/contexts.service';
|
||||
import {ClaimContext} from './claimEntities.class';
|
||||
import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete/staticAutoComplete.component';
|
||||
declare var UIkit:any;
|
||||
import {Session} from '../../login/utils/helper.class';
|
||||
import {ErrorCodes} from '../../login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
// moduleId: module.id,
|
||||
selector: 'claim-contexts-search-form',
|
||||
template: `
|
||||
|
||||
<div class=" uk-animation uk-card uk-card-default uk-padding uk-padding-large uk-padding-remove-left uk-margin-left" >
|
||||
<!--div uk-grid="" >
|
||||
<div class="uk-width-auto@m uk-first-column ">
|
||||
<div>
|
||||
<select [(ngModel)]="selectedCommunityId" (ngModelChange)="communityChanged()" class=" " name="select_funder" >
|
||||
<option value="0" >Select community</option>
|
||||
<option *ngFor="let community of communities" [value]="community.id" >{{community.label}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="selectedCommunityId != '0' && categories.length > 0">
|
||||
<select [(ngModel)]="selectedCategoryId" (ngModelChange)="categoryChanged()" class=" " name="select_funder" >
|
||||
<option value="0" >Select category</option>
|
||||
<option *ngFor="let category of categories" [value]="category.id" >{{category.label}}</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-expand@m">
|
||||
|
||||
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Concept name'" title = "Concepts" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
|
||||
</div>
|
||||
</div-->
|
||||
<table class="uk-width-1-1 uk-table uk-table-responsive" ><tr>
|
||||
<tr>
|
||||
<td >
|
||||
<select [(ngModel)]="selectedCommunityId" (ngModelChange)="communityChanged()" class=" " name="select_funder" >
|
||||
<option value="0" >Select community</option>
|
||||
<option *ngFor="let community of communities" [value]="community.id" >{{community.label}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td *ngIf="selectedCommunityId != '0' && categories.length > 0">
|
||||
<select [(ngModel)]="selectedCategoryId" (ngModelChange)="categoryChanged()" class=" " name="select_funder" >
|
||||
<option value="0" >Select category</option>
|
||||
<option *ngFor="let category of categories" [value]="category.id" >{{category.label}}</option>
|
||||
</select>
|
||||
</td><td >
|
||||
<static-autocomplete [(list)] = concepts [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Concept name'" title = "Concepts" [multipleSelections]=true (addItem) = "select($event)" > </static-autocomplete>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
<div *ngIf="loading" class="uk-alert uk-alert-primary" role="alert">Loading communities information...</div>
|
||||
<div *ngIf="error" class="uk-alert uk-alert-warning" role="alert">An error occured while loading communities...</div>
|
||||
<div class="uk-margin-left">
|
||||
<div>Or <a uk-toggle="target: #browse; animation: uk-animation-fade"> Browse </a> through categories </div>
|
||||
<div id="browse" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<a uk-toggle="target: #browse; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></a>
|
||||
<div *ngIf="selectedCommunityId =='0'" class="uk-alert uk-alert-warning" >Please select community first...</div>
|
||||
<div *ngIf="selectedCommunityId !='0'" class="uk-panel uk-panel-scrollable">
|
||||
<ul class="uk-list ">
|
||||
<li>
|
||||
<span (click)="displaySubcategory(selectedCommunityId)" >
|
||||
<span *ngIf="!conceptsClassDisplay[selectedCommunityId]" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="8 5 13 10 8 15"></polygon></svg></span>
|
||||
|
||||
<span *ngIf="conceptsClassDisplay[selectedCommunityId]" class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="5 7 15 7 10 12"></polygon></svg></span>{{selectedCommunityLabel}}
|
||||
</span>
|
||||
<a *ngIf="!isSelected(selectedCommunityId)" (click)="addNewContext(selectedCommunityLabel,null,{'id':selectedCommunityId, 'label':selectedCommunityLabel})" class="uk-button-default uk-align-right" class="uk-icon-button uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg> </a>
|
||||
<ul *ngIf="conceptsClassDisplay[selectedCommunityId]" class="uk-animation-fade" >
|
||||
<li *ngFor="let category of categories" >
|
||||
<span (click)="browseConcepts(category.id)" >
|
||||
<span *ngIf="!conceptsClassDisplay[category.id]" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="8 5 13 10 8 15"></polygon></svg></span>
|
||||
|
||||
<span *ngIf="conceptsClassDisplay[category.id]" class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="5 7 15 7 10 12"></polygon></svg></span>
|
||||
{{category.label}}</span><a *ngIf="!isSelected(category.id)" (click)="addNewContext(selectedCommunityLabel,category.label,{'id':category.id, 'label':category.label})" class="uk-button-default uk-align-right" class="uk-icon-button" >
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
<div *ngIf="conceptsCategoryLoading[category.id]" class="uk-alert uk-alert-primary" role="alert">Loading category information...</div>
|
||||
|
||||
<ul *ngIf="conceptsClass[category.id] && conceptsClassDisplay[category.id]" class="uk-list uk-animation-fade" id="ul_{{category.id}}" >
|
||||
<li *ngFor="let concept1 of conceptsClass[category.id]" >
|
||||
<span (click)="displaySubcategory(concept1.id)" >
|
||||
<span *ngIf="!conceptsClassDisplay[concept1.id] && concept1.concept" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="8 5 13 10 8 15"></polygon></svg></span>
|
||||
|
||||
<span *ngIf="conceptsClassDisplay[concept1.id] && concept1.concept" class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="5 7 15 7 10 12"></polygon></svg></span>
|
||||
{{concept1.label}}
|
||||
</span>
|
||||
<a *ngIf="!isSelected(concept1.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept1)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
<ul *ngIf="concept1.concept && conceptsClassDisplay[concept1.id] " class="uk-animation-fade" >
|
||||
<li *ngFor="let concept2 of concept1.concept"><span (click)="displaySubcategory(concept2.id)" >
|
||||
<span *ngIf="!conceptsClassDisplay[concept2.id] && concept2.concept" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="8 5 13 10 8 15"></polygon></svg></span>
|
||||
|
||||
<span *ngIf="conceptsClassDisplay[concept2.id] && concept2.concept" class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <polygon points="5 7 15 7 10 12"></polygon></svg></span>
|
||||
{{concept2.label}}</span>
|
||||
<a *ngIf="!isSelected(concept2.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept2)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
<ul *ngIf="concept2.concept && conceptsClassDisplay[concept2.id] " class="uk-animation-fade" >
|
||||
<li *ngFor="let concept3 of concept2.concept">{{concept3.label}}
|
||||
<a *ngIf="!isSelected(concept3.id)" (click)="addNewContext(selectedCommunityLabel,category.label,concept3)" class="uk-button-default uk-align-right" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="infoMessage.length > 0" class="uk-alert uk-alert-primary" role="alert">{{infoMessage}}</div>
|
||||
</div>
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class ClaimContextSearchFormComponent {
|
||||
// @Input() public inline:boolean = false ; // for claimed started from landing pages
|
||||
public showComponent:boolean = true ; // for claimed started from landing pages
|
||||
@Input() public selectedList;
|
||||
//The following need to be kept in case we have to save the current state
|
||||
@Input() public projects;
|
||||
@Input() public results;
|
||||
@Input() public inlineEntity;
|
||||
public selectedCommunityId:string = "0";
|
||||
public selectedCategoryId:string ="0";
|
||||
// @Output() contextSelected = new EventEmitter();
|
||||
|
||||
@ViewChild (StaticAutoCompleteComponent) autocomplete : StaticAutoCompleteComponent ;
|
||||
|
||||
public query = '';
|
||||
public filteredList = [];
|
||||
public communities:any;
|
||||
public selectedCommunityLabel:string = "Community:";
|
||||
|
||||
public categories:any;
|
||||
public selectedCategoryLabel:string ="Category:";
|
||||
public concepts = [];
|
||||
public conceptsClass = [];
|
||||
public conceptsClassDisplay = [];
|
||||
public conceptsCategoryLoading = [];
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
public loading:boolean = false;
|
||||
public error:boolean = false;
|
||||
|
||||
ngOnInit() {
|
||||
this.getCommunities();
|
||||
}
|
||||
constructor(private _contextService: ContextsService,private router: Router) {
|
||||
|
||||
}
|
||||
|
||||
select($event){
|
||||
var item = $event.value;
|
||||
this.addNewContext( this.selectedCommunityLabel, this.selectedCategoryLabel, item);
|
||||
}
|
||||
isSelected(id):boolean{
|
||||
for (var _i = 0; _i < this.selectedList.length; _i++) {
|
||||
let item = this.selectedList[_i];
|
||||
if(item.concept.id == id){
|
||||
return true;
|
||||
// this.warningMessage = "Concept already in selected list";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
addNewContext(community,category,concept){
|
||||
var context: ClaimContext= { community: community, category: category, concept: concept };
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
if (!this.isSelected(context.concept.id)) {
|
||||
|
||||
this.selectedList.push(context);
|
||||
UIkit.notification({
|
||||
message : 'A new concept is selected.',
|
||||
status : 'primary',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
|
||||
}else{
|
||||
UIkit.notification({
|
||||
message : 'The concept is already on your list.',
|
||||
status : 'warning',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getCommunities () {
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.saveStateAndRedirectLogin();
|
||||
|
||||
}else{
|
||||
this.loading = true;
|
||||
var token=Session.getUserJwt();
|
||||
this._contextService.getCommunities().subscribe(
|
||||
data => {
|
||||
this.communities = data.communities;
|
||||
this.loading = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.loading = false;
|
||||
this.error = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
getCategories () {
|
||||
this.loading = true;
|
||||
this.categories=[];
|
||||
if(this.selectedCommunityId != '0'){
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.saveStateAndRedirectLogin();
|
||||
|
||||
}else{
|
||||
var token=Session.getUserJwt();
|
||||
this._contextService.getCategories(this.selectedCommunityId).subscribe(
|
||||
data => {
|
||||
|
||||
this.categories = (Array.isArray(data.category))? data.category:[data.category];
|
||||
this.concepts = [];
|
||||
this.addCommunityInConcepts();
|
||||
this.filteredList = [];
|
||||
if (this.query !== ""){
|
||||
var event = {value: ""};
|
||||
event.value = this.query;
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
getConcepts () {
|
||||
this.loading = true;
|
||||
if(this.selectedCategoryId != '0'){
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.saveStateAndRedirectLogin();
|
||||
}else{
|
||||
this.concepts = [];
|
||||
var token=Session.getUserJwt();
|
||||
this._contextService.getConcepts(this.selectedCategoryId, "",true).subscribe(
|
||||
data => {
|
||||
|
||||
this.concepts =data;
|
||||
this.addCommunityInConcepts();
|
||||
if (this.query !== ""){
|
||||
var event = {value: ""};
|
||||
event.value = this.query;
|
||||
// this.filter(event);
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}else{
|
||||
this.concepts=[];
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
displaySubcategory(id) {
|
||||
if(this.conceptsClassDisplay[id] != null){
|
||||
this.conceptsClassDisplay[id] = !this.conceptsClassDisplay[id];
|
||||
|
||||
}else{
|
||||
this.conceptsClassDisplay[id] = true;
|
||||
}
|
||||
}
|
||||
browseConcepts (categoryId) {
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.saveStateAndRedirectLogin();
|
||||
}else{
|
||||
if(this.conceptsClass[categoryId] != null){
|
||||
this.conceptsClassDisplay[categoryId] = !this.conceptsClassDisplay[categoryId];
|
||||
return;
|
||||
}else{
|
||||
this.conceptsClassDisplay[categoryId] = true;
|
||||
}
|
||||
this.conceptsClass[categoryId] = [];
|
||||
var token=Session.getUserJwt();
|
||||
this.conceptsCategoryLoading[categoryId] = true;
|
||||
this._contextService.getConcepts(categoryId, "",false).subscribe(
|
||||
data => {
|
||||
var concepts = (Array.isArray(data))? data:[data];
|
||||
for(var i=0;i<concepts.length; i++){
|
||||
console.log("Data"+concepts[i]);
|
||||
if(concepts[i].id.split("::").length==3){
|
||||
this.conceptsClass[categoryId].push(concepts[i]);
|
||||
}
|
||||
}
|
||||
console.log(this.conceptsClass[categoryId]);
|
||||
this.conceptsCategoryLoading[categoryId] = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.conceptsCategoryLoading[categoryId] = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
communityChanged(){
|
||||
console.log(this.selectedCommunityId +" ");
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
for(var i = 0; i< this.communities.length; i++){
|
||||
if(this.communities[i].id==this.selectedCommunityId){
|
||||
this.selectedCommunityLabel = this.communities[i].label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.selectedCategoryId = "0";
|
||||
this.selectedCategoryLabel="Select Category:";
|
||||
this.getCategories();
|
||||
}
|
||||
categoryChanged(){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
for(var i = 0; i< this.categories.length; i++){
|
||||
if(this.categories[i].id==this.selectedCategoryId){
|
||||
this.selectedCategoryLabel = this.categories[i].label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.getConcepts();
|
||||
}
|
||||
addCommunityInConcepts(){
|
||||
this.concepts.push({"id":this.selectedCommunityId, "label":this.selectedCommunityLabel});
|
||||
this.autocomplete.updateList(this.concepts);
|
||||
}
|
||||
saveStateAndRedirectLogin(){
|
||||
if(this.projects != null){
|
||||
localStorage.setItem("projects", JSON.stringify(this.projects));
|
||||
}
|
||||
localStorage.setItem("contexts", JSON.stringify(this.selectedList));
|
||||
if(this.results != null){
|
||||
localStorage.setItem("results", JSON.stringify(this.results));
|
||||
}
|
||||
if(this.inlineEntity != null){
|
||||
localStorage.setItem("inlineEntity", JSON.stringify(this.inlineEntity));
|
||||
}
|
||||
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this.router.url } });
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { ClaimContextSearchFormComponent } from './claimContextSearchForm.component';
|
||||
import{ContextsServiceModule} from './service/contextsService.module';
|
||||
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,RouterModule,
|
||||
ContextsServiceModule,
|
||||
StaticAutocompleteModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
ClaimContextSearchFormComponent
|
||||
], exports: [ClaimContextSearchFormComponent ]
|
||||
})
|
||||
export class ClaimContextSearchFormModule { }
|
|
@ -0,0 +1,100 @@
|
|||
//Classes used in linking / inlinelinking when selecting an entity
|
||||
export class ClaimResult{
|
||||
public id: string;
|
||||
public type: string;
|
||||
public source: string;
|
||||
public title: string;
|
||||
public url: string;
|
||||
public result: any;
|
||||
public accessRights: string = "OPEN";
|
||||
public embargoEndDate: string;
|
||||
public date: string;
|
||||
public authors: string[] =[];
|
||||
public publisher: string;
|
||||
public description: string;
|
||||
public resourceType:string;
|
||||
|
||||
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
||||
|
||||
var result: ClaimResult = new ClaimResult();
|
||||
result.id = itemId;
|
||||
result.type = itemType;
|
||||
result.source = itemSource;
|
||||
|
||||
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
|
||||
result.url = itemUrl;
|
||||
result.accessRights = 'OPEN';
|
||||
result.date = date;
|
||||
result.result = item;
|
||||
if(item.publisher){
|
||||
result.publisher = item.publisher;
|
||||
}
|
||||
|
||||
if(itemSource == 'datacite'){
|
||||
|
||||
result.publisher = item.attributes['container-title'];
|
||||
if(item.attributes.author){
|
||||
result.authors =[]
|
||||
for(var i=0; i< item.attributes.author.length; i++){
|
||||
result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal);
|
||||
}
|
||||
}
|
||||
|
||||
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
|
||||
}else if (itemSource == 'openaire'){
|
||||
//TODO put right access rights
|
||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date};
|
||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
|
||||
result.embargoEndDate = accessmode;
|
||||
|
||||
}else if(itemSource == 'crossref'){
|
||||
date = (date == null) ? null : date.substring(0,10);
|
||||
result.date = date;
|
||||
result.resourceType = item.type;
|
||||
result.description = item.abstract;
|
||||
if(item.author){
|
||||
result.authors =[]
|
||||
for(var i=0; i< item.author.length; i++){
|
||||
result.authors.push(item.author[i].family +" "+ item.author[i].given );
|
||||
}
|
||||
}
|
||||
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
||||
}else if (itemSource == 'orcid'){
|
||||
date = (date == null) ? null : date + "-01.-01"
|
||||
result.date = date;
|
||||
if(item['work-type']){
|
||||
result.resourceType = item.type;
|
||||
|
||||
}
|
||||
if(item.contributors){
|
||||
result.authors =[]
|
||||
for(var i=0; i< item.contributors.length; i++){
|
||||
result.authors.push(item.contributors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
export class ClaimProject{
|
||||
public funderId: string;
|
||||
public funderName: string;
|
||||
public projectId: string;
|
||||
public projectName: string;
|
||||
public projectAcronym: string;
|
||||
public startDate: string;
|
||||
public endDate: string;
|
||||
public code: string;
|
||||
public jurisdiction: string;
|
||||
public fundingLevel0: string;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export class ClaimContext{
|
||||
public community: string;
|
||||
public category: string;
|
||||
public concept:any;
|
||||
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
import {Component, Input,Output, ElementRef, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {SearchProjectsService} from '../../services/searchProjects.service';
|
||||
import {ProjectService} from '../../landingPages/project/project.service';
|
||||
// import {ModalLoading} from '../../utils/modal/loading.component';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import {ClaimProject} from './claimEntities.class';
|
||||
declare var UIkit:any;
|
||||
@Component({
|
||||
selector: 'claim-projects-search-form',
|
||||
|
||||
template: `
|
||||
<div>
|
||||
<form class=" uk-animation uk-card uk-card-default uk-padding uk-padding-large uk-padding-remove-left uk-margin-left uk-grid" uk-grid="">
|
||||
|
||||
<div class="uk-width-auto@m uk-first-column">
|
||||
<select class="" [(ngModel)]="selectedFunderId" name="select_funder" >
|
||||
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option>
|
||||
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{(funder.name.split("||").length > 0)?(funder.name.split("||")[0]+" ("+funder.name.split("||")[1]+")"):(funder.name)}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-expand@m">
|
||||
|
||||
<entities-autocomplete entityType="project" [funderId]="selectedFunderId" [allowDuplicates]=true [showSelected]=false [placeHolderMessage] = "'Project name or ID'" title = "Projects" [multipleSelections]=true (addItem) = "select($event)" ></entities-autocomplete>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
`
|
||||
|
||||
})
|
||||
export class ClaimProjectsSearchFormComponent {
|
||||
ngOnInit() {
|
||||
this.getFunders();
|
||||
}
|
||||
// @ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
|
||||
// @Input() public inline: boolean = false ; // for claimed started from landing pages
|
||||
public query = '';
|
||||
@Input() public selectedProjects=[] ;
|
||||
public elementRef;
|
||||
|
||||
public funders:string[];
|
||||
public selectedFunderId:string ="0";
|
||||
selectedFunderName:string ="Select funder:";
|
||||
@Output() projectSelected = new EventEmitter();
|
||||
|
||||
public projects:string[];
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
// public searchTermStream = new Subject<string>();
|
||||
// filtered: Observable<{}> = this.searchTermStream
|
||||
// .debounceTime(300).distinctUntilChanged()
|
||||
// .switchMap((term: string) => this._projectService.searchForProjectsObs(term, this.selectedFunderId));
|
||||
public tries:number = 0 ;
|
||||
public keywordlimit = 3;
|
||||
|
||||
constructor(private _service: ProjectService, private _projectService: SearchProjectsService, myElement: ElementRef) {
|
||||
this.elementRef = myElement;
|
||||
}
|
||||
|
||||
|
||||
// search() {
|
||||
// console.info("heeere "+this.query );
|
||||
// this.infoMessage = "";
|
||||
// // this.filtered = [];
|
||||
// if(this.query == ""){
|
||||
// this.tries = 0;
|
||||
// this.warningMessage = "";
|
||||
// } else if(this.query && this.query.length < this.keywordlimit){
|
||||
// this.tries++;
|
||||
// if(this.tries == this.keywordlimit -1 ){
|
||||
// this.warningMessage = "Type at least " + this.keywordlimit + " characters";
|
||||
// this.tries = 0;
|
||||
// }
|
||||
// }else{
|
||||
// console.info("doo the search "+this.query );
|
||||
//
|
||||
// this.tries = 0;
|
||||
// this.warningMessage = "";
|
||||
// this.searchTermStream.next(this.query);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
select(item){
|
||||
this.query = "";
|
||||
// this.searchTermStream.next(this.query); //clear
|
||||
item = item.value;
|
||||
var project: ClaimProject = new ClaimProject();
|
||||
project.funderId = (this.selectedFunderId=="0")?item.funderId:this.selectedFunderId;
|
||||
project.funderName = (this.selectedFunderId=="0")?item.funderName:this.selectedFunderName;
|
||||
project.projectId = item.id;
|
||||
project.projectName = item.projectName;
|
||||
project.projectAcronym = item.projectAcronym;
|
||||
project.startDate = item.startDate;
|
||||
project.endDate = item.endDate;
|
||||
project.code = item.code;
|
||||
project.jurisdiction = item.jurisdiction;
|
||||
project.fundingLevel0 = item.fundingLevel0;
|
||||
|
||||
console.log(item);
|
||||
|
||||
|
||||
// this._service.getProjectDates(project.projectId).subscribe(
|
||||
// data => {
|
||||
// project.startDate = data.startDate;
|
||||
// project.endDate = data.endDate;
|
||||
// },
|
||||
// err => console.log(err)
|
||||
// );
|
||||
var index:number =this.selectedProjects.indexOf(project);
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
|
||||
for (var _i = 0; _i < this.selectedProjects.length; _i++) {
|
||||
let item = this.selectedProjects[_i];
|
||||
if(item.projectId == project.projectId){
|
||||
found=true;
|
||||
this.warningMessage = "Project already in selected list";
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
this.selectedProjects.push(project);
|
||||
this.projectSelected.emit({
|
||||
value: true
|
||||
});
|
||||
UIkit.notification({
|
||||
message : 'A new project is selected.',
|
||||
status : 'primary',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
}else{
|
||||
UIkit.notification({
|
||||
message : 'The project is already on your list.',
|
||||
status : 'warning',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
showItem(item):string{
|
||||
return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value'];
|
||||
}
|
||||
remove(item){
|
||||
var index:number =this.selectedProjects.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.selectedProjects.splice(index, 1);
|
||||
}
|
||||
|
||||
}
|
||||
handleClick(event){
|
||||
var clickedComponent = event.target;
|
||||
var inside = false;
|
||||
do {
|
||||
if (clickedComponent === this.elementRef.nativeElement) {
|
||||
inside = true;
|
||||
}
|
||||
clickedComponent = clickedComponent.parentNode;
|
||||
} while (clickedComponent);
|
||||
|
||||
}
|
||||
getFunders () {
|
||||
console.info("Getting Funders....");
|
||||
this._projectService.getFunders().subscribe(
|
||||
data => {
|
||||
this.funders = data[1];
|
||||
console.log("this.funders");
|
||||
},
|
||||
err => console.log(err)
|
||||
);
|
||||
}
|
||||
|
||||
getProjects () {
|
||||
if(this.selectedFunderId != '0'){
|
||||
|
||||
}
|
||||
}
|
||||
funderChanged(funderId:string, funderName:string){
|
||||
this.selectedFunderId = funderId;
|
||||
this.selectedFunderName = funderName;
|
||||
console.info("Selected funder:"+this.selectedFunderId+ ' name:'+funderName );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import {ClaimProjectsSearchFormComponent} from './claimProjectSearchForm.component';
|
||||
// import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
|
||||
|
||||
import {ProjectServiceModule} from '../../landingPages/project/projectService.module';
|
||||
import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, CommonModule,
|
||||
// LoadingModalModule,
|
||||
ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule
|
||||
],
|
||||
providers:[
|
||||
],
|
||||
declarations: [
|
||||
ClaimProjectsSearchFormComponent
|
||||
|
||||
],
|
||||
exports: [ClaimProjectsSearchFormComponent ]
|
||||
})
|
||||
export class ClaimProjectsSearchFormModule { }
|
|
@ -0,0 +1,222 @@
|
|||
|
||||
<form class=" uk-padding uk-padding-large uk-padding-remove-left uk-margin-left uk-grid" uk-grid="">
|
||||
|
||||
<select [(ngModel)]="searchSource" name="select_source" (ngModelChange)="searchSourceChanged(searchSource)" class="uk-select uk-width-1-4">
|
||||
<option value="openaire">in OpenAIRE </option>
|
||||
<option value="crossref">in Crossref </option>
|
||||
<option value="datacite">in Datacite </option>
|
||||
<option value="orcid">in ORCID </option>
|
||||
<option value="all">Search all</option>
|
||||
</select>
|
||||
<input class=" uk-input uk-width-1-2 form-control" [(ngModel)]="keyword" name="keyword" placeholder="Title, doi, author, orcid..."/>
|
||||
<span class="input-group-btn">
|
||||
<button (click)="search(false)" type="submit" class=" uk-button uk-button-default">Search</button>
|
||||
</span>
|
||||
</form>
|
||||
<div *ngIf="showSearchResults" class="uk-margin-top uk-animation">
|
||||
<ul class="uk-tab" uk-tab="animation: uk-animation-fade">
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openairePub')" ><a>Publications <span class="uk-badge uk-badge-notification">{{ (openairePubsNum)?openairePubsNum:0 }}</span></a></li>
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openaireData')" ><a>Research Data <span class="uk-badge uk-badge-notification">{{(openaireDataNum==null)?'0':openaireDataNum}}</span></a></li>
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'openaire'" (click)="clickTab('openaireSoftware')" ><a>Software <span class="uk-badge uk-badge-notification">{{(openaireSoftwareNum==null)?'0':openaireSoftwareNum}}</span></a></li>
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'crossref'" (click)="clickTab('crossref')" ><a>Crossref <span class="uk-badge uk-badge-notification">{{(crossrefResultsNum)?crossrefResultsNum:0}}</span></a></li>
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'datacite'" (click)="clickTab('datacite')"><a>Datacite <span class="uk-badge uk-badge-notification">{{(dataciteResultsNum==null)?'0':dataciteResultsNum}}</span></a></li>
|
||||
<li *ngIf="searchSource == 'all' || searchSource == 'orcid'" (click)="clickTab('orcid')"><a>Orcid <span class="uk-badge uk-badge-notification">{{(orcidResultsNum)?orcidResultsNum:0}}</span></a></li>
|
||||
</ul>
|
||||
|
||||
<div *ngIf="activeTab == 'crossref'" id="crossref" >
|
||||
<div class="uk-margin-top" >
|
||||
<div *ngIf="crossrefStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="crossrefStatus != errorCodes.LOADING && crossrefResults.length == 0" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||
<div *ngIf="crossrefStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="crossrefStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div *ngIf="crossrefResultsNum != null && crossrefResultsNum > 0" class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="crossrefPage" [totalResults]="crossrefResultsNum" [term]="keyword" [size]="size" (pageChange)="crossrefPageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''">
|
||||
<div >
|
||||
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" > <span class="custom-external"></span> {{item.title}}</a>
|
||||
<span *ngIf="!item.URL" >{{item.title}}</span>
|
||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</div>
|
||||
<span *ngIf="item.publisher" class="uk-article-meta">Publisher: {{item.publisher}}</span><span class="uk-article-meta" *ngIf="(item['published-print'] && item['published-print']['date-parts'] && item['published-print']['date-parts'][0])">({{(item['published-print']['date-parts'][0][0])?item['published-print']['date-parts'][0][0]:item['published-print']['date-parts'][0]}})</span>
|
||||
<div *ngIf="item.author && item.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of item.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.author.slice(0,10).length-1))?"; ":""}}{{(i == item.author.slice(0,10).length-1 && item.author.length > 10)?"...":""}}</span></div>
|
||||
<div *ngIf="item.editor && item.editor.length > 0" class="uk-article-meta">Editors: <span *ngFor="let author of item.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.editor.slice(0,10).length-1))?"; ":""}}{{(i == item.editor.slice(0,10).length-1 && item.editor.length > 10)?"...":""}}</span></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab == 'openairePub'" id="openairePubs" class="uk-animation-fade" >
|
||||
<div class = "uk-margin-top">
|
||||
<div *ngIf="openairePubsStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="openairePubsStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||
<div *ngIf="openairePubsStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="openairePubsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div *ngIf="openairePubsNum != null && openairePubsNum > 0" class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="openairePubsPage" [totalResults]="openairePubsNum" [term]="keyword" [size]="size" (pageChange)="openairePubsPageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="openairePubs.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let result of openairePubs " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
||||
<div >
|
||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
||||
<a *ngIf="!isSelected(result.id)" (click)="add(result, result.id, 'openaire', 'publication', result['title'].url, result['title'].name, result.year,result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</div>
|
||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span class="uk-article-meta" *ngIf="(result.year)">({{result.year}})</span>
|
||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab == 'orcid'" id="orcid" class="uk-animation-fade">
|
||||
<div class="uk-margin-top" >
|
||||
<div *ngIf="orcidStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="orcidStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div *ngIf="orcidStatus == errorCodes.NONE && (!authorIds ||authorIds.length == 0)" class = "uk-alert uk-alert-primary " > No results found </div>
|
||||
|
||||
<div *ngIf="orcidResultsNum != null" class="panel-body">
|
||||
<span>Results for
|
||||
<a target="_blank" href="http://orcid.org/{{authorId}}"> <span class="custom-external"></span> {{authorGivenName}} {{authorFamilyName}} - {{authorId}} </a> :
|
||||
</span>
|
||||
<div class = "uk-alert uk-alert-warning " > Not the author you are looking for?
|
||||
|
||||
<span class="dropdown">
|
||||
|
||||
<select [(ngModel)]="selectAuthorId" name="select_author" (ngModelChange)="getOrcidResultsById(selectAuthorId)" >
|
||||
<option [value]="0">Choose another one: </option>
|
||||
<option *ngFor=" let item of authorIds let i = index" [value]="authorIds[i]">{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['put-code']))?'uk-block-muted':''">
|
||||
<div>
|
||||
<span *ngIf="!item.URL" >{{item['work-title']['title'].value}}</span>
|
||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(authorId+item['put-code'])" (click)="add(item,authorId+'-'+item['put-code'],'orcid', 'publication', '', item['work-title']['title'].value, item['publication-date']?item['publication-date'].year.value :null,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</div>
|
||||
<span *ngIf="item['journal-title'] && item['journal-title'].value " class="uk-article-meta">Journal: {{item['journal-title'].value}}</span><span class="uk-article-meta" *ngIf="(item['publication-date']&&item['publication-date'].year&&item['publication-date'].year.value)"> ({{item['publication-date'].year.value}})</span>
|
||||
<div *ngIf="item.contributors && item.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of item.contributors.slice(0,10) let i = index">{{author}}{{(i < (item.contributors.slice(0,10).length-1))?"; ":""}}{{(i == item.contributors.slice(0,10).length-1 && item.contributors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-primary " > No results found </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade">
|
||||
<div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="dataciteStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||
<div *ngIf="dataciteStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="dataciteStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div class = "uk-margin-top">
|
||||
<div *ngIf="dataciteResultsNum != null && dataciteResultsNum > 0" class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="datacitePage" [totalResults]="dataciteResultsNum" [term]="keyword" [size]="size" (pageChange)="datacitePageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.attributes.doi))?'uk-block-muted':''" >
|
||||
<div >
|
||||
<a *ngIf="item.attributes.doi" target="_blank" href="{{'http://dx.doi.org/'+item.attributes.doi}}" > <span class="custom-external"></span> {{item.attributes.title}}</a>
|
||||
<span *ngIf="!item.attributes.doi" >{{item.attributes.title}}</span>
|
||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.attributes.doi)" (click)="add(item, item.attributes.doi,'datacite','dataset', 'http://dx.doi.org/'+item.attributes.doi, item.attributes.title, item.attributes.published,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
|
||||
</div>
|
||||
<span *ngIf="item.attributes['container-title']" class="uk-article-meta">Publisher: {{item.attributes['container-title']}}</span><span *ngIf="(item.attributes.published)" class="uk-article-meta">({{item.attributes.published}})</span>
|
||||
<div *ngIf="item.attributes.author && item.attributes.author.length > 0" class="uk-article-meta">Authors:
|
||||
<span *ngFor="let author of item.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (item.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == item.attributes.author.slice(0,10).length-1 && item.attributes.author.length > 10)?"...":""}}</span></div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab == 'openaireData'" id="openaireData" class="uk-animation-fade">
|
||||
<div *ngIf="openaireDataStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="openaireDataStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||
<div *ngIf="openaireDataStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="openaireDataStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div class = "uk-margin-top">
|
||||
<div *ngIf="openaireDataNum != null && openaireDataNum > 0" class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="openaireDataPage" [totalResults]="openaireDataNum" [term]="keyword" [size]="size" (pageChange)="openaireDataPageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="openaireData.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let result of openaireData " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
||||
<div >
|
||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
||||
|
||||
|
||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
|
||||
(click)="add(result, result.id, 'openaire','dataset', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
|
||||
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</div>
|
||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
|
||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab == 'openaireSoftware'" id="openaireSoftware" class="uk-animation-fade">
|
||||
<div *ngIf="openaireSoftwareStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="openaireSoftwareStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||
<div *ngIf="openaireSoftwareStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
|
||||
<div *ngIf="openaireSoftwareStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
|
||||
<div class = "uk-margin-top">
|
||||
<div *ngIf="openaireSoftwareNum != null && openaireSoftwareNum > 0" class="uk-clearfix">
|
||||
<div class="uk-float-right">
|
||||
<paging-no-load [currentPage]="openaireSoftwarePage" [totalResults]="openaireSoftwareNum" [term]="keyword" [size]="size" (pageChange)="openaireSoftwarePageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<ul *ngIf="openaireSoftware.length > 0 " class="uk-list uk-list-divider">
|
||||
<li *ngFor=" let result of openaireSoftware " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
||||
<div >
|
||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
||||
|
||||
|
||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
|
||||
(click)="add(result, result.id, 'openaire','software', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
|
||||
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||
</div>
|
||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
|
||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,643 @@
|
|||
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import {SearchCrossrefService} from '../claim-utils/service/searchCrossref.service';
|
||||
import {SearchOrcidService} from '../claim-utils/service/searchOrcid.service';
|
||||
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||
import { SearchDataciteService } from '../claim-utils/service/searchDatacite.service';
|
||||
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
||||
import {SearchSoftwareService} from '../../services/searchSoftware.service';
|
||||
|
||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {ClaimResult} from '../claim-utils/claimEntities.class';
|
||||
import{DOI} from '../../utils/string-utils.class';
|
||||
declare var UIkit:any;
|
||||
|
||||
@Component({
|
||||
selector: 'claim-result-search-form',
|
||||
templateUrl: 'claimResultSearchForm.component.html',
|
||||
|
||||
})
|
||||
export class ClaimResultSearchFormComponent {
|
||||
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService, private _searchSoftwareService:SearchSoftwareService,
|
||||
private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
|
||||
private route: ActivatedRoute) {
|
||||
var myDate = new Date();
|
||||
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
if(this.keyword !=null && this.keyword.length > 0){
|
||||
this.search(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
page : number = 1;
|
||||
size:number = 5;
|
||||
navigateTo: string = "Search";
|
||||
source: string = "datacite";
|
||||
type : string = "dataset";
|
||||
showSearchResults:boolean=false;
|
||||
// searchType ="publication";
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public keyword:string = '';
|
||||
@Input() public selectedResults:ClaimResult[];
|
||||
// @Output() datasetsChange = new EventEmitter();
|
||||
// @Output() publicationsChange = new EventEmitter();
|
||||
|
||||
// @Output() resultsChange = new EventEmitter();
|
||||
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
dataciteResults=[];
|
||||
dataciteResultsNum:number = null;
|
||||
// dataciteResultsNum : Observable<number> = null;
|
||||
dataciteStatus = this.errorCodes.NONE;
|
||||
datacitePage : number = 1;
|
||||
|
||||
openaireData=[];
|
||||
openaireDataNum:number = 0 ;
|
||||
openaireDataStatus = this.errorCodes.NONE;
|
||||
openaireDataPage : number = 1;
|
||||
openaireSoftware=[];
|
||||
openaireSoftwareNum:number = 0 ;
|
||||
openaireSoftwareStatus = this.errorCodes.NONE;
|
||||
openaireSoftwarePage : number = 1;
|
||||
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
public todayDate = '';
|
||||
public nextDate = '';
|
||||
public DOIs:string[] = [];
|
||||
sub: any;
|
||||
public searchSource:string = "openaire"
|
||||
public activeTab:string = "openairePub"
|
||||
|
||||
|
||||
crossrefResults=[];
|
||||
crossrefResultsNum : number = null;
|
||||
crossrefPage : number = 1;
|
||||
crossrefStatus:number = this.errorCodes.NONE;
|
||||
|
||||
openairePubs = [];
|
||||
openairePubsNum: number ;
|
||||
openairePubsPage : number = 1;
|
||||
openairePubsStatus:number = this.errorCodes.NONE;
|
||||
|
||||
orcidResults: string[];
|
||||
orcidResultsNum: number ;
|
||||
totalPages: number;
|
||||
orcidResultsToShow: string[];
|
||||
orcidPage : number = 1;
|
||||
orcidStatus:number = this.errorCodes.NONE;
|
||||
authorId: string;
|
||||
selectAuthorId: string = "0";
|
||||
authorGivenName: string;
|
||||
authorFamilyName: string;
|
||||
|
||||
authorIds: string[];
|
||||
authorGivenNames: string[];
|
||||
authorFamilyNames: string[];
|
||||
|
||||
authorsNum : number ;
|
||||
|
||||
reloadOpenaire:boolean = true;
|
||||
reloadCrossref:boolean = false;
|
||||
reloadDatacite:boolean = false;
|
||||
reloadOrcid:boolean = false;
|
||||
|
||||
|
||||
|
||||
|
||||
search(sourceChanged){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
if(!sourceChanged){
|
||||
this.DOIs = DOI.getDOIsFromString(this.keyword);
|
||||
this.reloadOpenaire = true;
|
||||
this.reloadCrossref = true;
|
||||
this.reloadDatacite = true;
|
||||
this.reloadOrcid = true;
|
||||
}
|
||||
if((this.searchSource == "all" || this.searchSource == "openaire") && this.reloadOpenaire){
|
||||
this.searchOpenairePubs(this.keyword, this.size, 1);
|
||||
this.searchOpenaireData(this.keyword,this.size,1);
|
||||
this.searchOpenaireSoftware(this.keyword,this.size,1);
|
||||
this.reloadOpenaire = false;
|
||||
}
|
||||
if((this.searchSource == "all" || this.searchSource == "crossref")&&this.reloadCrossref){
|
||||
this.getCrossrefResults(this.keyword, this.size,1);
|
||||
this.reloadCrossref = false;
|
||||
}
|
||||
if((this.searchSource == "all" || this.searchSource == "datacite")&& this.reloadDatacite){
|
||||
this.searchDatacite(this.keyword,this.size,1);
|
||||
this.reloadDatacite = false;
|
||||
}
|
||||
if((this.searchSource == "all" || this.searchSource == "orcid")&& this.reloadOrcid){
|
||||
this.searchOrcid(this.keyword);
|
||||
this.reloadOrcid = false;
|
||||
}
|
||||
this.showSearchResults = true;
|
||||
|
||||
}
|
||||
|
||||
private getCrossrefResults (term: string, size : number, page : number) {
|
||||
this.crossrefStatus = this.errorCodes.LOADING;
|
||||
if( this.DOIs.length > 0 ){
|
||||
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.crossrefResults = data.items;
|
||||
this.crossrefPage=page;
|
||||
this.crossrefResultsNum = data['total-results'];
|
||||
if(data.items == 0){
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.crossrefResults = data.items;
|
||||
this.crossrefPage=page;
|
||||
this.crossrefResultsNum = data['total-results'];
|
||||
this.crossrefStatus = this.errorCodes.DONE;
|
||||
|
||||
}else{
|
||||
this.crossrefStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
},
|
||||
err =>{
|
||||
console.log(err.status);
|
||||
this.crossrefStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
|
||||
);
|
||||
}else{
|
||||
this.crossrefStatus = this.errorCodes.DONE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
//console.log(err);
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.crossrefResults = data.items;
|
||||
this.crossrefPage=page;
|
||||
this.crossrefResultsNum = data['total-results'];
|
||||
this.crossrefStatus = this.errorCodes.DONE;
|
||||
|
||||
},
|
||||
err => {
|
||||
console.log(err.status);
|
||||
this.crossrefStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.crossrefResults = data.items;
|
||||
this.crossrefPage=page;
|
||||
this.crossrefResultsNum = data['total-results'];
|
||||
this.crossrefStatus = this.errorCodes.DONE;
|
||||
|
||||
}else{
|
||||
this.crossrefStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
|
||||
},
|
||||
err => {
|
||||
console.log(err.status);
|
||||
this.crossrefStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
private searchOpenairePubs(term: string, size : number, page : number) {
|
||||
|
||||
if(this.DOIs.length > 0 ){
|
||||
this.openairePubsStatus = this.errorCodes.LOADING;
|
||||
this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openairePubsPage=page;
|
||||
this.openairePubsNum = data[0];
|
||||
this.openairePubs = data[1];
|
||||
this.openairePubsStatus = this.errorCodes.DONE;
|
||||
if(this.openairePubsNum == 0){
|
||||
this.openairePubsStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}else {
|
||||
this.openairePubsStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openairePubsStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this.openairePubsStatus = this.errorCodes.LOADING;
|
||||
this._searchPublicationsService.searchPublications('q='+term, null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openairePubsPage=page;
|
||||
this.openairePubsNum = data[0];
|
||||
this.openairePubs = data[1];
|
||||
this.openairePubsStatus = this.errorCodes.DONE;
|
||||
if(this.openairePubsNum == 0){
|
||||
this.openairePubsStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}else {
|
||||
this.openairePubsStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openairePubsStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private searchOrcid (term: string) {
|
||||
if(this.DOIs.length > 0){
|
||||
this.orcidStatus = this.errorCodes.NONE;
|
||||
return;
|
||||
}
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
this.authorIds = new Array<string>();
|
||||
this.authorGivenNames = new Array<string>();
|
||||
this.authorFamilyNames = new Array<string>();
|
||||
|
||||
this.getOrcidAuthor(term);
|
||||
|
||||
console.info('searchOrcid in searchOrcid file');
|
||||
}
|
||||
|
||||
private readData(data: any) {
|
||||
this.authorIds.push(data[2].path);
|
||||
|
||||
if(data[0] != null) {
|
||||
this.authorGivenNames.push(data[0].value);
|
||||
} else {
|
||||
this.authorGivenNames.push("");
|
||||
}
|
||||
if(data[1] != null) {
|
||||
this.authorFamilyNames.push(data[1].value);
|
||||
} else {
|
||||
this.authorFamilyNames.push("");
|
||||
}
|
||||
}
|
||||
|
||||
private getOrcidAuthor (term: string) {
|
||||
this.orcidResultsNum = null;
|
||||
|
||||
//passing structures in order to fill them in service
|
||||
this._searchOrcidService.searchOrcidAuthor(term, this.authorIds,
|
||||
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
||||
data => {
|
||||
if(data != null && data == true) {
|
||||
this.getOrcidResultsByIndex(0);
|
||||
}
|
||||
|
||||
this.orcidStatus = this.errorCodes.NONE;
|
||||
|
||||
},
|
||||
err => this.errorHandler(err, term)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
private errorHandler(err: any, term: string) {
|
||||
if(err.status == 404){
|
||||
this.getOrcidAuthors(term);
|
||||
} else {
|
||||
this.orcidStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private getOrcidAuthors (term: string) {
|
||||
this.orcidResultsNum = null;
|
||||
this.selectAuthorId = "0";
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
//passing structures in order to fill them in service
|
||||
this._searchOrcidService.searchOrcidAuthors(term, this.authorIds,
|
||||
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
||||
data => {
|
||||
if(data != null && data == true) {
|
||||
this.getOrcidResultsByIndex(0);
|
||||
}else{
|
||||
this.orcidStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
|
||||
},
|
||||
err => {
|
||||
this.orcidStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private getOrcidResultsByIndex (index:number) {
|
||||
if(this.authorIds.length > index) {
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
let id = this.authorIds[index];
|
||||
this.authorGivenName = this.authorGivenNames[index];
|
||||
this.authorFamilyName = this.authorFamilyNames[index];
|
||||
this.getOrcidResultsById(id);
|
||||
}
|
||||
}
|
||||
private getOrcidResultsById (id:string) {
|
||||
if(id=="0"){
|
||||
return;
|
||||
}
|
||||
var index = this.authorIds.indexOf(id);
|
||||
this.authorGivenName = this.authorGivenNames[index];
|
||||
this.authorFamilyName = this.authorFamilyNames[index];
|
||||
this.authorId = id;
|
||||
console.info("getOrcidResultsById: "+id);
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
this._searchOrcidService.searchOrcidPublications(id).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.orcidResults=data['orcid-work'];
|
||||
this.orcidResultsNum = data['orcid-work'].length;
|
||||
this.orcidPage = 1;
|
||||
if((this.orcidResultsNum % this.size) == 0){
|
||||
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size));
|
||||
} else{
|
||||
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size+1));
|
||||
}
|
||||
|
||||
this.orcidResultsToShow = this.orcidResults.slice(0,10);
|
||||
|
||||
this.orcidStatus = this.errorCodes.DONE;
|
||||
if(this.orcidResultsNum == 0){
|
||||
this.orcidStatus = this.errorCodes.NONE;
|
||||
}
|
||||
} else {
|
||||
this.orcidResultsNum = 0;
|
||||
this.totalPages=0;
|
||||
this.orcidStatus = this.errorCodes.NONE;
|
||||
}
|
||||
|
||||
},
|
||||
err => {
|
||||
console.log(err.status);
|
||||
this.orcidStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Is it USED???
|
||||
private remove(item){
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
var index:number =this.selectedResults.indexOf(item);
|
||||
item.selected=false;
|
||||
if (index > -1) {
|
||||
this.selectedResults.splice(index, 1);
|
||||
// this.publicationsChange.emit({
|
||||
// value: this.selectedResults
|
||||
// });
|
||||
}
|
||||
|
||||
}*/
|
||||
private crossrefPageChange($event) {
|
||||
this.crossrefPage=$event.value;
|
||||
this.crossrefResults=[];
|
||||
console.log("Crossref chaenged "+this.crossrefPage);
|
||||
this.getCrossrefResults(this.keyword,this.size,this.crossrefPage);
|
||||
}
|
||||
private orcidPageChange($event) {
|
||||
this.orcidPage=$event.value;
|
||||
this.orcidResultsToShow=[];
|
||||
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
|
||||
}
|
||||
private openairePubsPageChange($event) {
|
||||
this.openairePubsPage=$event.value;
|
||||
this.searchOpenairePubs(this.keyword,this.size,this.openairePubsPage);
|
||||
}
|
||||
datacitePageChange($event) {
|
||||
this.datacitePage=$event.value;
|
||||
this.dataciteResults=[];
|
||||
this.searchDatacite(this.keyword,10,this.datacitePage);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
openaireDataPageChange($event) {
|
||||
this.openaireDataPage=$event.value;
|
||||
this.openaireData=[];
|
||||
this.searchOpenaireData(this.keyword,10,this.openaireDataPage);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
openaireSoftwarePageChange($event) {
|
||||
this.openaireSoftwarePage=$event.value;
|
||||
this.openaireSoftware=[];
|
||||
this.searchOpenaireSoftware(this.keyword,10,this.openaireSoftwarePage);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
|
||||
private isSelected(id:string){
|
||||
|
||||
var found:boolean = false;
|
||||
this.warningMessage = "";
|
||||
for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
||||
let item = this.selectedResults[_i];
|
||||
if(item.id == id){
|
||||
found=true;
|
||||
this.warningMessage = "Publication already in selected list";
|
||||
}
|
||||
}
|
||||
return found;
|
||||
|
||||
|
||||
}
|
||||
// isSelected(id:string){
|
||||
//
|
||||
// var found:boolean = false;
|
||||
// this.warningMessage = "";
|
||||
// for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
||||
// let item = this.selectedResults[_i];
|
||||
// if(item.id == id){
|
||||
// found=true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return found;
|
||||
// }
|
||||
private searchDatacite (term: string, size : number, page : number) {
|
||||
this.getDataciteResults(term,size,page);
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
private searchOpenaireData (term: string, size : number, page : number) {
|
||||
if(this.DOIs.length > 0 ){
|
||||
this.openaireDataStatus = this.errorCodes.LOADING;
|
||||
this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openaireDataPage=page;
|
||||
this.openaireDataNum = data[0];
|
||||
this.openaireData = data[1];
|
||||
this.openaireDataStatus = this.errorCodes.DONE;
|
||||
if(this.openaireDataNum == 0){
|
||||
this.openaireDataStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openaireDataStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this._searchDatasetsService.searchDatasets('q='+term+'', null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openaireDataPage=page;
|
||||
this.openaireDataNum = data[0];
|
||||
this.openaireData = data[1];
|
||||
this.openaireDataStatus = this.errorCodes.DONE;
|
||||
if(this.openaireDataNum == 0){
|
||||
this.openaireDataStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openaireDataStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
private searchOpenaireSoftware (term: string, size : number, page : number) {
|
||||
if(this.DOIs.length > 0 ){
|
||||
this.openaireSoftwareStatus = this.errorCodes.LOADING;
|
||||
this._searchSoftwareService.searchSoftwareByDois(this.DOIs, null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openaireSoftwarePage=page;
|
||||
this.openaireSoftwareNum = data[0];
|
||||
this.openaireSoftware = data[1];
|
||||
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
||||
if(this.openaireSoftwareNum == 0){
|
||||
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openaireSoftwareStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this._searchSoftwareService.searchSoftware('q='+term+'', null, page, size, []).subscribe(
|
||||
data => {
|
||||
if(data != null) {
|
||||
this.openaireSoftwarePage=page;
|
||||
this.openaireSoftwareNum = data[0];
|
||||
this.openaireSoftware = data[1];
|
||||
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
||||
if(this.openaireSoftwareNum == 0){
|
||||
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
this.openaireSoftwareStatus = this.errorCodes.ERROR;
|
||||
console.log(err.status);
|
||||
}
|
||||
);
|
||||
}
|
||||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
|
||||
}
|
||||
private getDataciteResults (term: string, size : number, page : number) {
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data.data;
|
||||
this.datacitePage=page;
|
||||
this.dataciteResultsNum = data.meta.total;
|
||||
this.dataciteStatus = this.errorCodes.DONE;
|
||||
|
||||
|
||||
},
|
||||
err => {
|
||||
this.dataciteStatus = this.errorCodes.ERROR;
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
||||
|
||||
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
|
||||
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode);
|
||||
|
||||
|
||||
if (itemSource == 'orcid'){
|
||||
if(result.authors.length ==0 ){
|
||||
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName);
|
||||
}
|
||||
}
|
||||
var found:boolean = this.isSelected( result.id);
|
||||
|
||||
this.warningMessage = "";
|
||||
if (!found) {
|
||||
this.selectedResults.push(result);
|
||||
|
||||
UIkit.notification({
|
||||
message : 'A new research result is selected.',
|
||||
status : 'primary',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
|
||||
|
||||
}else{
|
||||
this.warningMessage = "Research Data already in selected list";
|
||||
UIkit.notification({
|
||||
message : 'The research result is already on your list.',
|
||||
status : 'warning',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public searchSourceChanged(source){
|
||||
this.searchSource = source;
|
||||
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source;
|
||||
if(this.keyword && this.keyword.length > 0){
|
||||
this.search(true);
|
||||
}
|
||||
}
|
||||
public clickTab(tab){
|
||||
this.activeTab = tab;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component';
|
||||
|
||||
import {SearchDataciteServiceModule} from './service/searchDataciteService.module';
|
||||
|
||||
import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module';
|
||||
import {SearchOrcidService} from './service/searchOrcid.service';
|
||||
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {SoftwareServiceModule} from '../../services/softwareService.module';
|
||||
import {PagingModule } from '../../utils/paging.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule,
|
||||
SearchDataciteServiceModule,SoftwareServiceModule],
|
||||
providers:[
|
||||
SearchOrcidService
|
||||
],
|
||||
declarations: [
|
||||
ClaimResultSearchFormComponent
|
||||
|
||||
],
|
||||
exports: [ClaimResultSearchFormComponent ]
|
||||
})
|
||||
export class ClaimResultSearchFormModule { }
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
<div class="uk-width-1-1">
|
||||
<helper position="top"></helper>
|
||||
</div>
|
||||
<div class="uk-grid helper-grid">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
<form class="">
|
||||
|
||||
|
||||
<div class="-row">
|
||||
<span class="uk-text-bold">Filter By:</span>
|
||||
<input type="text" class=" uk-input form-control" placeholder="Search for keywords in titles ..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" name="claims-keyword" ></div>
|
||||
<div class="uk-margin-small-top">
|
||||
<label class="uk-margin-small-right"> <input [(ngModel)]="projectCB" type="checkbox" (ngModelChange)="changeType()" name="project" />
|
||||
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>
|
||||
Project </label>
|
||||
<label class="uk-margin-small-right"> <input [(ngModel)]="publicationCB" type="checkbox" (ngModelChange)="changeType()" name="publication" />
|
||||
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect><polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span>
|
||||
Publication </label>
|
||||
<label class="uk-margin-small-right"> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" name="dataset" />
|
||||
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
|
||||
Research Data </label>
|
||||
<label class="uk-margin-small-right"> <input [(ngModel)]="softwareCB" type="checkbox" (ngModelChange)="changeType()" name="software" />
|
||||
<span class="uk-icon" >
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
|
||||
</span>
|
||||
Software </label>
|
||||
<label class="uk-margin-small-right"> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" name="context" />
|
||||
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>
|
||||
Context </label>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin="">
|
||||
|
||||
<div *ngIf="resultsNum" class="uk-float-right">
|
||||
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
|
||||
<div *ngIf="resultsNum>0" class="uk-width-1-2">
|
||||
<span > Show
|
||||
<select *ngIf="resultsNum>10" class="uk-width-1-2 uk-select" [(ngModel)]="size" name="select_size" (ngModelChange)="changeSize(size)" >
|
||||
<option *ngFor="let size of sizes" [value]="size">{{size}}</option>
|
||||
</select>
|
||||
</span>
|
||||
<span >Showing {{(size*page - size +1)}} to {{(size*page>resultsNum)?resultsNum:(size*page)}} of {{resultsNum}} claims </span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="showErrorMessage " class = "uk-alert uk-alert-danger " >
|
||||
An Error occured.
|
||||
</div>
|
||||
<div *ngIf="showForbiddenMessage " class = "uk-alert uk-alert-danger " >
|
||||
You are not allowed to access this page.
|
||||
</div>
|
||||
<div *ngIf="userValidMessage.length > 0 " class = "uk-alert uk-alert-danger " >
|
||||
User session is not valid. Please login again.
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Buttons for selecting and Delete Claims -->
|
||||
<div *ngIf="enableDelete">
|
||||
<div *ngIf="selected.length>0 && resultsNum > 0 ">
|
||||
<div class = "uk-alert uk-alert-primary " >
|
||||
You have selected {{selected.length}} claim(s)
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="deleteMessage.length>0 " [innerHTML]="deleteMessage">
|
||||
|
||||
</div>
|
||||
<button class=" uk-button uk-button-default" (click)="confirmOpen()"> <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="trash" ratio="1"><polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" width="1" height="9"></rect><rect x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> Delete</button>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
<div *ngIf=" claims && claims.length == 0" >
|
||||
<div class = "uk-alert uk-alert-primary " >No entries found.</div>
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<table *ngIf="claims && claims.length > 0" class="uk-table uk-table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngIf="enableDelete"><input id="checkAll" type="checkbox" (click)="selectAll($event)" [ngModel]="selected.length==claims.length" /></th>
|
||||
<!--<th>Id</th>
|
||||
<!-- <th>Target Type</th> -->
|
||||
<th><a (click)="changeOrderby('target')" >Research Result</a> </th>
|
||||
<!--<th>Source type</th> -->
|
||||
<th><a (click)="changeOrderby('source')" >Link to</a> </th>
|
||||
|
||||
<th *ngIf="showUserEmail"><a (click)="changeOrderby('user')" >Claimed by</a> </th>
|
||||
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let claim of claims " >
|
||||
<td *ngIf="enableDelete"><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="isSelected(claim.id)"/></td>
|
||||
|
||||
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td>
|
||||
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>
|
||||
<td *ngIf="showUserEmail">{{claim.userMail}}</td>
|
||||
<td>{{claim.date}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
<helper position="bottom"></helper>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
|
@ -0,0 +1,495 @@
|
|||
import {Component, ViewChild, Input} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ClaimsService} from '../service/claims.service';
|
||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||
import {AlertModal} from '../../../utils/modal/alert';
|
||||
import {Session} from '../../../login/utils/helper.class';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'displayClaims',
|
||||
templateUrl: 'displayClaims.component.html',
|
||||
providers:[ ClaimsService]
|
||||
|
||||
})
|
||||
export class DisplayClaimsComponent {
|
||||
constructor (private _claimService: ClaimsService, private route: ActivatedRoute, private _router:Router, private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
if( this.myClaims){
|
||||
this.fetchBy = "User";
|
||||
this.fetchId = Session.getUserEmail();
|
||||
}else{
|
||||
|
||||
this.fetchBy = params['fetchBy'];
|
||||
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
|
||||
this.fetchId = params['fetchId'];
|
||||
this.fetchId = this.fetchId?this.fetchId:'';
|
||||
|
||||
}
|
||||
|
||||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
let size = (params['size']=== undefined)?10:+params['size'];
|
||||
|
||||
this.keyword = (params['keyword']?params['keyword']:"");
|
||||
this.inputkeyword = this.keyword;
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.size = ( size <= 0 ) ? 10 : size;
|
||||
this.entityTypes = []//(params['types']?params['types']:[]);
|
||||
this.setTypes(params['types']); // check the appropriate checkboxes
|
||||
this.setSortby(params['sort']);
|
||||
this.getClaims();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
sub: any;
|
||||
//string because comes as input from component directive
|
||||
@Input() enableDelete: boolean = false;
|
||||
@Input() showUserEmail: boolean = true;
|
||||
@Input() myClaims: boolean= false ;
|
||||
@Input() isAdmin:boolean = false;
|
||||
page : number;
|
||||
size:number;
|
||||
sizes = [10,20,30,50];
|
||||
keyword:string; // the keyword string to give to the request as parameter
|
||||
inputkeyword:string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing)
|
||||
lengths = [10,20,30,50];
|
||||
types = ["All","Project","Context","Result","User"];
|
||||
@Input() fetchBy:string;
|
||||
@Input() fetchId:string;
|
||||
|
||||
navigateTo: string = "Claims";
|
||||
resultsNum: number ;
|
||||
claims: string[];
|
||||
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
|
||||
//checkboxes:
|
||||
publicationCB = false;
|
||||
datasetCB = false;
|
||||
softwareCB = false;
|
||||
contextCB = false;
|
||||
projectCB = false;
|
||||
entityTypes : string[] =[] ;
|
||||
|
||||
descending = true;
|
||||
sortby = "date";
|
||||
|
||||
selected=[];
|
||||
deleteMessage:string = "";
|
||||
showErrorMessage:boolean = false;
|
||||
showForbiddenMessage:boolean = false;
|
||||
userValidMessage:string = "";
|
||||
|
||||
//params for pagingFormatter to use when navigate to page
|
||||
params;
|
||||
@ViewChild(AlertModal) alert;
|
||||
|
||||
claimsDeleted:number = 0;
|
||||
|
||||
getClaims () {
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.userValidMessage = "User session has expired. Please login again.";
|
||||
|
||||
}else{
|
||||
var token=Session.getUserJwt();
|
||||
this.selected=[];
|
||||
var types = '';
|
||||
this.showErrorMessage = false;
|
||||
this.showForbiddenMessage = false;
|
||||
for (var type of this.entityTypes){
|
||||
types+=(types.length>0?'&':'')+"types="+type;
|
||||
}
|
||||
if(this.fetchBy =="Project" ){
|
||||
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => {
|
||||
this.handleErrors(err);
|
||||
}
|
||||
);
|
||||
}else if(this.fetchBy =="User"){
|
||||
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => {
|
||||
this.handleErrors(err);
|
||||
}
|
||||
);
|
||||
}else if(this.fetchBy =="Result"){
|
||||
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= data.total;
|
||||
},
|
||||
err => {
|
||||
this.handleErrors(err);
|
||||
}
|
||||
);
|
||||
}else if(this.fetchBy =="Context"){
|
||||
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum= null;
|
||||
this.resultsNum= data.total;//data.length; //TODO get the total results num
|
||||
},
|
||||
err => {
|
||||
this.handleErrors(err);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types).subscribe(
|
||||
data => {
|
||||
this.claims = data.data;
|
||||
this.resultsNum = null;
|
||||
this.resultsNum= data.total;//data.length; //TODO get the total results num
|
||||
},
|
||||
err => {
|
||||
this.handleErrors(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
handleErrors(err){
|
||||
|
||||
this.showErrorMessage = true;
|
||||
try{
|
||||
var error = err.json()
|
||||
var code = error.code;
|
||||
if(code == 403){
|
||||
this.showErrorMessage = false;
|
||||
this.showForbiddenMessage = true;
|
||||
}
|
||||
}catch (e) {
|
||||
console.log("Couldn't parse answer as json")
|
||||
this.showErrorMessage = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goTo(page:number = 1){
|
||||
|
||||
this.page = page;
|
||||
|
||||
this.location.go(location.pathname,this.getParametersString());
|
||||
this.getClaims();
|
||||
}
|
||||
getParameters(){
|
||||
var params = {}
|
||||
if(this.myClaims){
|
||||
params={ page: this.page, size: this.size, types: this.entityTypes, keyword : this.keyword, sort: this.getSortby() };
|
||||
}else{
|
||||
params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() };
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
getParametersString(){
|
||||
var params='';
|
||||
params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
|
||||
params+=(this.size==10?"":(params.length>0?'&':'')+"size="+this.size);
|
||||
// params+=(this.entityTypes==''?"":(params.length>0?'&':'')+"types="+this.entityTypes);
|
||||
var types="";
|
||||
for (var type of this.entityTypes){
|
||||
types+=(types.length>0?',':'')+type;
|
||||
}
|
||||
params+=(types.length>0)?"types="+types:"";
|
||||
|
||||
if(this.isAdmin ){
|
||||
params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
|
||||
params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
|
||||
}
|
||||
params+=(this. getSortby()=='datedesc'?"":(params.length>0?'&':'')+"sort="+this. getSortby());
|
||||
params+=(this.keyword==''?"":(params.length>0?'&':'')+"keyword="+this.keyword);
|
||||
return params;
|
||||
}
|
||||
changeSize(size: number ){
|
||||
this.goTo();
|
||||
}
|
||||
|
||||
clearFilters(){
|
||||
this.keyword = '';
|
||||
this.inputkeyword = '';
|
||||
this.publicationCB = false;
|
||||
this.projectCB = false;
|
||||
this.datasetCB = false;
|
||||
this.softwareCB = false;
|
||||
this.contextCB = false;
|
||||
this.entityTypes = [];
|
||||
this.goTo();
|
||||
}
|
||||
|
||||
changeOrderby(sortby:string){
|
||||
if(sortby==this.sortby){
|
||||
this.descending = !this.descending;
|
||||
}else{
|
||||
this.sortby = sortby;
|
||||
this.descending = false;
|
||||
}
|
||||
this.goTo();
|
||||
}
|
||||
setSortby(sortby:string){
|
||||
if(!sortby|| sortby == "datedesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "date";
|
||||
}else if(sortby == "dateasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "date";
|
||||
}else if(sortby == "userasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "user";
|
||||
}else if(sortby == "userdesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "user";
|
||||
}if(sortby =="sourceasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "source";
|
||||
}else if(sortby == "sourcedesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "source";
|
||||
}else if(sortby == "targetasc"){
|
||||
this.descending = false;
|
||||
this.sortby = "target";
|
||||
}else if(sortby == "targetdesc"){
|
||||
this.descending = true;
|
||||
this.sortby = "target";
|
||||
}
|
||||
}
|
||||
getSortby():string{
|
||||
if(this.descending){
|
||||
return this.sortby+"desc";
|
||||
}else{
|
||||
return this.sortby+"asc";
|
||||
}
|
||||
|
||||
}
|
||||
changeType(){
|
||||
this.entityTypes = [];
|
||||
if(this.publicationCB){
|
||||
this.entityTypes.push('publication');
|
||||
}
|
||||
if(this.datasetCB){
|
||||
this.entityTypes.push('dataset');
|
||||
}
|
||||
if(this.softwareCB){
|
||||
this.entityTypes.push('software');
|
||||
}
|
||||
if(this.projectCB){
|
||||
this.entityTypes.push('project');
|
||||
}
|
||||
if(this.contextCB){
|
||||
this.entityTypes.push('context');
|
||||
}
|
||||
|
||||
this.goTo();
|
||||
}
|
||||
setTypes(types:string){
|
||||
if(!types){
|
||||
return;
|
||||
}
|
||||
if(types.length > 0){
|
||||
this.entityTypes = [];
|
||||
if(types.indexOf("publication")!=-1){
|
||||
this.publicationCB = true;
|
||||
this.entityTypes.push("publication");
|
||||
}
|
||||
if(types.indexOf("dataset")!=-1){
|
||||
this.datasetCB = true;
|
||||
this.entityTypes.push("dataset");
|
||||
}
|
||||
if(types.indexOf("software")!=-1){
|
||||
this.softwareCB = true;
|
||||
this.entityTypes.push("software");
|
||||
}
|
||||
if(types.indexOf("project")!=-1){
|
||||
this.projectCB = true;
|
||||
this.entityTypes.push("project");
|
||||
}
|
||||
if(types.indexOf("context")!=-1){
|
||||
this.contextCB = true;
|
||||
this.entityTypes.push("context");
|
||||
}
|
||||
}
|
||||
if(this.publicationCB && this.datasetCB && this.softwareCB && this.contextCB && this.projectCB){
|
||||
this.entityTypes=[];
|
||||
}
|
||||
}
|
||||
changekeyword(){
|
||||
|
||||
if(this.inputkeyword.length >= 3 || this.inputkeyword.length == 0 ){
|
||||
this.keyword = this.inputkeyword;
|
||||
this.page = 1;
|
||||
this.goTo();
|
||||
}
|
||||
|
||||
}
|
||||
select(item:any,event){
|
||||
this.deleteMessage="";
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
this.selected.push(item);
|
||||
}else{
|
||||
for (var _i = 0; _i < this.selected.length; _i++) {
|
||||
let claim = this.selected[_i];
|
||||
if(claim['id'] == item.id){
|
||||
this.selected.splice(_i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
selectAll(event){
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
this.selected = [];
|
||||
for (var _i = 0; _i < this.claims.length; _i++) {
|
||||
let claim = this.claims[_i];
|
||||
this.selected.push(claim);
|
||||
}
|
||||
this.deleteMessage = "";
|
||||
}else{
|
||||
this.selected = [];
|
||||
this.deleteMessage="";
|
||||
}
|
||||
}
|
||||
|
||||
isSelected(id:string){
|
||||
for (var _i = 0; _i < this.selected.length; _i++) {
|
||||
let claim = this.selected[_i];
|
||||
if(claim['id'] == id){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
confirmOpen(){
|
||||
if(this.selected.length <= 0){
|
||||
|
||||
}else{
|
||||
this.alert.cancelButton = true;
|
||||
this.alert.okButton = true;
|
||||
this.alert.alertTitle = "Delete "+this.selected.length+" claim(s)";
|
||||
this.alert.message = this.selected.length+" claims will be deleted. Do you want to proceed? ";
|
||||
this.alert.okButtonText = "Yes";
|
||||
this.alert.cancelButtonText = "No";
|
||||
this.alert.open();
|
||||
}
|
||||
}
|
||||
confirmClose(data){
|
||||
this.delete();
|
||||
}
|
||||
delete(){
|
||||
this.deleteMessage="";
|
||||
this.loading.open();
|
||||
this.claimsDeleted = 0;
|
||||
var ids = [];
|
||||
for (var i = 0; i < this.selected.length; i++){
|
||||
var id =this.selected[i].id;
|
||||
ids.push(id);
|
||||
// var selected =this.selected[i].id;
|
||||
// console.warn("Deleting claim with id:"+id);
|
||||
// this.deleteById(id);
|
||||
//TODO for multiple concurrent
|
||||
}
|
||||
this.batchDeleteById(ids);
|
||||
}
|
||||
|
||||
deleteById(id:string){
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.userValidMessage = "User session has expired. Please login again.";
|
||||
|
||||
}else{
|
||||
var token=Session.getUserJwt();
|
||||
console.log("Deleting claim with id:"+id);
|
||||
// this._claimService.deleteClaimById(id);
|
||||
this._claimService.deleteClaimById(id).subscribe(
|
||||
res => {
|
||||
console.log('Delete response'+res.code );
|
||||
console.log("Deleted claim with id:"+ id);
|
||||
//remove this claim from the
|
||||
let newClaims=this.claims;
|
||||
for (var _i = 0; _i < this.claims.length; _i++) {
|
||||
let claim = this.claims[_i];
|
||||
if(claim['id'] == id){
|
||||
newClaims.splice(_i, 1);
|
||||
}
|
||||
}
|
||||
//TODO should call getClaims???
|
||||
this.claimsDeleted++;
|
||||
this.claims = newClaims;
|
||||
if(this.claimsDeleted == this.selected.length){
|
||||
this.resultsNum = this.resultsNum - this.selected.length;
|
||||
this.loading.close();
|
||||
this.selected = [];
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
batchDeleteById(ids:string[]){
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.userValidMessage = "User session has expired. Please login again.";
|
||||
|
||||
}else{
|
||||
var token=Session.getUserJwt();
|
||||
console.warn("Deleting claim with ids:"+ids);
|
||||
this._claimService.deleteBulk(ids).subscribe(
|
||||
res => {
|
||||
console.info('Delete response'+res.code );
|
||||
console.warn("Deleted ids:"+ res.deletedIds);
|
||||
console.warn("Not found ids:"+ res.notFoundIds);
|
||||
//remove this claim from the
|
||||
let newClaims=this.claims;
|
||||
for(var id of res.deletedIds){
|
||||
for (var _i = 0; _i < this.claims.length; _i++) {
|
||||
let claim = this.claims[_i];
|
||||
if(claim['id'] == id){
|
||||
newClaims.splice(_i, 1);
|
||||
}
|
||||
}
|
||||
for (var _i = 0; _i < this.selected.length; _i++) {
|
||||
let claim = this.selected[_i];
|
||||
if(claim['id'] == id){
|
||||
this.selected.splice(_i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.claims = newClaims;
|
||||
this.resultsNum = this.resultsNum - res.deletedIds.length;
|
||||
this.loading.close();
|
||||
if(res.deletedIds.length>0){
|
||||
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-primary " >'+res.deletedIds.length+' claim(s) successfully deleted.</div>';
|
||||
}
|
||||
if(res.notFoundIds.length>0){
|
||||
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>';
|
||||
}
|
||||
}, err => {
|
||||
console.log(err);
|
||||
this.showErrorMessage = true;
|
||||
this.loading.close();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
pageChange($event) {
|
||||
var page:number = +$event.value
|
||||
this.goTo(page);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import {ClaimServiceModule} from '../service/claimsService.module';
|
||||
import {DisplayClaimsComponent} from './displayClaims.component';
|
||||
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
|
||||
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
|
||||
import {ClaimEntityFormatterModule} from '../entityFormatter/claimEntityFormatter.module';
|
||||
import {PagingModule } from '../../../utils/paging.module';
|
||||
import {HelperModule} from '../../../utils/helper/helper.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, ClaimServiceModule, LoadingModalModule, AlertModalModule,
|
||||
ClaimEntityFormatterModule, PagingModule, HelperModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
DisplayClaimsComponent
|
||||
|
||||
],
|
||||
exports: [
|
||||
DisplayClaimsComponent
|
||||
]
|
||||
})
|
||||
export class DisplayClaimsModule { }
|
|
@ -0,0 +1,48 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
|
||||
|
||||
//externalUrl
|
||||
@Component({
|
||||
selector: 'claim-entity',
|
||||
template: `
|
||||
<div *ngIf="type == 'publication'" title="Publication">
|
||||
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect><polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span>
|
||||
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'dataset'" title="Dataset">
|
||||
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>
|
||||
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'software'" title="Software">
|
||||
<span class="uk-margin-small-right uk-icon" >
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
|
||||
</span>
|
||||
<publication-title [title]="entity.title" [url]="entity.externalUrl" ></publication-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'project' " title="Project">
|
||||
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>
|
||||
<project-title [project]="entity"></project-title>
|
||||
</div>
|
||||
<div *ngIf="type == 'context' " title="Concept">
|
||||
<span class="uk-margin-small-right uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>
|
||||
<span>{{entity.title}}</span>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class ClaimEntityFormatter {
|
||||
@Input() entity: string[];
|
||||
@Input() type: string;
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.type && this.type == "software"){
|
||||
|
||||
console.log(this.entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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';
|
||||
import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
|
||||
import {ClaimEntityFormatter} from './claimEntityFormatter.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, RouterModule
|
||||
],
|
||||
declarations: [
|
||||
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
|
||||
|
||||
],
|
||||
providers: [ ],
|
||||
exports: [
|
||||
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
|
||||
|
||||
]
|
||||
})
|
||||
export class ClaimEntityFormatterModule { }
|
|
@ -0,0 +1,25 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import {RouterHelper} from '../../../utils/routerHelper.class';
|
||||
|
||||
//Usage Example "<project-title [project]="X" > </project-title>"
|
||||
|
||||
@Component({
|
||||
selector: 'project-title',
|
||||
template: `
|
||||
<span class="project-title">
|
||||
<span ><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" routerLinkActive="router-link-active" routerLink="/search/project" >{{project['name']}} ({{project['funderName']}})</a></span>
|
||||
</span>
|
||||
`
|
||||
})
|
||||
|
||||
export class ProjectTitleFormatter {
|
||||
@Input() project: string[];
|
||||
public url:string;
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.url = OpenaireProperties.getsearchLinkToProject() + "?projectId=" + this.project["openaireId"];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
//Usage Example "<publication-title [title]="X" [url]="X" > </publication-title>"
|
||||
|
||||
@Component({
|
||||
selector: 'publication-title',
|
||||
template: `
|
||||
<span class="publication-title">
|
||||
<span *ngIf="url" ><a target="_blank" href="{{url}}" ><span class="custom-external custom-icon" ></span> {{title}}</a></span>
|
||||
<span *ngIf="!url" >{{title}}</span>
|
||||
</span>
|
||||
`
|
||||
})
|
||||
|
||||
export class PublicationTitleFormatter {
|
||||
@Input() title: string[];
|
||||
@Input() url: string[];
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {URLSearchParams } from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
// import {Claim} from '../claim';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
import { } from '../../../shared/cache.service';
|
||||
import { CustomOptions } from './customOptions.class';
|
||||
@Injectable()
|
||||
export class ClaimsService {
|
||||
private baseUrl;
|
||||
constructor(private http: Http ) {
|
||||
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
||||
}
|
||||
|
||||
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any {
|
||||
console.info('ClaimsService: Claims request: '+url);
|
||||
let key = url;
|
||||
//(fromCache && OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url
|
||||
return this.http.get(url, CustomOptions.getAuthOptions())
|
||||
.map(request => <any> request.json())
|
||||
.do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size ))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims ' );
|
||||
console.info('ClaimsService: Types : '+types );
|
||||
let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any {
|
||||
console.info('ClaimsService: getClaims for user : '+user);
|
||||
let url = this.baseUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
return this.getClaimRequest(size,page,url,false);
|
||||
|
||||
}
|
||||
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||
console.info('ClaimsService: getClaims for context : '+contextId);
|
||||
let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||
console.info('ClaimsService: getClaims for result : '+resultId);
|
||||
let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
|
||||
}
|
||||
getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string ):any {
|
||||
console.info('ClaimsService: getClaims for project : '+projectId);
|
||||
let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types;
|
||||
return this.getClaimRequest(size,page,url,true);
|
||||
}
|
||||
|
||||
deleteClaimById(claimId:string ):any{
|
||||
console.warn('Trying to delete claim with id : '+claimId);
|
||||
let url = this.baseUrl +"claims/"+claimId;
|
||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
// let options = new RequestOptions({ headers: headers });
|
||||
return this.http.delete( url, CustomOptions.getAuthOptionsWithBody()).map(request => <any> request.json())
|
||||
// .do(request => console.info("After delete" ))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
deleteBulk(claimIds:string[]):any{
|
||||
|
||||
console.warn('Trying to delete claims with ids : '+claimIds);
|
||||
var url = "";
|
||||
|
||||
for(var claimId of claimIds){
|
||||
url=url+(url.length >0 ?"&":"")+"claimId="+claimId;
|
||||
}
|
||||
url= this.baseUrl +"claims/bulk?"+url;
|
||||
|
||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
// let options = new RequestOptions({ headers: headers });
|
||||
return this.http.delete( url, CustomOptions.getAuthOptions()).map(request => <any> request.json())
|
||||
// .do(request => console.info("After delete" ))
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
insertBulkClaims(claims):any{
|
||||
console.warn('Trying toinsert claims : '+claims);
|
||||
let url = this.baseUrl +"claims/bulk";
|
||||
let body = JSON.stringify( claims );
|
||||
console.warn('Json body: : '+body);
|
||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
// let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request.status) )
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
insertClaim(claim):any{
|
||||
console.warn('Trying toinsert claim : '+claim);
|
||||
let url = this.baseUrl +"claims";
|
||||
let body = JSON.stringify( claim );
|
||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
// let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request.status) )
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
insertDirectRecords(records):any{
|
||||
console.warn('Trying to feedrecords : '+records);
|
||||
let url = this.baseUrl +"feed/bulk";
|
||||
let body = JSON.stringify( records );
|
||||
console.warn('Json body: : '+body);
|
||||
// let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
// let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request) )
|
||||
.catch(this.handleError);
|
||||
|
||||
}
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
getClaim(id:string):any {
|
||||
let url = this.baseUrl+"claims/"+id;
|
||||
return new Promise((resolve, reject) => {
|
||||
this.http.get(url)
|
||||
.map(res => res.json())
|
||||
.subscribe(
|
||||
data => {
|
||||
resolve(data.data);
|
||||
},
|
||||
err => {
|
||||
reject(err);
|
||||
}
|
||||
)
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {ClaimsService} from './claims.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
providers:[
|
||||
ClaimsService,
|
||||
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
export class ClaimServiceModule { }
|
|
@ -0,0 +1,85 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Jsonp, URLSearchParams, RequestOptions, Headers} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Claim} from '../claim';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import {AutoCompleteValue} from '../../../searchPages/searchUtils/searchHelperClasses.class';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
import { } from '../../../shared/cache.service';
|
||||
import { COOKIE } from '../../../login/utils/helper.class';
|
||||
@Injectable()
|
||||
export class ContextsService {
|
||||
private baseUrl;
|
||||
constructor(private http: Http ) {
|
||||
this.baseUrl = OpenaireProperties.getClaimsAPIURL();
|
||||
}
|
||||
|
||||
public getCommunities():any {
|
||||
let url = this.baseUrl + 'communities';
|
||||
let key = url;
|
||||
|
||||
|
||||
console.info('ContextsService: request communities '+url);
|
||||
return this.http.get(url, this.getAuthOptions())
|
||||
.map(request => <any> request.json().data)
|
||||
// .do(request => console.info("Get claims: offset = "))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
public getCategories(communityId :string):any {
|
||||
console.info('ContextsService: request categories for community with id '+communityId);
|
||||
let url= this.baseUrl + 'communities/' + communityId + '/categories';
|
||||
let key = url;
|
||||
|
||||
|
||||
return this.http.get(url, this.getAuthOptions())
|
||||
.map(request => <any> request.json().data)
|
||||
// .do(request => console.info("Get claims: offset = " ))
|
||||
.catch(this.handleError);;
|
||||
}
|
||||
public getConcepts(categoryId :string, keyword: string, parsing:boolean):any {
|
||||
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
|
||||
let url= this.baseUrl + 'categories/' + categoryId+ "/concepts";
|
||||
let key = url+"_parsing="+parsing;
|
||||
|
||||
|
||||
return this.http.get(url, this.getAuthOptions())
|
||||
.map(request => <any> request.json().data)
|
||||
.catch(this.handleError)
|
||||
.map(res => (parsing)?this.parse(res.concept):res.concept);
|
||||
// .do(res => console.info("Result is "+ res.length ));
|
||||
}
|
||||
parse (data: any):AutoCompleteValue[] {
|
||||
var array:AutoCompleteValue[] =[]
|
||||
if(!Array.isArray(data) && data.id && data.label){
|
||||
var value:AutoCompleteValue = new AutoCompleteValue();
|
||||
value.id = data.id;
|
||||
value.label = data.label;
|
||||
array.push(value);
|
||||
}
|
||||
for(var i = 0; i < data.length; i++){
|
||||
var value:AutoCompleteValue = new AutoCompleteValue();
|
||||
value.id = data[i].id;
|
||||
value.label = data[i].label;
|
||||
array.push(value);
|
||||
}
|
||||
|
||||
return array;
|
||||
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
private getAuthOptions():RequestOptions{
|
||||
let headers = new Headers();
|
||||
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||
return options;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {ContextsService} from './contexts.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
providers:[
|
||||
ContextsService
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
})
|
||||
export class ContextsServiceModule { }
|
|
@ -0,0 +1,19 @@
|
|||
import { RequestOptions, Headers} from '@angular/http';
|
||||
import { COOKIE } from '../../../login/utils/helper.class';
|
||||
|
||||
|
||||
export class CustomOptions{
|
||||
public static getAuthOptionsWithBody():RequestOptions{
|
||||
let headers = new Headers();
|
||||
headers.append('Content-Type', 'application/json');
|
||||
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||
return options;
|
||||
}
|
||||
public static getAuthOptions():RequestOptions{
|
||||
let headers = new Headers();
|
||||
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||
return options;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
@Injectable()
|
||||
export class SearchCrossrefService {
|
||||
constructor( private http: Http ) {}
|
||||
|
||||
|
||||
searchCrossrefResults (term: string, size : number, page : number):any {
|
||||
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?query='+term+'&rows='+size+'&offset='+(size*(page-1));
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(request => <any> request.json().message)
|
||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term));
|
||||
//.catch(this.handleError);
|
||||
|
||||
}
|
||||
searchCrossrefByDOIs(DOIs: string[]):any {
|
||||
/*
|
||||
$request ="http://api.crossref.org/works"."?filter=";
|
||||
foreach($dois as $doi){
|
||||
$request.="doi:".urlencode( trim($doi)).",";
|
||||
}
|
||||
*/
|
||||
var doisParams = "";
|
||||
for(var i =0 ;i < DOIs.length; i++){
|
||||
doisParams+=(doisParams.length > 0?",":"")+'doi:'+DOIs[i];
|
||||
}
|
||||
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+doisParams;
|
||||
let key = url;
|
||||
|
||||
|
||||
return this.http.get(url)
|
||||
.map(request => <any> request.json().message)
|
||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams));
|
||||
//.catch(this.handleError);
|
||||
|
||||
}
|
||||
searchCrossrefByMultipleDOIs(dois: string[]):any {
|
||||
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter=doi:';
|
||||
for(var i=0; i<dois.length; i++){
|
||||
url=url+(url.length==0?'':',')+'doi:'+dois[i];
|
||||
}
|
||||
url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+url;
|
||||
let key = url;
|
||||
|
||||
|
||||
return this.http.get(url)
|
||||
.map(request => <any> request.json().message)
|
||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']));
|
||||
//.catch(this.handleError);
|
||||
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {SearchCrossrefService} from './searchCrossref.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
providers:[
|
||||
SearchCrossrefService
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
})
|
||||
export class SearchCrossrefServiceModule { }
|
|
@ -0,0 +1,50 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
@Injectable()
|
||||
export class SearchDataciteService {
|
||||
constructor(private http: Http ) {}
|
||||
|
||||
searchDataciteResults (term: string, size : number, page : number):any {
|
||||
console.info("In search datacite results "+term);
|
||||
let url = OpenaireProperties.getSearchDataciteAPIURL()+'?query='+term+'&rows='+size+'&start='+(size*(page-1));
|
||||
let key = url;
|
||||
|
||||
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
|
||||
.map(request => <any> request.json())
|
||||
.do(items => console.info(items))
|
||||
.do(items => console.log("Datacite Results: total results = "+items.meta.total+" keyword = "+term));
|
||||
//.catch(this.handleError);
|
||||
}
|
||||
getDataciteResultByDOI (doi: string):any {
|
||||
console.info("Fetch datacite resultt by DOI: "+doi);
|
||||
let url = OpenaireProperties.getSearchDataciteAPIURL()+'/'+doi;
|
||||
let key = url;
|
||||
|
||||
return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
|
||||
.map(request => <any> request.json())
|
||||
.do(items => console.info(items));
|
||||
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi))
|
||||
|
||||
//.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
private extractData(res: Response) {
|
||||
if (res.status < 200 || res.status >= 300) {
|
||||
throw new Error('Bad response status: ' + res.status);
|
||||
}
|
||||
let body = res.json();
|
||||
return body.data || { };
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {SearchDataciteService} from './searchDatacite.service';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
providers:[
|
||||
SearchDataciteService
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
})
|
||||
export class SearchDataciteServiceModule { }
|
|
@ -0,0 +1,126 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {URLSearchParams} from '@angular/http';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import { Headers, RequestOptions } from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
|
||||
@Injectable()
|
||||
export class SearchOrcidService {
|
||||
constructor( private http: Http ) {}
|
||||
|
||||
|
||||
searchOrcidAuthor (term: string, authorIds: string[],
|
||||
authorGivenNames: string[], authorFamilyNames: string[]):any {
|
||||
console.info("In searchOrcidAuthor: "+term);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = OpenaireProperties.getSearchOrcidURL()+term+'/orcid-bio';
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-profile'])
|
||||
.map(res => [res['orcid-bio']['personal-details']['given-names'],
|
||||
res['orcid-bio']['personal-details']['family-name'],
|
||||
res['orcid-identifier']])
|
||||
.map(res => this.parseOrcidAuthor(res, authorIds, authorGivenNames, authorFamilyNames));
|
||||
}
|
||||
|
||||
searchOrcidAuthors (term: string, authorIds: string[],
|
||||
authorGivenNames: string[], authorFamilyNames: string[]):any {
|
||||
console.info("In search Orcid authors for keyword: "+term);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = OpenaireProperties.getSearchOrcidURL()+'search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10';
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-search-results']['orcid-search-result'])
|
||||
.map(res => this.parseOrcidAuthors(res, authorIds, authorGivenNames, authorFamilyNames));
|
||||
|
||||
}
|
||||
|
||||
searchOrcidPublications (id: string):any {
|
||||
console.info("In search Orcid publications for author: "+id);
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Accept', 'application/orcid+json');
|
||||
|
||||
let url = OpenaireProperties.getSearchOrcidURL()+id+'/orcid-works';
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url, { headers: headers })
|
||||
.map(res => res.json()['orcid-profile']['orcid-activities']['orcid-works']);
|
||||
//.map(res => res['orcid-work']);
|
||||
}
|
||||
|
||||
|
||||
parseOrcidAuthor (data: any, authorIds: string[],
|
||||
authorGivenNames: string[], authorFamilyNames: string[]):any {
|
||||
|
||||
if(data[2] != null) {
|
||||
authorIds.push(data[2].path);
|
||||
|
||||
if(data[0] != null) {
|
||||
authorGivenNames.push(data[0].value);
|
||||
} else {
|
||||
authorGivenNames.push("");
|
||||
}
|
||||
if(data[1] != null) {
|
||||
authorFamilyNames.push(data[1].value);
|
||||
} else {
|
||||
authorFamilyNames.push("");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parseOrcidAuthors (data: any, authorIds: string[],
|
||||
authorGivenNames: string[], authorFamilyNames: string[]):any {
|
||||
let ret: boolean = false;
|
||||
let mydata: any;
|
||||
let length: number;
|
||||
|
||||
if(data != null) {
|
||||
length = data.length!=undefined ? data.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data.length!=undefined ? data[i] : data;
|
||||
|
||||
if(mydata.hasOwnProperty("orcid-profile")) {
|
||||
if(mydata['orcid-profile'].hasOwnProperty("orcid-identifier")) {
|
||||
authorIds.push(mydata['orcid-profile']['orcid-identifier'].path);
|
||||
|
||||
if(mydata['orcid-profile'].hasOwnProperty("orcid-bio")) {
|
||||
if(mydata['orcid-profile']['orcid-bio'].hasOwnProperty("personal-details")) {
|
||||
if(mydata['orcid-profile']['orcid-bio']['personal-details'].hasOwnProperty("given-names")) {
|
||||
authorGivenNames.push(mydata['orcid-profile']['orcid-bio']['personal-details']['given-names'].value);
|
||||
} else {
|
||||
authorGivenNames.push("");
|
||||
}
|
||||
|
||||
if(mydata['orcid-profile']['orcid-bio']['personal-details'].hasOwnProperty("family-name")) {
|
||||
authorFamilyNames.push(mydata['orcid-profile']['orcid-bio']['personal-details']['family-name'].value);
|
||||
} else {
|
||||
authorFamilyNames.push("");
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
|
||||
|
||||
import {ClaimResult} from '../claim-utils/claimEntities.class';
|
||||
import {AlertModal} from '../../utils/modal/alert';
|
||||
|
||||
@Component({
|
||||
selector: 'start-over',
|
||||
template: `
|
||||
<button (click)="confirmOpen()" class="uk-button uk-button-danger uk-align-left" > <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="refresh" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg></span> Clear All</button>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
`,
|
||||
|
||||
})
|
||||
export class StartOverComponent {
|
||||
constructor () {
|
||||
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// @Input() public inlineEntity = null;
|
||||
@Input() public type:string;
|
||||
@Input() public linkTo:string;
|
||||
@Input() public results;
|
||||
@Input() public projects;
|
||||
@Input() public contexts;
|
||||
|
||||
@ViewChild(AlertModal) alertApplyAll;
|
||||
|
||||
confirmOpen(){
|
||||
this.alertApplyAll.cancelButton = true;
|
||||
this.alertApplyAll.okButton = true;
|
||||
this.alertApplyAll.alertTitle = "Remove selected";
|
||||
this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?";
|
||||
this.alertApplyAll.okButtonText = "Yes";
|
||||
this.alertApplyAll.cancelButtonText = "No";
|
||||
this.alertApplyAll.open();
|
||||
}
|
||||
confirmClose(data){
|
||||
this.startOver();
|
||||
}
|
||||
startOver(){
|
||||
if(this.type != null && this.linkTo != null){
|
||||
console.log("inline");
|
||||
if(this.linkTo == "project"){
|
||||
this.projects.splice(0, this.projects.length);
|
||||
}else if(this.linkTo == "context"){
|
||||
this.contexts.splice(0, this.contexts.length);
|
||||
}else if(this.linkTo == "result"){
|
||||
this.results.splice(0, this.results.length);
|
||||
}
|
||||
}else{
|
||||
console.log("generic");
|
||||
this.results.splice(0, this.results.length);
|
||||
this.projects.splice(0, this.projects.length);
|
||||
this.contexts.splice(0, this.contexts.length);
|
||||
}
|
||||
console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {StartOverComponent} from './startOver.component';
|
||||
import {AlertModalModule} from '../../utils/modal/alertModal.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, CommonModule, AlertModalModule
|
||||
],
|
||||
declarations: [
|
||||
StartOverComponent
|
||||
],
|
||||
exports: [StartOverComponent ]
|
||||
})
|
||||
export class StartOverModule { }
|
|
@ -0,0 +1,68 @@
|
|||
// import { NgModule} from '@angular/core';
|
||||
// import { CommonModule } from '@angular/common';
|
||||
// import { FormsModule } from '@angular/forms';
|
||||
// //
|
||||
// import {UtilsModule} from '../utils/utils.module';
|
||||
// import {ServicesModule} from '../services/services.module';
|
||||
//
|
||||
// import { ClaimsService} from '../services/claims.service';
|
||||
// //main
|
||||
// import {ClaimComponent} from './claim/claim.component';
|
||||
// import {ClaimsAdminComponent} from './claims/claimsAdmin.component';
|
||||
// import {MyClaimsComponent} from './myClaims/myClaims.component';
|
||||
// import {LinkingHomeComponent} from './linking/linkingHome.component';
|
||||
// import {LinkingComponent} from './linking/linking.component';
|
||||
// import { BulkLinkingComponent } from './linking/bulkLinking.component';
|
||||
//
|
||||
// import {BulkClaimComponent} from './linking/bulkClaim/bulkClaim.component';
|
||||
// import {ClaimsComponent} from './claim-utils/claims.component';
|
||||
//
|
||||
// import {ClaimContextComponent} from './claim-utils/claimContext.component';
|
||||
// import {ClaimProjectsComponent} from './claim-utils/claimProject.component';
|
||||
// import {ClaimResultComponent} from './claim-utils/claimResult.component';
|
||||
// import {ClaimPublicationComponent} from './claim-utils/claimPublication.component';
|
||||
// import {ClaimDatasetComponent} from './claim-utils/claimDataset.component';
|
||||
//
|
||||
// import {ClaimInsertComponent} from './linking/insertClaim/insertClaim.component';
|
||||
//
|
||||
// import {ClaimSelectedContextsComponent} from './linking/selected/selectedContexts.component';
|
||||
// import {ClaimSelectedComponent} from './linking/selected/selected.component';
|
||||
// import {ClaimSelectedDatasetsComponent} from './linking/selected/selectedDatasets.component';
|
||||
// import {ClaimSelectedResultsComponent} from './linking/selected/selectedResults.component';
|
||||
// import {ClaimSelectedProjectsComponent} from './linking/selected/selectedProjects.component';
|
||||
// import {ClaimSelectedPublicationsComponent} from './linking/selected/selectedPublications.component';
|
||||
//
|
||||
// import {LinkingGenericComponent} from './linking/linkingGeneric.component';
|
||||
//
|
||||
// import {InlineClaimContextComponent} from './inlineClaims/inlineClaimContext.component';
|
||||
// import {InlineClaimProjectComponent} from './inlineClaims/inlineClaimProject.component';
|
||||
// import {InlineClaimResultComponent} from './inlineClaims/inlineClaimResult.component';
|
||||
// import {ClaimEntityFormatter} from '../utils/claimEntityFormatter.component';
|
||||
//
|
||||
// import { Claim } from '../utils/entities/claim';
|
||||
// //helpers
|
||||
//
|
||||
// import { ClaimRoutingModule } from './claim-routing.module';
|
||||
// @NgModule({
|
||||
// imports: [
|
||||
// CommonModule, FormsModule,
|
||||
// UtilsModule,
|
||||
// ServicesModule,
|
||||
// ClaimRoutingModule
|
||||
//
|
||||
// ],
|
||||
// declarations: [
|
||||
// ClaimsAdminComponent, MyClaimsComponent, ClaimComponent, ClaimsComponent,
|
||||
// BulkLinkingComponent, LinkingComponent, LinkingHomeComponent, LinkingGenericComponent,
|
||||
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent, ClaimSelectedComponent,
|
||||
// ClaimContextComponent, ClaimSelectedContextsComponent, ClaimInsertComponent, ClaimProjectsComponent, ClaimSelectedProjectsComponent,
|
||||
// ClaimResultComponent, ClaimSelectedPublicationsComponent, ClaimSelectedDatasetsComponent, ClaimSelectedResultsComponent, ClaimPublicationComponent,
|
||||
// ClaimDatasetComponent, BulkClaimComponent,
|
||||
// ClaimEntityFormatter
|
||||
// ],
|
||||
// providers: [ ClaimsService ],
|
||||
// exports: [
|
||||
// InlineClaimContextComponent, InlineClaimProjectComponent, InlineClaimResultComponent
|
||||
// ]
|
||||
// })
|
||||
// export class ClaimModule { }
|
|
@ -0,0 +1,16 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
|
||||
|
||||
import { ClaimsAdminComponent } from './claimsAdmin.component';
|
||||
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: ClaimsAdminComponent, canActivate: [IsRouteEnabled, AdminLoginGuard],
|
||||
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
|
||||
]
|
||||
})
|
||||
export class ClaimsAdminRoutingModule { }
|
|
@ -0,0 +1,38 @@
|
|||
import {Component, ViewChild, Input} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
|
||||
@Component({
|
||||
selector: 'claims-admin',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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 id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
Claims Administrator
|
||||
</div>
|
||||
<div>
|
||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||
<displayClaims [enableDelete]=true [myClaims]=false [isAdmin]=true></displayClaims>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`,
|
||||
|
||||
})
|
||||
export class ClaimsAdminComponent {
|
||||
constructor ( private _meta: Meta ) {
|
||||
this._meta.setTitle("OpenAIRE | Claims Administrator");
|
||||
}
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { ClaimsAdminComponent } from './claimsAdmin.component';
|
||||
import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module';
|
||||
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
|
||||
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
|
||||
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
ClaimsAdminRoutingModule,
|
||||
// ClaimServiceModule,
|
||||
DisplayClaimsModule
|
||||
|
||||
],
|
||||
providers:[AdminLoginGuard, PreviousRouteRecorder,IsRouteEnabled],
|
||||
declarations: [
|
||||
ClaimsAdminComponent
|
||||
]
|
||||
})
|
||||
export class ClaimsAdminModule { }
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
import { ClaimsByTokenComponent } from './claimsByToken.component';
|
||||
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: ClaimsByTokenComponent, canActivate: [IsRouteEnabled, LoginGuard],
|
||||
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
|
||||
]
|
||||
})
|
||||
export class ClaimsByTokenRoutingModule { }
|
|
@ -0,0 +1,433 @@
|
|||
import {Component, ViewChild, Input} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Params} from '@angular/router';
|
||||
import {ClaimsByTokenService} from './claimsByToken.service';
|
||||
|
||||
import {ModalSelect} from '../../utils/modal/selectModal.component';
|
||||
import {ModalLoading} from '../../utils/modal/loading.component';
|
||||
|
||||
import {Session} from '../../login/utils/helper.class';
|
||||
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
|
||||
|
||||
//import {DataTable} from "angular2-datatable";
|
||||
|
||||
@Component({
|
||||
selector: 'claims-project-manager',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container">
|
||||
<!--div *ngIf="accessStatus=='empty'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
|
||||
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
|
||||
<p class="uk-text-large">Please enter your email and then press 'See Claims' button.</p>
|
||||
<form class="uk-form">
|
||||
<fieldset data-uk-margin>
|
||||
<input type="text" placeholder="example@email.com" name="email" [(ngModel)]="email">
|
||||
<button (click)="validateJWTandToken()" class=" uk-button uk-button-default">See Claims</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<div *ngIf="accessStatus=='invalid'" class="uk-margin-top uk-width-medium-2-3 uk-container-center">
|
||||
<div class="uk-block uk-block-primary uk-block-large uk-contrast uk-text-center">
|
||||
<!--p class="uk-text-large">Oops! There is no entry for you! Please retry with another email or for another project.</p-->
|
||||
<!--button (click)="accessStatus='empty'" class=" uk-button uk-button-default">Retry</button-->
|
||||
<p class="uk-text-large">Oops! Your email does not give you the authority to view claims for the selected project. Please contact the administrators.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="accessStatus=='valid'">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
Claims Administrator
|
||||
<a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])"
|
||||
routerLinkActive="router-link-active"
|
||||
routerLink="/search/project" >
|
||||
{{project['name']}} ({{project['funderName']}})
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<h2> Pending Claims</h2>
|
||||
|
||||
<div *ngIf=" pending_claims && pending_claims.length == 0" >
|
||||
<div class = "uk-alert uk-alert-primary " >No pending claims found.</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-overflow-container custom-dataTable-content">
|
||||
|
||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
||||
<form class="uk-text-center uk-panel">
|
||||
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery" name="keyword" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<span *ngIf="pending_claims && pending_claims.length > 0 && totalPendingResults.count > 0">
|
||||
{{totalPendingResults.count}} pending claims, page {{activePendingPage.page}} of {{totalPages(totalPendingResults.count)}}
|
||||
<paging-no-load class="uk-float-right" [currentPage]="activePendingPage.page" [totalResults]="totalPendingResults.count" [size]="rowsOnPage" (pageChange)="refreshTable(table1, $event, 'pending')"></paging-no-load>
|
||||
</span>
|
||||
<table #filtered1 *ngIf="pending_claims && pending_claims.length > 0" class="uk-table uk-table-striped"
|
||||
[mfData]="pending_claims | claimsDatatable : [filterQuery, totalPendingResults, activePendingPage]" #mf1="mfDataTable" [mfRowsOnPage]="rowsOnPage" [mfActivePage]="1">
|
||||
<!--[(mfSortBy)]="sortByClaimDate1" (mfSortOrder)="sortOrder"-->
|
||||
<thead>
|
||||
<tr>
|
||||
<th><mfDefaultSorter [by]="sortByTitle1">Research Result</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="userMail">Claimed By</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter [by]="sortByClaimDate1">Claimed Date</mfDefaultSorter></th>
|
||||
<th class="uk-text-center">Approve</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="uk-table-middle" *ngFor="let claim1 of mf1.data">
|
||||
<td class="uk-width-2-5" *ngIf="claim1.targetType != 'project'"><claim-entity [entity]="claim1.target" [type]="claim1.targetType" > </claim-entity></td>
|
||||
<td class="uk-width-2-5 uk-text-center" *ngIf="claim1.sourceType != 'project'"><claim-entity [entity]="claim1.source" [type]="claim1.sourceType" > </claim-entity></td>
|
||||
<td class="uk-width-1-5 uk-text-center">{{claim1.userMail}}</td>
|
||||
<td class="uk-width-1-5 uk-text-center">{{claim1.date}}</td>
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
|
||||
<label>
|
||||
Yes <input [id]="claim1.id" type="checkbox" (click)="selectApprove(claim1.id,$event)" [ngModel]="isSelectedRight(claim1.id)"/>
|
||||
</label>
|
||||
<label>
|
||||
No <input [id]="claim1.id" type="checkbox" (click)="selectDisapprove(claim1.id,$event)" [ngModel]="isSelectedWrong(claim1.id)"/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="uk-text-small uk-text-right">*Note that claims you did not approved or disapproved are considered as right (but not curated)</div>
|
||||
<button class="uk-button uk-button-primary uk-float-right" type="submit" (click)="saveChanges()">Save Changes</button>
|
||||
|
||||
<h2> Already Curated Claims</h2>
|
||||
|
||||
<div *ngIf=" curated_claims && curated_claims.length == 0" >
|
||||
<div class = "uk-alert uk-alert-primary " >No curated claims found.</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-overflow-container custom-dataTable-content">
|
||||
|
||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
||||
<form class="uk-text-center uk-panel">
|
||||
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery2" name="keyword" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<span *ngIf="curated_claims && curated_claims.length > 0 && totalCuratedResults.count > 0">
|
||||
{{totalCuratedResults.count}} curated claims, page {{activeCuratedPage.page}} of {{totalPages(totalCuratedResults.count)}}
|
||||
<paging-no-load class="uk-float-right" [currentPage]="activeCuratedPage.page" [totalResults]="totalCuratedResults.count" [size]="rowsOnPage" (pageChange)="refreshTable(table2, $event, 'curated')"> </paging-no-load>
|
||||
</span>
|
||||
|
||||
<table *ngIf="curated_claims && curated_claims.length > 0" class="uk-table uk-table-striped"
|
||||
[mfData]="curated_claims | claimsDatatable : [filterQuery2, totalCuratedResults, activeCuratedPage]" #mf2="mfDataTable" [mfRowsOnPage]="rowsOnPage" [mfActivePage]="1">
|
||||
<!--[(mfSortBy)]="sortByCurationDate2" [(mfSortOrder)]="sortOrder"-->
|
||||
<thead>
|
||||
<!--tr>
|
||||
<td colspan="6">
|
||||
<form class="uk-text-center uk-panel uk-background-muted">
|
||||
<input type="text" class="uk-input uk-width-1-3" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="filterQuery2" name="keyword" />
|
||||
</form>
|
||||
</td>
|
||||
</tr-->
|
||||
<!--tr>
|
||||
<td>
|
||||
Filter curated claims:
|
||||
<input class="uk-input uk-width-1-3" [(ngModel)]="filterQuery2"/>
|
||||
</td>
|
||||
</tr-->
|
||||
<tr>
|
||||
<th><mfDefaultSorter [by]="sortByTitle1">Research Result</mfDefaultSorter></th>
|
||||
<!--th>Link to</th-->
|
||||
<th class="uk-text-center"><mfDefaultSorter by="userMail">Claimed by</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter [by]="sortByClaimDate2">Claimed Date</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="curatedBy">Curated by</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter [by]="sortByCurationDate2">Curation Date</mfDefaultSorter></th>
|
||||
<th class="uk-text-center">Approved</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="uk-table-middle" *ngFor="let claim of mf2.data let i=index">
|
||||
<td class="uk-width-1-6" *ngIf="claim.targetType != 'project'"><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td>
|
||||
<td class="uk-width-1-6" *ngIf="claim.sourceType != 'project'"><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td>
|
||||
<td class="uk-width-1-6 uk-text-center">{{claim.userMail}}</td>
|
||||
<td class="uk-width-1-6 uk-text-center">{{claim.date}}</td>
|
||||
<td class="uk-width-1-6 uk-text-center">{{claim.curatedBy}}</td>
|
||||
<td class="uk-width-1-6 uk-text-center">{{claim.curationDate}}</td>
|
||||
<td class="uk-width-1-6 uk-text-center">
|
||||
|
||||
<label>
|
||||
Yes <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isRight(claim)"/>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
No <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isWrong(claim)"/>
|
||||
</label>
|
||||
|
||||
</td>
|
||||
<!--td><input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isWrong(claim)"/></td-->
|
||||
<!--td><button class="uk-button" (click)="editable.add(i)">Edit</button></td-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!--modal-select (alertOutput)="curatorSelected($event)"></modal-select-->
|
||||
<modal-loading [message]= "'Loading...'"></modal-loading>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
|
||||
})
|
||||
export class ClaimsByTokenComponent {
|
||||
public token: string = "";
|
||||
public sub: any;
|
||||
public project: any;
|
||||
private claims:any = [];
|
||||
public pending_claims: any = [];
|
||||
public curated_claims: any = [];
|
||||
public selectedRight: Set<string>;
|
||||
public selectedWrong: Set<string>;
|
||||
public editable: Set<string>;
|
||||
public contact_person: string[] = ["Konstantina", "Argiro", "Katerina"];
|
||||
|
||||
// when 'valid' show proper claims, when 'invalid' show no matched entry-wanna retry
|
||||
public accessStatus: string;// = "empty";
|
||||
|
||||
public rowsOnPage = 5;
|
||||
public sortOrder = "asc";
|
||||
public filterQuery:string = "";
|
||||
public filterQuery2:string = "";
|
||||
|
||||
public activePendingPage:any = {page: 1};
|
||||
public totalPendingResults:any = {count: 0};
|
||||
public activeCuratedPage:any = {page: 1};
|
||||
public totalCuratedResults:any = {count: 0};
|
||||
|
||||
|
||||
@ViewChild('mf1') table1: any;//DataTable;
|
||||
@ViewChild('mf2') table2: any;//DataTable;
|
||||
@ViewChild('filtered1') filteredItems1;
|
||||
|
||||
|
||||
@ViewChild (ModalSelect) selectModal : ModalSelect;
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
constructor ( private route: ActivatedRoute, private claimsByTokenService: ClaimsByTokenService, private _meta: Meta) {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.token = params['token'];
|
||||
this.selectedRight = new Set<string>();
|
||||
this.selectedWrong = new Set<string>();
|
||||
this.editable = new Set<string>();
|
||||
//this.openSelect();
|
||||
//this.setMessageSelect("Please select your identity:");
|
||||
//this.setOptionsSelect(this.contact_person);
|
||||
this.validateJWTandToken();
|
||||
this.updateTitle("Claims For Project Managers");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
refreshTable(table:any, $event:any, whichTable: string) {
|
||||
if(whichTable == "pending") {
|
||||
this.activePendingPage.page = $event.value;
|
||||
} else if(whichTable == 'curated') {
|
||||
this.activeCuratedPage.page = $event.value;
|
||||
}
|
||||
table.mfActivePage=$event.value;
|
||||
table.setPage(table.mfActivePage, this.rowsOnPage);
|
||||
}
|
||||
|
||||
public sortByClaimDate1 = (claim: any) => {
|
||||
return new Date(claim.date);
|
||||
}
|
||||
|
||||
public sortByCurationDate1 = (claim: any) => {
|
||||
return new Date(claim.curationDate);
|
||||
}
|
||||
|
||||
public sortByTitle1 = (claim: any) => {
|
||||
if(claim.targetType != 'project') {
|
||||
return claim.target.title;
|
||||
} else {
|
||||
return claim.source.title;
|
||||
}
|
||||
}
|
||||
|
||||
public sortByClaimDate2 = (claim: any) => {
|
||||
return new Date(claim.date);
|
||||
}
|
||||
|
||||
public sortByCurationDate2 = (claim: any) => {
|
||||
console.info(new Date(claim.curationDate));
|
||||
return new Date(claim.curationDate);
|
||||
}
|
||||
|
||||
public sortByTitle2= (claim: any) => {
|
||||
if(claim.targetType != 'project') {
|
||||
return claim.target.title;
|
||||
} else {
|
||||
return claim.source.title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
validateJWTandToken() {
|
||||
var jwtToken=Session.getUserJwt();
|
||||
if(this.token) {
|
||||
this.claimsByTokenService.getClaims(this.token, jwtToken).subscribe(
|
||||
data => {
|
||||
this.closeLoading();
|
||||
this.accessStatus = "valid";
|
||||
//console.info(data);
|
||||
this.claims = data.data;
|
||||
for(let claim of this.claims) {
|
||||
if(claim.targetType == "project") {
|
||||
this.project = claim.target;
|
||||
} else {
|
||||
this.project = claim.source;
|
||||
}
|
||||
if(claim.curatedBy) {
|
||||
this.curated_claims.push(claim);
|
||||
} else {
|
||||
this.pending_claims.push(claim);
|
||||
}
|
||||
}
|
||||
|
||||
this.totalPendingResults.count = this.pending_claims.length;
|
||||
this.totalCuratedResults.count = this.curated_claims.length;
|
||||
|
||||
this.updateTitle("Claims For Project Managers - "+this.project.name);
|
||||
},
|
||||
err => {
|
||||
this.accessStatus = "invalid";
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.accessStatus = "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
selectApprove(id:string, event) {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
this.selectedRight.add(id);
|
||||
this.selectedWrong.delete(id);
|
||||
console.info(this.selectedRight);
|
||||
}else{
|
||||
this.selectedRight.delete(id);
|
||||
console.info(this.selectedRight);
|
||||
}
|
||||
}
|
||||
|
||||
selectDisapprove(id:string,event) {
|
||||
var value = event.currentTarget.checked;
|
||||
if(value){
|
||||
this.selectedWrong.add(id);
|
||||
this.selectedRight.delete(id);
|
||||
}else{
|
||||
this.selectedWrong.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
isSelectedRight(id:string) {
|
||||
return this.selectedRight.has(id);
|
||||
}
|
||||
|
||||
isSelectedWrong(id:string) {
|
||||
return this.selectedWrong.has(id);
|
||||
}
|
||||
|
||||
isRight(claim: any) {
|
||||
//claim.approved = true;
|
||||
if(this.isSelectedRight(claim.id)) {
|
||||
return true;
|
||||
} else if(claim.approved == true && !this.isSelectedWrong(claim.id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
isWrong(claim: any) {
|
||||
if(this.isSelectedWrong(claim.id)) {
|
||||
return true;
|
||||
} else if(claim.approved == false && !this.isSelectedRight(claim.id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
saveChanges() {
|
||||
console.info("Changes Saved!");
|
||||
var jwtToken=Session.getUserJwt();
|
||||
|
||||
this.claimsByTokenService.updateClaimsCuration(this.selectedRight, this.selectedWrong).subscribe(
|
||||
data => {
|
||||
console.info(data);
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public closeLoading(){
|
||||
if(this.loading){
|
||||
this.loading.close();
|
||||
}
|
||||
}
|
||||
|
||||
curatorSelected(selected: string) {
|
||||
console.info("selected curator: "+selected);
|
||||
}
|
||||
|
||||
public openSelect(){
|
||||
if(this.selectModal){
|
||||
this.selectModal.open();
|
||||
}
|
||||
}
|
||||
|
||||
public setMessageSelect(message: string){
|
||||
if(this.selectModal){
|
||||
this.selectModal.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
public setOptionsSelect(options: string[]){
|
||||
if(this.selectModal){
|
||||
this.selectModal.options = options;
|
||||
}
|
||||
}
|
||||
|
||||
totalPages(totalResults: number): number {
|
||||
let totalPages:any = totalResults/(this.rowsOnPage);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import {DataTableModule} from "angular2-datatable";
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { ClaimsByTokenComponent } from './claimsByToken.component';
|
||||
import { ClaimsByTokenService } from './claimsByToken.service';
|
||||
import { ClaimsByTokenRoutingModule } from './claimsByToken-routing.module';
|
||||
import {ClaimEntityFormatterModule} from '../claim-utils/entityFormatter/claimEntityFormatter.module';
|
||||
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
|
||||
//import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
|
||||
import {SelectModalModule} from '../../utils/modal/selectModal.module';
|
||||
import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
|
||||
|
||||
import {LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import {PagingModule} from '../../utils/paging.module';
|
||||
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule,
|
||||
DataTableModule,
|
||||
SharedModule,
|
||||
ClaimsByTokenRoutingModule,
|
||||
ClaimEntityFormatterModule,
|
||||
SelectModalModule,
|
||||
LoadingModalModule,
|
||||
PagingModule
|
||||
// ClaimServiceModule,
|
||||
//DisplayClaimsModule
|
||||
|
||||
],
|
||||
providers:[
|
||||
ClaimsByTokenService,
|
||||
LoginGuard, PreviousRouteRecorder, IsRouteEnabled
|
||||
],
|
||||
declarations: [
|
||||
ClaimsByTokenComponent, ClaimsDatatablePipe
|
||||
],
|
||||
exports: [
|
||||
ClaimsByTokenComponent, ClaimsDatatablePipe
|
||||
]
|
||||
})
|
||||
export class ClaimsByTokenModule { }
|
|
@ -0,0 +1,77 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/operator/do';
|
||||
|
||||
import { CustomOptions } from '../claim-utils/service/customOptions.class';
|
||||
|
||||
@Injectable()
|
||||
export class ClaimsByTokenService {
|
||||
|
||||
constructor(private http: Http ) {}
|
||||
|
||||
getClaims(token: string, jwtToken: string):any {
|
||||
console.info("getClaims in service");
|
||||
|
||||
let url = OpenaireProperties.getClaimsAPIURL()+"project/claims?projectToken="+token;
|
||||
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url, CustomOptions.getAuthOptions())
|
||||
//.map(res => <any> res.text())
|
||||
.map(request => <any> request.json());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
getClaims(email: string, token: string, user_token: string):any {
|
||||
let url = OpenaireProperties.getClaimsAPIURL(); // What else?
|
||||
let body = JSON.stringify( {"email": email, "token": token} );
|
||||
console.warn('Json body: : '+body);
|
||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, options)
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request.status) )
|
||||
.catch(this.handleError);
|
||||
}
|
||||
*/
|
||||
|
||||
updateClaimsCuration( selectedRight: Set<string>, selectedWrong: Set<string>) {
|
||||
let url = OpenaireProperties.getClaimsAPIURL() + "curate/bulk";
|
||||
let claimsCurationInfo: any = []; //e.g.: [{"id":"2","approved":true},{"id":"1","approved":true}]
|
||||
|
||||
selectedRight.forEach(function(selected) {
|
||||
console.info(selected);
|
||||
let claimCurationInfo: {"id": string, "approved": boolean} = {"id": selected, "approved": true};
|
||||
claimsCurationInfo.push(claimCurationInfo);
|
||||
});
|
||||
|
||||
selectedWrong.forEach(function(selected) {
|
||||
let claimCurationInfo: any = {"id": selected, "approved": false};
|
||||
claimsCurationInfo.push(claimCurationInfo);
|
||||
});
|
||||
|
||||
console.info("\n\n"+claimsCurationInfo);
|
||||
|
||||
|
||||
let body = JSON.stringify( claimsCurationInfo );
|
||||
console.warn('Json body: : '+body);
|
||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
||||
.map(res => res.json())
|
||||
.do(request => console.info("Insert Response:"+request.status) )
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { DirectLinkingComponent } from './directLinking.component';
|
||||
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
|
||||
redirect: '/error'
|
||||
}, canDeactivate: [PreviousRouteRecorder]},
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class DirectLinkingRoutingModule { }
|
|
@ -0,0 +1,135 @@
|
|||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
Link
|
||||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
<helper position="top"></helper>
|
||||
</div>
|
||||
<div class="uk-grid helper-grid">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
<div *ngIf="validInput != null && !validInput" class="uk-alert uk-alert-warning" role="alert">No valid arguments provided in order to start linking openAIRE entities. </div>
|
||||
<div *ngIf="validInput != null && validInput">
|
||||
<!--div class="uk-clearfix">
|
||||
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span class="uk-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
||||
</span> More Information </a>
|
||||
</div>
|
||||
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<a uk-toggle="target: #linkingInfo; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></a>
|
||||
<div class="uk-text-bold"><span class="uk-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
||||
</span> Linking Functionality:</div>
|
||||
<p>Through linking functioanilty you are able to create links from {{type}} to {{(linkTo =='context')?"communities/ concepts":((linkTo =='project')?"projects":"research results")}}. You have to select at least one {{(linkTo =='context')?"community/ concept":((linkTo =='project')?"project":"research result")}} in order to be able to proceed.</p>
|
||||
|
||||
<p *ngIf="linkTo=='project'"><span class="uk-text-bold">Projects:</span> Search & add projects using keyword search. Limit the search space by specifying project Funder. </p>
|
||||
<p *ngIf="linkTo=='context'"><span class="uk-text-bold">Communities:</span> Search & add communities/ concepts by selecting community, category and using keyword search for . Or browse through the categories and add communities. </p>
|
||||
<p *ngIf="linkTo=='result'"><span class="uk-text-bold">Research Results:</span> You can search for reasearch results (publication and/ or research data) to link, in openaire, crossref, Orcid, and/ or Datacite. Use search mode, to search and add results through keyword search. Use upload mode, to upload a list of DOIs of results. </p>
|
||||
<p *ngIf="show=='claim' && linkTo=='result'"><span class="uk-text-bold">Review Metadata of research results:</span> The selected research results that came from 3rd party repositories (Datacite, Crossreff, Orcid), need review and change of metadata (such as access mode, and type) before they are included in openaire information space.
|
||||
Please have in mind that ignoring this step, the research results will get the default values, that may be wrong.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</div-->
|
||||
<ul uk-accordion>
|
||||
<li>
|
||||
<h3 class=" uk-text-right uk-margin-remove-vertical uk-width-small uk-margin-auto-left uk-accordion-title basket-title ">
|
||||
<span class="uk-icon"><svg xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" height="28px" id="my-box" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="28px" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"></path></g> </svg> </span>
|
||||
<span *ngIf="(projects.length + contexts.length + results.length)> 0" class="uk-badge basket-badge ">{{(projects.length + contexts.length + results.length)}}</span>
|
||||
</h3>
|
||||
<div class="uk-accordion-content dropbasket uk-padding-small uk-margin uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-grid uk-grid-stack">
|
||||
<claim-selected-projects *ngIf=" linkTo == 'project' " title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-projects>
|
||||
|
||||
<claim-selected-contexts *ngIf=" linkTo == 'context' " title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-contexts>
|
||||
<claim-selected-results *ngIf=" linkTo == 'result' " title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false>
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<!--div *ngIf=" ! (linkTo =='result' && show=='claim') " >
|
||||
<div class="uk-clearfix">
|
||||
<a class="uk-float-right" uk-toggle="target: #selected; animation: uk-animation-fade">
|
||||
<span class="uk-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="my-box" x="0px" y="0px" width="28px" height="28px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"/></g>
|
||||
</svg>
|
||||
</span>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
<div id="selected" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<claim-selected-projects *ngIf=" linkTo == 'project' " title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-projects>
|
||||
|
||||
<claim-selected-contexts *ngIf=" linkTo == 'context' " title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-contexts>
|
||||
<claim-selected-results *ngIf=" linkTo == 'result' " title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false>
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
</div-->
|
||||
<div class="uk-text-large">
|
||||
Link {{(type=="project")?'Project':' Research result'}}:
|
||||
</div>
|
||||
<div class="uk-clearfix">
|
||||
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" [linkTo]="linkTo" [type]="type" ></start-over-->
|
||||
</div>
|
||||
<!-- inline result -->
|
||||
<div *ngIf="displayedResult != null && (type =='publication' || type =='dataset' || type=='software' )" class=" uk-margin-top uk-card uk-card-default uk-padding uk-padding-large uk-padding-remove-left uk-margin-left uk-grid uk-grid-stack" uk-grid="">
|
||||
<div class="uk-width-1-1" >
|
||||
<div>
|
||||
<a *ngIf="displayedResult.url" target="_blank" href="{{displayedResult.url}}" > <span class="custom-external"></span> {{displayedResult.title}}</a>
|
||||
<span *ngIf="!displayedResult.url" >{{displayedResult.title}}</span>
|
||||
</div>
|
||||
<div *ngIf="displayedResult.result.authors && displayedResult.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of displayedResult.result.authors.slice(0,10) let i = index">{{author}}{{(i < (displayedResult.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == displayedResult.result.authors.slice(0,10).length-1 && displayedResult.result.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- inline project -->
|
||||
<div *ngIf=" type == 'project' && projects.length > 0 " class="uk-margin-top uk-card uk-card-default uk-padding uk-padding-large uk-padding-remove-left uk-margin-left uk-grid uk-grid-stack" uk-grid="">
|
||||
{{projects[0].funderName}} | {{projects[0].projectName}} {{(projects[0].projectAcronym)?'('+projects[0].projectAcronym+')':''}}
|
||||
|
||||
</div>
|
||||
|
||||
<!-- search for entity -->
|
||||
|
||||
<div class = "uk-margin-top">
|
||||
|
||||
<claim-projects-search-form *ngIf=" linkTo =='project' " [(selectedProjects)]="projects" > </claim-projects-search-form>
|
||||
|
||||
<claim-contexts-search-form *ngIf=" linkTo =='context' " [(selectedList)]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineResult" > </claim-contexts-search-form>
|
||||
|
||||
<claim-result-search-form *ngIf=" linkTo =='result' && show!='claim' " [selectedResults]="results" > </claim-result-search-form>
|
||||
|
||||
</div>
|
||||
<div *ngIf=" show == 'claim' " class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l ">
|
||||
<claim-selected-results *ngIf=" linkTo =='result' " title= "Selected Research Results" [results]="results" [bulkMode]=false showSearch = false showAccessRights = true>
|
||||
</claim-selected-results>
|
||||
<div class="uk-width-1-1 uk-margin-small-top">
|
||||
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [inlineEntity] = "inlineResult" [show] = "show"
|
||||
(showChange)="showChange($event)" ></claim-insert>
|
||||
</div>
|
||||
</div>
|
||||
<ul *ngIf="linkTo == 'result'" class="uk-pagination">
|
||||
<li *ngIf="show == 'claim'" (click)="show='result';"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
|
||||
<li *ngIf="show != 'claim'"(click)="show='claim';" class="uk-margin-auto-left">
|
||||
<a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
<helper position="bottom"></helper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,208 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
|
||||
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
|
||||
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
||||
import {SearchSoftwareService} from '../../services/searchSoftware.service';
|
||||
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
|
||||
@Component({
|
||||
selector: 'directLinking',
|
||||
templateUrl: 'directLinking.component.html'
|
||||
})
|
||||
export class DirectLinkingComponent {
|
||||
contexts=[];
|
||||
projects=[];
|
||||
|
||||
results = [];
|
||||
|
||||
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
|
||||
/* url Parameters for inline linking */
|
||||
id:string = null; //entity id
|
||||
type:string = null; // entity type (publication or dataset)
|
||||
linkTo:string = null; // entity type (project or context or result)
|
||||
|
||||
entityTypes=["dataset", "publication","software", "project","context"];
|
||||
inlineResult:ClaimResult =null;
|
||||
displayedResult:ClaimResult =null;
|
||||
sub:any =null;
|
||||
show:string="claim"; //{claim,result}
|
||||
validInput:boolean = null;//'true;
|
||||
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
|
||||
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private softwareSearch:SearchSoftwareService, private _meta: Meta) {
|
||||
this._meta.setTitle("OpenAIRE | Direct Linking");
|
||||
}
|
||||
ngOnInit() {
|
||||
if(localStorage.getItem("projects")){
|
||||
this.projects = JSON.parse(localStorage.getItem("projects"));
|
||||
}
|
||||
if(localStorage.getItem("contexts")){
|
||||
this.contexts = JSON.parse(localStorage.getItem("contexts"));
|
||||
}
|
||||
if(localStorage.getItem("results")){
|
||||
this.results = JSON.parse(localStorage.getItem("results"));
|
||||
}
|
||||
if(localStorage.getItem("inlineEntity")){
|
||||
this.inlineResult = JSON.parse(localStorage.getItem("inlineEntity"));
|
||||
}
|
||||
|
||||
localStorage.removeItem("projects");
|
||||
localStorage.removeItem("contexts");
|
||||
localStorage.removeItem("results");
|
||||
localStorage.removeItem("inlineEntity");
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.id = params['id'];
|
||||
this.type = params['type'];
|
||||
this.linkTo = params['linkTo'];
|
||||
if(this.type!=null && this.linkTo!=null){
|
||||
this.type = (this.entityTypes.indexOf(this.type) != -1)? this.type:'publication';
|
||||
this.linkTo = (this.entityTypes.indexOf(this.linkTo) != -1 || this.linkTo == "result")? this.linkTo:'project';
|
||||
this.show = (this.linkTo != "result")?"claim":"result";
|
||||
this.linkType = this.linkTo;
|
||||
var isInlineResult:boolean = false; // is a link result - result
|
||||
// if((this.type == "publication" || this.type == "dataset" || this.type == "software") && ((this.linkTo == "publication" || this.linkTo == "dataset" || this.linkTo == "software") || this.linkTo == "result" )){
|
||||
// isInlineResult = true;
|
||||
// }
|
||||
if(this.type == "project"){
|
||||
this.linkType = "project";
|
||||
this.getProjectById(this.id);
|
||||
}else if(this.type == "publication"){
|
||||
this.getPublicationById(this.id,true);
|
||||
}else if(this.type == "dataset"){
|
||||
this.getDatasetById(this.id,true);
|
||||
}else if(this.type == "software"){
|
||||
this.getSoftwareById(this.id,true);
|
||||
}else{
|
||||
this.validInput = this.isValidInput(null);
|
||||
}
|
||||
|
||||
}else{
|
||||
this.validInput = this.isValidInput(null);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
isValidInput(result){
|
||||
if(result == null){
|
||||
return false;
|
||||
}else if(this.type == "project" && this.linkTo != "result"){
|
||||
return false;
|
||||
}else if(["dataset","publication","software"].indexOf(this.type) != -1 && (["project","context","result"].indexOf(this.linkTo) == -1)){
|
||||
return false;
|
||||
}else if(["project","dataset","publication","software"].indexOf(this.type) == -1){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
getProjectById(id:string){
|
||||
this.sub = this.entitySearch.fetchByType(id,"project").subscribe(
|
||||
data => {
|
||||
console.log(data);
|
||||
var item =data[0];
|
||||
var project: ClaimProject = new ClaimProject();
|
||||
project.funderId = item.funderId;
|
||||
project.funderName = item.funderName;
|
||||
project.projectId = id;
|
||||
project.projectName = item.projectName;
|
||||
project.projectAcronym = item.projectAcronym;
|
||||
project.startDate = item.startDate;
|
||||
project.endDate = item.endDate;
|
||||
project.code = item.code;
|
||||
project.jurisdiction = item.jurisdiction;
|
||||
project.fundingLevel0 = item.fundingLevel0;
|
||||
|
||||
this.projects.push( project);
|
||||
this.validInput = this.isValidInput(project);
|
||||
|
||||
},
|
||||
err => {
|
||||
this.validInput = this.isValidInput(null);
|
||||
console.log("An error occured")
|
||||
});
|
||||
}
|
||||
getPublicationById(id:string, isInlineResult:boolean){
|
||||
|
||||
this.sub = this.publicationsSearch.searchPublicationById(id).subscribe(
|
||||
data => {
|
||||
var item =data[0];
|
||||
var result: ClaimResult = new ClaimResult();
|
||||
result.id=id;
|
||||
result.type="publication";
|
||||
result.source="openaire";
|
||||
result.title = item['title'].name;
|
||||
result.url= item['title'].url;
|
||||
result.result = item;
|
||||
result.accessRights = item['title'].accessMode;
|
||||
result.date = item.year;
|
||||
this.displayedResult = result;
|
||||
if(isInlineResult){
|
||||
this.inlineResult = result;
|
||||
}else{
|
||||
this.results.push( result);
|
||||
}
|
||||
this.validInput = this.isValidInput(result);
|
||||
},
|
||||
err => {
|
||||
this.validInput = this.isValidInput(null);
|
||||
console.log("An error occured")
|
||||
});
|
||||
}
|
||||
getDatasetById(id:string, isInlineResult:boolean){
|
||||
this.sub = this.datasetsSearch.searchDatasetById(id).subscribe(
|
||||
data => {
|
||||
var item =data[0];
|
||||
var result: ClaimResult = new ClaimResult();
|
||||
result.id=id;
|
||||
result.type="dataset";
|
||||
result.source="openaire";
|
||||
result.title = item['title'].name;
|
||||
result.url= item['title'].url;
|
||||
result.result = item;
|
||||
result.accessRights = item['title'].accessMode;
|
||||
result.date = item.year;
|
||||
this.displayedResult = result;
|
||||
if(isInlineResult){
|
||||
this.inlineResult = result;
|
||||
}else{
|
||||
this.results.push( result);
|
||||
}
|
||||
this.validInput = this.isValidInput(result);
|
||||
},
|
||||
err => {
|
||||
this.validInput = this.isValidInput(null);
|
||||
console.log("An error occured")
|
||||
});
|
||||
}
|
||||
getSoftwareById(id:string, isInlineResult:boolean){
|
||||
this.sub = this.softwareSearch.searchSoftwareById(id).subscribe(
|
||||
data => {
|
||||
var item =data[0];
|
||||
var result: ClaimResult = new ClaimResult();
|
||||
result.id=id;
|
||||
result.type="software";
|
||||
result.source="openaire";
|
||||
result.title = item['title'].name;
|
||||
result.url= item['title'].url;
|
||||
result.result = item;
|
||||
result.accessRights = item['title'].accessMode;
|
||||
result.date = item.year;
|
||||
this.displayedResult = result;
|
||||
if(isInlineResult){
|
||||
this.inlineResult = result;
|
||||
}else{
|
||||
this.results.push( result);
|
||||
}
|
||||
this.validInput = this.isValidInput(result);
|
||||
},
|
||||
err => {
|
||||
this.validInput = this.isValidInput(null);
|
||||
console.log("An error occured")
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { DirectLinkingComponent } from './directLinking.component';
|
||||
import { DirectLinkingRoutingModule } from './directLinking-routing.module';
|
||||
|
||||
import {SelectedProjectsModule} from '../linking/selected/selectedProjects.module';
|
||||
import {SelectedContextsModule} from '../linking/selected/selectedContexts.module';
|
||||
import {SelectedPublicationsModule} from '../linking/selected/selectedResults.module';
|
||||
import {InsertClaimsModule} from '../linking/insertClaim/insertClaim.module';
|
||||
import {StartOverModule} from '../claim-utils/startOver.module';
|
||||
|
||||
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {SoftwareServiceModule} from '../../services/softwareService.module';
|
||||
import {LoginGuard} from'../../login/loginGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {HelperModule} from '../../utils/helper/helper.module';
|
||||
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
|
||||
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
|
||||
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
DirectLinkingRoutingModule,SelectedProjectsModule, SelectedContextsModule, SelectedPublicationsModule, InsertClaimsModule,
|
||||
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, StartOverModule, HelperModule,
|
||||
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, ClaimResultSearchFormModule
|
||||
|
||||
|
||||
],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
|
||||
declarations: [
|
||||
DirectLinkingComponent
|
||||
], exports:[DirectLinkingComponent]
|
||||
})
|
||||
export class DirectLinkingModule { }
|
|
@ -0,0 +1,256 @@
|
|||
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service';
|
||||
import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.service';
|
||||
|
||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||
import {Dates, DOI} from '../../../utils/string-utils.class';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import {ClaimResult} from '../../claim-utils/claimEntities.class';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'bulk-claim',
|
||||
template: `
|
||||
<div class="uk-animation " style=" ">
|
||||
<form class=" uk-padding uk-panel uk-background-muted ">
|
||||
|
||||
<div class="uk-clearfix">
|
||||
<a class="uk-float-right" uk-toggle="target: #uploadInfo; animation: uk-animation-fade"><span class="uk-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
||||
</span> What is upload mode? </a>
|
||||
</div>
|
||||
<div id="uploadInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></a>
|
||||
<div class="uk-text-bold"><span class="uk-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
||||
</span> Upload information:</div>
|
||||
Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef or Datacite.
|
||||
Available results will be added to your selected resarch results list in order to be linked with the selected Projects and Contexts.
|
||||
|
||||
<div class="uk-article-meta">
|
||||
CSV format:
|
||||
<ul class="uk-list">
|
||||
<li>The format of CSV file should be "DOI","ACCESS_MODE","DATE".</li>
|
||||
<li>The value "DOI" is required </li>
|
||||
<li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</li>
|
||||
<li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li>
|
||||
<li>In case access mode is not available default value is "OPEN".</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div for="exampleInputFile">Upload a DOI csv file:</div>
|
||||
<label for="exampleInputFile">Select a file</label>
|
||||
<input id="exampleInputFile" class="uk-width-1-2" type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
|
||||
<button class="uk-button uk-button-success" [class.disabled]="!enableUpload" type="button" (click)="upload()">Upload</button>
|
||||
|
||||
<div *ngIf="showReport" uk-alert class="uk-alert uk-alert-primary" role="alert" >
|
||||
<a class="uk-alert-close" uk-close></a>
|
||||
<div>Uploaded file contains {{allIds.length}} rows. {{foundIds.length}} results were sucefully fetched from CrossRef and Datacite.</div>
|
||||
<div *ngIf ="duplicateIds.length > 0" >{{duplicateIds.length}} duplicate DOIs.</div>
|
||||
<div *ngIf = "notFoundIds.length > 0" >Couldn't be found:
|
||||
<ul class="">
|
||||
<li *ngFor="let id of notFoundIds">"{{id}}"</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div *ngIf = "noValidIds.length > 0" >No valid DOIs:
|
||||
<ul class="">
|
||||
<li *ngFor="let id of noValidIds">"{{id}}"</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div *ngIf = "allIds.length == 0 || foundIds.length == 0" > Please make sure you are using the right format for the csv file... </div>
|
||||
|
||||
</div>
|
||||
<div *ngIf="errorMessage.length > 0 " class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
||||
<modal-loading [message]= "'Uploading, reading and fetching results from your document. Please give us a moment..'"></modal-loading>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
`
|
||||
|
||||
})
|
||||
//[(ngModel)]="date"
|
||||
export class BulkClaimComponent {
|
||||
filesToUpload: Array<File>;
|
||||
navigateTo: string = "Search";
|
||||
source: string = "crossref";
|
||||
type : string = "publication";
|
||||
resultsFromSearch:number;
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public results;
|
||||
|
||||
allIds:string[] = [];
|
||||
foundIds:string[] = [];
|
||||
duplicateIds:string[] = [];
|
||||
notFoundIds:string[] = [];
|
||||
noValidIds:string[] = [];
|
||||
showReport:boolean = false;
|
||||
showInfo :boolean = false;
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
errorMessage = "";
|
||||
infoMEssage = "";
|
||||
enableUpload:boolean = true;
|
||||
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
||||
this.filesToUpload = [];
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
upload() {
|
||||
this.enableUpload = false;
|
||||
this.showReport = false;
|
||||
this.errorMessage = "";
|
||||
if(this.filesToUpload.length == 0){
|
||||
this.errorMessage = "There is no selected file to upload.";
|
||||
return ;
|
||||
}
|
||||
this.loading.open();
|
||||
|
||||
this.makeFileRequest(OpenaireProperties.getUploadServiceUrl(), [], this.filesToUpload).then((result) => {
|
||||
var rows = (result as any).split('\n'); // I have used space, you can use any thing.
|
||||
var i = 0;
|
||||
this.duplicateIds = [];
|
||||
this.allIds = [];
|
||||
this.foundIds = [];
|
||||
this.noValidIds = [];
|
||||
this.results.slice(0,this.results.length);
|
||||
this.notFoundIds = [];
|
||||
|
||||
for(i=0;i<rows.length;i++){
|
||||
if(rows[i] && rows[i] != null ){
|
||||
console.log("Row is:" + rows[i]);
|
||||
var values = rows[i].split(',');
|
||||
|
||||
var id=this.removeDoubleQuotes(values[0]);
|
||||
if(DOI.isValidDOI(id)){
|
||||
var accessMode = (values[1] != undefined) ? this.removeDoubleQuotes(values[1]):"OPEN";
|
||||
accessMode = (this.validateAccessMode(accessMode)?accessMode:"OPEN");
|
||||
var embargoDate =(values[2] != undefined) ? this.removeDoubleQuotes(values[2]):Dates.getDateToday();
|
||||
embargoDate = (Dates.isValidDate(embargoDate)?embargoDate:Dates.getDateToday());
|
||||
if(this.allIds.indexOf(id)>-1){
|
||||
this.duplicateIds.push(id);
|
||||
}else{
|
||||
this.allIds.push(id);
|
||||
this.fetchResult(id,accessMode,embargoDate);
|
||||
}
|
||||
}else{
|
||||
this.noValidIds.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, (error) => {
|
||||
this.enableUpload = true;
|
||||
console.log(error);
|
||||
this.loading.close();
|
||||
this.errorMessage = "An error occured while uploading...";
|
||||
});
|
||||
}
|
||||
private removeDoubleQuotes(value){
|
||||
if(value.indexOf('"')== 0){
|
||||
value = value.substring(1,value.length);
|
||||
}
|
||||
var index =+value.indexOf('"');
|
||||
if(index == (value.length - 1) || index == (value.length - 2) ){
|
||||
value = value.substring(0,index);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
private validateAccessMode(value){
|
||||
var accessModes = ["OPEN", "CLOSED", "EMBARGO"];
|
||||
if(accessModes.indexOf(value) > -1){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
fileChangeEvent(fileInput: any){
|
||||
this.filesToUpload = <Array<File>> fileInput.target.files;
|
||||
}
|
||||
|
||||
makeFileRequest(url: string, params: Array<string>, files: Array<File>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var formData: any = new FormData();
|
||||
var xhr = new XMLHttpRequest();
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
formData.append("uploads[]", files[i], files[i].name);
|
||||
}
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4) {
|
||||
if (xhr.status == 200) {
|
||||
resolve(xhr.response);
|
||||
} else {
|
||||
reject(xhr.response);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.open("POST", url, true);
|
||||
xhr.send(formData);
|
||||
});
|
||||
}
|
||||
|
||||
fetchResult(id:string,accessMode:string,date:string){
|
||||
this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe(
|
||||
data => {
|
||||
|
||||
var crossrefResult = data.items[0];
|
||||
if(data.items.length > 0){
|
||||
this.foundIds.push(id);
|
||||
var result: ClaimResult = ClaimResult.generateResult(crossrefResult, id,"crossref","publication", crossrefResult.URL, crossrefResult.title, crossrefResult.created['date-time'], accessMode);
|
||||
result.embargoEndDate = date;
|
||||
this.results.push(result);
|
||||
this.endOfFetching();
|
||||
}else{
|
||||
this.searchInDatacite(id,accessMode,date);
|
||||
// this.notFoundIds.push(id);
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.notFoundIds.push(id);
|
||||
this.endOfFetching();
|
||||
}
|
||||
);
|
||||
}
|
||||
searchInDatacite(id:string,accessMode:string,date:string){
|
||||
this._searchDataciteService.getDataciteResultByDOI(id).subscribe(
|
||||
item => {
|
||||
var dataciteResult = item.data;
|
||||
|
||||
if(dataciteResult != null && dataciteResult.attributes!= null ){
|
||||
|
||||
this.foundIds.push(id);
|
||||
var result: ClaimResult = ClaimResult.generateResult(dataciteResult, id,"datacite","dataset", 'http://dx.doi.org/'+dataciteResult.attributes.doi, dataciteResult.attributes.title, dataciteResult.attributes.published, accessMode);
|
||||
result.embargoEndDate = date;
|
||||
this.results.push(result);
|
||||
}else{
|
||||
this.notFoundIds.push(id);
|
||||
}
|
||||
this.endOfFetching();
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.notFoundIds.push(id);
|
||||
this.endOfFetching();
|
||||
}
|
||||
);
|
||||
}
|
||||
endOfFetching(){
|
||||
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length ){
|
||||
this.showReport = true;
|
||||
this.enableUpload = true;
|
||||
this.loading.close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
|
||||
import {BulkClaimComponent} from './bulkClaim.component';
|
||||
import {SearchCrossrefServiceModule} from '../../claim-utils/service/searchCrossrefService.module';
|
||||
import {SearchDataciteServiceModule} from '../../claim-utils/service/searchDataciteService.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, LoadingModalModule, SearchCrossrefServiceModule
|
||||
],
|
||||
declarations: [
|
||||
BulkClaimComponent
|
||||
], exports:[ BulkClaimComponent]
|
||||
})
|
||||
export class BulkClaimModule { }
|
|
@ -0,0 +1,16 @@
|
|||
// import {Component, Input} from '@angular/core';
|
||||
// import {Observable} from 'rxjs/Observable';
|
||||
//
|
||||
// @Component({
|
||||
// selector: 'bulk-linking',
|
||||
// //providers: [MdRadioDispatcher],
|
||||
// template: `
|
||||
// <linking-generic [bulkMode]=true> </linking-generic>
|
||||
// `
|
||||
//
|
||||
// })
|
||||
// //[(ngModel)]="date"
|
||||
// export class BulkLinkingComponent {
|
||||
// constructor () {
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1,20 @@
|
|||
// import { NgModule } from '@angular/core';
|
||||
//
|
||||
// import { SharedModule } from '../../shared/shared.module';
|
||||
// import { BulkLinkingComponent } from './bulkLinking.component';
|
||||
// import { BulkLinkingRoutingModule } from './bulkLinking-routing.module';
|
||||
// import {LinkingGenericModule} from './linkingGeneric.module';
|
||||
// import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
|
||||
// @NgModule({
|
||||
// imports: [
|
||||
// SharedModule,
|
||||
// BulkLinkingRoutingModule,
|
||||
// LinkingGenericModule,
|
||||
// BulkClaimModule
|
||||
//
|
||||
// ],
|
||||
// declarations: [
|
||||
// BulkLinkingComponent
|
||||
// ], exports:[BulkLinkingComponent]
|
||||
// })
|
||||
// export class BulkLinkingModule { }
|
|
@ -0,0 +1,371 @@
|
|||
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Router} from '@angular/router';
|
||||
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} from '../../../login/utils/helper.class';
|
||||
import {ErrorCodes} from '../../../login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-insert',
|
||||
template: `
|
||||
<div *ngIf="errorMessage.length > 0">
|
||||
<div class="uk-alert uk-alert-danger" role="alert" [innerHTML]="errorMessage"></div>
|
||||
<div *ngIf="insertedClaims.length>0">There are {{insertedClaims.length}} claims, follow <a routerLinkActive="router-link-active" routerLink="/myclaims">the link</a> to manage your claims</div>
|
||||
</div>
|
||||
<div *ngIf="warningMessage.length > 0">
|
||||
<div class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
<button *ngIf="!claiming && showButton" (click)="validateInsertions()" class="uk-button uk-button-primary" >Finish</button>
|
||||
`
|
||||
})
|
||||
export class ClaimInsertComponent {
|
||||
constructor (private claimService: ClaimsService, private _router:Router) {}
|
||||
ngOnInit() {
|
||||
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
|
||||
}
|
||||
|
||||
|
||||
@Input() public contexts;
|
||||
@Input() public projects;
|
||||
@Input() public results;
|
||||
@Input() public showButton:boolean = true;
|
||||
@Input() show='claim';
|
||||
@Input() inlineEntity = null; // the entity from the landing page
|
||||
@Output() showChange = new EventEmitter();
|
||||
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
@ViewChild(AlertModal) alert;
|
||||
|
||||
public claiming =false;
|
||||
public error = false;
|
||||
public errorMessage = "";
|
||||
public warningMessage = "";
|
||||
public claimsTODO:number = 0;
|
||||
public claims:number = 0;
|
||||
|
||||
private servicesRespond:number = 0;
|
||||
private insertedClaims=[];
|
||||
private errorInClaims=[];
|
||||
private insertedRecords=[];
|
||||
private errorInRecords=[];
|
||||
public validateInsertions(){
|
||||
// console.info("Inlineentity:" +(this.inlineEntity)?this.inlineEntity+(this.inlineEntity.id)?this.inlineEntity.id:"no id":"null"+ + " show "+ (!this.claiming && this.showButton) );
|
||||
if(this.validate()){
|
||||
if(this.validateDates()){
|
||||
this.insertActions();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
private insertActions(){
|
||||
this.servicesRespond = 0;
|
||||
this.insertedClaims=[];
|
||||
this.errorInClaims=[];
|
||||
this.insertedRecords=[];
|
||||
this.errorInRecords=[];
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.showButton = false;
|
||||
localStorage.setItem("projects", JSON.stringify(this.projects));
|
||||
localStorage.setItem("contexts", JSON.stringify(this.contexts));
|
||||
localStorage.setItem("results", JSON.stringify(this.results));
|
||||
if(this.inlineEntity != null){
|
||||
localStorage.setItem("inlineEntity", JSON.stringify(this.inlineEntity));
|
||||
}
|
||||
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": ErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
|
||||
}else{
|
||||
this.claiming = true;
|
||||
var user=Session.getUserEmail();
|
||||
this.loading.open();
|
||||
var claims = [];
|
||||
var directclaims = [];
|
||||
if(this.results){
|
||||
console.info("results: "+this.results.length);
|
||||
|
||||
for (var i = 0; i < this.results.length; i++) {
|
||||
var result=this.results[i];
|
||||
if(["crossref","datacite","orcid"].indexOf(result.source) != -1){
|
||||
directclaims.push({"id":result.id, "record":this.createDirectClaim(result,this.projects,this.contexts)});
|
||||
}
|
||||
if(this.contexts){
|
||||
for (var j = 0; j < this.contexts.length; j++) {
|
||||
var context = this.contexts[j];
|
||||
var claim = this.createContextClaim(result, context, user);
|
||||
claims.push(claim);
|
||||
}
|
||||
}
|
||||
if(this.projects){
|
||||
for (var k = 0; k < this.projects.length; k++) {
|
||||
var project = this.projects[k];
|
||||
var projectClaim = this.createProjectClaim(result, project, user);
|
||||
claims.push(projectClaim);
|
||||
}
|
||||
}
|
||||
if(this.inlineEntity != null){
|
||||
var resultClaim = this.createResultClaim(this.inlineEntity, result, user);
|
||||
claims.push(resultClaim);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB
|
||||
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
|
||||
if(directclaims.length > 0){
|
||||
this.claimService.insertDirectRecords(directclaims).subscribe(
|
||||
data => {
|
||||
this.insertedRecords = data.insertedIds;
|
||||
|
||||
this.errorInRecords = data.errorInClaims;
|
||||
this.isertBulkClaims(claims);
|
||||
},
|
||||
err => {
|
||||
err=err.json();
|
||||
if(err.insertedIds && err.insertedIds.length >0){
|
||||
this.insertedRecords = err.insertedIds;
|
||||
}
|
||||
if(err.errorInClaims && err.errorInClaims.length >0){
|
||||
this.errorInRecords = err.errorInClaims;
|
||||
}
|
||||
this.isertBulkClaims(claims);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this.isertBulkClaims(claims);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private isertBulkClaims(claims){
|
||||
console.info("try to insert "+claims.length+" claims");
|
||||
this.claimService.insertBulkClaims(claims).subscribe(
|
||||
data => {
|
||||
this.insertedClaims = data.insertedIds;
|
||||
this.errorInClaims = data.errorInClaims;
|
||||
this.afterclaimsInsertion();
|
||||
},
|
||||
err => {
|
||||
err=err.json();
|
||||
if(err.insertedIds && err.insertedIds.length >0){
|
||||
this.insertedClaims = err.insertedIds;
|
||||
}
|
||||
if(err.errorInClaims && err.errorInClaims.length >0){
|
||||
this.errorInClaims = err.errorInClaims;
|
||||
}
|
||||
this.afterclaimsInsertion();
|
||||
}
|
||||
);
|
||||
}
|
||||
private validate(){
|
||||
this.warningMessage = "";
|
||||
this.errorMessage = "";
|
||||
if( this.results && this.results.length == 0){
|
||||
this.warningMessage = "There are no research results selected.";
|
||||
}else if((!this.contexts|| this.contexts.length==0 )&&(!this.projects|| this.projects.length==0 )&& ( this.inlineEntity == null)){
|
||||
this.warningMessage = "There are no projects or communities to link.";
|
||||
// }else if (this.inline && !this.inlineEntity){
|
||||
// this.errorMessage = "No inline entity";
|
||||
// console.log(this.inline + " "+ this.inlineEntity);
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private validateDates(){
|
||||
if(this.projects){
|
||||
for (var k = 0; k < this.projects.length; k++) {
|
||||
var project = this.projects[k];
|
||||
console.info(project.startDate+" "+project.endDate + " "+project.projectAcronym);
|
||||
if(this.results){
|
||||
for (var i = 0; i < this.results.length; i++) {
|
||||
var result = this.results[i];
|
||||
if(result.date && result.date != null){
|
||||
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
|
||||
if((project.startDate && result.date < project.startDate) || ( project.endDate && result.date > (project.endDate+5)) ){
|
||||
this.confirmOpen();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if(this.results){
|
||||
for (var i = 0; i < this.results.length; i++) {
|
||||
var result = this.results[i];
|
||||
if(result.date && result.date != null){
|
||||
console.info("Date :"+ result.date + " & embargoEndDate :" +result.embargoEndDate );
|
||||
if((result.embargoEndDate && result.embargoEndDate != null) && result.date >result.embargoEndDate ){
|
||||
this.confirmOpen();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private afterclaimsInsertion(){
|
||||
|
||||
this.loading.close();
|
||||
this.claiming = false;
|
||||
|
||||
if(this.errorInClaims.length == 0 && this.insertedClaims.length > 0 && this.errorInRecords.length == 0){
|
||||
|
||||
this._router.navigate( ['/myclaims'] );
|
||||
this.showChange.emit({
|
||||
value: this.show
|
||||
});
|
||||
}else{
|
||||
this.errorsInClaimsInsertion();
|
||||
}
|
||||
}
|
||||
private errorsInClaimsInsertion(){
|
||||
this.errorMessage = "";
|
||||
this.loading.close();
|
||||
this.error = true;
|
||||
this.claiming = false;
|
||||
this.showButton = false;
|
||||
var text =""
|
||||
console.log("Errors: this.errorInRecords.length: "+this.errorInRecords.length+" - this.errorInClaims.length: "+this.errorInClaims.length);
|
||||
if(this.errorInRecords.length>0){
|
||||
text+="<div>The following records couldn't automatically inserted to the Openaire Info space: <ul>";
|
||||
for(var i=0; i< this.errorInRecords.length ; i++){
|
||||
for(var k=0; k< this.results.length ; k++){
|
||||
if(this.results[k].id == this.errorInRecords[i]){
|
||||
text+="<li>"+this.results[i].title+" from "+this.results[i].source+"</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
text+="</ul></div>";
|
||||
|
||||
}
|
||||
if(this.errorInClaims.length > 0){
|
||||
text+="<div>The following links couldn't be saved: <ul>";
|
||||
for(var i=0; i< this.errorInClaims.length ; i++){
|
||||
// var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
|
||||
|
||||
text+="<li>"+this.errorInClaims[i].sourceType+": "+this.errorInClaims[i].sourceId +"(from "+this.errorInClaims[i].sourceCollectedFrom+") link to "+this.errorInClaims[i].targetType+": "+this.errorInClaims[i].targetId +"(from "+this.errorInClaims[i].targetCollectedFrom+") </li>";
|
||||
|
||||
}
|
||||
text+="</ul></div>";
|
||||
}
|
||||
this.errorMessage+="<div>An error occured:</div>"+text;
|
||||
console.log(text);
|
||||
// if(this.inline){
|
||||
// this.show = "error";
|
||||
// this.showChange.emit({
|
||||
// value: this.show
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private createContextClaim(result:any, context:any, user:any){
|
||||
var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
|
||||
return claim;
|
||||
}
|
||||
private createProjectClaim(result:any, project:any, user:any){
|
||||
//project.projectId
|
||||
// var dummyID = "dummyID";
|
||||
var claim = { claimedBy : user, sourceId : project.projectId, sourceType : "project", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)};
|
||||
return claim;
|
||||
}
|
||||
private createResultClaim(inlineResult:any, result:any, user:any){
|
||||
var claim = { claimedBy : user, sourceId : result.id, sourceType : result.type, sourceCollectedFrom: result.source, sourceAccessRights: result.accessRights, sourceEmbargoEndDate: result.embargoEndDate, targetId : inlineResult.id , targetType : inlineResult.type, targetCollectedFrom: inlineResult.source, targetAccessRights: inlineResult.accessRights, targetEmbargoEndDate: (inlineResult.embargoEndDate == null?"":inlineResult.embargoEndDate)};
|
||||
return claim;
|
||||
}
|
||||
createDirectClaim(result, projects, contexts){
|
||||
var entity = {};
|
||||
var md5_id = Md5.hashStr(result.id);
|
||||
entity["originalId"]="userclaim___::"+md5_id;
|
||||
entity["openaireId"]="userclaim___::"+md5_id;
|
||||
entity["title"]=result.title;
|
||||
entity["title"] =(Array.isArray(result.title) && result.title.length > 0 )?result.title[0]:result.title;
|
||||
|
||||
if(result.authors && result.authors.length > 0){
|
||||
entity["authors"]=result.authors;
|
||||
}
|
||||
if(result.publisher){
|
||||
entity["publisher"]=result.publisher;
|
||||
}
|
||||
if(result.description){
|
||||
entity["description"]=result.description;
|
||||
}
|
||||
// entity["language"]=""; no info
|
||||
entity["type"]=result.type;
|
||||
if(result.source == "crossref" || result.source == "datacite"){
|
||||
entity["pids"]= [];//{type:string, value:string}[];
|
||||
entity["pids"].push({type:"doi",value:result.id})
|
||||
}
|
||||
entity["licenseCode"]=result.accessRights;
|
||||
if(result.accessRights == "EMBARGO"){
|
||||
entity["embargoEndDate"]=result.embargoEndDate;
|
||||
}
|
||||
if(result.type =="publication"){
|
||||
entity["resourceType"]="0001";
|
||||
}else if(result.type =="dataset"){
|
||||
entity["resourceType"]="0021";
|
||||
}else if(result.type =="software"){
|
||||
entity["resourceType"]="0029";
|
||||
}
|
||||
entity["url"]=result.url;
|
||||
entity["hostedById"]="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18";
|
||||
if(result.source == "crossref"){
|
||||
entity["collectedFromId"]="openaire____::crossref";
|
||||
}else if(result.source == "datacite"){
|
||||
entity["collectedFromId"]="openaire____::datacite";
|
||||
}else if(result.source == "orcid"){
|
||||
entity["collectedFromId"]="openaire____::orcid";
|
||||
}else if(result.source == "orpenaire"){
|
||||
entity["collectedFromId"]="openaire____::driver";
|
||||
}
|
||||
|
||||
if(projects.length>0){
|
||||
entity["linksToProjects"]=[];
|
||||
for(var i =0; i < projects.length; i++){
|
||||
// "info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus",
|
||||
entity["linksToProjects"].push("info:eu-repo/grantAgreement/"+projects[i].funderName+"/"+projects[i].fundingLevel0+"/"+projects[i].code+"/"+projects[i].jurisdiction+"/"+projects[i].projectName+"/"+projects[i].projectAcronym);
|
||||
}
|
||||
}
|
||||
if(contexts.length > 0){
|
||||
entity["contexts"]=[];
|
||||
for(var i =0; i < contexts.length; i++){
|
||||
entity["contexts"].push(contexts[i].concept.id);
|
||||
}
|
||||
}
|
||||
var json = JSON.stringify(entity);
|
||||
console.log("\nJSON:\n"+json);
|
||||
return entity;
|
||||
|
||||
|
||||
|
||||
}
|
||||
confirmOpen(){
|
||||
this.alert.cancelButton = true;
|
||||
this.alert.okButton = true;
|
||||
this.alert.alertTitle = "Invalid dates";
|
||||
this.alert.message = "There is a research result whose publication date is after project end date or before project start date. Or embargo end date of a research result is before research result's publication date.";
|
||||
this.alert.okButtonText = "Proceed anyway";
|
||||
this.alert.cancelButtonText = "Cancel";
|
||||
this.alert.open();
|
||||
}
|
||||
confirmClose(data){
|
||||
this.insertActions();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
|
||||
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
|
||||
import {ClaimInsertComponent} from './insertClaim.component';
|
||||
import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule
|
||||
],
|
||||
declarations: [ClaimInsertComponent],
|
||||
exports:[ ClaimInsertComponent]
|
||||
})
|
||||
export class InsertClaimsModule { }
|
|
@ -0,0 +1,19 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { LinkingGenericComponent } from './linkingGeneric.component';
|
||||
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: LinkingGenericComponent, canActivate: [IsRouteEnabled, LoginGuard], data: {
|
||||
redirect: '/error'
|
||||
}, canDeactivate: [PreviousRouteRecorder]},
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class LinkingRoutingModule { }
|
|
@ -0,0 +1,16 @@
|
|||
// import {Component, Input} from '@angular/core';
|
||||
// import {Observable} from 'rxjs/Observable';
|
||||
// import {LinkingGenericComponent} from './linkingGeneric.component';
|
||||
//
|
||||
// @Component({
|
||||
// selector: 'linking',
|
||||
// template: `
|
||||
// <linking-generic [bulkMode]=false> </linking-generic>
|
||||
// `
|
||||
//
|
||||
// })
|
||||
// export class LinkingComponent {
|
||||
// constructor () {
|
||||
// }
|
||||
//
|
||||
// }
|
|
@ -0,0 +1,118 @@
|
|||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
Link
|
||||
</div>
|
||||
|
||||
<div class="uk-width-1-1">
|
||||
<helper position="top"></helper>
|
||||
</div>
|
||||
<div class="uk-grid helper-grid">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
|
||||
<ul class="uk-subnav uk-margin-remove-bottom uk-subnav-divider linkingSteps" uk-margin="">
|
||||
<li [class]="(step==1)?'uk-active':' '" ><a (click)="step=1;"> 1 Select Projects <span >or Communities </span></a></li>
|
||||
<li [class]="(step==2)?'uk-active':' '" ><a (click)="step=2;">2 Select Research Results </a></li>
|
||||
<li [class]="(step==3)?'uk-active':' '" (click)="step=3;"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" >3 Review metadata</a></li>
|
||||
</ul>
|
||||
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" ></start-over-->
|
||||
<ul uk-accordion>
|
||||
<li>
|
||||
<h3 class=" uk-text-right uk-margin-remove-vertical uk-width-small uk-margin-auto-left uk-accordion-title basket-title ">
|
||||
|
||||
<span class="uk-icon"><svg xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" height="28px" id="my-box" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="28px" x="0px" xmlns="http://www.w3.org/2000/svg" y="0px"><g> <path d="M480,320v128H32V320h78.859l64.016,96h162.25l64-96H480 M384,32H128L0,288v192h512V288L384,32L384,32z M35.781,288l112-224 h216.438l112,224H384l-64,96H192l-64.016-96H35.781L35.781,288z" fill="#b5b5b5"></path></g> </svg> </span>
|
||||
<span *ngIf="(projects.length + contexts.length + results.length)> 0" class="uk-badge basket-badge ">{{(projects.length + contexts.length + results.length)}}</span>
|
||||
</h3>
|
||||
<div class="uk-accordion-content dropbasket uk-padding-small uk-margin uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-grid uk-grid-stack">
|
||||
<claim-selected-projects title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-projects>
|
||||
|
||||
<claim-selected-contexts title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
|
||||
(showChange)="showChange($event)" > </claim-selected-contexts>
|
||||
<claim-selected-results *ngIf="step!=3" title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch=false showAccessRights=false>
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div *ngIf="step==1">
|
||||
|
||||
<ul class=" uk-tab " uk-tab="connect: #tabs; animation: uk-animation-fade">
|
||||
<li>
|
||||
<a>Projects ({{projects.length}})</a>
|
||||
</li>
|
||||
<li>
|
||||
<a>Communities ({{contexts.length}})</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul id="tabs" class="uk-switcher uk-margin-left uk-width-1-1">
|
||||
<li>
|
||||
|
||||
<claim-projects-search-form [(selectedProjects)]="projects" > </claim-projects-search-form>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<claim-contexts-search-form [(selectedList)]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineResult" > </claim-contexts-search-form>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!--/div-->
|
||||
<!--/div-->
|
||||
<!--hr-->
|
||||
<!-- Research Results -->
|
||||
|
||||
<div *ngIf="step==2 ">
|
||||
<div class="uk-width-1-1 uk-card uk-card-default uk-padding ">
|
||||
<div class=" uk-padding-small uk-padding-remove-bottom ">
|
||||
<span *ngIf="bulkMode" class=" uk-animation uk-float-right">
|
||||
<span title= "Bulk mode"><i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></span>
|
||||
<a title= "Switch to Search mode" (click)="bulkMode = !bulkMode;"> <span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
</span></a>
|
||||
</span>
|
||||
<span *ngIf="!bulkMode" class=" uk-animation uk-float-right">
|
||||
<a title= "Switch to Bulk mode" (click)="bulkMode = !bulkMode;"><i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></a>
|
||||
<span title= "Search mode"> <span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
</span></span>
|
||||
</span>
|
||||
</div>
|
||||
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" > </claim-result-search-form>
|
||||
<bulk-claim *ngIf="bulkMode" [results]="results" > </bulk-claim>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="step==3" class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l">
|
||||
<claim-selected-results title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" showSearch = false showAccessRights = true>
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<ul class=" uk-pagination uk-flex-center uk-margin-auto uk-text-center">
|
||||
<li *ngIf="step !=1 " (click)="step=step-1;" class="uk-margin-left"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
|
||||
<li *ngIf="step !=3 " (click)="step=step + 1;" >
|
||||
<a>Next <span uk-pagination-next></span></a>
|
||||
</li>
|
||||
<li *ngIf=" step == 3 " (click)="next()" >
|
||||
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
|
||||
(showChange)="showChange($event)" ></claim-insert>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
<helper position="bottom"></helper>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,117 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
|
||||
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
|
||||
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
declare var UIkit:any;
|
||||
|
||||
@Component({
|
||||
selector: 'linking-generic',
|
||||
templateUrl: 'linkingGeneric.component.html'
|
||||
|
||||
})
|
||||
export class LinkingGenericComponent {
|
||||
|
||||
@Input() bulkMode: boolean = false;
|
||||
sourceType:string;
|
||||
targetType:string;
|
||||
step:number = 1;
|
||||
contexts=[];
|
||||
projects=[];
|
||||
results = [];
|
||||
show = "project";
|
||||
date='8-6-2016';
|
||||
keyword: string = "";
|
||||
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
|
||||
/* url Parameters for inline linking */
|
||||
id:string = null; //entity id
|
||||
type:string = null; // entity type (publication or research data)
|
||||
linkTo:string = null; // entity type (project or context or result)
|
||||
|
||||
entityTypes=["dataset", "publication", "project","context"];
|
||||
inlineResult:ClaimResult =null;
|
||||
sub:any =null;
|
||||
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
|
||||
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) {
|
||||
this._meta.setTitle("OpenAIRE | Linking");
|
||||
}
|
||||
ngOnInit() {
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("projects")){
|
||||
this.projects = JSON.parse(localStorage.getItem("projects"));
|
||||
|
||||
}
|
||||
if(localStorage.getItem("contexts")){
|
||||
this.contexts = JSON.parse(localStorage.getItem("contexts"));
|
||||
}
|
||||
if(localStorage.getItem("results")){
|
||||
this.results = JSON.parse(localStorage.getItem("results"));
|
||||
|
||||
}
|
||||
localStorage.removeItem("projects");
|
||||
localStorage.removeItem("contexts");
|
||||
localStorage.removeItem("results");
|
||||
}
|
||||
}
|
||||
|
||||
next(){
|
||||
|
||||
if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
|
||||
this.show='claim';
|
||||
|
||||
}
|
||||
}
|
||||
prev(){
|
||||
if(this.show == 'claim'){
|
||||
this.show='result';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resultsChange($event) {
|
||||
this.results=$event.value;
|
||||
}
|
||||
|
||||
projectsChange($event) {
|
||||
this.projects=$event.value;
|
||||
}
|
||||
|
||||
linkTypeChange($event) {
|
||||
|
||||
this.linkType =$event.value;
|
||||
this.show="result";
|
||||
if(this.bulkMode){
|
||||
this.show="claim";
|
||||
}
|
||||
}
|
||||
|
||||
showChange($event) {
|
||||
this.show=$event.value;
|
||||
this.showChangedType($event.value);
|
||||
}
|
||||
|
||||
showChangedType(type:string) {
|
||||
this.show=type;
|
||||
if(this.show == 'project' || this.show == 'context' || this.show == 'software'){
|
||||
this.linkType = this.show;
|
||||
}
|
||||
}
|
||||
|
||||
canProceedToMetadata(){
|
||||
if(this.results.length == 0){
|
||||
|
||||
UIkit.notification({
|
||||
message : 'No research results selected!<br>Please select research results to link with projects and/ or ommunities.',
|
||||
status : 'warning',
|
||||
timeout : 1000,
|
||||
pos : 'top-center'
|
||||
});
|
||||
}else{
|
||||
this.show = 'claim';
|
||||
this.step = 3;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
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 {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import { LinkingRoutingModule } from './linking-routing.module';
|
||||
import {StartOverModule} from '../claim-utils/startOver.module';
|
||||
import {LoginGuard} from'../../login/loginGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
|
||||
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
|
||||
import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
|
||||
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
|
||||
import {HelperModule} from '../../utils/helper/helper.module';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, SelectedProjectsModule, SelectedContextsModule,
|
||||
SelectedPublicationsModule,
|
||||
InsertClaimsModule,
|
||||
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
|
||||
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, HelperModule
|
||||
],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
|
||||
declarations: [
|
||||
LinkingGenericComponent
|
||||
], exports:[
|
||||
LinkingGenericComponent ]
|
||||
})
|
||||
export class LinkingGenericModule { }
|
|
@ -0,0 +1,91 @@
|
|||
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
||||
import {ClaimContext} from '../../claim-utils/claimEntities.class';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-selected-contexts',
|
||||
template: `
|
||||
|
||||
<!-- Contexts -->
|
||||
|
||||
<div class="uk-placeholder uk-margin-top" >
|
||||
|
||||
<!--div class="uk-width-1-2 ">
|
||||
|
||||
<div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button uk-button-default uk-animation uk-float-right">Add more <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span></button></div>
|
||||
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" [projects]="projects" [results]="results" [inlineEntity]="inlineEntity" > </claim-contexts-search-form>
|
||||
</div-->
|
||||
<div *ngIf="contexts.length > 0 " class=" ">
|
||||
<h5 class=" uk-margin uk-h5 uk-text-primary">Selected Communities ({{contexts.length}}) </h5>
|
||||
|
||||
<ul class="uk-list uk-list-divider">
|
||||
<li class="list-group-item" *ngFor="let context of contexts" >
|
||||
<span *ngIf="context.community != context.concept.label">{{context.community }} > {{context.category}} ></span><span> {{context.concept.label}} </span>
|
||||
<span (click)="removeContext(context)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div *ngIf="contexts.length == 0 " class="uk-text-center">There are no selected communities</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
export class ClaimSelectedContextsComponent {
|
||||
ngOnInit() {
|
||||
var myDate = new Date();
|
||||
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
//2015-05-01
|
||||
// if(this.linkType == "context"){
|
||||
this.showsearch = true
|
||||
// }else{
|
||||
// this.showsearch = false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Input() contexts:ClaimContext[];
|
||||
//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';
|
||||
@Input() linkType:string = "project";
|
||||
|
||||
@Input() hideType;
|
||||
@Input() bulkMode:boolean = false;
|
||||
@Output() showChange = new EventEmitter();
|
||||
|
||||
showsearch:boolean = false;
|
||||
|
||||
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) {
|
||||
this.contexts.splice(index, 1);
|
||||
}
|
||||
|
||||
}
|
||||
contextSelected($event) {
|
||||
// this.showsearch = false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
],
|
||||
declarations: [
|
||||
ClaimSelectedContextsComponent
|
||||
], exports:[ClaimSelectedContextsComponent]
|
||||
})
|
||||
export class SelectedContextsModule { }
|
|
@ -0,0 +1,88 @@
|
|||
import {Component, Input,Output, EventEmitter} from '@angular/core';
|
||||
import {ClaimProject} from '../../claim-utils/claimEntities.class';
|
||||
import {RouterHelper} from '../../../utils/routerHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-selected-projects',
|
||||
template: `
|
||||
|
||||
|
||||
<div class="uk-placeholder uk-margin-top" >
|
||||
|
||||
<!--div class="uk-width-1-2 ">
|
||||
<!--div class="uk-clearfix"><button *ngIf=" !showsearch " (click)="showsearch = true;" class="uk-button-default uk-float-right uk-animation ">Add more <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span></button></div>
|
||||
<claim-projects-search-form *ngIf=" showsearch " [selectedProjects]="projects" (projectSelected)="projectSelected($event)" > </claim-projects-search-form>
|
||||
</div>
|
||||
<div class="uk-width-1-2 "-->
|
||||
<div>
|
||||
<h5 class=" uk-margin uk-h5 uk-text-primary" *ngIf="projects.length > 0 "> Selected Projects ({{projects.length}}) </h5>
|
||||
<ul class="uk-list uk-list-divider">
|
||||
<li class="list-group-item" *ngFor="let project of projects">
|
||||
<a [queryParams]="routerHelper.createQueryParam('projectId',project.projectId)" routerLinkActive="router-link-active" routerLink="/search/project" >{{project.funderName}} | {{project.projectName}} {{(project.projectAcronym)?'('+project.projectAcronym+')':''}} <!--[{{project.startDate}} - {{project.endDate}}]--></a>
|
||||
<span (click)="removeProject(project)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div *ngIf="projects.length == 0 " class="uk-text-center">There are no selected projects</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
export class ClaimSelectedProjectsComponent {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
var myDate = new Date();
|
||||
this.todayDate=( myDate.getFullYear()+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
this.nextDate= ( (myDate.getFullYear()+100)+ "-" +myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
||||
// if(this.linkType == "project"){
|
||||
this.showsearch = true
|
||||
// }else{
|
||||
// this.showsearch = false;
|
||||
// }
|
||||
//2015-05-01
|
||||
}
|
||||
|
||||
|
||||
@Input() projects: ClaimProject[];
|
||||
@Input() show='home';
|
||||
@Input() title='Projects';
|
||||
@Input() linkType:string = "project";
|
||||
@Input() hideType;
|
||||
@Input() bulkMode:boolean = false;
|
||||
@Input() linkToResults:boolean = true;
|
||||
@Output() projectsChange = new EventEmitter();
|
||||
@Output() showChange = new EventEmitter();
|
||||
showsearch:boolean = false;
|
||||
|
||||
todayDate = '';
|
||||
nextDate = '';
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
removeProject(item:any){
|
||||
var index:number =this.projects.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.projects.splice(index, 1);
|
||||
}
|
||||
this.projectsChange.emit({
|
||||
value: this.projects
|
||||
});
|
||||
}
|
||||
showType(type){
|
||||
if(type != this.show){
|
||||
this.show = type;
|
||||
this.showChange.emit({
|
||||
value: this.show
|
||||
});
|
||||
}
|
||||
}
|
||||
projectSelected($event) {
|
||||
// this.showsearch = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
import { NgModule } from '@angular/core';
|
||||
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
|
||||
], exports:[ClaimSelectedProjectsComponent]
|
||||
})
|
||||
export class SelectedProjectsModule { }
|
|
@ -0,0 +1,225 @@
|
|||
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
|
||||
import {AlertModal} from '../../../utils/modal/alert';
|
||||
import {ClaimResult} from '../../claim-utils/claimEntities.class';
|
||||
import {IMyOptions, IMyDateModel} from '../../../utils/my-date-picker/interfaces/index';
|
||||
import {Dates} from '../../../utils/string-utils.class';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-selected-results',
|
||||
template: `
|
||||
|
||||
|
||||
|
||||
|
||||
<!--div *ngIf="showSearch " class="uk-width-1-2 ">
|
||||
<div class="uk-clearfix"><a (click)="bulkMode = !bulkMode;" class=" uk-animation uk-float-right">
|
||||
<span *ngIf="!bulkMode">Switch to Upload mode <i class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></i></span>
|
||||
<span *ngIf="bulkMode">Switch to Search mode <span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
</span></span>
|
||||
</a></div>
|
||||
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" > </claim-result-search-form>
|
||||
<bulk-claim *ngIf="bulkMode" [results]="results" > </bulk-claim>
|
||||
</div-->
|
||||
<div class="uk-placeholder uk-margin-top" >
|
||||
<div *ngIf="results.length == 0 " class="uk-text-center">There are no selected research results</div>
|
||||
<div *ngIf="results.length > 0 ">
|
||||
<h5 class=" uk-margin uk-h5 uk-text-primary" > {{title}} ({{results.length}}) </h5>
|
||||
<table class="uk-table uk-table-responsive">
|
||||
<thead *ngIf="showAccessRights">
|
||||
<tr>
|
||||
<th> Research Result</th>
|
||||
<th> Change type and access mode</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let pub of results" >
|
||||
<td >
|
||||
<div>
|
||||
<span *ngIf="showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></span>
|
||||
<a *ngIf="pub.url" target="_blank" href="{{pub.url}}" > <span class="custom-external"></span> {{pub.title}}</a>
|
||||
<span *ngIf="!pub.url" >{{pub.title}}</span>
|
||||
<span *ngIf="!showAccessRights" (click)="removePublication(pub)" aria-hidden="true" class="uk-icon-button"><span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></span>
|
||||
</div>
|
||||
|
||||
<span *ngIf="pub.publisher" >Publisher: {{pub.publisher}}</span>
|
||||
<!--Orcid --><span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " >Journal: {{pub.result['journal-title'].value}}</span>
|
||||
<span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
|
||||
|
||||
<div *ngIf="pub.authors && pub.authors.length > 0" >Authors: <span *ngFor="let author of pub.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.authors.slice(0,10).length-1 && pub.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
<!-- Crossref -->
|
||||
<!--span *ngIf="pub.result.publisher" class="uk-article-meta">Publisher: {{pub.result.publisher}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
|
||||
<div *ngIf="pub.result.author && pub.result.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.author.slice(0,10).length-1 && pub.result.author.length > 10)?"...":""}}</span></div-->
|
||||
<div *ngIf="pub.result.editor && pub.result.editor.length > 0" >Editors: <span *ngFor="let author of pub.result.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.editor.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.editor.slice(0,10).length-1 && pub.result.editor.length > 10)?"...":""}}</span></div>
|
||||
|
||||
<!-- Openaire -->
|
||||
<div *ngIf="pub.result.authors && pub.result.authors.length >0 " >Authors: <span *ngFor="let author of pub.result.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.authors.slice(0,10).length-1 && pub.result.authors.length > 10)?"...":""}}</span></div>
|
||||
|
||||
<!-- Orcid -->
|
||||
|
||||
<!--span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span>
|
||||
<div *ngIf="pub.result.contributors && pub.result.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.contributors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.contributors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.contributors.slice(0,10).length-1 && pub.result.contributors.length > 10)?"...":""}}</span></div-->
|
||||
<!-- Datacite -->
|
||||
<!--span *ngIf="pub.result.attributes['container-title']" class="uk-article-meta">Publisher: {{pub.result.attributes['container-title']}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
|
||||
<div *ngIf="pub.result.attributes.author && pub.result.attributes.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (pub.result.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.attributes.author.slice(0,10).length-1 && pub.result.attributes.author.length > 10)?"...":""}}</span></div-->
|
||||
<div><span class="uk-label label-grey">{{pub.source}}</span>
|
||||
<span *ngIf="pub.accessRights" [class]=" 'uk-label label-'+pub.accessRights" > {{pub.accessRights}}</span>
|
||||
<span *ngIf="pub.type" [class]="'uk-label label-'+pub.type" > {{pub.type}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td *ngIf="showAccessRights && pub.source != 'openaire' " >
|
||||
|
||||
<select [(ngModel)]="pub.type" name="{{'select_type_'+pub.id}}" >
|
||||
<option [value]="'publication'" (click)="onTypeChanged('publication',pub)" >Publication</option>
|
||||
<option [value]="'dataset'" (click)="onTypeChanged('dataset',pub)" >Research Data</option>
|
||||
<option [value]="'software'" (click)="onTypeChanged('software',pub)" >Software</option>
|
||||
</select>
|
||||
|
||||
<select [(ngModel)]="pub.accessRights" name="{{'select_rights_'+pub.id}}" >
|
||||
<option *ngFor="let type of accessTypes" [value]="type" (click)="accessRightsTypeChanged(type,pub)">{{type}}</option>
|
||||
</select>
|
||||
<my-date-picker *ngIf="pub.accessRights== 'EMBARGO'" name="{{'date'+pub.id}}" [options]="myDatePickerOptions"
|
||||
[(ngModel)]="nextDate" (dateChanged)="onDateChanged($event,pub)" ></my-date-picker>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td *ngIf="showAccessRights && pub.source == 'openaire' " >
|
||||
Currently you cannot change metadata from OpenAIRE
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<div>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class ClaimSelectedResultsComponent {
|
||||
ngOnInit() {
|
||||
var myDate = new Date();
|
||||
this.nextDate = { date: { year: myDate.getFullYear()+10, month: (myDate.getMonth()+1), day: myDate.getDate() } };
|
||||
//2015-05-01
|
||||
|
||||
}
|
||||
|
||||
@Input() results: ClaimResult[];
|
||||
@Input() title:string = "Research Results";
|
||||
@Input() showAccessRights:boolean = false;
|
||||
@Input() bulkMode:boolean = false;
|
||||
// @Output()resultsChange = new EventEmitter();
|
||||
@Input() showSearch:boolean = false;
|
||||
nextDate = {};
|
||||
@ViewChild(AlertModal) alertApplyAll;
|
||||
|
||||
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every result
|
||||
public commonEmbargoEndDate; // for access rights: embargoEndDate - changes when user apply a change to every result
|
||||
public commonType; // for research result type - changes when user apply a change to every result
|
||||
public typeChanged:boolean = true; //
|
||||
accessTypes = ["OPEN","CLOSED","EMBARGO","RESTRICTED"];
|
||||
private myDatePickerOptions: IMyOptions = {
|
||||
// other options...
|
||||
dateFormat: 'yyyy-mm-dd',
|
||||
selectionTxtFontSize: '15px',
|
||||
height:'28px',
|
||||
width: '100%',
|
||||
editableDateField: false,
|
||||
showClearDateBtn: false
|
||||
};
|
||||
|
||||
|
||||
removePublication(item:any){
|
||||
var index:number =this.results.indexOf(item);
|
||||
if (index > -1) {
|
||||
this.results.splice(index, 1);
|
||||
}
|
||||
// this.resultsChange.emit({
|
||||
// value: this.results
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
onDateChanged (event:any, item:any) {
|
||||
item.embargoEndDate = Dates.getDateFromString(event.formatted);
|
||||
if(this.results.length > 1 ){
|
||||
this.commonAccessRights = "EMBARGO";
|
||||
this.commonEmbargoEndDate = item.embargoEndDate;
|
||||
this.confirmOpen(false,"Do you wish to apply the change to every result?");
|
||||
}
|
||||
|
||||
}
|
||||
onTypeChanged (event:any, item:any) {
|
||||
item.type =(event);
|
||||
if(this.results.length > 1 ){
|
||||
this.commonType = item.type;
|
||||
this.confirmOpen(true, "Do you wish to apply the change to every result?");
|
||||
}
|
||||
|
||||
}
|
||||
// resultsChanged($event) {
|
||||
// this.results=$event.value;
|
||||
// this.resultsChange.emit({
|
||||
// value: this.results
|
||||
// });
|
||||
// }
|
||||
/* The following methods:
|
||||
*typeChanged
|
||||
*confirmOpen
|
||||
*confirmClose
|
||||
implement the functionality: change accessRights of a publication - apply to all if asked */
|
||||
accessRightsTypeChanged (type:any, item:any) {
|
||||
item.accessRights = type;
|
||||
if(this.results.length > 1 ){
|
||||
this.commonAccessRights = type;
|
||||
if(this.commonAccessRights != "EMBARGO"){
|
||||
this.commonEmbargoEndDate = item.embargoEndDate;
|
||||
this.confirmOpen(false, "Do you wish to apply the change to every result?");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
confirmOpen(type: boolean, message: string){
|
||||
this.typeChanged = type;
|
||||
this.alertApplyAll.cancelButton = true;
|
||||
this.alertApplyAll.okButton = true;
|
||||
this.alertApplyAll.alertTitle = "Change metadata";
|
||||
this.alertApplyAll.message = "Do you wish to apply the change to every result?";
|
||||
this.alertApplyAll.okButtonText = "Yes";
|
||||
this.alertApplyAll.cancelButtonText = "No";
|
||||
this.alertApplyAll.open();
|
||||
}
|
||||
confirmClose(data){
|
||||
if(this.typeChanged){
|
||||
|
||||
for (var i = 0; i < this.results.length; i++) {
|
||||
if(this.results[i].source != 'openaire' ){
|
||||
this.results[i].type = this.commonType;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
for (var i = 0; i < this.results.length; i++) {
|
||||
if(this.results[i].source != 'openaire' ){
|
||||
this.results[i].accessRights = this.commonAccessRights;
|
||||
if(this.commonAccessRights == "EMBARGO"){
|
||||
this.results[i].embargoEndDate = this.commonEmbargoEndDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import {ClaimSelectedResultsComponent} from './selectedResults.component';
|
||||
import {AlertModalModule} from '../../../utils/modal/alertModal.module';
|
||||
import { MyDatePickerModule } from '../../../utils/my-date-picker/my-date-picker.module';
|
||||
// import {BulkClaimModule} from '../bulkClaim/bulkClaim.module';
|
||||
// import {ClaimResultSearchFormModule} from '../../claim-utils/claimResultSearchForm.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
AlertModalModule,
|
||||
MyDatePickerModule,
|
||||
// BulkClaimModule, ClaimResultSearchFormModule,
|
||||
],
|
||||
declarations: [
|
||||
ClaimSelectedResultsComponent
|
||||
], exports:[ClaimSelectedResultsComponent]
|
||||
})
|
||||
export class SelectedPublicationsModule { }
|
|
@ -0,0 +1,16 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { MyClaimsComponent } from './myClaims.component';
|
||||
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: MyClaimsComponent, canActivate: [IsRouteEnabled, LoginGuard],
|
||||
data: {redirect: '/error'}, canDeactivate: [PreviousRouteRecorder]}])
|
||||
]
|
||||
})
|
||||
export class MyClaimsRoutingModule { }
|
|
@ -0,0 +1,36 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'my-claims',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
My Claims
|
||||
</div>
|
||||
<div>
|
||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||
<displayClaims [enableDelete]=true [myClaims]=true [isAdmin]=false [showUserEmail]=false ></displayClaims>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
})
|
||||
export class MyClaimsComponent {
|
||||
constructor ( private _meta: Meta ) {
|
||||
this._meta.setTitle("OpenAIRE | My Claims");
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { MyClaimsComponent } from './myClaims.component';
|
||||
import { MyClaimsRoutingModule } from './myClaims-routing.module';
|
||||
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
|
||||
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
|
||||
import {LoginGuard} from'../../login/loginGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
MyClaimsRoutingModule,
|
||||
// ClaimServiceModule,
|
||||
DisplayClaimsModule
|
||||
|
||||
],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
|
||||
declarations: [
|
||||
MyClaimsComponent
|
||||
]
|
||||
})
|
||||
export class MyClaimsModule { }
|
|
@ -0,0 +1,51 @@
|
|||
// import {Component, Input} from '@angular/core';
|
||||
// import {Observable} from 'rxjs/Observable';
|
||||
// import { Router } from '@angular/router';
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Component({
|
||||
// selector: 'my-claims-demo',
|
||||
// template: `
|
||||
// <div *ngIf="user" class="container">
|
||||
// <div class="page-header">
|
||||
// <h1> My Claims Demo</h1>
|
||||
// </div>
|
||||
// <div>
|
||||
// <div class=""><a routerLink="/Linking">Linking</a></div>
|
||||
// <div class=""><a routerLink]="/MyClaims">MyClaims</a></div>
|
||||
// <div class=""><a routerLink="/Claims">Claims Admin</a></div>
|
||||
// <p> Extra parameters for claims admin</p>
|
||||
// <div class=""><a href="claims?fetchBy=User&fetchId=amelie.baecker@uni-bielefeld.de">Claims By user</a></div>
|
||||
// <div class=""><a href="claims?fetchBy=Project&fetchId=corda_______::2c37878a0cede85dbbd1081bb9b4a2f8">Claims By project</a></div>
|
||||
// <div class=""><a href="claims?fetchBy=Context&fetchId=egi::country::gr">Claims By context</a></div>
|
||||
//
|
||||
// <!-- <p>Orcid
|
||||
// <p>N.M.
|
||||
// 0000-0002-3477-3082
|
||||
// </p>
|
||||
// </p> -->
|
||||
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
|
||||
// <!--<div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>
|
||||
// <div class=""><a href="publication?articleId=od_______908::3a5b2885656a91307156325644e73b92" >Publication od_______908::3a5b2885656a91307156325644e73b92</a></div>-->
|
||||
// </div>
|
||||
// </div>
|
||||
//
|
||||
//
|
||||
//
|
||||
// `
|
||||
// //(click)="changeOrderby('target')"
|
||||
// //od_______908::3a5b2885656a91307156325644e73b92
|
||||
//
|
||||
// })
|
||||
// export class MyClaimsDemoComponent {
|
||||
// constructor ( private _router: Router ) {
|
||||
// }
|
||||
// user:string="argirok@di.uoa.gr";
|
||||
// ngOnInit() {
|
||||
//
|
||||
// }
|
||||
// goToPub(id: number){
|
||||
// this._router.navigate( ['Publication', { articleId: id}] );
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1,34 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Router } from '@angular/router';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-by-subject',
|
||||
template: `
|
||||
<div class="uk-margin-top">
|
||||
|
||||
<h3>Or search for domain specific repositories</h3>
|
||||
|
||||
<form class= "uk-grid">
|
||||
<input type="text" [(ngModel)]="subjectKeyword" class="uk-margin-medium-left uk-padding-remove-left uk-input" name="subject" placeholder="Type keywords (e.g Biology, Natural sciences, Social Sciences, Engineering Sciences... )" style="width: 580px;" />
|
||||
|
||||
<button class=" uk-button uk-button-default" type="submit" (click)="search()" >
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositBySubjectComponent {
|
||||
@Input() subjectKeyword: string='';
|
||||
|
||||
constructor (private _router: Router) { }
|
||||
|
||||
public search() {
|
||||
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "q": this.subjectKeyword } } );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top">
|
||||
<div class="uk-article-title custom-article-title">
|
||||
Deposit {{requestFor}}
|
||||
</div>
|
||||
|
||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
||||
<form class= "uk-margin uk-text-center uk-margin-top">
|
||||
<input type="text" [(ngModel)]="newSubject" class=" uk-input uk-width-1-2" name="subject" placeholder="Search for classifications..." />
|
||||
|
||||
<button class=" uk-button uk-button-default" type="submit" (click)="searchDataproviders()" >
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
<div *ngIf="subject.length > 0" class=" uk-text-center ">
|
||||
<span>Keywords: {{subject}}<span><a class="uk-icon-button" (click) = "subject = ''"><span aria-hidden="true" class=" clickable "><span class="clickable uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
||||
</span></span></a></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
<helper position="top"></helper>
|
||||
</div>
|
||||
<div class="uk-grid helper-grid">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING"
|
||||
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
|
||||
<p>Please use the information/contacts shown below to deposit your {{requestFor}}.</p>
|
||||
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
|
||||
<div *ngIf="fetchDataproviders.searchUtils.totalResults" class="">
|
||||
<paging-no-load [currentPage]="page" [totalResults]="fetchDataproviders.searchUtils.totalResults" size=10 (pageChange)="pageChange($event)"> </paging-no-load>
|
||||
</div>
|
||||
<div class="" *ngIf="fetchDataproviders.results && fetchDataproviders.searchUtils.totalResults > 0">
|
||||
{{fetchDataproviders.searchUtils.totalResults}} content providers, page {{fetchDataproviders.searchUtils.page}} of {{(totalPages())}}
|
||||
</div>
|
||||
|
||||
<search-result [(results)]="fetchDataproviders.results"
|
||||
type="dataprovider" urlParam="datasourceId" [showSubjects]=true
|
||||
[custom_class]="'other-results'">
|
||||
</search-result>
|
||||
</div>
|
||||
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE && subject != ''" class = "uk-alert uk-alert-primary">
|
||||
No content providers found with classification "{{subject}}".
|
||||
</div>
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR && subject != ''" class = "uk-alert uk-alert-danger">
|
||||
An error occured.
|
||||
</div>
|
||||
|
||||
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && fetchDataproviders.searchUtils.status == errorCodes.DONE)
|
||||
|| fetchDataproviders.searchUtils.status == errorCodes.NONE || fetchDataproviders.searchUtils.status == errorCodes.ERROR" class = "uk-alert ">
|
||||
|
||||
You can still deposit your {{requestFor}} in
|
||||
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
|
||||
hosted by CERN.
|
||||
</div>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
|
||||
<button class=" uk-button uk-button-default uk-margin-small-top" type="submit" (click)="goToDeposit()">
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-left" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="13 16 7 10 13 4"></polyline></svg></span> Back
|
||||
</button>
|
||||
<helper position="bottom"></helper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,127 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
||||
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
|
||||
|
||||
import {OrganizationService} from '../../services/organization.service';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
import {PiwikService} from '../../utils/piwik/piwik.service';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-by-subject-result',
|
||||
templateUrl: 'depositBySubjectResult.component.html'
|
||||
})
|
||||
|
||||
export class DepositBySubjectResultComponent {
|
||||
@Input() compatibility: string = '';
|
||||
|
||||
// Type of entity: Publication or Research Data
|
||||
@Input() requestFor: string = "Research Data";
|
||||
@Input() subject: string = "";
|
||||
|
||||
public newSubject: string= "";
|
||||
|
||||
public fetchDataproviders : FetchDataproviders;
|
||||
public linkToSearchDataproviders = "";
|
||||
|
||||
// url of Zenodo
|
||||
public zenodo: string;
|
||||
|
||||
public page: number = 1;
|
||||
|
||||
public status: number;
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
sub: any;
|
||||
piwiksub: any;
|
||||
|
||||
constructor ( private _router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private _searchDataprovidersService: SearchDataprovidersService,
|
||||
private _meta: Meta, private _piwikService:PiwikService) {
|
||||
|
||||
this.zenodo = OpenaireProperties.getZenodoURL();
|
||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.updateTitle("Deposit "+this.requestFor);
|
||||
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
console.info('depositResult init');
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.subject = params['q'];
|
||||
this.newSubject = this.subject;
|
||||
this.searchDataproviders();
|
||||
});
|
||||
}
|
||||
|
||||
// ngDoCheck() {
|
||||
// if(this.organizationId == "" || this.organizationId == undefined) {
|
||||
// this.organizationId = "";
|
||||
// this.status = this.errorCodes.ERROR;
|
||||
// }
|
||||
// }
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public totalPages(): number {
|
||||
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
public searchDataproviders() {
|
||||
this.subject = this.newSubject;
|
||||
this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10);
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
}
|
||||
|
||||
public goToDeposit() {
|
||||
if(this.requestFor == "Publications") {
|
||||
this._router.navigate( ['participate/deposit-publications'] );
|
||||
} else if(this.requestFor == "Research Data") {
|
||||
this._router.navigate( ['participate/deposit-datasets'] );
|
||||
}
|
||||
}
|
||||
public pageChange($event) {
|
||||
this.page = +$event.value;
|
||||
this.searchDataproviders();
|
||||
}
|
||||
|
||||
private updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
private updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
private updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
|
||||
|
||||
import {DepositModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {PagingModule } from '../../utils/paging.module';
|
||||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
|
||||
import {HelperModule} from '../../utils/helper/helper.module';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DepositModule,
|
||||
SearchResultsModule, DataProvidersServiceModule, PagingModule,
|
||||
HelperModule
|
||||
],
|
||||
declarations: [
|
||||
|
||||
DepositBySubjectResultComponent
|
||||
|
||||
],
|
||||
exports: [
|
||||
DepositBySubjectResultComponent
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class DepositBySubjectResultsModule { }
|
|
@ -0,0 +1,21 @@
|
|||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-datasets',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container">
|
||||
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'" [searchBySubjects]=true></deposit>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositDatasetsComponent {
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { DepositDatasetsComponent } from './depositDatasets.component';
|
||||
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
|
||||
import {DepositModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DepositModule
|
||||
],
|
||||
declarations: [
|
||||
|
||||
DepositDatasetsComponent
|
||||
|
||||
],
|
||||
exports: [
|
||||
DepositDatasetsComponent
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class DepositDatasetsModule { }
|
|
@ -0,0 +1,14 @@
|
|||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-datasets-result',
|
||||
template: `
|
||||
<deposit-result [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit-result>
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositDatasetsResultComponent {
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
|
||||
|
||||
import {DepositModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DepositModule
|
||||
],
|
||||
declarations: [
|
||||
|
||||
DepositDatasetsResultComponent,
|
||||
|
||||
],
|
||||
exports: [
|
||||
DepositDatasetsResultComponent,
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class DepositDatasetsResultsModule { }
|
|
@ -0,0 +1,56 @@
|
|||
<div class="uk-margin-top">
|
||||
<div class="uk-article-title custom-article-title uk-margin-bottom">
|
||||
Deposit {{requestFor}}
|
||||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
<helper position="top"></helper>
|
||||
</div>
|
||||
<div class="uk-grid helper-grid uk-margin-top">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
<!--div>
|
||||
<p>
|
||||
<i>
|
||||
Are you a grant recipient from the following: H2020; FP7 with SC39; or ERC?
|
||||
</i>
|
||||
Then you are required to publish in
|
||||
<a href="{{openAccess}}" target="_blank">open access (<i class="custom-external"></i>)</a>.
|
||||
One way to do this is to deposit your {{requestFor}} into an
|
||||
<a href="{{openAccessRepo}}" target="_blank">open access repository (<i class="custom-external"></i>)</a>.
|
||||
</p>
|
||||
<p>
|
||||
Click the following to find more information:
|
||||
<a href="{{fp7Guidlines}}" target="_blank">FP7 guidelines (<i class="custom-external"></i>)</a>,
|
||||
<a href="{{h2020Guidlines}}" target="_blank">H2020 guidelines (<i class="custom-external"></i>)</a>,
|
||||
<a href="{{ercGuidlines}}" target="_blank">ERC guidelines (<i class="custom-external"></i>)</a> OR
|
||||
<a href="{{helpdesk}}" target="_blank">ask a question (<i class="custom-external"></i>)</a> to OpenAIRE’s national representative.
|
||||
</p>
|
||||
</div-->
|
||||
<h3>See if your institution has a repository </h3>
|
||||
|
||||
<form class= "uk-grid">
|
||||
<div class="uk-width-1-2 ">
|
||||
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
|
||||
[placeHolderMessage] = "'Organization name'" [title] = "'Organizations'" [multipleSelections]=false
|
||||
(selectedValueChanged)="valueChanged($event)">
|
||||
</entities-autocomplete>
|
||||
</div>
|
||||
<button class=" uk-margin-left uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
|
||||
Locate
|
||||
</button>
|
||||
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">{{warningMessage}}</div>
|
||||
</form>
|
||||
<div *ngIf="searchBySubjects" >
|
||||
<deposit-by-subject></deposit-by-subject>
|
||||
</div>
|
||||
<div *ngIf="mapUrl" class="uk-margin-large-top">
|
||||
<h3>Or locate repository on map</h3>
|
||||
<div class="uk-margin-top">
|
||||
<i-frame [url]="mapUrl" width="100%" height="900"></i-frame>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
<helper position="bottom"></helper>
|
||||
</div>
|
|
@ -0,0 +1,91 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Router } from '@angular/router';
|
||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||
import { Meta} from '../../angular2-meta';
|
||||
import {PiwikService} from '../utils/piwik/piwik.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'deposit',
|
||||
templateUrl: 'deposit.component.html'
|
||||
})
|
||||
|
||||
export class DepositComponent {
|
||||
@Input() compatibility: string = '';
|
||||
@Input() mapUrl: string = null; // optional in case i-frame is needed
|
||||
@Input() searchBySubjects: boolean = false; // optional: in case search by subjects is needed
|
||||
|
||||
|
||||
public status: number;
|
||||
|
||||
// Type of entity: Publication or Research Data
|
||||
@Input() requestFor: string = "Publications";
|
||||
|
||||
// url's needed for information text
|
||||
public openAccess: string;
|
||||
public openAccessRepo: string;
|
||||
public fp7Guidlines: string;
|
||||
public h2020Guidlines: string;
|
||||
public ercGuidlines: string;
|
||||
public helpdesk: string;
|
||||
|
||||
// Id of the new selected organization to be searched
|
||||
public selectedId: string = "";
|
||||
|
||||
public warningMessage: string = "";
|
||||
|
||||
piwiksub:any;
|
||||
|
||||
constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) {
|
||||
|
||||
this.openAccess = OpenaireProperties.getOpenAccess();
|
||||
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
|
||||
this.fp7Guidlines = OpenaireProperties.getFP7Guidlines();
|
||||
this.h2020Guidlines = OpenaireProperties.getH2020Guidlines();
|
||||
this.ercGuidlines = OpenaireProperties.getERCGuidlines();
|
||||
this.helpdesk = OpenaireProperties.getHelpdesk();
|
||||
this.updateTitle("Deposit "+this.requestFor);
|
||||
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
|
||||
}
|
||||
}
|
||||
ngOnDestroy() {
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public organizationSelected(id: string) {
|
||||
console.info("organization selected");
|
||||
if(id && id.length > 0){
|
||||
if(this.requestFor == "Publications") {
|
||||
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
||||
} else if(this.requestFor == "Research Data") {
|
||||
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
||||
}
|
||||
} else {
|
||||
this.warningMessage = "No organization selected";
|
||||
}
|
||||
}
|
||||
|
||||
public valueChanged($event){
|
||||
this.selectedId = $event.value;
|
||||
}
|
||||
|
||||
private updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
private updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
private updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* Common Component of deposit for both research data & ppublications*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DepositComponent } from './deposit.component';
|
||||
import { DepositResultComponent } from './depositResult.component';
|
||||
import {EntitiesAutocompleteModule} from '../utils/entitiesAutoComplete/entitiesAutoComplete.module';
|
||||
import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
|
||||
import {OrganizationServiceModule} from '../services/organizationService.module';
|
||||
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
|
||||
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
|
||||
import {HelperModule} from '../utils/helper/helper.module';
|
||||
import { DepositBySubjectComponent } from './datasets/depositBySubject.component';
|
||||
import {IFrameModule} from '../utils/iframe.module';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
RouterModule,
|
||||
EntitiesAutocompleteModule,
|
||||
DataProvidersServiceModule,
|
||||
OrganizationServiceModule,
|
||||
SearchResultsModule,
|
||||
PiwikServiceModule,
|
||||
HelperModule,
|
||||
IFrameModule
|
||||
],
|
||||
declarations: [
|
||||
DepositComponent,
|
||||
DepositResultComponent,
|
||||
DepositBySubjectComponent
|
||||
],
|
||||
exports: [
|
||||
DepositComponent,
|
||||
DepositResultComponent
|
||||
],
|
||||
providers: [
|
||||
]
|
||||
})
|
||||
export class DepositModule { }
|
|
@ -0,0 +1,283 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { FetchDataproviders } from '../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
||||
import { SearchDataprovidersService } from '../services/searchDataproviders.service';
|
||||
|
||||
import {OrganizationService} from '../services/organization.service';
|
||||
import { Meta} from '../../angular2-meta';
|
||||
|
||||
import {RouterHelper} from '../utils/routerHelper.class';
|
||||
import {PiwikService} from '../utils/piwik/piwik.service';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-result',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top">
|
||||
<!--div class="uk-article-title custom-article-title">
|
||||
Deposit {{requestFor}}
|
||||
</div-->
|
||||
<helper position="top"></helper>
|
||||
<div class="uk-grid helper-grid">
|
||||
<helper position="left" styleName=" uk-width-1-5 uk-padding-left"></helper>
|
||||
<div class="uk-width-expand">
|
||||
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && fetchDataproviders.searchUtils.status == errorCodes.LOADING)"
|
||||
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
|
||||
</div>
|
||||
|
||||
|
||||
<!--div *ngIf="status != errorCodes.LOADING" class="uk-margin-bottom uk-margin-top">
|
||||
<h3>See if your institution has a repository </h3>
|
||||
|
||||
<form class= "uk-grid">
|
||||
<div class="uk-width-1-2 ">
|
||||
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'"
|
||||
[depositType]=compatibility [showSelected]=true [placeHolderMessage] = "'Organization name'"
|
||||
[title] = "'Organizations'" [multipleSelections]=false (selectedValueChanged)="valueChanged($event)">
|
||||
</entities-autocomplete>
|
||||
</div>
|
||||
<button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
|
||||
Locate
|
||||
</button>
|
||||
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">{{warningMessage}}</div>
|
||||
</form>
|
||||
</div-->
|
||||
|
||||
|
||||
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
|
||||
<h2 *ngIf="organization" class="organization">
|
||||
<a *ngIf="organization['url']!=''" href="{{organization.url}}" target="_blank">
|
||||
<span><i class="custom-external"></i>{{organization['name']}}</span>
|
||||
</a>
|
||||
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
|
||||
</h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
|
||||
<p class="uk-text-meta">Please use the information below and contact your repository to deposit your <span class="uk-text-lowercase">{{requestFor}}</span>.</p>
|
||||
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
|
||||
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
|
||||
<!--a [href] = "linkToSearchDataproviders">
|
||||
View all {{fetchDataproviders.searchUtils.totalResults}} results <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-->
|
||||
|
||||
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'or'], [organizationId, 'and'])"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
|
||||
View all {{fetchDataproviders.searchUtils.totalResults}} results
|
||||
</a>
|
||||
</div>
|
||||
<search-result [(results)]="fetchDataproviders.results"
|
||||
[(status)]= "fetchDataproviders.searchUtils.status"
|
||||
type="dataprovider" urlParam="datasourceId" [showOrganizations] = false
|
||||
[custom_class]="'other-results'">
|
||||
</search-result>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|
||||
|| status == errorCodes.NOT_FOUND || status == errorCodes.ERROR || status == errorCodes.NOT_AVAILABLE" class = "alert alert-warning">
|
||||
<div *ngIf="organization">
|
||||
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR">
|
||||
An error occured.
|
||||
</span>
|
||||
No content providers found for institution:
|
||||
<a *ngIf="organization['url']!=''" target="_blank" href="{{organization.url}}">
|
||||
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
|
||||
</a>
|
||||
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
|
||||
.
|
||||
</div>
|
||||
<div *ngIf="status == errorCodes.NOT_FOUND && organizationId != ''">
|
||||
No organization with ID: {{organizationId}} found.
|
||||
</div>
|
||||
<div *ngIf="status == errorCodes.ERROR && organizationId != ''">
|
||||
An error occured.
|
||||
</div>
|
||||
<span *ngIf="status == errorCodes.NOT_AVAILABLE && organizationId != ''">
|
||||
Service temprorarily unavailable. Please try again later.
|
||||
</span>
|
||||
<div *ngIf="organizationId == ''">
|
||||
No ID for organization.
|
||||
</div>
|
||||
|
||||
You can still deposit your {{requestFor}} in
|
||||
<a href="{{zenodo}}" target="_blank">OpenAIRE's Zenodo catch-all repository (<i class="custom-external"></i>)</a>
|
||||
hosted by CERN.
|
||||
</div>
|
||||
</div>
|
||||
<helper position="right" styleName=" uk-width-1-5"></helper>
|
||||
</div>
|
||||
<button class=" uk-button uk-button-default uk-margin-small-top" type="submit" (click)="goToDeposit()">
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-left" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="13 16 7 10 13 4"></polyline></svg></span> Back
|
||||
</button>
|
||||
<helper position="bottom"></helper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositResultComponent {
|
||||
@Input() compatibility: string = '';
|
||||
|
||||
// Type of entity: Publication or Research Data
|
||||
@Input() requestFor: string = "Publications";
|
||||
|
||||
public organization: {"name": string, "url": string};
|
||||
public organizationId: string = "";
|
||||
|
||||
// Id of the new selected organization to be searched
|
||||
public selectedId: string = "";
|
||||
|
||||
public status: number;
|
||||
public warningMessage: string = "";
|
||||
|
||||
public fetchDataproviders : FetchDataproviders;
|
||||
public linkToSearchDataproviders: string = "";
|
||||
|
||||
// url of Zenodo
|
||||
public zenodo: string;
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
sub: any; piwiksub: any;
|
||||
|
||||
constructor ( private _router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private _searchDataprovidersService: SearchDataprovidersService,
|
||||
private _organizationService: OrganizationService,
|
||||
private _meta: Meta, private _piwikService:PiwikService) {
|
||||
|
||||
this.zenodo = OpenaireProperties.getZenodoURL();
|
||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.updateTitle("Deposit "+this.requestFor);
|
||||
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info('depositResult init');
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.organizationId = params['organizationId'];
|
||||
console.info("Id is :"+this.organizationId);
|
||||
if(this.organizationId){
|
||||
this.getOrganizationInfo();
|
||||
}
|
||||
this.selectedId = "";
|
||||
});
|
||||
}
|
||||
|
||||
ngDoCheck() {
|
||||
if(this.organizationId == "" || this.organizationId == undefined) {
|
||||
this.organizationId = "";
|
||||
this.status = this.errorCodes.ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private searchDataproviders() {
|
||||
// if(this.organization != undefined) {
|
||||
// this.fetchDataproviders.getResults(this.organization.name, false, 1, 10);
|
||||
// } else if(this.organizationId != undefined) {
|
||||
this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, 1, 10);
|
||||
//}
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
}
|
||||
|
||||
private getOrganizationInfo () {
|
||||
console.info("inside getOrganizationInfo of component");
|
||||
|
||||
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
|
||||
data => {
|
||||
if(data == null) {
|
||||
this.status = this.errorCodes.NOT_FOUND;
|
||||
} else {
|
||||
this.organization = data.title;
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.searchDataproviders();
|
||||
}
|
||||
},
|
||||
err => {
|
||||
//console.log(err)
|
||||
|
||||
if(err.status == '404') {
|
||||
this.status = this.errorCodes.NOT_FOUND;
|
||||
console.info("not found");
|
||||
} else if(err.status == '500') {
|
||||
this.status = this.errorCodes.ERROR;
|
||||
console.info("error");
|
||||
} else {
|
||||
this.status = this.errorCodes.NOT_AVAILABLE;
|
||||
console.info("not available");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public goToDeposit() {
|
||||
if(this.requestFor == "Publications") {
|
||||
this._router.navigate( ['participate/deposit-publications'] );
|
||||
} else if(this.requestFor == "Research Data") {
|
||||
this._router.navigate( ['participate/deposit-datasets'] );
|
||||
}
|
||||
}
|
||||
|
||||
public valueChanged($event){
|
||||
this.selectedId = $event.value;
|
||||
}
|
||||
|
||||
public organizationSelected(id: string) {
|
||||
console.info("organization selected");
|
||||
if(id && id.length > 0 && id != this.organizationId){
|
||||
this.organization = null;
|
||||
this.status = this.errorCodes.LOADING;
|
||||
|
||||
if(this.requestFor == "Publications") {
|
||||
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
||||
} else if(this.requestFor == "Research Data") {
|
||||
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
||||
}
|
||||
} else {
|
||||
this.warningMessage = "No new organization selected";
|
||||
}
|
||||
}
|
||||
|
||||
private updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
private updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
private updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-publications',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container">
|
||||
<deposit [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'" [mapUrl]=mapUrl></deposit>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositPublicationsComponent {
|
||||
public mapUrl ="https://beta.openaire.eu/stats/markers-demo.html";
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { DepositPublicationsComponent } from './depositPublications.component';
|
||||
|
||||
import {DepositModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DepositModule
|
||||
],
|
||||
declarations: [
|
||||
DepositPublicationsComponent
|
||||
],
|
||||
exports: [
|
||||
DepositPublicationsComponent,
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class DepositPublicationsModule { }
|
|
@ -0,0 +1,12 @@
|
|||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'deposit-publications-result',
|
||||
template: `
|
||||
<deposit-result [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit-result>
|
||||
`
|
||||
})
|
||||
|
||||
export class DepositPublicationsResultComponent {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
|
||||
|
||||
import {DepositModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DepositModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
DepositPublicationsResultComponent
|
||||
],
|
||||
exports: [
|
||||
DepositPublicationsResultComponent
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class DepositPublicationsResultsModule { }
|
|
@ -0,0 +1,17 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {ErrorPageComponent } from './errorPage.component';
|
||||
import {MetaModule} from '../../meta.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, MetaModule
|
||||
],
|
||||
providers:[],
|
||||
declarations: [
|
||||
ErrorPageComponent
|
||||
], exports:[ErrorPageComponent]
|
||||
})
|
||||
export class ErrorModule { }
|
|
@ -0,0 +1,55 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Meta} from '../../angular2-meta';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'error',
|
||||
template: `
|
||||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container">
|
||||
<h2>
|
||||
Bad karma: we can't find that page!
|
||||
</h2>
|
||||
<br>
|
||||
|
||||
<p>
|
||||
You asked for {{page}}, but despite our computers looking very hard, we could not find it. What happened ?
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>the link you clicked to arrive here has a typo in it</li>
|
||||
<li>or somehow we removed that page, or gave it another name</li>
|
||||
<li>or, quite unlikely for sure, maybe you typed it yourself and there was a little mistake ?</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class ErrorPageComponent {
|
||||
public page: string;
|
||||
|
||||
constructor (private _location: Location, private _meta: Meta,private route: ActivatedRoute) {
|
||||
this._meta.setTitle("OpenAIRE | Error page");
|
||||
this.page = _location.path(true);
|
||||
//this.page = _router.url;
|
||||
//this.page = location.href;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(data => {
|
||||
|
||||
|
||||
this.page = data['page'];
|
||||
if(!this.page){
|
||||
this.page = this._location.path(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/filter';
|
||||
import { ConfigurationService } from '../utils/configuration/configuration.service';
|
||||
|
||||
@Injectable()
|
||||
export class IsRouteEnabled implements CanActivate {
|
||||
|
||||
constructor(private router: Router, private config: ConfigurationService) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
let customRedirect = route.data['redirect'];
|
||||
console.log("In IsRouteEnabled");
|
||||
console.log(state.url.split("?")[0].substring(1));
|
||||
let isEnabled = this.config.isPageEnabled(state.url.split("?")[0].substring(1));
|
||||
let redirect = !!customRedirect ? customRedirect : '/error';
|
||||
isEnabled.filter(enabled => !enabled)
|
||||
.subscribe(() => this.router.navigate([redirect], { queryParams: { "page": state.url } }));
|
||||
|
||||
return isEnabled;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// import { NgModule } from '@angular/core';
|
||||
// import { RouterModule } from '@angular/router';
|
||||
//
|
||||
// import { DataProviderComponent } from './dataProvider.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: DataProviderComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
|
||||
// redirect: '/error'
|
||||
// },canDeactivate: [PreviousRouteRecorder] }
|
||||
// ])
|
||||
// ]
|
||||
// })
|
||||
// export class DataProviderRoutingModule { }
|
|
@ -0,0 +1,234 @@
|
|||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top datasource">
|
||||
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-margin-large-top" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger uk-margin-large-top" role="alert">{{errorMessage}}</div>
|
||||
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
|
||||
<div *ngIf="dataProviderInfo != null" uk-grid class="uk-grid-large">
|
||||
|
||||
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
|
||||
<!--h3 *ngIf="dataProviderInfo.title != null">
|
||||
<a *ngIf="dataProviderInfo.title['url'] != undefined && dataProviderInfo.title['url'] != null"
|
||||
href="{{dataProviderInfo.title['url']}}" target="_blank" class="custom-external">
|
||||
{{dataProviderInfo.title['name']}}
|
||||
</a>
|
||||
<p *ngIf="dataProviderInfo.title['url'] == undefined || dataProviderInfo.title['url'] == null">
|
||||
{{dataProviderInfo.title['name']}}
|
||||
</p>
|
||||
</h3-->
|
||||
<showTitle [title]="dataProviderInfo.title"></showTitle>
|
||||
<div class="uk-text-large " *ngIf="dataProviderInfo.officialName && this.dataProviderInfo.title.name != dataProviderInfo.officialName ">{{dataProviderInfo.officialName}}</div>
|
||||
|
||||
<span *ngIf="dataProviderInfo.type" class="uk-label custom-label label-type label-dataprovider " title="Type">{{dataProviderInfo.type}}</span>
|
||||
<span *ngIf="dataProviderInfo.compatibility" class="uk-label custom-label label-compatibility " title="Compatibility">{{dataProviderInfo.compatibility}}</span>
|
||||
|
||||
<ul class="uk-list">
|
||||
|
||||
|
||||
<li *ngIf="dataProviderInfo.oaiPmhURL"><span class="uk-text-bold">OAI-PMH: </span>
|
||||
<span class="uk-button-text">
|
||||
<a target="_blank" href="{{dataProviderInfo.oaiPmhURL}}">
|
||||
{{dataProviderInfo.oaiPmhURL}}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
</li>
|
||||
<li *ngIf="dataProviderInfo.openDoarURL">
|
||||
<span class="uk-button-text">
|
||||
<a target="_blank" href="{{dataProviderInfo.openDoarURL}}">
|
||||
Detailed content provider information (OpenDOAR)
|
||||
</a>
|
||||
</span>
|
||||
|
||||
</li>
|
||||
<li *ngIf="dataProviderInfo.r3DataURL">
|
||||
<span class="uk-button-text">
|
||||
<a target="_blank" href="{{dataProviderInfo.r3DataURL}}">
|
||||
Detailed content provider information (Re3data)
|
||||
</a>
|
||||
</span>
|
||||
|
||||
</li>
|
||||
|
||||
<li *ngIf="dataProviderInfo.countries != undefined && dataProviderInfo.countries.length > 0"><span class="uk-text-bold">Countries: </span>{{dataProviderInfo.countries.join(", ")}}</li>
|
||||
</ul>
|
||||
|
||||
<!--tabs [id] = "datasourceId"
|
||||
[name] = "dataProviderInfo.title['name']"
|
||||
[resultsBy] = "dataProviderInfo.resultsBy"
|
||||
[tabs]="dataProviderInfo.tabs"
|
||||
[statistics]="dataProviderInfo.statistics"
|
||||
[organizations]="dataProviderInfo.organizations"
|
||||
[_dataproviderService]="_dataproviderService">
|
||||
</tabs-->
|
||||
<div *ngIf="showTabs">
|
||||
<ul *ngIf="dataProviderInfo.tabs != undefined" class="uk-tab uk-visible@xl" uk-tab="connect: #tab-content">
|
||||
<li *ngFor="let tab of dataProviderInfo.tabs; let i=index" id="{{dataProviderInfo.tabs[i].content}}"
|
||||
[class]="activeTab==tab.name?'uk-active':''">
|
||||
<a
|
||||
(click)="search(tab.content, 1, 10); activeTab=tab.name">
|
||||
{{tab.name}}
|
||||
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='publicationsTab'">
|
||||
{{fetchPublications.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='datasetsTab'">
|
||||
{{fetchDatasets.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='projectsTab'">
|
||||
{{fetchProjects.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='datasourcesTab'">
|
||||
{{fetchDataproviders.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='organizationsTab'">
|
||||
{{dataProviderInfo.organizations.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<button class="uk-button uk-button-default uk-hidden@xl" type="button">
|
||||
<span uk-navbar-toggle-icon></span> <span class="uk-margin-small-left">{{activeTab}}</span>
|
||||
</button>
|
||||
|
||||
<ul *ngIf="dataProviderInfo.tabs != undefined" id="toggle-small-tabs" class="uk-subnav uk-subnav-pill uk-dropdown uk-hidden@xl" uk-switcher="connect: #tab-content" uk-dropdown="mode: click" uk-toggle="target: #toggle-small-tabs">
|
||||
<li *ngFor="let tab of dataProviderInfo.tabs; let i=index" id="{{dataProviderInfo.tabs[i].content}}"
|
||||
[class]="activeTab==tab.name?'uk-active':''">
|
||||
<a
|
||||
(click)="search(tab.content, 1, 10); activeTab=tab.name">
|
||||
{{tab.name}}
|
||||
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='publicationsTab'">
|
||||
{{fetchPublications.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='datasetsTab'">
|
||||
{{fetchDatasets.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='projectsTab'">
|
||||
{{fetchProjects.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='datasourcesTab'">
|
||||
{{fetchDataproviders.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="uk-badge uk-badge-notification" *ngIf="tab.content=='organizationsTab'">
|
||||
{{dataProviderInfo.organizations.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--ul *ngIf="dataProviderInfo.tabs != undefined" id="tab-content" class="uk-switcher uk-margin custom-tab-content"-->
|
||||
<div *ngIf="dataProviderInfo.tabs != undefined" class="uk-margin custom-tab-content">
|
||||
|
||||
<!--div class="uk-animation-fade" *ngFor="let tab of dataProviderInfo.tabs; let i=index"-->
|
||||
<div class="uk-animation-fade">
|
||||
<!--*ngIf="tab.content=='publicationsTab'"-->
|
||||
<publicationsTab *ngIf="activeTab=='Publications'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[fetchPublications] = "fetchPublications">
|
||||
</publicationsTab>
|
||||
<!--*ngIf="tab.content=='datasetsTab'"-->
|
||||
<datasetsTab *ngIf="activeTab=='Research Data'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[fetchDatasets]="fetchDatasets">
|
||||
</datasetsTab>
|
||||
<!--*ngIf=" tab.content=='projectsTab'"-->
|
||||
<projectsTab *ngIf="activeTab=='Projects'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[fetchProjects]="fetchProjects">
|
||||
</projectsTab>
|
||||
<!--*ngIf=" tab.content=='datasourcesTab'"-->
|
||||
<datasourcesTab *ngIf="activeTab=='Datasources'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[fetchDataproviders]="fetchDataproviders">
|
||||
</datasourcesTab>
|
||||
<!--*ngIf=" tab.content=='organizationsTab'"-->
|
||||
<organizationsTab *ngIf="activeTab=='Organizations'"
|
||||
[organizations]="dataProviderInfo.organizations">
|
||||
</organizationsTab>
|
||||
<!--*ngIf=" tab.content=='relatedDatasourcesTab'"-->
|
||||
<relatedDatasourcesTab *ngIf="activeTab=='Related Content Providers'"
|
||||
[dataproviderId]="datasourceId"
|
||||
[results]="dataProviderInfo.relatedDatasources"
|
||||
[loading]="loadingRelatedDatasources"
|
||||
[fetchPublications]="fetchAggregatorsPublications"
|
||||
[fetchDatasets]="fetchAggregatorsDatasets">
|
||||
<!--[type]="relatedDataprovidersResultsType"-->
|
||||
</relatedDatasourcesTab>
|
||||
|
||||
<!-- *ngIf=" tab.content=='statisticsTab' && statsClicked"-->
|
||||
<div *ngIf="activeTab=='Statistics' && statsClicked">
|
||||
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
|
||||
No statistics available
|
||||
</div-->
|
||||
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
|
||||
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR || fetchDatasets.searchUtils.status == errorCodes.ERROR"
|
||||
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE || fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
|
||||
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING"
|
||||
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
|
||||
|
||||
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'statistics'"></errorMessages>
|
||||
|
||||
<div *ngIf="(fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">
|
||||
<p class="uk-text-bold">Latest Research Result Timeline</p>
|
||||
<i-frame [url]=docsTimelineUrl width="800" height="350"></i-frame>
|
||||
<p class="uk-text-bold">Research Result Types</p>
|
||||
<i-frame [url]=docsTypesUrl width="800" height="350"></i-frame>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0)">
|
||||
|
||||
<p class="uk-text-bold">Funders in Research Results of content provider</p>
|
||||
<i-frame [url]=docsFunderUrl width="800" height="350"></i-frame>
|
||||
|
||||
</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 ">
|
||||
<p class="uk-text-bold">Projects with most Publications</p>
|
||||
<i-frame [url]=pubsProjectsUrl width="800" height="350"></i-frame>
|
||||
</div>
|
||||
<div *ngIf="(fetchDatasets.searchUtils.totalResults > 0)">
|
||||
<div>
|
||||
<p class="uk-text-bold">Projects with most Research Data</p>
|
||||
<i-frame [url]=dataProjectsUrl width="800" height="350"></i-frame>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--*ngIf=" tab.content=='metricsTab'"-->
|
||||
<!--[name]="dataProviderInfo.title['name']"-->
|
||||
<metrics *ngIf="activeTab=='Metrics'" [pageViews]="pageViews"
|
||||
[id]="datasourceId" [entityType]="'datasources'" [entity]="'Content Provider'"
|
||||
(metricsResults)="metricsResults($event)">
|
||||
</metrics>
|
||||
<i-frame *ngIf="activeTab=='Metrics' && metricsClicked && totalViews > 0"
|
||||
[url]=viewsFrameUrl width="100%" height="250">
|
||||
</i-frame>
|
||||
<i-frame *ngIf="activeTab=='Metrics' && metricsClicked && totalDownloads > 0"
|
||||
[url]=downloadsFrameUrl width="100%" height="250">
|
||||
</i-frame>
|
||||
</div>
|
||||
<!--/ul-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="uk-width-1-4@l uk-width-1-4@xl uk-width-1-4@m uk-width-1-1@s">
|
||||
<div class="uk-card uk-card-default uk-padding-small">
|
||||
<div>
|
||||
Share - Bookmark<addThis ></addThis>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,385 @@
|
|||
import {Component, ViewChild, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DataProviderService} from './dataProvider.service';
|
||||
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
||||
import { SearchPublicationsService } from '../../services/searchPublications.service';
|
||||
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
|
||||
import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
||||
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
||||
import { SearchProjectsService } from '../../services/searchProjects.service';
|
||||
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
||||
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
|
||||
import { RelatedDatasourcesTabComponent } from './relatedDatasourcesTab.component';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
import {PiwikService} from '../../utils/piwik/piwik.service';
|
||||
|
||||
import 'rxjs/add/operator/switch';
|
||||
import 'rxjs/add/operator/switchMap';
|
||||
|
||||
@Component({
|
||||
selector: 'dataprovider',
|
||||
templateUrl: 'dataProvider.component.html',
|
||||
})
|
||||
|
||||
export class DataProviderComponent {
|
||||
public dataProviderInfo: DataProviderInfo;
|
||||
public datasourceId: string;
|
||||
|
||||
// Message variables
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
public showLoading: boolean = true;
|
||||
|
||||
// Variable to specify requests with either collectedFrom or hostedBy
|
||||
public paramsForSearchLink = {};
|
||||
|
||||
// Metrics tab variables
|
||||
public metricsClicked: boolean;
|
||||
public viewsFrameUrl: string;
|
||||
public downloadsFrameUrl: string;
|
||||
public totalViews: number;
|
||||
public totalDownloads: number;
|
||||
public pageViews: number;
|
||||
|
||||
// Statistics tab variables
|
||||
public statsClicked: boolean = false;
|
||||
public docsTimelineUrl: string;
|
||||
public docsTypesUrl:string;
|
||||
public docsFunderUrl:string;
|
||||
public dataProjectsUrl:string ;
|
||||
public pubsProjectsUrl:string;
|
||||
|
||||
// Variables for publications, research data, projects, content providers, related content providers tabs
|
||||
public fetchPublications : FetchPublications;
|
||||
public fetchDatasets: FetchDatasets;
|
||||
public fetchProjects: FetchProjects;
|
||||
public fetchDataproviders: FetchDataproviders;
|
||||
public fetchAggregatorsPublications: FetchPublications;
|
||||
public fetchAggregatorsDatasets: FetchDatasets;
|
||||
|
||||
public loadingRelatedDatasources: boolean = true;
|
||||
|
||||
// Active tab variable for responsiveness - show tabs only if main request is completed
|
||||
public activeTab: string = "";
|
||||
public showTabs:boolean = false;
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
// Request results of each tab only the one time (first time tab is clicked)
|
||||
private reloadPublications: boolean = true;
|
||||
private reloadDatasets: boolean = true;
|
||||
private reloadProjects: boolean = true;
|
||||
private reloadDataproviders: boolean = true;
|
||||
private reloadRelatedDatasources: boolean = true;
|
||||
|
||||
private nativeElement : Node;
|
||||
|
||||
sub: any;
|
||||
piwiksub: any;
|
||||
subInfo: any;
|
||||
relatedDatasourcesSub: any;
|
||||
|
||||
constructor (private element: ElementRef,
|
||||
private _dataproviderService: DataProviderService,
|
||||
private _piwikService:PiwikService,
|
||||
private route: ActivatedRoute,
|
||||
private _meta: Meta,
|
||||
private _router: Router,
|
||||
private _searchPublicationsService: SearchPublicationsService,
|
||||
private _searchDatasetsService: SearchDatasetsService,
|
||||
private _searchProjectsService: SearchProjectsService,
|
||||
private _searchDataprovidersService: SearchDataprovidersService) {
|
||||
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
|
||||
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
|
||||
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(data => {
|
||||
this.updateTitle("Content provider");
|
||||
this.updateDescription("Content provider, search, repositories, open access");
|
||||
this.datasourceId = data['datasourceId'];
|
||||
if(this.datasourceId){
|
||||
this.getDataProviderInfo(this.datasourceId);
|
||||
}else{
|
||||
// console.info("Content Provider id not found");
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
if(this.subInfo) {
|
||||
this.subInfo.unsubscribe();
|
||||
}
|
||||
|
||||
if(this.relatedDatasourcesSub) {
|
||||
this.relatedDatasourcesSub.unsubscribe();
|
||||
}
|
||||
}
|
||||
private getDataProviderInfo(id:string) {
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
this.showLoading = true;
|
||||
|
||||
this.showTabs = false ;
|
||||
if(this.datasourceId==null || this.datasourceId==''){
|
||||
this.showLoading = false;
|
||||
this.warningMessage="No valid datasource id";
|
||||
}else{
|
||||
this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId).subscribe(
|
||||
data => {
|
||||
this.dataProviderInfo = data;
|
||||
this.initTabs();
|
||||
this.showTabs = true ;
|
||||
this.updateTitle(this.dataProviderInfo.title.name);
|
||||
this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name);
|
||||
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView(this.dataProviderInfo.title.name).subscribe();
|
||||
}
|
||||
|
||||
this.showLoading = false;
|
||||
|
||||
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
|
||||
this.activeTab = this.dataProviderInfo.tabs[0].name;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
// console.info("error");
|
||||
this.errorMessage = 'No dataProvider found';
|
||||
this.showLoading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
private updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
private updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
|
||||
private initTabs(){
|
||||
|
||||
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
|
||||
this.reloadPublications = true;
|
||||
this.reloadDatasets = true;
|
||||
this.reloadProjects = true;
|
||||
this.reloadDataproviders = true;
|
||||
this.reloadRelatedDatasources = true;
|
||||
this.statsClicked = false;
|
||||
|
||||
this.search(this.dataProviderInfo.tabs[0].content, 1, 10);
|
||||
this.count(1, 0);
|
||||
|
||||
this.metricsClicked = false;
|
||||
|
||||
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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 = OpenaireProperties.getFramesAPIURL()+'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 = OpenaireProperties.getFramesAPIURL()+'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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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 = OpenaireProperties.getFramesAPIURL()+'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';
|
||||
*/
|
||||
|
||||
this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.datasourceId+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250';
|
||||
this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.docsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Data"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
|
||||
//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 FetchPublications(this._searchPublicationsService);
|
||||
//} else {
|
||||
// this.relatedDataprovidersResultsType = 'datasets';
|
||||
this.fetchAggregatorsDatasets = new FetchDatasets(this._searchDatasetsService);
|
||||
//}
|
||||
}
|
||||
if(this.dataProviderInfo.resultsBy == "collectedFrom") {
|
||||
//this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and";
|
||||
this.paramsForSearchLink = this.routerHelper.createQueryParams(['collectedFrom', 'co'], [this.datasourceId, 'and']);
|
||||
} else if (this.dataProviderInfo.resultsBy == "hostedBy") {
|
||||
//this.paramsForSearchLink = "?hostedBy="+this.datasourceId+"&ho=and";
|
||||
this.paramsForSearchLink = this.routerHelper.createQueryParams(['hostedBy', 'ho'], [this.datasourceId, 'and']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private count(page: number, size: number) {
|
||||
for(let i=1; 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=='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) {
|
||||
if(content=='publicationsTab') {
|
||||
this.searchPublications(page, size);
|
||||
} else if(content=='datasetsTab') {
|
||||
this.searchDatasets(page, size);
|
||||
} else if(content=='projectsTab') {
|
||||
this.searchProjects(page, size);
|
||||
} else if(content=='datasourcesTab') {
|
||||
this.searchDatasources(page, size);
|
||||
} else if(content=='relatedDatasourcesTab') {
|
||||
this.searchRelatedDatasources(1, 0);
|
||||
} else if(content=='metricsTab') {
|
||||
this.metricsClicked = true;
|
||||
} else if(content=='statisticsTab') {
|
||||
this.statsClicked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private searchPublications(page: number, size: number) {
|
||||
if( this.reloadPublications &&
|
||||
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE ) ) {
|
||||
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
|
||||
}
|
||||
this.reloadPublications = false;
|
||||
}
|
||||
|
||||
private countPublications(page: number, size: number) {
|
||||
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
|
||||
}
|
||||
|
||||
private searchDatasets(page: number, size: number) {
|
||||
if( this.reloadDatasets &&
|
||||
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
|
||||
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
|
||||
}
|
||||
this.reloadDatasets = false;
|
||||
}
|
||||
|
||||
private countDatasets(page: number, size: number) {
|
||||
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
|
||||
}
|
||||
|
||||
private searchProjects(page: number, size: number) {
|
||||
if( this.reloadProjects &&
|
||||
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchProjects.searchUtils.status == this.errorCodes.DONE ) ) {
|
||||
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size);
|
||||
}
|
||||
this.reloadProjects = false;
|
||||
}
|
||||
|
||||
private countProjects(page: number, size: number) {
|
||||
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size);
|
||||
}
|
||||
|
||||
private searchDatasources(page: number, size: number) {
|
||||
if( this.reloadDataproviders &&
|
||||
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE ) ) {
|
||||
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size);
|
||||
}
|
||||
this.reloadDataproviders = false;
|
||||
}
|
||||
|
||||
private countDatasources(page: number, size: number) {
|
||||
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size);
|
||||
}
|
||||
|
||||
private searchRelatedDatasources(page: number, size: number) {
|
||||
// Currently no counting is done for this tab. Following condition is always false
|
||||
|
||||
if( this.reloadRelatedDatasources &&
|
||||
( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE )
|
||||
&&
|
||||
( this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
||||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
|
||||
this.relatedDatasourcesSub = Observable.merge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete)
|
||||
.subscribe(
|
||||
data => {},
|
||||
err => {},
|
||||
() => { this.preprocessRelatedDatasources(); }
|
||||
)
|
||||
|
||||
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size);
|
||||
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size);
|
||||
} else {
|
||||
this.loadingRelatedDatasources = false;
|
||||
}
|
||||
|
||||
|
||||
this.reloadRelatedDatasources = false;
|
||||
}
|
||||
|
||||
private countRelatedDatasources(page: number, size: number) {
|
||||
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size);
|
||||
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size);
|
||||
}
|
||||
|
||||
|
||||
private preprocessRelatedDatasources() {
|
||||
if( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE ||
|
||||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) {
|
||||
this.dataProviderInfo.relatedDatasources = new Map<string, {"name": string, "countPublications": string, "countDatasets": 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"});
|
||||
} 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});
|
||||
} else {
|
||||
this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count)+"";
|
||||
}
|
||||
}
|
||||
this.loadingRelatedDatasources = false;
|
||||
}
|
||||
|
||||
public metricsResults($event) {
|
||||
this.totalViews = $event.totalViews;
|
||||
this.totalDownloads = $event.totalDownloads;
|
||||
this.pageViews = $event.pageViews;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
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.module';
|
||||
import {LandingModule} from '../landing-utils/landing.module';
|
||||
import {PagingModule} from '../../utils/paging.module';
|
||||
|
||||
import {PublicationsTabComponent} from './publicationsTab.component';
|
||||
import {DatasetsTabComponent} from './datasetsTab.component';
|
||||
import {StatisticsTabComponent} from './statisticsTab.component';
|
||||
import {ProjectsTabComponent} from './projectsTab.component';
|
||||
import {DatasourcesTabComponent} from './datasourcesTab.component';
|
||||
import {OrganizationsTabComponent} from './organizationsTab.component';
|
||||
import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component';
|
||||
// import {TabsComponent} from './tabs.component';
|
||||
|
||||
import {DataProviderComponent} from './dataProvider.component';
|
||||
import {DataProviderService} from './dataProvider.service';
|
||||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
|
||||
// import { DataProviderRoutingModule } from './dataProvider-routing.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
@NgModule({
|
||||
imports:
|
||||
[CommonModule, FormsModule, RouterModule,
|
||||
TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule,
|
||||
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule,
|
||||
PagingModule],
|
||||
declarations:
|
||||
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
|
||||
RelatedDatasourcesTabComponent, DataProviderComponent
|
||||
],
|
||||
providers:[
|
||||
DataProviderService, FreeGuard, IsRouteEnabled],
|
||||
exports: [
|
||||
DataProviderComponent
|
||||
]
|
||||
|
||||
})
|
||||
export class DataProviderModule { }
|
|
@ -0,0 +1,162 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DataProviderService {
|
||||
|
||||
constructor(private http: Http ) {}
|
||||
|
||||
dataProviderInfo: DataProviderInfo;
|
||||
|
||||
getDataproviderInfo (id: string):any {
|
||||
console.info("getDataProviderInfo in service");
|
||||
let url = OpenaireProperties.getSearchAPIURLLast() + 'datasources/' +id +"?format=json";
|
||||
let key = url;
|
||||
|
||||
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => res['result']['metadata']['oaf:entity'])
|
||||
.map(res => [res['oaf:datasource'],
|
||||
res['oaf:datasource']['datasourcetype'],
|
||||
res['oaf:datasource']['openairecompatibility'],
|
||||
res['oaf:datasource']['accessinfopackage'],
|
||||
res['oaf:datasource']['rels']['rel']
|
||||
])
|
||||
.map(res => this.parseDataProviderInfo(res));
|
||||
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parseDataProviderInfo (data: any):any {
|
||||
this.dataProviderInfo = new DataProviderInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
this.dataProviderInfo.title = {"name": (data[0].englishname)?data[0].englishname: data[0].officialname, "url": data[0].websiteurl};
|
||||
this.dataProviderInfo.officialName = data[0].officialname;
|
||||
var originalId =(data[0].originalId)?data[0].originalId:"";
|
||||
if(originalId && originalId != ""){
|
||||
if(originalId.indexOf("opendoar____::") != -1){
|
||||
this.dataProviderInfo.openDoarURL = "http://www.opendoar.org/find.php?format=full&rID="+originalId.split("opendoar____::")[1];
|
||||
|
||||
}else if (originalId.indexOf("re3data_____::") != -1){
|
||||
this.dataProviderInfo.r3DataURL = "http://service.re3data.org/repository/"+originalId.split("re3data_____::")[1];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(data[1] != null) {
|
||||
this.dataProviderInfo.type = data[1].classname;
|
||||
|
||||
if(data[1].classid == "entityregistry" || data[1].classid == "entityregistry::projects" || data[1].classid == "entityregistry::repositories") {
|
||||
this.dataProviderInfo.registry = true;
|
||||
} else {
|
||||
this.dataProviderInfo.registry = false;
|
||||
}
|
||||
|
||||
if(this.dataProviderInfo.tabs == undefined) {
|
||||
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
|
||||
}
|
||||
|
||||
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Publications", "content": "publicationsTab"});
|
||||
}
|
||||
if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Research Data", "content": "datasetsTab"});
|
||||
}
|
||||
|
||||
if(this.dataProviderInfo.tabsInTypes.projectsTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Projects", "content": "projectsTab"});
|
||||
}
|
||||
if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Content Providers", "content": "datasourcesTab"});
|
||||
}
|
||||
this.dataProviderInfo.tabs.push({"name": "Organizations", "content": "organizationsTab"});
|
||||
|
||||
if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Related Content Providers", "content": "relatedDatasourcesTab"});
|
||||
}
|
||||
|
||||
if(this.dataProviderInfo.tabsInTypes.statisticsTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Statistics", "content": "statisticsTab"});
|
||||
}
|
||||
|
||||
this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
|
||||
|
||||
if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) {
|
||||
this.dataProviderInfo.resultsBy = "collectedFrom";
|
||||
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(data[1].classid)) {
|
||||
this.dataProviderInfo.resultsBy = "hostedBy";
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.dataProviderInfo.registry) {
|
||||
if(data[2] != null) {
|
||||
this.dataProviderInfo.compatibility = data[2].classname;
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
let oaiPmhURL: string;
|
||||
if(Array.isArray(data[3])) {
|
||||
oaiPmhURL = data[3][0];
|
||||
}
|
||||
else {
|
||||
oaiPmhURL = data[3];
|
||||
}
|
||||
|
||||
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
|
||||
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
let mydata;
|
||||
let counter = 0;
|
||||
let countriesSet: Set<string>;
|
||||
let length = data[4].length!=undefined ? data[4].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data[4].length!=undefined ? data[4][i] : data[4];
|
||||
if(mydata.hasOwnProperty("to")) {
|
||||
if(mydata['to'].class == "provides" && mydata['to'].type == "organization") {
|
||||
//if(this.dataProviderInfo.organizations == undefined) {
|
||||
if(this.dataProviderInfo.organizations.length == 0) {
|
||||
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
|
||||
this.dataProviderInfo.countries = new Array<string>();
|
||||
countriesSet = new Set<string>();
|
||||
}
|
||||
|
||||
this.dataProviderInfo.organizations[counter] = {"name": "", "id": ""};
|
||||
this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname;
|
||||
this.dataProviderInfo.organizations[counter]['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/mydata['to'].content;
|
||||
|
||||
if(mydata.country != '' && mydata['country'].classname != '') {
|
||||
if(!countriesSet.has(mydata['country'].classname)) {
|
||||
this.dataProviderInfo.countries.push(mydata['country'].classname);
|
||||
countriesSet.add(mydata['country'].classname);
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.dataProviderInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
|
||||
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'datasetsTab',
|
||||
template: `
|
||||
<!--div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div>
|
||||
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service temprorarily unavailable. Please try again later.</div>
|
||||
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No research data found</div-->
|
||||
<errorMessages [status]="[fetchDatasets.searchUtils.status]" [type]="'research data'"></errorMessages>
|
||||
|
||||
<!--div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert">
|
||||
No research data available
|
||||
</div-->
|
||||
|
||||
<div *ngIf="fetchDatasets.searchUtils.totalResults > 0">
|
||||
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults > 10" >
|
||||
<a [queryParams]="paramsForSearchLink"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets" class="uk-button uk-button-text">
|
||||
View all {{fetchDatasets.searchUtils.totalResults}} results
|
||||
</a>
|
||||
</div>
|
||||
<tab-result [(results)]="fetchDatasets.results"
|
||||
[(status)]= "fetchDatasets.searchUtils.status"
|
||||
type="dataset" urlParam="datasetId">
|
||||
</tab-result>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class DatasetsTabComponent {
|
||||
@Input() paramsForSearchLink = {};
|
||||
@Input() fetchDatasets : FetchDatasets;
|
||||
public linkToSearchDatasets = "";
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.linkToSearchDatasets = OpenaireProperties.getLinkToAdvancedSearchDatasets();
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
||||
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'datasourcesTab',
|
||||
template: `
|
||||
<!--div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No content providers available</div>
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service temprorarily unavailable. Please try again later.</div>
|
||||
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No content providers found</div-->
|
||||
<errorMessages [status]="[fetchDataproviders.searchUtils.status]" [type]="'content providers'"></errorMessages>
|
||||
|
||||
<!--div *ngIf="fetchDataproviders.searchUtils.totalResults == 0" class = "uk-alert">
|
||||
No content providers available
|
||||
</div-->
|
||||
|
||||
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
|
||||
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
|
||||
<a [queryParams]="paramsForSearchLink"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
|
||||
View all {{fetchDataproviders.searchUtils.totalResults}} results
|
||||
</a>
|
||||
</div>
|
||||
<tab-result [(results)]="fetchDataproviders.results"
|
||||
[(status)]= "fetchDataproviders.status"
|
||||
type="dataprovider" urlParam="datasourceId"
|
||||
lazy=false>
|
||||
</tab-result>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class DatasourcesTabComponent {
|
||||
|
||||
@Input() paramsForSearchLink = {};
|
||||
@Input() fetchDataproviders : FetchDataproviders;
|
||||
public linkToSearchDataproviders = "";
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders();
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'organizationsTab',
|
||||
template: `
|
||||
<div *ngIf=" !organizations || organizations.length == 0" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">
|
||||
No organizations available
|
||||
</div>
|
||||
|
||||
<div *ngIf=" organizations && organizations.length > 0">
|
||||
<div *ngIf="organizations.length > pageSize" class="uk-margin-bottom">
|
||||
{{organizations.length}} organizations, page {{organizationsPage}} of {{totalPages(organizations.length)}}
|
||||
<paging-no-load class="uk-float-right" [currentPage]="organizationsPage" [totalResults]="organizations.length" [size]="pageSize" (pageChange)="updateOrganizationsPage($event)"></paging-no-load>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let item of organizations.slice((organizationsPage-1)*pageSize, organizationsPage*pageSize)" class="uk-h4">
|
||||
<p *ngIf=" item != undefined && item['id'] != undefined">
|
||||
<!--a href="{{item['url']}}"-->
|
||||
<a [queryParams]="{organizationId: item.id}" routerLinkActive="router-link-active" routerLink="/search/organization">
|
||||
{{item['name']}}
|
||||
</a>
|
||||
</p>
|
||||
<p *ngIf="item['id'] == undefined">
|
||||
{{item['name']}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class OrganizationsTabComponent {
|
||||
|
||||
@Input() organizations: {"name": string, "id": string}[];
|
||||
public organizationsPage: number = 1;
|
||||
public pageSize: number = 10;
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
ngOnDestroy() {}
|
||||
|
||||
totalPages(totalResults: number): number {
|
||||
let totalPages:any = totalResults/this.pageSize;
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, this.pageSize) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
updateOrganizationsPage($event) {
|
||||
this.organizationsPage = $event.value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
||||
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'projectsTab',
|
||||
template: `
|
||||
<!--div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
|
||||
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
|
||||
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'"></errorMessages>
|
||||
|
||||
<!--div *ngIf="fetchProjects.searchUtils.totalResults == 0" class = "uk-alert">
|
||||
No projects available
|
||||
</div-->
|
||||
|
||||
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
|
||||
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResults > 10">
|
||||
<a [queryParams]="paramsForSearchLink"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchProjects" class="uk-button uk-button-text">
|
||||
View all {{fetchProjects.searchUtils.totalResults}} results
|
||||
</a>
|
||||
</div>
|
||||
<tab-result [(results)]="fetchProjects.results"
|
||||
[(status)]= "fetchProjects.status"
|
||||
type="project" urlParam="projectId">
|
||||
</tab-result>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class ProjectsTabComponent {
|
||||
|
||||
@Input() paramsForSearchLink = {};
|
||||
@Input() fetchProjects : FetchProjects;
|
||||
public linkToSearchProjects = "";
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
||||
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'publicationsTab',
|
||||
template: `
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
<!--errorMessages [status]="[fetchPublications.searchUtils.status]" [type]="'publications'"></errorMessages>
|
||||
{{fetchPublications.searchUtils.status}}-->
|
||||
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert">
|
||||
No publications available
|
||||
</div-->
|
||||
|
||||
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
|
||||
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10">
|
||||
<!--a [href] = "linkToSearchPublications">
|
||||
View all {{fetchPublications.searchUtils.totalResults}} results
|
||||
</a-->
|
||||
<a [queryParams]="paramsForSearchLink"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications" class="uk-button uk-button-text">
|
||||
View all {{fetchPublications.searchUtils.totalResults}} results
|
||||
</a>
|
||||
</div>
|
||||
<tab-result [(results)]="fetchPublications.results"
|
||||
[(status)]= "fetchPublications.status"
|
||||
type="publication" urlParam="articleId">
|
||||
</tab-result>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class PublicationsTabComponent {
|
||||
@Input() paramsForSearchLink = {};//: string = "";
|
||||
@Input() fetchPublications : FetchPublications;
|
||||
public linkToSearchPublications = "";
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();//+this.paramsForSearchLink;
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
||||
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
|
||||
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@Component({
|
||||
selector: 'relatedDatasourcesTab',
|
||||
template: `
|
||||
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
|
||||
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">
|
||||
No related content providers available
|
||||
</div>
|
||||
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR && fetchDatasets.searchUtils.status == errorCodes.ERROR"
|
||||
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">
|
||||
An Error Occured
|
||||
</div-->
|
||||
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE && fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
|
||||
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">
|
||||
Service not available
|
||||
</div-->
|
||||
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING || loading"
|
||||
class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
|
||||
</div-->
|
||||
|
||||
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'related content providers'"></errorMessages>
|
||||
|
||||
<div *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE || fetchDatasets.searchUtils.status == errorCodes.DONE) && !loading">
|
||||
<div *ngIf="results && results.size > pageSize" class="uk-margin">
|
||||
<span class="uk-text-bold">{{results.size}} related content providers, page {{page}} of {{totalPages(results.size)}}</span>
|
||||
<paging-no-load class="uk-float-right" [currentPage]="page" [totalResults]="results.size" [size]="pageSize" (pageChange)="updatePage($event)"></paging-no-load>
|
||||
</div>
|
||||
|
||||
<table class="uk-table uk-table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="uk-text-center">Content Provider Name</th>
|
||||
<th *ngIf="fetchPublications.results.length > 0 || fetchPublications.searchUtils.status == errorCodes.ERROR"
|
||||
class="uk-text-center">
|
||||
Number of Publications
|
||||
</th>
|
||||
<th *ngIf="fetchDatasets.results.length > 0 || fetchDatasets.searchUtils.status == errorCodes.ERROR"
|
||||
class="uk-text-center">
|
||||
Number of Research Data
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<ng-container *ngIf="results">
|
||||
<ng-container *ngFor="let id of results.keys() let i=index">
|
||||
<tr *ngIf="i>=(page-1)*pageSize && i<page*pageSize">
|
||||
<td class="uk-text-center">
|
||||
<a [queryParams]="{datasourceId: id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
|
||||
{{results.get(id).name}}
|
||||
</a>
|
||||
</td>
|
||||
<td *ngIf="fetchPublications.results.length > 0" class="uk-text-center">
|
||||
<a [queryParams]="routerHelper.createQueryParams(['hostedBy', 'ho', 'collectedFrom', 'co'], [id, 'and', dataproviderId, 'and'])"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications">
|
||||
{{results.get(id).countPublications}}
|
||||
</a>
|
||||
</td>
|
||||
<td *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-text-center">-</td>
|
||||
|
||||
<td *ngIf="fetchDatasets.results.length > 0" class="uk-text-center">
|
||||
<a [queryParams]="routerHelper.createQueryParams(['hostedBy', 'ho', 'collectedFrom', 'co'], [id, 'and', dataproviderId, 'and'])"
|
||||
routerLinkActive="router-link-active" [routerLink]="linkToSearchResearchData">
|
||||
{{results.get(id).countDatasets}}
|
||||
</a>
|
||||
</td>
|
||||
<td *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-text-center">-</td>
|
||||
</tr>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class RelatedDatasourcesTabComponent {
|
||||
@Input() dataproviderId: string;
|
||||
@Input() fetchPublications : FetchPublications;
|
||||
@Input() fetchDatasets : FetchDatasets;
|
||||
// true: preprocessing is not over
|
||||
@Input() loading: boolean = true;
|
||||
// Εvery content provider's id is a single key of a map
|
||||
@Input() results: Map<string, {"name": string, "countPublications": string, "countDatasets": string}>;
|
||||
|
||||
public linkToSearchPublications: string = "";
|
||||
public linkToSearchResearchData: string = "";
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
public page: number = 1;
|
||||
public pageSize: number = 10;
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();//+"?&hostedBy=";//+ +"&ho=and&collectedFrom="+ +"&co=and";
|
||||
this.linkToSearchResearchData = OpenaireProperties.getLinkToAdvancedSearchDatasets();
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
|
||||
totalPages(totalResults: number): number {
|
||||
let totalPages:any = totalResults/this.pageSize;
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, this.pageSize) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
updatePage($event) {
|
||||
this.page = $event.value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component';
|
||||
import { SearchPublicationsComponent } from '../../searchPages/simple/searchPublications.component';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'statisticsTab',
|
||||
template: `
|
||||
<div *ngIf="show">
|
||||
<!--div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NONE && DatasetsComponent.searchUtils.status == errorCodes.NONE"
|
||||
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
|
||||
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.ERROR || DatasetsComponent.searchUtils.status == errorCodes.ERROR"
|
||||
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE || DatasetsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE"
|
||||
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.LOADING || DatasetsComponent.searchUtils.status == errorCodes.LOADING"
|
||||
class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
|
||||
<errorMessages [status]="[searchPublicationsComponent.searchUtils.status, DatasetsComponent.searchUtils.status]" [type]="'statistics'"></errorMessages>
|
||||
|
||||
<!--div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0 && searchDatasetsComponent.searchUtils.totalResults == 0" class = "uk-alert">
|
||||
No statistics available
|
||||
</div-->
|
||||
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults != 0 || searchDatasetsComponent.searchUtils.totalResults != 0">
|
||||
<p class="uk-text-bold">Latest Documents Timeline</p>
|
||||
<i-frame [url]=docsTimelineUrl width="800" height="350"></i-frame>
|
||||
<p class="uk-text-bold">Documents Types</p>
|
||||
<i-frame [url]=docsTypesUrl width="800" height="350"></i-frame>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="(searchPublicationsComponent.searchUtils.totalResults > 0)">
|
||||
<div>
|
||||
<p class="uk-text-bold">Funders in content providers Publications</p>
|
||||
<i-frame [url]=docsFunderUrl width="800" height="350"></i-frame>
|
||||
<p class="uk-text-bold">Projects with most Publications</p>
|
||||
<i-frame [url]=pubsProjectsUrl width="800" height="350"></i-frame>
|
||||
|
||||
</div>
|
||||
<div *ngIf="(searchDatasetsComponent.searchUtils.totalResults > 0)">
|
||||
<div>
|
||||
<p class="uk-text-bold">Projects with most Research Data</p>
|
||||
<i-frame [url]=dataProjectsUrl width="800" height="350"></i-frame>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
export class StatisticsTabComponent {
|
||||
|
||||
@Input() statistics;
|
||||
@Input() id;
|
||||
@Input() searchDatasetsComponent : SearchDatasetsComponent;
|
||||
@Input() searchPublicationsComponent : SearchPublicationsComponent;
|
||||
@Input() show : boolean = false;
|
||||
|
||||
private docsTimelineUrl: string;
|
||||
private docsTypesUrl:string;
|
||||
private docsFunderUrl:string;
|
||||
private dataProjectsUrl:string ;
|
||||
private pubsProjectsUrl:string;
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.id+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250';
|
||||
this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.docsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// import { NgModule } from '@angular/core';
|
||||
// import { RouterModule } from '@angular/router';
|
||||
//
|
||||
// import { DatasetComponent } from './dataset.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: DatasetComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
|
||||
// redirect: '/error'
|
||||
// },canDeactivate: [PreviousRouteRecorder] }
|
||||
// ])
|
||||
// ]
|
||||
// })
|
||||
// export class DatasetRoutingModule { }
|
|
@ -0,0 +1,292 @@
|
|||
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
||||
<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="uk-container uk-margin-top dataset">
|
||||
|
||||
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-margin-large-top" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger uk-margin-large-top" role="alert">{{errorMessage}}</div>
|
||||
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||
|
||||
<div *ngIf="datasetInfo != null" uk-grid class="uk-grid-large">
|
||||
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
|
||||
<showTitle [title]="datasetInfo.title"></showTitle>
|
||||
<span *ngIf="datasetInfo.types.length > 0"class="uk-label custom-label label-dataset " title="Type">{{datasetInfo.types.join(", ")}}</span>
|
||||
<span *ngIf="datasetInfo.languages.length > 0" class="uk-label custom-label label-language " title="Language">{{datasetInfo.languages.join(", ")}}</span>
|
||||
|
||||
<span *ngIf="datasetInfo.title && datasetInfo.title.accessMode" [class]="'uk-label custom-label label-'+ datasetInfo.title.accessMode " >{{datasetInfo.title.accessMode}}</span>
|
||||
<span *ngIf="datasetInfo.underCurationMessage" class="uk-label custom-label label-underCuration " >
|
||||
<span uk-tooltip="pos:right; delay:10"
|
||||
title="{{buildCurationTooltip()}}">
|
||||
<i>Record in preview</i>
|
||||
<i class="uk-icon-info-circle"></i>
|
||||
</span></span>
|
||||
<!--div *ngIf="datasetInfo.underCurationMessage">
|
||||
<span uk-tooltip="pos:right; delay:10"
|
||||
title="{{buildCurationTooltip()}}">
|
||||
<i>Record in preview</i>
|
||||
<i class="uk-icon-info-circle"></i>
|
||||
</span>
|
||||
</div-->
|
||||
|
||||
<div class= " uk-margin-top">
|
||||
<showAuthors [authors]="datasetInfo.authors" searchPage="datasets"></showAuthors>
|
||||
<span *ngIf="datasetInfo.date != ''">({{datasetInfo.date}})</span>
|
||||
</div>
|
||||
|
||||
<ul class="uk-list">
|
||||
<li *ngIf="datasetInfo.publisher"><span class="uk-text-bold">Publisher:</span> {{datasetInfo.publisher}}</li>
|
||||
|
||||
<li *ngIf="datasetInfo.embargoEndDate"><span class="uk-text-bold">Embargo end date:</span> {{datasetInfo.embargoEndDate}}</li>
|
||||
<li *ngIf="datasetInfo.identifiers && datasetInfo.identifiers.size > 0">
|
||||
<showIdentifiers [identifiers]="datasetInfo.identifiers"></showIdentifiers>
|
||||
</li>
|
||||
<li *ngIf="datasetInfo.subjects ||datasetInfo.otherSubjects || datasetInfo.classifiedSubjects">
|
||||
<showSubjects [subjects]="datasetInfo.subjects"
|
||||
[otherSubjects]="datasetInfo.otherSubjects"
|
||||
[classifiedSubjects]="datasetInfo.classifiedSubjects">
|
||||
</showSubjects>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div *ngIf="datasetInfo.description" class="uk-margin-bottom uk-text-justify descriptionText">
|
||||
{{datasetInfo.description}}
|
||||
</div>
|
||||
|
||||
<!-- <div class="uk-clearfix"><div class="uk-float-right uk-margin-top">
|
||||
<div class="uk-inline">
|
||||
<button class="uk-button uk-button-small uk-button-action" type="button">
|
||||
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="link" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M7.925,11.875 L11.925,7.975"></path></svg></span>
|
||||
Link this research data to
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-down" ratio="1"><polygon points="5 7 15 7 10 12"></polygon></svg></span>
|
||||
</button>
|
||||
<div uk-dropdown="mode: click; boundary: ! .uk-button-group; boundary-align: true;"
|
||||
class="uk-dropdown uk-dropdown-boundary uk-dropdown-bottom-left" style="top: 40px; left: -236.5px;">
|
||||
<ul class="uk-nav uk-dropdown-nav uk-padding-small" >
|
||||
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','project'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Projects</a></li>
|
||||
<li><a class="uk-width-1-1"[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','context'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Communities</a></li>
|
||||
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Other research results</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div></div> -->
|
||||
|
||||
|
||||
<ul class="uk-tab uk-visible@m" uk-tab="connect: #tab-content">
|
||||
<li (click)="activeTab='Related Research Results'"
|
||||
[class]="activeTab == 'Related Research Results'?'uk-active':''">
|
||||
<a>
|
||||
Related Research Results
|
||||
<span class="uk-badge uk-badge-notification">
|
||||
{{relatedResearchResultsNum}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li (click)="activeTab='Similar Research Results'"
|
||||
[class]="activeTab == 'Similar Research Results'?'uk-active':''">
|
||||
<a>
|
||||
Similar Research Results
|
||||
<span *ngIf="!datasetInfo.similarResearchResults" class="uk-badge uk-badge-notification">0</span>
|
||||
<span *ngIf="datasetInfo.similarResearchResults" class="uk-badge uk-badge-notification">
|
||||
{{datasetInfo.similarResearchResults.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li (click)="metricsClicked=true; activeTab='Metrics'"
|
||||
[class]="activeTab == 'Metrics'?'uk-active':''">
|
||||
<a>
|
||||
Metrics <!--i class="icon-line-chart"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36" style="fill:currentColor;">
|
||||
<path d="M4.415 31.713h31.704v4.529h-36.233v-36.233h4.529zM10.077 29.447c-1.877 0-3.396-1.521-3.396-3.396s1.521-3.396 3.396-3.396c0.101 0 0.199 0.006 0.297 0.014l3.652-6.086c-0.348-0.534-0.551-1.171-0.551-1.855 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 0.685-0.203 1.321-0.551 1.855l3.652 6.086c0.098-0.009 0.196-0.014 0.297-0.014 0.076 0 0.151 0.004 0.225 0.009l6.028-10.549c-0.373-0.546-0.592-1.204-0.592-1.916 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 1.877-1.521 3.396-3.396 3.396-0.076 0-0.151-0.004-0.225-0.009l-6.028 10.549c0.373 0.546 0.592 1.204 0.592 1.916 0 1.877-1.521 3.396-3.396 3.396s-3.396-1.521-3.396-3.396c0-0.684 0.203-1.321 0.551-1.855l-3.652-6.086c-0.098 0.009-0.196 0.014-0.297 0.014s-0.199-0.006-0.297-0.014l-3.652 6.086c0.348 0.534 0.551 1.171 0.551 1.855 0 1.877-1.521 3.396-3.396 3.396z"></path>
|
||||
</svg></i-->
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<button class="uk-button uk-button-default uk-hidden@m" type="button">
|
||||
<span uk-navbar-toggle-icon></span> <span class="uk-margin-small-left">{{activeTab}}</span>
|
||||
</button>
|
||||
|
||||
<ul id="toggle-small-tabs" class="uk-subnav uk-subnav-pill uk-dropdown uk-hidden@m" uk-switcher="connect: #tab-content" uk-dropdown="mode: click" uk-toggle="target: #toggle-small-tabs">
|
||||
<li (click)="activeTab='Related Research Results'"
|
||||
[class]="activeTab == 'Related Research Results'?'uk-active':''">
|
||||
<a>
|
||||
Related Research Results
|
||||
<span class="uk-badge uk-badge-notification">
|
||||
{{relatedResearchResultsNum}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li (click)="activeTab='Similar Research Results'"
|
||||
[class]="activeTab == 'Similar Research Results'?'uk-active':''">
|
||||
<a>
|
||||
Similar Research Results
|
||||
<span *ngIf="!datasetInfo.similarResearchResults" class="uk-badge uk-badge-notification">0</span>
|
||||
<span *ngIf="datasetInfo.similarResearchResults" class="uk-badge uk-badge-notification">
|
||||
{{datasetInfo.similarResearchResults.length}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li (click)="metricsClicked=true; activeTab='Metrics'"
|
||||
[class]="activeTab == 'Metrics'?'uk-active':''">
|
||||
<a>
|
||||
Metrics<!--i class="icon-line-chart"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36" style="fill:currentColor;">
|
||||
<path d="M4.415 31.713h31.704v4.529h-36.233v-36.233h4.529zM10.077 29.447c-1.877 0-3.396-1.521-3.396-3.396s1.521-3.396 3.396-3.396c0.101 0 0.199 0.006 0.297 0.014l3.652-6.086c-0.348-0.534-0.551-1.171-0.551-1.855 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 0.685-0.203 1.321-0.551 1.855l3.652 6.086c0.098-0.009 0.196-0.014 0.297-0.014 0.076 0 0.151 0.004 0.225 0.009l6.028-10.549c-0.373-0.546-0.592-1.204-0.592-1.916 0-1.877 1.521-3.396 3.396-3.396s3.396 1.521 3.396 3.396c0 1.877-1.521 3.396-3.396 3.396-0.076 0-0.151-0.004-0.225-0.009l-6.028 10.549c0.373 0.546 0.592 1.204 0.592 1.916 0 1.877-1.521 3.396-3.396 3.396s-3.396-1.521-3.396-3.396c0-0.684 0.203-1.321 0.551-1.855l-3.652-6.086c-0.098 0.009-0.196 0.014-0.297 0.014s-0.199-0.006-0.297-0.014l-3.652 6.086c0.348 0.534 0.551 1.171 0.551 1.855 0 1.877-1.521 3.396-3.396 3.396z"></path>
|
||||
</svg></i-->
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--ul id="tab-content" class="uk-switcher uk-margin custom-tab-content"-->
|
||||
<div class="uk-margin custom-tab-content">
|
||||
<div *ngIf="activeTab=='Related Research Results'" class="uk-animation-fade">
|
||||
<div *ngIf="!datasetInfo.relatedResearchResults" class = "uk-alert uk-alert-primary" >
|
||||
No related research results available
|
||||
</div>
|
||||
<div *ngIf="datasetInfo.relatedResearchResults && datasetInfo.relatedResearchResults.size > 0">
|
||||
|
||||
<div *ngFor="let provenanceaction of getKeys(datasetInfo.relatedResearchResults)">
|
||||
<div class="uk-text-large">{{provenanceaction}}</div>
|
||||
|
||||
<tabTable [info]="datasetInfo.relatedResearchResults.get(provenanceaction)"></tabTable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="activeTab=='Similar Research Results'" class="uk-animation-fade">
|
||||
<div *ngIf="!datasetInfo.similarResearchResults" class = "uk-alert uk-alert-primary" >
|
||||
No similar research results available
|
||||
</div>
|
||||
<div *ngIf="datasetInfo.similarResearchResults">
|
||||
<tabTable [info]="datasetInfo.similarResearchResults"></tabTable>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="activeTab=='Metrics'" class="uk-animation-fade">
|
||||
<!-- Page Views: {{pageViews}} -->
|
||||
<metrics [pageViews]="pageViews"
|
||||
[id]="datasetId" [entityType]="'results'" [entity]="'Research Data'"
|
||||
(metricsResults)="metricsResults($event)">
|
||||
</metrics>
|
||||
<i-frame *ngIf="metricsClicked && totalViews > 0"
|
||||
[url]=viewsFrameUrl width="100%" height="250">
|
||||
</i-frame>
|
||||
<i-frame *ngIf="metricsClicked && totalDownloads > 0"
|
||||
[url]=downloadsFrameUrl width="100%" height="250">
|
||||
</i-frame>
|
||||
</div>
|
||||
<!--/ul-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-1-4@l uk-width-1-4@xl uk-width-1-4@m uk-width-1-1@s">
|
||||
<div class="uk-card uk-card-default uk-padding-small">
|
||||
<div >
|
||||
Share - Bookmark
|
||||
<addThis></addThis>
|
||||
</div>
|
||||
<altmetrics *ngIf="datasetInfo.identifiers && datasetInfo.identifiers.get('doi')"
|
||||
id="{{datasetInfo.identifiers.get('doi')[0]}}" type="doi">
|
||||
</altmetrics >
|
||||
<ul class="uk-list ">
|
||||
|
||||
<li *ngIf="datasetInfo.hostedBy_collectedFrom && datasetInfo.hostedBy_collectedFrom.length > 0">
|
||||
<availableOn [availableOn]="datasetInfo.hostedBy_collectedFrom"></availableOn>
|
||||
</li>
|
||||
<li *ngIf="datasetInfo.fundedByProjects != undefined && datasetInfo.fundedByProjects.length > 0">
|
||||
<fundedBy [fundedByProjects]="datasetInfo.fundedByProjects"></fundedBy>
|
||||
</li>
|
||||
|
||||
<li *ngIf="datasetInfo.contexts && datasetInfo.contexts.length >0 ">
|
||||
<dl class="uk-description-list-line" >
|
||||
<dt class="title">Related to </dt>
|
||||
<dd class="line" *ngFor="let item of datasetInfo.contexts">
|
||||
<span *ngIf = "!item['inline']" >
|
||||
<span>{{item['labelContext']}}</span>
|
||||
<span *ngIf="item['labelCategory']">-> {{item['labelCategory']}}</span>
|
||||
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span>
|
||||
</span>
|
||||
<mark *ngIf = "item['inline']" >
|
||||
<span>{{item['labelContext']}}</span>
|
||||
<span *ngIf="item['labelCategory']">-> {{item['labelCategory']}}</span>
|
||||
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span>
|
||||
</mark>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<ul uk-accordion class="uk-padding-remove">
|
||||
<li>
|
||||
<div class=" uk-accordion-title cite-this-button uk-width-1-1" type="button">
|
||||
Cite this reasearch data
|
||||
</div>
|
||||
<div class="uk-accordion-content">
|
||||
<citeThis [result]="datasetInfo" [id]="datasetId" type="research data"></citeThis>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul uk-accordion class="uk-padding-remove">
|
||||
<li>
|
||||
<button class="uk-button uk-button-primary uk-accordion-title link-to-button uk-width-1-1" type="button">
|
||||
<span class="uk-icon" >
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="link" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M7.925,11.875 L11.925,7.975"></path></svg></span>
|
||||
<span>Link this research data to</span>
|
||||
</button>
|
||||
<div class="uk-accordion-content">
|
||||
<ul class="uk-nav uk-dropdown-nav uk-padding-small" >
|
||||
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','project'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Projects</a></li>
|
||||
<li><a class="uk-width-1-1"[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','context'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Communities</a></li>
|
||||
<li><a class="uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Other research results</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
<!--div class="uk-card uk-card-default uk-padding-small uk-card-body">
|
||||
<div class="uk-card-title">
|
||||
<span class="" uk-tooltip="pos:right; delay:5"
|
||||
title='<div id="linkinginfo" class= "uk-margin uk-padding-small">
|
||||
<p>Do you think that information is missing about a project, a community or other research results related to this dataset?</p>
|
||||
<p>You are able to enhance it! Please follow the links and create the missing relations.</p>
|
||||
</div>'>
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="link" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M7.925,11.875 L11.925,7.975"></path></svg></span>
|
||||
Link this dataset to</div>
|
||||
<div>
|
||||
|
||||
<div class="uk-clearfix">
|
||||
|
||||
<div><a class="uk-button-text uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','project'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Projects</a></div>
|
||||
<div><a class=" uk-button-text uk-width-1-1"[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','context'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Communities</a></div>
|
||||
<div><a class=" uk-button-text uk-width-1-1" [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[datasetId,'dataset','result'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" >
|
||||
Other research results</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,172 @@
|
|||
import {Component, ViewChild, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DatasetService} from './dataset.service';
|
||||
import {DatasetInfo} from '../../utils/entities/datasetInfo';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties'
|
||||
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
import {PiwikService} from '../../utils/piwik/piwik.service';
|
||||
|
||||
@Component({
|
||||
selector: 'dataset',
|
||||
templateUrl: 'dataset.component.html',
|
||||
})
|
||||
|
||||
export class DatasetComponent {
|
||||
public datasetInfo: DatasetInfo;
|
||||
public datasetId : string ;
|
||||
|
||||
// APP BOX variables
|
||||
public showAllCollectedFrom: boolean = false;
|
||||
public showAllDownloadFrom: boolean = false;
|
||||
public showAllPublishedIn: boolean = false;
|
||||
|
||||
// Metrics tab variables
|
||||
public metricsClicked: boolean;
|
||||
public viewsFrameUrl: string;
|
||||
public downloadsFrameUrl: string;
|
||||
public totalViews: number;
|
||||
public totalDownloads: number;
|
||||
public pageViews: number;
|
||||
|
||||
// Active tab variable for responsiveness
|
||||
public activeTab: string = "Related Research Results";
|
||||
|
||||
// Map counting variable
|
||||
public relatedResearchResultsNum: number = 0;
|
||||
|
||||
// Message variables
|
||||
public warningMessage = "";
|
||||
public errorMessage = "";
|
||||
public showLoading: boolean = true;
|
||||
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
private result ;
|
||||
sub: any; piwiksub: any; infoSub: any;
|
||||
|
||||
constructor (private element: ElementRef,
|
||||
private _datasetService: DatasetService,
|
||||
private _piwikService:PiwikService,
|
||||
private route: ActivatedRoute,
|
||||
private _meta: Meta,
|
||||
private _router: Router) {
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.datasetInfo = null;
|
||||
this.updateTitle("Dataset");
|
||||
this.updateDescription("Dataset, search, open access");
|
||||
|
||||
this.datasetId = params['datasetId'];
|
||||
console.info("Id is :"+this.datasetId);
|
||||
|
||||
if(this.datasetId){
|
||||
this.getDatasetInfo(this.datasetId);
|
||||
}else{
|
||||
this.showLoading = false;
|
||||
this.warningMessage="No valid research data id";
|
||||
}
|
||||
|
||||
this.metricsClicked = false;
|
||||
|
||||
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "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":["Monthly views"],"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.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "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":["Monthly views"],"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(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 = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "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":["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.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "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":["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';
|
||||
*/
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
if(this.infoSub) {
|
||||
this.infoSub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private getDatasetInfo(id:string) {
|
||||
this.warningMessage = '';
|
||||
this.errorMessage=""
|
||||
this.showLoading = true;
|
||||
|
||||
this.infoSub = this._datasetService.getDatasetInfo(id).subscribe(
|
||||
data => {
|
||||
this.datasetInfo = data;
|
||||
this.updateTitle(this.datasetInfo.title.name);
|
||||
this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name);
|
||||
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView(this.datasetInfo.title.name).subscribe();
|
||||
}
|
||||
|
||||
this.result = []
|
||||
this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.title.accessMode, embargoEndDate: ''};
|
||||
|
||||
let relatedResearchResultsNum = 0;
|
||||
if(this.datasetInfo.relatedResearchResults != undefined) {
|
||||
this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
|
||||
relatedResearchResultsNum += value.length;
|
||||
});
|
||||
}
|
||||
this.relatedResearchResultsNum = relatedResearchResultsNum;
|
||||
|
||||
this.showLoading = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err)
|
||||
console.info("error");
|
||||
|
||||
this.errorMessage = 'No research data found';
|
||||
this.showLoading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// showChange($event) {
|
||||
// this.showAllReferences=$event.value;
|
||||
// }
|
||||
|
||||
public metricsResults($event) {
|
||||
this.totalViews = $event.totalViews;
|
||||
this.totalDownloads = $event.totalDownloads;
|
||||
this.pageViews = $event.pageViews;
|
||||
}
|
||||
|
||||
private updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
private updateTitle(title:string){
|
||||
var _prefix ="OpenAIRE | ";
|
||||
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
private updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
|
||||
public buildCurationTooltip() {
|
||||
let tooltipContent: string = "<div class='uk-padding-small uk-light'>";
|
||||
|
||||
tooltipContent += "<h4>Record in preview</h4>";
|
||||
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>";
|
||||
|
||||
return tooltipContent;
|
||||
}
|
||||
public getKeys( map) {
|
||||
return Array.from(map.keys());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
//import {MaterialModule} from '@angular/material';
|
||||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DatasetService} from './dataset.service';
|
||||
import { DatasetComponent } from './dataset.component';
|
||||
// import { DatasetRoutingModule } from './dataset-routing.module';
|
||||
import {MetricsModule} from '../landing-utils/metrics.module';
|
||||
import {IFrameModule} from '../../utils/iframe.module';
|
||||
import {AltMetricsModule} from '../../utils/altmetrics.module';
|
||||
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
|
||||
|
||||
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
|
||||
import { LandingModule } from '../landing-utils/landing.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||
|
||||
import {MetaModule} from '../../../meta.module';
|
||||
import { ConfigurationServiceModule } from '../../utils/configuration/configurationService.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
//MaterialModule.forRoot(),
|
||||
CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CiteThisModule,
|
||||
ResultLandingModule, MetricsModule, IFrameModule, AltMetricsModule,
|
||||
MetaModule, ConfigurationServiceModule
|
||||
],
|
||||
declarations: [
|
||||
DatasetComponent
|
||||
],
|
||||
providers:[
|
||||
DatasetService, FreeGuard, IsRouteEnabled
|
||||
],
|
||||
exports: [
|
||||
DatasetComponent
|
||||
]
|
||||
})
|
||||
export class DatasetModule { }
|
|
@ -0,0 +1,195 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {DatasetInfo} from '../../utils/entities/datasetInfo';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
import 'rxjs/add/operator/share';
|
||||
|
||||
import { ParsingFunctions } from '../landing-utils/parsingFunctions.class';
|
||||
|
||||
@Injectable()
|
||||
export class DatasetService {
|
||||
|
||||
constructor(private http: Http ) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
}
|
||||
|
||||
public parsingFunctions: ParsingFunctions;
|
||||
datasetInfo: DatasetInfo;
|
||||
|
||||
getDatasetInfo (id: string):any {
|
||||
console.info("getDatasetInfo in service");
|
||||
|
||||
let url = OpenaireProperties. getSearchAPIURLLast()+'datasets/'+id+"?format=json";
|
||||
let key = url;
|
||||
|
||||
|
||||
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
||||
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result']])
|
||||
.map(res => [res[1],
|
||||
res[1]['title'],
|
||||
res[1]['rels']['rel'],
|
||||
res[1]['children'],
|
||||
res[1]['pid'],
|
||||
res[1]['subject'],
|
||||
res[1]['bestaccessright'],
|
||||
res[1]['collectedfrom'],
|
||||
res[1]['context'],
|
||||
//res[1]['resulttype'],
|
||||
res[0],
|
||||
res[1]['creator']
|
||||
]).map(res => this.parseDatasetInfo(res));
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parseDatasetInfo (data: any):any {
|
||||
this.datasetInfo = new DatasetInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||
this.datasetInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||
this.datasetInfo.dateofacceptance = data[0].dateofacceptance;
|
||||
this.datasetInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.datasetInfo.description = data[0].description;
|
||||
} else {
|
||||
this.datasetInfo.description = data[0].description[0];
|
||||
}
|
||||
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(data[0]['bestaccessright'].hasOwnProperty("classid")) {
|
||||
this.datasetInfo.title.accessMode = data[0]['bestaccessright'].classid;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
if(Array.isArray(data[1])) {
|
||||
this.datasetInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.datasetInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let relation;
|
||||
let length = data[2].length!=undefined ? data[2].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
relation = data[2].length!=undefined ? data[2][i] : data[2];
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "isProducedBy") {
|
||||
this.datasetInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.datasetInfo.fundedByProjects, relation, this.datasetInfo.projectsProvenanceVocabulary);
|
||||
} else if(relation['to'].class == "isRelatedTo") {
|
||||
let provenanceAction: string;
|
||||
if(relation.provenanceaction in this.datasetInfo.researchResultsProvenanceVocabulary) {
|
||||
provenanceAction = this.datasetInfo.researchResultsProvenanceVocabulary[relation.provenanceaction];
|
||||
} else {
|
||||
provenanceAction = "Other"
|
||||
}
|
||||
|
||||
this.datasetInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.datasetInfo.relatedResearchResults, relation, provenanceAction);
|
||||
|
||||
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
this.datasetInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.datasetInfo.similarResearchResults, relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
|
||||
"collectedName": string, "collectedId": string,
|
||||
"accessMode": string[], "bestAccessMode": string,
|
||||
"type": string, "year":string}>();
|
||||
|
||||
this.datasetInfo.types = new Array<string>();
|
||||
let types = new Set<string>();
|
||||
|
||||
let counter = 0;
|
||||
let instance;
|
||||
|
||||
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
instance = data[3]['instance'].length!=undefined ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
this.parsingFunctions.parseTypes(this.datasetInfo.types, types, instance);
|
||||
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(instance['webresource'].length == undefined) {
|
||||
url = instance['webresource'].url;
|
||||
} else{
|
||||
url = instance['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
counter = this.parsingFunctions.parseHostedBy_collectedFrom(this.datasetInfo.hostedBy_collectedFrom, instance, data[0], url, counter, this.datasetInfo.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[5]);
|
||||
this.datasetInfo.subjects = subjectResults[0];
|
||||
this.datasetInfo.otherSubjects = subjectResults[1];
|
||||
this.datasetInfo.classifiedSubjects = subjectResults[2];
|
||||
}
|
||||
|
||||
this.datasetInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
|
||||
this.datasetInfo.hostedBy_collectedFrom, this.datasetInfo.publisher,
|
||||
null, this.datasetInfo.identifiers, this.datasetInfo.title);
|
||||
|
||||
if(data[8] != null) {
|
||||
this.datasetInfo.contexts = this.parsingFunctions.parseContexts(data[8]);
|
||||
}
|
||||
|
||||
// if(data[9] != null && this.datasetInfo.type == undefined) {
|
||||
// if(data[9].hasOwnProperty('classname')) {
|
||||
// this.datasetInfo.type = data[9].classname;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data[9] != null && data[9] == "under curation") {
|
||||
this.datasetInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.datasetInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
if(data[10] != null) {
|
||||
if(this.datasetInfo.authors == undefined) {
|
||||
this.datasetInfo.authors = new Array<string>();
|
||||
}
|
||||
|
||||
let authors = data[10];
|
||||
let length = Array.isArray(authors) ? authors.length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||
this.datasetInfo.authors[author.rank-1] = author.content;
|
||||
|
||||
}
|
||||
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
|
||||
return this.datasetInfo;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue