From e2aee4cadb1f4f16529c83eec739348c5e9ab994 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 4 Jan 2017 14:41:42 +0000 Subject: [PATCH] Landing pages: remove bootstrap class - add uikit class (under construction, Dataproviders still in bootstrap) | Login do not store password git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45058 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataset/dataset.component.html | 108 +++++----- .../landingPages/dataset/dataset.component.ts | 3 - .../organization/organization.component.html | 75 +++---- .../organization/organization.component.ts | 3 - .../landingPages/person/person.component.html | 46 ++--- .../project/project.component.html | 115 +++++------ .../landingPages/project/project.component.ts | 3 - .../publication/publication.component.html | 190 +++++++++--------- .../publication/publication.component.ts | 19 +- .../app/landingPages/showAuthors.component.ts | 6 +- .../landingPages/showIdentifiers.component.ts | 4 +- .../landingPages/showSubjects.component.ts | 12 +- .../app/landingPages/showTitle.component.ts | 2 +- .../app/landingPages/tabTable.component.ts | 5 +- portal-2/src/app/services/login.service.ts | 21 +- .../src/app/services/publication.service.ts | 61 +++--- .../app/sharedComponents/login.component.ts | 36 ++-- portal-2/src/app/utils/entities/user.ts | 1 - .../utils/properties/openaireProperties.ts | 4 +- portal-2/src/index.html | 9 +- 20 files changed, 384 insertions(+), 339 deletions(-) diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html index 17ab2649..18c278ed 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.html +++ b/portal-2/src/app/landingPages/dataset/dataset.component.html @@ -3,19 +3,19 @@
- - + + -
+
- -
+ + diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index 4f623ea5..b618e1bb 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -73,9 +73,16 @@ ngAfterContentInit() { public activeTab: string = ''; - public myfunct(tab: string) { - this.activeTab = tab; - } + public myfunct() { + //this.activeTab = tab; + /*UIkit.ul($('[data-uk-tab]').on('show.uk.tab', function(event, area){ + console.info("Switcher switched to ", area); + }));*/ + + //var elem = document.activeElement; + //console.info("id="+elem.id); + console.info("hi"); +} getPublicationInfo(id:string) { this.warningMessage = ''; @@ -110,7 +117,8 @@ ngAfterContentInit() { } } - getMetrics() { + getMetrics(id: any) { + console.info(id); this.metricsClicked = true; //this.viewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly","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":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Number of views for '+this.publicationInfo.title.name+'","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]}]&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.openaireViewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly_charts","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":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly_charts(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]},{"table":"repo_view_stats_monthly_charts","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"repo_view_stats_monthly_charts(source)-(piwik_id)datasource_piwik(openaire_id)-(id)datasource-name","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"repo_view_stats_monthly_charts(id)-(orid)result_oids(id)-(id)result-id","values":["'+this.articleId+'"],"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'; @@ -122,9 +130,6 @@ ngAfterContentInit() { }, err => { console.log(err); - console.info("error"); - - this.errorMessage = 'No publication metrics found'; } ); } diff --git a/portal-2/src/app/landingPages/showAuthors.component.ts b/portal-2/src/app/landingPages/showAuthors.component.ts index 7794b62a..6e4ce0f4 100644 --- a/portal-2/src/app/landingPages/showAuthors.component.ts +++ b/portal-2/src/app/landingPages/showAuthors.component.ts @@ -5,7 +5,7 @@ import {Component, Input} from '@angular/core'; template: `
- View less authors + View less authors
@@ -21,12 +21,12 @@ import {Component, Input} from '@angular/core';
- + view all {{authors.length}} authors - View less authors + View less authors diff --git a/portal-2/src/app/landingPages/showIdentifiers.component.ts b/portal-2/src/app/landingPages/showIdentifiers.component.ts index 40aa40ca..1de9d340 100644 --- a/portal-2/src/app/landingPages/showIdentifiers.component.ts +++ b/portal-2/src/app/landingPages/showIdentifiers.component.ts @@ -4,7 +4,7 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties'; @Component({ selector: 'showIdentifiers', template: ` -
+
Identifiers:
@@ -19,7 +19,7 @@ import {OpenaireProperties} from '../utils/properties/openaireProperties';
-
+ ` }) diff --git a/portal-2/src/app/landingPages/showSubjects.component.ts b/portal-2/src/app/landingPages/showSubjects.component.ts index f2ad2a30..8bf957d4 100644 --- a/portal-2/src/app/landingPages/showSubjects.component.ts +++ b/portal-2/src/app/landingPages/showSubjects.component.ts @@ -3,7 +3,7 @@ import {Component, Input} from '@angular/core'; @Component({ selector: 'showSubjects', template: ` -
+
@@ -29,8 +29,9 @@ import {Component, Input} from '@angular/core';
-
+
Show additional classifications @@ -38,11 +39,11 @@ import {Component, Input} from '@angular/core';
Hide additional classifications - +
-
+
Classified by OpenAIRE into
@@ -50,8 +51,9 @@ import {Component, Input} from '@angular/core';
+
-
+ ` }) diff --git a/portal-2/src/app/landingPages/showTitle.component.ts b/portal-2/src/app/landingPages/showTitle.component.ts index b7bb72a3..9614c97d 100644 --- a/portal-2/src/app/landingPages/showTitle.component.ts +++ b/portal-2/src/app/landingPages/showTitle.component.ts @@ -4,7 +4,7 @@ import {Component, Input} from '@angular/core'; @Component({ selector: 'showTitle', template: ` -

+

diff --git a/portal-2/src/app/landingPages/tabTable.component.ts b/portal-2/src/app/landingPages/tabTable.component.ts index 04ee9d7a..9c57527d 100644 --- a/portal-2/src/app/landingPages/tabTable.component.ts +++ b/portal-2/src/app/landingPages/tabTable.component.ts @@ -26,10 +26,11 @@ import {Component, Input} from '@angular/core'; -
-
+
+
{{item['trust']}}
+

no trust found

diff --git a/portal-2/src/app/services/login.service.ts b/portal-2/src/app/services/login.service.ts index a07092bc..b6a182e9 100644 --- a/portal-2/src/app/services/login.service.ts +++ b/portal-2/src/app/services/login.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {Http, Response} from '@angular/http'; +import {Http, Response, Headers, RequestOptions} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; @@ -15,22 +15,33 @@ export class LoginService { constructor(private http: Http, public _cache: CacheService) {} - authenticate (user: User):any { + authenticate (/*user: User*/username: string, password: string):any { +/* + let headers = new Headers({ 'Content-Type': 'application/json' }); + let options = new RequestOptions({ headers: headers }); - let url = OpenaireProperties.getLoginAPIURL()+user.username+"&password="+user.password; + return this.http.post(this.heroesUrl, { name }, options) + .map(this.extractData) + .catch(this.handleError); +*/ + let url = OpenaireProperties.getLoginAPIURL()+username+"&password="+password; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)); } return this.http.get(url) .map(res => res.json()) - .map(res => this.parseUserInfo(res['data'], user)) + .map(res => this.parseUserInfo(res['data'])) .do(res => { this._cache.set(key, res); }); + } - private parseUserInfo(data: any, user: User): User { + private parseUserInfo(data: any/*, user: User*/): User { + var user: User = new User(); + + user.username = data.username; user.email = data.email; user.id = data.id; user.fullname = data.fullname; diff --git a/portal-2/src/app/services/publication.service.ts b/portal-2/src/app/services/publication.service.ts index c1c1e831..90f8e8a1 100644 --- a/portal-2/src/app/services/publication.service.ts +++ b/portal-2/src/app/services/publication.service.ts @@ -129,6 +129,7 @@ export class PublicationService { this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""}; if(data[0]['bestlicense'].hasOwnProperty("classid")) { this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid; + console.info("accessmode by bestlicense = "+this.publicationInfo.title.accessMode); } if(data[1] != null) { @@ -191,24 +192,24 @@ export class PublicationService { } if(fundingData.hasOwnProperty("funding_level_2")) { - funding = fundingData['funding_level_2'].content; + funding = fundingData['funding_level_2'].name;//.content; } else if(fundingData.hasOwnProperty("funding_level_1")) { - funding = fundingData['funding_level_1'].content; + funding = fundingData['funding_level_1'].name;//.content; } else if(fundingData.hasOwnProperty("funding_level_0")) { - funding = fundingData['funding_level_0'].content; + funding = fundingData['funding_level_0'].name;//.content; } if(funding != undefined) { - funding = funding.split("::"); + // funding = funding.split("::"); if(this.publicationInfo.fundedByProjects[counter]['funding'] != "") { - this.publicationInfo.fundedByProjects[counter]['funding'] += ", "+funding[1]; + this.publicationInfo.fundedByProjects[counter]['funding'] += ", "+funding;//[1]; } else { - this.publicationInfo.fundedByProjects[counter]['funding'] = funding[1]; - } - for(let i=2; i(); } - counter2 = this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'].length; - this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'][counter2] = url; + this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'].push(url); if(this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] == null) { this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] = new Array(); } if(instance.hasOwnProperty("licence")) { - this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'][counter2] = instance['licence'].classid; + this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'].push(instance['licence'].classid); } else { - this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'][counter2] = ""; + this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'].push(""); } } else { if(data[0] != null && data[0].hasOwnProperty("source")) { let key: string; if(Array.isArray(data[0].source)) { - if(!this.publicationInfo.publishedIn.has(data[0]['source'][counter1])) { - key = data[0]['source'][counter1]; + if(counter1==data[0].source.length) { + counter1--; } + key = data[0]['source'][counter1]; } else { - if(!this.publicationInfo.publishedIn.has(data[0]['source'])) { - key = data[0]['source']; - } + key = data[0]['source']; + } + if(!this.publicationInfo.publishedIn.has(key)) { + this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null}); } - - this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null}); if(this.publicationInfo.publishedIn.get(key)['url'] == null) { this.publicationInfo.publishedIn.get(key)['url'] = new Array(); @@ -351,22 +351,19 @@ export class PublicationService { } if(instance.hasOwnProperty("licence")) { - this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = instance['licence'].classid; + this.publicationInfo.publishedIn.get(key)['accessMode'].push(instance['licence'].classid); } else { - this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = ""; + this.publicationInfo.publishedIn.get(key)['accessMode'].push(""); } counter1++; } } if(this.publicationInfo.title != undefined) { - if(this.publicationInfo.title['url'] == "") { - this.publicationInfo.title['url'] = url; - } - switch (this.publicationInfo.title['accessMode']) { case undefined: - this.publicationInfo.title['accessMode'] = instance['accessMode'].classid; + this.publicationInfo.title['accessMode'] = instance['licence'].classid; this.publicationInfo.title['url'] = url; + console.info("accessmode by undefined = "+this.publicationInfo.title.accessMode); break; case "CLOSED": if(instance['licence'].classid == "OPEN" || @@ -374,6 +371,7 @@ export class PublicationService { instance['licence'].classid == "RESTRICTED") { this.publicationInfo.title['accessMode'] = instance['licence'].classid; this.publicationInfo.title['url'] = url; + console.info("accessmode by closed = "+this.publicationInfo.title.accessMode); } break; case "RESTRICTED": @@ -381,12 +379,20 @@ export class PublicationService { instance['licence'].classid == "EMBARGO") { this.publicationInfo.title['accessMode'] = instance['licence'].classid; this.publicationInfo.title['url'] = url; + console.info("accessmode by restricted = "+this.publicationInfo.title.accessMode); } break; case "EMBARGO": if(instance['licence'].classid == "OPEN") { this.publicationInfo.title['accessMode'] = instance['licence'].classid; this.publicationInfo.title['url'] = url; + console.info("accessmode by embargo= "+this.publicationInfo.title.accessMode); + } + break; + case "OPEN": + if(this.publicationInfo.title['url'] == "") { + this.publicationInfo.title['url'] = url; + console.info("title url by empty = "+this.publicationInfo.title.url); } break; } @@ -554,6 +560,7 @@ export class PublicationService { if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") { this.publicationInfo.title['url'] = url; + console.info("title url by doi = "+this.publicationInfo.title.url); } } diff --git a/portal-2/src/app/sharedComponents/login.component.ts b/portal-2/src/app/sharedComponents/login.component.ts index 8c01e24f..606cef2a 100644 --- a/portal-2/src/app/sharedComponents/login.component.ts +++ b/portal-2/src/app/sharedComponents/login.component.ts @@ -8,25 +8,28 @@ import {User} from '../utils/entities/user'; template: ` -
+
- Legend + Login Form
- +
- +
- +
-
...
-
...
-
...
-
+
{{errorMessage}}
+ +
+ Hello {{user.fullname}}! +
+ + ` }) export class LoginComponent { - public user: User; + 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")); @@ -73,16 +80,17 @@ export class LoginComponent { } } - if(this.loggedIn == undefined) { + /*if(this.loggedIn == undefined) { this.user = new User(); this.loggedIn = false; - } + }*/ this.errorMessage = ""; } login() { - this._loginService.authenticate(this.user).subscribe( + this._loginService.authenticate(/*this.user*/this.username, this.password).subscribe( data => { + this.user = data; this.loggedIn = true; }, err => { diff --git a/portal-2/src/app/utils/entities/user.ts b/portal-2/src/app/utils/entities/user.ts index f81d400b..aaed5ab0 100644 --- a/portal-2/src/app/utils/entities/user.ts +++ b/portal-2/src/app/utils/entities/user.ts @@ -1,5 +1,4 @@ export class User { - password:string; email:string; username: string; id: string; diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index 963bba8f..9fb979af 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -36,13 +36,13 @@ export class OpenaireProperties { // private static searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; - // private static searchAPIURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; + private static searchAPIURLLAst = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; // private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/"; // private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; // private static searchAPIURLLAst = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; - private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT-new/rest/v2/api/"; + //private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT-new/rest/v2/api/"; // private static searchResourcesAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources"; private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT-new/rest/v2/api/resources"; diff --git a/portal-2/src/index.html b/portal-2/src/index.html index 867b997f..e4bb7a2a 100644 --- a/portal-2/src/index.html +++ b/portal-2/src/index.html @@ -25,7 +25,7 @@ - + @@ -44,6 +44,13 @@ + + + + + + +