options for more memory in package.json |Claims: add root community in the list of concepts , add fields/parsing for direct index claim, create direct index claim record | Create Guards for routes that need authentication or admin roles | scroll in browse results| login component that works with guards
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46737 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
e5ddfc8955
commit
12aa6406eb
|
@ -7,7 +7,7 @@
|
|||
"url": "https://github.com/angular/universal-starter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "webpack --watch",
|
||||
"watch": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --watch",
|
||||
"watch:dev": "npm run server & npm run watch",
|
||||
"clean:dist": "rimraf dist",
|
||||
"clean:ngc": "rimraf **/*.ngfactory.ts **/*.css.shim.ts",
|
||||
|
@ -15,13 +15,13 @@
|
|||
"build": "webpack --progress",
|
||||
"build:prod:ngc": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod",
|
||||
"build:prod:ngc:json": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod:json",
|
||||
"build:prod": "webpack --config webpack.prod.config.ts",
|
||||
"build:prod": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts",
|
||||
"build:prod:json": "webpack --config webpack.prod.config.ts --json | webpack-bundle-size-analyzer",
|
||||
"ngc": "ngc -p tsconfig.aot.json",
|
||||
"prestart": "npm run build",
|
||||
"minify": "uglifyjs dist/client/main.bundle.js --screw-ie8 --compress --mangle --output dist/client/main.bundle.min.js",
|
||||
"minify-test": "uglifyjs dist/client/main.bundle.js --output dist/client/main.xmin.js",
|
||||
"server": "nodemon dist/server/index.js",
|
||||
"server": "nodemon dist/server/index.js",
|
||||
"debug:server": "node-nightly --inspect --debug-brk dist/server/index.js",
|
||||
"start": "npm run server",
|
||||
"debug:start": "npm run build && npm run debug:server",
|
||||
|
@ -57,6 +57,7 @@
|
|||
"angular2-platform-node": "~2.1.0-rc.1",
|
||||
"angular2-universal": "~2.1.0-rc.1",
|
||||
"angular2-universal-polyfills": "~2.1.0-rc.1",
|
||||
"base64url": "^2.0.0",
|
||||
"body-parser": "^1.15.2",
|
||||
"citation-js": "^0.3.0-2",
|
||||
"clipboard": "^1.5.16",
|
||||
|
@ -65,9 +66,9 @@
|
|||
"js.clone": "0.0.3",
|
||||
"methods": "~1.1.2",
|
||||
"morgan": "^1.7.0",
|
||||
"mydatepicker": "^1.7.3",
|
||||
"preboot": "~4.5.2",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"ts-md5": "^1.2.0",
|
||||
"webfontloader": "^1.6.26",
|
||||
"zone.js": "~0.6.26"
|
||||
},
|
||||
|
|
|
@ -119,18 +119,19 @@ export function getLinkingModule() {
|
|||
return System.import('./claims/linking/linkingGeneric.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'LinkingGenericModuleNgFactory' : 'LinkingGenericModule')]);
|
||||
}
|
||||
// export function getBulkLinkingModule() {
|
||||
// return System.import('./claims/linking/bulkLinking.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
// .then(mod => mod[(process.env.AOT ? 'BulkLinkingModuleNgFactory' : 'BulkLinkingModule')]);
|
||||
// }
|
||||
|
||||
export function getDirectLinkingModule() {
|
||||
return System.import('./claims/directLinking/directLinking.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'DirectLinkingModuleNgFactory' : 'DirectLinkingModule')]);
|
||||
}
|
||||
export function getUserModule() {
|
||||
return System.import('./login/user.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'UserModuleNgFactory' : 'UserModule')]);
|
||||
}
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', redirectTo: '/search/find', pathMatch: 'full' },
|
||||
{ path: '', redirectTo: '/search/find', pathMatch: 'full'},
|
||||
{ path: 'search/publication', loadChildren: getPublicationModule },
|
||||
{ path: 'search/dataset', loadChildren: getDatasetModule },
|
||||
{ path: 'search/person', loadChildren: getPersonModule },
|
||||
|
@ -141,25 +142,14 @@ export function getDirectLinkingModule() {
|
|||
{ path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule },
|
||||
{ path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule },
|
||||
{ path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule },
|
||||
{ path: 'search/find', loadChildren: getMainSearchModule , data: {
|
||||
meta: {
|
||||
title: 'Home page',
|
||||
description: 'Description of the home page'
|
||||
}
|
||||
}},
|
||||
{ path: 'search/find', loadChildren: getMainSearchModule },
|
||||
{ path: 'search/find/publications', loadChildren: getSearchPublicationsModule },
|
||||
{ path: 'search/find/datasets', loadChildren: getSearchDatasetsModule },
|
||||
{ path: 'search/find/projects', loadChildren: getSearchProjectsModule },
|
||||
{ path: 'search/find/dataproviders', loadChildren: getSearchDataProvidersModule },
|
||||
{ path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule },
|
||||
{ path: 'search/find/people', loadChildren: getSearchPeopleModule },
|
||||
{ path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule,
|
||||
data: {
|
||||
meta: {
|
||||
title: 'Home page',
|
||||
description: 'Description of the home page'
|
||||
}
|
||||
}},
|
||||
{ path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule },
|
||||
{ path: 'search/entity-registries', loadChildren: getEntityRegistriesModule },
|
||||
{ path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule },
|
||||
{ path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule },
|
||||
|
@ -170,9 +160,10 @@ export function getDirectLinkingModule() {
|
|||
{ path: 'project-report', loadChildren: gethtmlProjectReportModule },
|
||||
{ path: 'myclaims', loadChildren: getMyClaimsModule },
|
||||
{ path: 'claims', loadChildren: getClaimsAdminModule },
|
||||
// { path: 'participate/bulk-claim', loadChildren: getBulkLinkingModule },
|
||||
{ path: 'participate/claim', loadChildren: getLinkingModule },
|
||||
{ path: 'participate/direct-claim', loadChildren: getDirectLinkingModule },
|
||||
{ path: 'user-info', loadChildren: getUserModule },
|
||||
|
||||
])
|
||||
],
|
||||
})
|
||||
|
|
|
@ -6,7 +6,6 @@ import { SharedModule } from './shared/shared.module';
|
|||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent, XLargeDirective } from './app.component';
|
||||
|
||||
import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar
|
||||
import { ErrorModule } from './error/error.module';
|
||||
import { CacheService } from './shared/cache.service';
|
||||
|
@ -20,8 +19,11 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module
|
|||
SharedComponentsModule,
|
||||
AppRoutingModule,
|
||||
ErrorModule,
|
||||
CookieLawModule
|
||||
], exports:[], providers:[CacheService]
|
||||
CookieLawModule,
|
||||
|
||||
], exports:[],
|
||||
providers:[CacheService]
|
||||
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// import { NgModule } from '@angular/core';
|
||||
// import { RouterModule } from '@angular/router';
|
||||
//
|
||||
// import {ClaimsAdminComponent} from './claims/claimsAdmin.component';
|
||||
// import {ClaimComponent} from './claim/claim.component';
|
||||
// import {MyClaimsComponent} from './myClaims/myClaims.component';
|
||||
// import { LinkingComponent } from './linking/linking.component';
|
||||
// import { BulkLinkingComponent } from './linking/bulkLinking.component';
|
||||
//
|
||||
// @NgModule({
|
||||
// imports: [
|
||||
// RouterModule.forChild([
|
||||
// { path: 'claims', component: ClaimsAdminComponent },
|
||||
// { path: 'myclaims', component: MyClaimsComponent },
|
||||
// { path: 'claim', component: ClaimComponent },
|
||||
// { path: 'linking', component: LinkingComponent },
|
||||
// { path: 'bulk-linking', component: BulkLinkingComponent},
|
||||
//
|
||||
// ])
|
||||
// ]
|
||||
// })
|
||||
// export class ClaimRoutingModule { }
|
|
@ -20,7 +20,7 @@ declare var UIkit:any;
|
|||
<option *ngIf="communities" (click)="communityChanged(communities.id, communities.label)" [value]="communities.id" >{{communities.label}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td *ngIf="selectedCommunityId != 0 && categories.length > 0"><select class="custom-select-mini" name="select_funder" >
|
||||
<td *ngIf="selectedCommunityId != '0' && categories.length > 0"><select class="custom-select-mini" name="select_funder" >
|
||||
<option value="0" (click)="categoryChanged('0','Category:')">Select Category:</option>
|
||||
<option *ngFor="let category of categories" (click)="categoryChanged(category.id, category.label)" [value]="category.id" >{{category.label}}</option>
|
||||
</select>
|
||||
|
@ -29,7 +29,7 @@ declare var UIkit:any;
|
|||
</td></tr>
|
||||
|
||||
</table>
|
||||
<div *ngIf="loading" class="uk-alert uk-alert-info" role="alert">Loading...</div>
|
||||
<div *ngIf="loading" class="uk-alert uk-alert-info" role="alert">Loading communities information...</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-info" role="alert">{{infoMessage}}</div>
|
||||
</div>
|
||||
|
@ -123,6 +123,7 @@ getCommunities () {
|
|||
data => {
|
||||
this.categories = data.category;
|
||||
this.concepts = [];
|
||||
this.addCommunityInConcepts();
|
||||
this.filteredList = [];
|
||||
if (this.query !== ""){
|
||||
var event = {value: ""};
|
||||
|
@ -140,10 +141,12 @@ getCommunities () {
|
|||
getConcepts () {
|
||||
this.loading = true;
|
||||
if(this.selectedCategoryId != '0'){
|
||||
this.concepts = [];
|
||||
this.addCommunityInConcepts();
|
||||
this._contextService.getConcepts(this.selectedCategoryId, "").subscribe(
|
||||
data => {
|
||||
this.concepts = data;
|
||||
this.autocomplete.updateList(this.concepts);
|
||||
this.addCommunityInConcepts();
|
||||
if (this.query !== ""){
|
||||
var event = {value: ""};
|
||||
event.value = this.query;
|
||||
|
@ -167,8 +170,6 @@ getCommunities () {
|
|||
this.warningMessage = "";
|
||||
this.infoMessage = "";
|
||||
if(this.selectedCommunityId != communityId){
|
||||
console.log( " here");
|
||||
|
||||
this.selectedCommunityId = communityId;
|
||||
this.selectedCommunityLabel = communityLabel;
|
||||
this.getCategories();
|
||||
|
@ -185,5 +186,9 @@ getCommunities () {
|
|||
}
|
||||
|
||||
}
|
||||
addCommunityInConcepts(){
|
||||
this.concepts.push({"id":this.selectedCommunityId, "label":this.selectedCommunityLabel});
|
||||
this.autocomplete.updateList(this.concepts);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ export class ClaimResult{
|
|||
public accessRights: string = "OPEN";
|
||||
public embargoEndDate: string;
|
||||
public date: string;
|
||||
|
||||
public authors: string[] =[];
|
||||
public publisher: string;
|
||||
public description: string;
|
||||
public resourceType:string;
|
||||
}
|
||||
export class ClaimProject{
|
||||
public funderId: string;
|
||||
|
@ -19,6 +22,10 @@ export class ClaimProject{
|
|||
public projectAcronym: string;
|
||||
public startDate: string;
|
||||
public endDate: string;
|
||||
public code: string;
|
||||
public jurisdiction: string;
|
||||
public fundingLevel0: string;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,5 +33,5 @@ export class ClaimContext{
|
|||
public community: string;
|
||||
public category: string;
|
||||
public concept:any;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,18 @@ select(item){
|
|||
this.query = "";
|
||||
// this.searchTermStream.next(this.query); //clear
|
||||
item = item.value;
|
||||
var project: ClaimProject = { funderId: (this.selectedFunderId=="0")?item.funderId:this.selectedFunderId,funderName: (this.selectedFunderId=="0")?item.funderName:this.selectedFunderName, projectId: item.id, projectName: item.projectName , projectAcronym: item.projectAcronym, startDate: item.startDate, endDate: item.endDate };
|
||||
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);
|
||||
|
||||
|
||||
|
|
|
@ -40,11 +40,11 @@ export class ClaimResultSearchFormComponent {
|
|||
// searchType ="publication";
|
||||
@Input() public select:boolean = true ;
|
||||
@Input() public keyword:string = '';
|
||||
@Input() public selectedResults = [] ;
|
||||
@Input() public selectedResults:ClaimResult[];
|
||||
// @Output() datasetsChange = new EventEmitter();
|
||||
// @Output() publicationsChange = new EventEmitter();
|
||||
|
||||
@Output() resultsChange = new EventEmitter();
|
||||
// @Output() resultsChange = new EventEmitter();
|
||||
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
|
@ -500,34 +500,75 @@ openaireDataPageChange($event) {
|
|||
|
||||
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
||||
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
|
||||
var result: ClaimResult ;
|
||||
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.embargoEndDate = this.nextDate;
|
||||
result.date = date;
|
||||
result.result = item;
|
||||
if(item.publisher){
|
||||
result.publisher = item.publisher;
|
||||
}
|
||||
|
||||
if(itemSource == 'datacite'){
|
||||
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
|
||||
if(item.creator){
|
||||
result.authors =[]
|
||||
for(var i=0; i< item.creator.length; i++){
|
||||
result.authors.push(item.creator[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = {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 = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
||||
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 = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
||||
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]);
|
||||
}
|
||||
}
|
||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
||||
}
|
||||
var found:boolean = this.isSelected( result.id);
|
||||
|
||||
this.warningMessage = "";
|
||||
if (!found) {
|
||||
this.selectedResults.push(result);
|
||||
this.resultsChange.emit({
|
||||
value: this.selectedResults
|
||||
});
|
||||
// this.resultsChange.emit({
|
||||
// value: this.selectedResults
|
||||
// });
|
||||
}else{
|
||||
this.warningMessage = "Dataset already in selected list";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Pag
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
|
||||
|
||||
import { ClaimsAdminComponent } from './claimsAdmin.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: ClaimsAdminComponent},
|
||||
{ path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard]},
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -5,6 +5,7 @@ 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';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -14,6 +15,7 @@ import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.mo
|
|||
DisplayClaimsModule
|
||||
|
||||
],
|
||||
providers:[AdminLoginGuard],
|
||||
declarations: [
|
||||
ClaimsAdminComponent
|
||||
]
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { DirectLinkingComponent } from './directLinking.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DirectLinkingComponent},
|
||||
{ path: '', component: DirectLinkingComponent, canActivate: [LoginGuard]},
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -142,7 +142,18 @@ export class DirectLinkingComponent {
|
|||
data => {
|
||||
console.log(data);
|
||||
var item =data[0];
|
||||
var project: ClaimProject = { funderId: item.funderId,funderName: item.funderName, projectId: id, projectName: item.projectName , projectAcronym: item.projectAcronym, startDate: item.startDate, endDate: item.endDate };
|
||||
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);
|
||||
|
||||
|
@ -157,7 +168,15 @@ export class DirectLinkingComponent {
|
|||
this.sub = this.publicationsSearch.searchPublicationById(id).subscribe(
|
||||
data => {
|
||||
var item =data[0];
|
||||
var result: ClaimResult = {id: id, type :"publication", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
|
||||
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;
|
||||
|
@ -175,8 +194,15 @@ export class DirectLinkingComponent {
|
|||
this.sub = this.datasetsSearch.searchDatasetById(id).subscribe(
|
||||
data => {
|
||||
var item =data[0];
|
||||
var result: ClaimResult = {id: id, type : "dataset", source : "openaire", title: item['title'].name, url: item['title'].url, result: item, accessRights:item['title'].accessMode, embargoEndDate: null, date: item.year};
|
||||
this.displayedResult = result;
|
||||
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{
|
||||
|
|
|
@ -13,6 +13,7 @@ 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 {LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
|
||||
|
||||
|
@ -24,6 +25,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
|||
|
||||
|
||||
],
|
||||
providers:[LoginGuard],
|
||||
declarations: [
|
||||
DirectLinkingComponent
|
||||
], exports:[DirectLinkingComponent]
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// import { NgModule } from '@angular/core';
|
||||
// import { RouterModule } from '@angular/router';
|
||||
//
|
||||
// import { BulkLinkingComponent } from './bulkLinking.component';
|
||||
//
|
||||
// @NgModule({
|
||||
// imports: [
|
||||
// RouterModule.forChild([
|
||||
// { path: '', component: BulkLinkingComponent},
|
||||
//
|
||||
// ])
|
||||
// ]
|
||||
// })
|
||||
// export class BulkLinkingRoutingModule { }
|
|
@ -4,7 +4,7 @@ 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';
|
||||
|
||||
@Component({
|
||||
selector: 'claim-insert',
|
||||
|
@ -63,12 +63,15 @@ private insert(){
|
|||
var user="argirok@di.uoa.gr"
|
||||
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(["crosreff","datacite","orcid"].indexOf(result.source) != -1){
|
||||
directclaims.push(this.createDirectClaim(result,this.projects,this.contexts));
|
||||
}
|
||||
if(this.contexts){
|
||||
for (var j = 0; j < this.contexts.length; j++) {
|
||||
var context = this.contexts[j];
|
||||
|
@ -202,26 +205,61 @@ private errorsInClaimsInsertion(insertedIds, errorInClaims){
|
|||
}
|
||||
createDirectClaim(result, projects, contexts){
|
||||
var entity = {};
|
||||
entity["originalId"]="";
|
||||
entity["title"]="";
|
||||
entity["authors"]=[];
|
||||
entity["publisher"]="";
|
||||
entity["description"]="";
|
||||
entity["language"]="";
|
||||
var md5_id = Md5.hashStr(result.id);
|
||||
entity["originalId"]="user:claim__"+md5_id;
|
||||
entity["title"]=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;
|
||||
entity["pids"]= [];//{type:string, value:string}[];
|
||||
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;
|
||||
}
|
||||
entity["resourceType"]="";
|
||||
entity["url"]="";
|
||||
entity["collectedFromId"]="";
|
||||
entity["linksToProjects"]=[];
|
||||
entity["contexts"]=[];
|
||||
for(var i =0; i < contexts.length; i++){
|
||||
entity["contexts"].push(contexts[i].concept.id);
|
||||
if(result.type =="publication"){
|
||||
entity["resourceType"]="0001";
|
||||
}else{
|
||||
entity["resourceType"]="0021";
|
||||
}
|
||||
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 json;
|
||||
|
||||
/*
|
||||
{
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { LinkingGenericComponent } from './linkingGeneric.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: LinkingGenericComponent},
|
||||
{ path: '', component: LinkingGenericComponent, canActivate: [LoginGuard]},
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -11,14 +11,16 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
|
|||
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';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, SelectedProjectsModule, SelectedContextsModule,
|
||||
SelectedPublicationsModule,
|
||||
InsertClaimsModule,
|
||||
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule
|
||||
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
|
||||
],
|
||||
providers:[LoginGuard],
|
||||
declarations: [
|
||||
LinkingGenericComponent
|
||||
], exports:[
|
||||
|
|
|
@ -13,7 +13,7 @@ import {ClaimContext} from '../../claim-utils/claimEntities.class';
|
|||
<claim-contexts-search-form *ngIf=" showsearch " [selectedList]="contexts" (contextSelected)="contextSelected($event)" > </claim-contexts-search-form>
|
||||
<ul class="uk-list uk-list-line">
|
||||
<li class="list-group-item" *ngFor="let context of contexts" >
|
||||
<span >{{context.community }} > {{context.category}} > {{context.concept.label}} </span>
|
||||
<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-button "><i class="uk-icon-remove"></i></span>
|
||||
|
||||
</li>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
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 'mydatepicker';
|
||||
// import {IMyOptions} from '../../../utils/my-date-picker/interfaces/my-options.interface';
|
||||
// import {IMyDateModel} from '../../../utils/my-date-picker/interfaces/my-date-model.interface';
|
||||
import {IMyOptions, IMyDateModel} from '../../../utils/my-date-picker/interfaces/index';
|
||||
import {Dates} from '../../../utils/string-utils.class';
|
||||
|
||||
@Component({
|
||||
|
@ -17,8 +19,8 @@ import {Dates} from '../../../utils/string-utils.class';
|
|||
<div class="uk-clearfix"><button (click)="bulkMode = !bulkMode;" class="uk-button uk-animation uk-float-right">
|
||||
<span *ngIf="!bulkMode">Bulk mode <i class="uk-icon-upload"></i></span>
|
||||
<span *ngIf="bulkMode">Search mode <i class="uk-icon-search"></i></span>
|
||||
</button></div>
|
||||
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" (resultsChange)="resultsChanged($event)" > </claim-result-search-form>
|
||||
</button></div><!-- (resultsChange)="resultsChanged($event)" -->
|
||||
<claim-result-search-form *ngIf="!bulkMode" [selectedResults]="results" > </claim-result-search-form>
|
||||
<bulk-claim *ngIf="bulkMode" [publications]="results" > </bulk-claim>
|
||||
</div>
|
||||
<div [ngClass]="showAccessRights && !showSearch?'uk-width-1-1':'uk-width-1-2'">
|
||||
|
@ -101,7 +103,7 @@ export class ClaimSelectedResultsComponent {
|
|||
@Input() title:string = "Research Results";
|
||||
@Input() showAccessRights:boolean = false;
|
||||
@Input() bulkMode:boolean = false;
|
||||
@Output()resultsChange = new EventEmitter();
|
||||
// @Output()resultsChange = new EventEmitter();
|
||||
@Input() showSearch:boolean = false;
|
||||
nextDate = {};
|
||||
@ViewChild(AlertModal) alertApplyAll;
|
||||
|
@ -125,9 +127,9 @@ private myDatePickerOptions: IMyOptions = {
|
|||
if (index > -1) {
|
||||
this.results.splice(index, 1);
|
||||
}
|
||||
this.resultsChange.emit({
|
||||
value: this.results
|
||||
});
|
||||
// this.resultsChange.emit({
|
||||
// value: this.results
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,12 +142,12 @@ private myDatePickerOptions: IMyOptions = {
|
|||
}
|
||||
|
||||
}
|
||||
resultsChanged($event) {
|
||||
this.results=$event.value;
|
||||
this.resultsChange.emit({
|
||||
value: this.results
|
||||
});
|
||||
}
|
||||
// resultsChanged($event) {
|
||||
// this.results=$event.value;
|
||||
// this.resultsChange.emit({
|
||||
// value: this.results
|
||||
// });
|
||||
// }
|
||||
/* The following methods:
|
||||
*typeChanged
|
||||
*confirmOpen
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { LoginGuard} from'../../login/loginGuard.guard';
|
||||
|
||||
import { MyClaimsComponent } from './myClaims.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: MyClaimsComponent},
|
||||
{ path: '', component: MyClaimsComponent, canActivate: [LoginGuard]},
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -5,6 +5,7 @@ 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';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -14,6 +15,7 @@ import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.mo
|
|||
DisplayClaimsModule
|
||||
|
||||
],
|
||||
providers:[LoginGuard],
|
||||
declarations: [
|
||||
MyClaimsComponent
|
||||
]
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class AdminLoginGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
console.log("AAA inside the AdminLoginGuard!")
|
||||
var user;
|
||||
var loggedIn = false;
|
||||
var isAdmin = false;
|
||||
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
loggedIn = true;
|
||||
user = JSON.parse(localStorage.getItem("user"));
|
||||
if(user.role == 2){
|
||||
isAdmin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!loggedIn){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl": state.url } });
|
||||
|
||||
return false;
|
||||
}else if(!isAdmin){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 2, "redirectUrl": state.url } });
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import {PersonInfo} from '../utils/entities/personInfo';
|
|||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||
import {User} from '../utils/entities/user';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class LoginService {
|
||||
|
||||
|
@ -37,15 +38,27 @@ export class LoginService {
|
|||
});
|
||||
|
||||
}
|
||||
private validateJWTFormat(data){
|
||||
|
||||
if(data == null || (data.indexOf(".") !=-1 && data.split('.').length != 3)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private getPayload(data){
|
||||
var payload = data.split('.')[1];
|
||||
return atob(payload);
|
||||
}
|
||||
private parseUserInfo(data: any/*, user: User*/): User {
|
||||
if(this.validateJWTFormat(data)){
|
||||
var info = JSON.parse(this.getPayload(data));
|
||||
}
|
||||
var user: User = new User();
|
||||
|
||||
user.username = data.username;
|
||||
user.email = data.email;
|
||||
user.id = data.id;
|
||||
user.fullname = data.fullname;
|
||||
|
||||
user.username = info.sub;
|
||||
user.email = info.email;
|
||||
user.id = info.userId;
|
||||
user.fullname = info.fullname;
|
||||
localStorage.setItem("user", JSON.stringify(user));
|
||||
|
||||
return user;
|
|
@ -0,0 +1,27 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class LoginGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
console.log("AAA inside the LoginGuard!")
|
||||
var user;
|
||||
var loggedIn = false;
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
user = JSON.parse(localStorage.getItem("user"));
|
||||
loggedIn = true;
|
||||
}
|
||||
}
|
||||
if(!loggedIn){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl": state.url } });
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { UserComponent } from './user.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: UserComponent},
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class UserRoutingModule { }
|
|
@ -0,0 +1,136 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
import {LoginService} from './login.service';
|
||||
import {User} from '../utils/entities/user';
|
||||
|
||||
@Component({
|
||||
selector: 'user',
|
||||
template: `
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
||||
The requested page requires authentication. Please login.
|
||||
</div>
|
||||
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
||||
You are not authorized to use the requested page
|
||||
</div>
|
||||
<form *ngIf="!loggedIn" class="uk-form uk-flex ">
|
||||
<fieldset>
|
||||
<legend>Login Form</legend>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Text input" type="text" name="username" [(ngModel)]="username">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Password input" type="password" name="password" [(ngModel)]="password">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<button (click)="login()" class="uk-button">Login</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
||||
|
||||
<div *ngIf="loggedIn">
|
||||
<div class="uk-alert uk-alert-success">
|
||||
Hello {{user.fullname}}!
|
||||
</div>
|
||||
<button (click)="logout()" class="uk-button">Log out</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class UserComponent {
|
||||
public user: User;
|
||||
public loggedIn: boolean = false;
|
||||
public errorMessage: string;
|
||||
public username: string = "";
|
||||
public password: string = "";
|
||||
private sub:any;private sublogin:any;
|
||||
public errorCode: string = "";
|
||||
public redirectUrl: string = "";
|
||||
|
||||
constructor( private router: Router, private _loginService: LoginService, private route: ActivatedRoute ) {}
|
||||
|
||||
ngOnInit() {
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.errorMessage = "";
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.errorCode = params["errorCode"];
|
||||
this.redirectUrl = params["redirectUrl"];
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.errorMessage = "";
|
||||
});
|
||||
}
|
||||
ngOnDestroy(){
|
||||
this.sub.unsubscribe();
|
||||
if(this.sublogin){
|
||||
this.sublogin.unsubscribe();
|
||||
}
|
||||
}
|
||||
logout(){
|
||||
localStorage.removeItem("user");
|
||||
this.loggedIn = false;
|
||||
this.user = new User();
|
||||
this.username = "";
|
||||
this.password = "";
|
||||
|
||||
this.redirect();
|
||||
|
||||
}
|
||||
redirect(){
|
||||
if(this.redirectUrl && this.redirectUrl != null && this.redirectUrl != ""){
|
||||
this.router.navigate([this.redirectUrl]);
|
||||
}else{
|
||||
this.router.navigate(['/user-info']);
|
||||
}
|
||||
}
|
||||
login() {
|
||||
this.sublogin =this._loginService.authenticate(/*this.user*/this.username, this.password).subscribe(
|
||||
data => {
|
||||
this.user = data;
|
||||
this.loggedIn = true;
|
||||
this.username = "";
|
||||
this.password = "";
|
||||
this.errorCode = "";
|
||||
this.redirect();
|
||||
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
if(err.status == "404") {
|
||||
this.errorMessage = "Wrong username";
|
||||
} else if(err.status == "401") {
|
||||
this.errorMessage = "Wrong password";
|
||||
}
|
||||
this.username = "";
|
||||
this.password = "";
|
||||
this.errorCode = "";
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {UserComponent } from './user.component';
|
||||
import { UserRoutingModule } from './user-routing.module';
|
||||
import {LoginService} from './login.service';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
UserRoutingModule
|
||||
|
||||
],
|
||||
providers:[LoginService],
|
||||
declarations: [
|
||||
UserComponent
|
||||
|
||||
]
|
||||
})
|
||||
export class UserModule { }
|
|
@ -0,0 +1,59 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
import {LoginService} from './login.service';
|
||||
import {User} from '../utils/entities/user';
|
||||
|
||||
@Component({
|
||||
selector: 'user-mini',
|
||||
template: `
|
||||
|
||||
<div class="uk-margin-top uk-margin-right uk-float-right">
|
||||
<span *ngIf="loggedIn" >Hello {{user.fullname}}!</span>
|
||||
<a routerLinkActive="router-link-active" routerLink="/user-info" [queryParams]="{redirectUrl: redirectUrl}" ><span *ngIf="loggedIn">Log out</span><span *ngIf="!loggedIn">Log in</span></a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class UserMiniComponent {
|
||||
public user: User;
|
||||
public loggedIn: boolean = false;
|
||||
|
||||
public redirectUrl: string = "";
|
||||
sub:any;
|
||||
constructor( private router: Router, private route: ActivatedRoute, private location: Location) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.initialize();
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
|
||||
this.initialize();
|
||||
});
|
||||
}
|
||||
ngOnDestroy(){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
initialize(){
|
||||
this.redirectUrl = this.location.path();
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
|||
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
|
||||
<div class ="uk-grid">
|
||||
<div *ngFor= "let filter of filters" class = "uk-margin-top uk-width-large-1-5 uk-width-medium-1-4 uk-width-small-1-2">
|
||||
<div *ngFor= "let filter of filters" class = "uk-margin-top uk-width-large-1-4 uk-width-medium-1-3 uk-width-small-1-2">
|
||||
<browse-statistic [baseUrl]=baseUrl [filter]=filter ></browse-statistic>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,8 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
|
|||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
import { Filter, Value, DateValue} from './searchHelperClasses.class';
|
||||
import {IMyOptions, IMyDateModel} from 'mydatepicker';
|
||||
import {IMyOptions, IMyDateModel} from '../../utils/my-date-picker/interfaces/index';
|
||||
// import {IMyDateModel} from '../../../utils/my-date-picker/interfaces/my-date-model.interface';
|
||||
import {Dates} from '../../utils/string-utils.class';
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -113,18 +113,20 @@ export class CookieLawComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.animation = this.position === 'bottom' ? 'bottomIn' : 'topIn';
|
||||
if (typeof document !== 'undefined') {
|
||||
this.animation = this.position === 'bottom' ? 'bottomIn' : 'topIn';
|
||||
|
||||
this.closeSvg = '<i class="uk-icon-close"></i>' ;
|
||||
this.closeSvg = '<i class="uk-icon-close"></i>' ;
|
||||
|
||||
if (this.cookieLawSeen) {
|
||||
this.isSeen = true;
|
||||
if (this.cookieLawSeen) {
|
||||
this.isSeen = true;
|
||||
}
|
||||
|
||||
this.currentStyles = {
|
||||
'top': this.position === 'top' ? '0' : null,
|
||||
'bottom': this.position === 'top' ? 'initial' : null,
|
||||
};
|
||||
}
|
||||
|
||||
this.currentStyles = {
|
||||
'top': this.position === 'top' ? '0' : null,
|
||||
'bottom': this.position === 'top' ? 'initial' : null,
|
||||
};
|
||||
}
|
||||
|
||||
afterDismissAnimation(evt: AnimationTransitionEvent) {
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {LoginService} from '../services/login.service';
|
||||
import {User} from '../utils/entities/user';
|
||||
|
||||
@Component({
|
||||
selector: 'login',
|
||||
template: `
|
||||
|
||||
|
||||
<!--form *ngIf="!loggedIn" class="uk-form uk-width-medium-1-3"-->
|
||||
<form *ngIf="!loggedIn" class="uk-form uk-flex uk-flex-center">
|
||||
<fieldset>
|
||||
<legend>Login Form</legend>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Text input" type="text" name="username" [(ngModel)]="username">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Password input" type="password" name="password" [(ngModel)]="password">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<button (click)="login()" class="uk-button">Login</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>
|
||||
|
||||
<div *ngIf="loggedIn" class="uk-alert uk-alert-success">
|
||||
Hello {{user.fullname}}!
|
||||
</div>
|
||||
|
||||
<!--div class="container-fluid">
|
||||
<div *ngIf="!loggedIn">
|
||||
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">
|
||||
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
||||
{{errorMessage}}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-group">
|
||||
<label>Username:</label>
|
||||
<input [(ngModel)]="user.username" type="username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-group">
|
||||
<label for="password">Password:</label>
|
||||
<input [(ngModel)]="user.password" type="password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn" (click)="login()"
|
||||
type="submit">Login
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="loggedIn">
|
||||
Hello {{user.fullname}}!
|
||||
</div>
|
||||
</div-->
|
||||
`
|
||||
})
|
||||
|
||||
export class LoginComponent {
|
||||
private user: User;
|
||||
private loggedIn: boolean;
|
||||
private errorMessage: string;
|
||||
private username: string = "";
|
||||
private password: string = "";
|
||||
|
||||
constructor( private _loginService: LoginService ) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.loggedIn = false;
|
||||
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
this.loggedIn = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*if(this.loggedIn == undefined) {
|
||||
this.user = new User();
|
||||
this.loggedIn = false;
|
||||
}*/
|
||||
this.errorMessage = "";
|
||||
}
|
||||
|
||||
login() {
|
||||
this._loginService.authenticate(/*this.user*/this.username, this.password).subscribe(
|
||||
data => {
|
||||
this.user = data;
|
||||
this.loggedIn = true;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
if(err.status == "404") {
|
||||
this.errorMessage = "Wrong username";
|
||||
} else if(err.status == "401") {
|
||||
this.errorMessage = "Wrong password";
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -74,21 +74,20 @@ import 'rxjs/Rx';
|
|||
</div>
|
||||
|
||||
</li>
|
||||
<!--li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
|
||||
<li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
|
||||
<a routerLinkActive="router-link-active" routerLink="/participate/claim" >Linking</a>
|
||||
|
||||
<div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom" aria-hidden="true" style="top: 40px; left: 0px;" tabindex="">
|
||||
<ul class="uk-nav uk-nav-navbar">
|
||||
<li><a routerLinkActive="router-link-active" routerLink="/participate/claim">Linking</a></li>
|
||||
<li><a routerLinkActive="router-link-active" routerLink="/bulk-linking">Bulk Linking</a></li>
|
||||
<li><a routerLinkActive="router-link-active" routerLink="/claims">Claims Admin</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</li-->
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<user-mini></user-mini>
|
||||
<a href="#offcanvas-mainmenu" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas="{mode:'slide'}"></a>
|
||||
<div class="uk-navbar-brand uk-navbar-center uk-visible-small"><img src="assets/newlogo.png" class="uk-responsive-height" title="OpenAIRE" alt="OpenAIRE" ></div>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { RouterModule } from "@angular/router";
|
|||
|
||||
import {NavigationBarComponent} from './navigationBar.component';
|
||||
import {BottomComponent} from './bottom.component';
|
||||
import {LoginComponent} from './login.component';
|
||||
import {UserMiniComponent} from '../login/userMini.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
@ -16,13 +16,11 @@ import {LoginComponent} from './login.component';
|
|||
],
|
||||
declarations: [
|
||||
NavigationBarComponent,
|
||||
BottomComponent,
|
||||
LoginComponent
|
||||
BottomComponent,UserMiniComponent
|
||||
],
|
||||
exports: [
|
||||
NavigationBarComponent,
|
||||
BottomComponent,
|
||||
LoginComponent
|
||||
BottomComponent,UserMiniComponent
|
||||
]
|
||||
})
|
||||
export class SharedComponentsModule{ }
|
||||
|
|
|
@ -60,10 +60,9 @@ export class EntitiesAutocompleteComponent {
|
|||
@Input() public keyword = '';
|
||||
@Input() public fieldId:string ;
|
||||
public currentFieldId: string ;
|
||||
|
||||
public currentFunderId: string ;
|
||||
public warningMessage = "";
|
||||
public infoMessage = "";
|
||||
|
||||
public tries = 0;
|
||||
public showInput = true;
|
||||
public sub;
|
||||
|
@ -80,6 +79,7 @@ export class EntitiesAutocompleteComponent {
|
|||
public focus:boolean = false;
|
||||
constructor (public _search:EntitiesSearchService, private myElement: ElementRef) {
|
||||
this.currentFieldId=this.fieldId;
|
||||
this.currentFunderId=this.funderId;
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,9 @@ export class EntitiesAutocompleteComponent {
|
|||
if(this.currentFieldId!=this.fieldId){ //this is going to be called when
|
||||
this.currentFieldId=this.fieldId;
|
||||
this.initialize();
|
||||
}else if(this.currentFunderId!=this.funderId){
|
||||
this.currentFunderId=this.funderId;
|
||||
this.initialize();
|
||||
}
|
||||
}
|
||||
private initialize(){
|
||||
|
|
|
@ -188,8 +188,31 @@ private fetch (link,id,oafEntityType,type){
|
|||
value.projectName = value.label;
|
||||
value.endDate = null;
|
||||
value.startDate = null;
|
||||
value.funderId = (resData['fundingtree'] && resData['fundingtree']['funder'] && resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:"";
|
||||
value.funderName = (resData['fundingtree'] && resData['fundingtree']['funder'] && resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:"";
|
||||
value.funderId = "";
|
||||
value.funderName = "";
|
||||
value.jurisdiction = "";
|
||||
value.fundingLevel0 = "";
|
||||
value.code = resData['code'];
|
||||
|
||||
if(resData['fundingtree'] && resData['fundingtree']['funder']){
|
||||
value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:"";
|
||||
value.funderName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:"";
|
||||
value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:"";
|
||||
if(resData['fundingtree']['funding_level_2']){
|
||||
value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] &&
|
||||
resData['fundingtree']['funding_level_2']['parent']['funding_level_1'] && resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']
|
||||
&& resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])?
|
||||
resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:"";
|
||||
}else if(resData['fundingtree']['funding_level_1']){
|
||||
value.fundingLevel0 = (resData['fundingtree']['funding_level_1'] && resData['fundingtree']['funding_level_1']['parent'] && resData['fundingtree']['funding_level_1']['parent']['funding_level_0'])?
|
||||
resData['fundingtree']['funding_level_1']['parent']['funding_level_0']['name']:"";
|
||||
}else if(resData['fundingtree']['funding_level_0']){
|
||||
value.fundingLevel0 = (resData['fundingtree']['funding_level_0'] )?resData['fundingtree']['funding_level_0']['name']:"";
|
||||
}else {
|
||||
value.fundingLevel0="";
|
||||
}
|
||||
}
|
||||
|
||||
if(resData.hasOwnProperty("startdate")) {
|
||||
value.startDate = resData.startdate.split('-')[0];
|
||||
}
|
||||
|
@ -198,7 +221,7 @@ private fetch (link,id,oafEntityType,type){
|
|||
}
|
||||
|
||||
}
|
||||
console.info("add:"+value.label+" "+value.id);
|
||||
// console.info("add:"+value.label+" "+value.id);
|
||||
|
||||
array.push(value);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import { UtilService } from "./services/my-date-picker.util.service";
|
|||
|
||||
// webpack1_
|
||||
declare var require: any;
|
||||
const myDpStyles: string = require("./my-date-picker.component.css");
|
||||
const myDpTpl: string = require("./my-date-picker.component.html");
|
||||
// declare var myDpStyles: string = require("./my-date-picker.component.css");
|
||||
// declare var myDpTpl: string = require("./my-date-picker.component.html");
|
||||
// webpack2_
|
||||
|
||||
export const MYDP_VALUE_ACCESSOR: any = {
|
||||
|
@ -18,8 +18,8 @@ export const MYDP_VALUE_ACCESSOR: any = {
|
|||
|
||||
@Component({
|
||||
selector: "my-date-picker",
|
||||
styles: [myDpStyles],
|
||||
template: myDpTpl,
|
||||
styleUrls: ['my-date-picker.component.css'],
|
||||
templateUrl: 'my-date-picker.component.html',
|
||||
providers: [LocaleService, UtilService, MYDP_VALUE_ACCESSOR],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
|
|
@ -53,7 +53,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
|
|||
{ provide: 'res', useFactory: getResponse },
|
||||
{ provide: 'LRU', useFactory: getLRU, deps: [] },
|
||||
CacheService,
|
||||
Meta,
|
||||
Meta
|
||||
|
||||
// { provide: AUTO_PREBOOT, useValue: false } // turn off auto preboot complete
|
||||
]
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<!-- tabs/switcher -->
|
||||
<script src="assets/uikit-2.27.2/js/core/tab.min.js" type="text/javascript"></script>
|
||||
<script src="assets/uikit-2.27.2/js/core/switcher.min.js" type="text/javascript"></script>
|
||||
<!-- toggle -->
|
||||
<!-- toggle -->
|
||||
<script src="assets/uikit-2.27.2/js/core/toggle.min.js" type="text/javascript"></script>
|
||||
<!-- Progress Bar -->
|
||||
<link href="assets/uikit-2.27.2/css/components/progress.almost-flat.min.css" rel="stylesheet" type="text/css" />
|
||||
|
@ -93,10 +93,10 @@
|
|||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-autocomplete .uk-nav-navbar > li > a {
|
||||
color: #444;
|
||||
}
|
||||
.custom-description-list-horizontal{ line-height:200%}
|
||||
.custom-autocomplete .uk-nav-navbar > li > a {
|
||||
color: #444;
|
||||
}
|
||||
.custom-description-list-horizontal{ line-height:200%}
|
||||
.uk-alert-default {
|
||||
background: #fff none repeat scroll 0 0;
|
||||
border: 1px solid #ddd;
|
||||
|
@ -177,6 +177,11 @@
|
|||
.filterItem span div {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.browseFilters{
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-height:200px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
|
|||
|
||||
CacheService,
|
||||
|
||||
Meta,
|
||||
Meta
|
||||
]
|
||||
})
|
||||
export class MainModule {
|
||||
|
|
|
@ -17,7 +17,7 @@ export const routes: string[] = [
|
|||
'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result',
|
||||
'search/data-providers','search/entity-registries', 'project-report',
|
||||
'claims','myclaims','participate/claim', 'participate/bulk-claim',
|
||||
'test',
|
||||
'error', 'login'
|
||||
'test', 'user-info',
|
||||
'error'
|
||||
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue