1. Language parsed in 'Software' and 'Dataset' Landing

2. Added check if 'bestaccessright' is undefined in search pages and landing pages
3. Small fix in 'available on' component used by landing pages
4. Helper component and service updates - 'position' and 'before' inputs are for page contents, 'div' is for div contents
5. Search page gets page contents properly (check case if CSV button is shown)
6. Checks for functionality of div contents in 'claimContextSearchForm' component and 'claimProjectSearchForm' component


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@50728 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-02-13 14:52:23 +00:00
parent 5c641d6386
commit 114c3b2004
17 changed files with 69 additions and 33 deletions

View File

@ -15,6 +15,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
template: `
<div class=" uk-animation uk-card uk-card-default uk-padding uk-padding-large uk-padding-remove-left uk-margin-left" >
<button class="uk-button" type="button" uk-toggle="target: #toggle-hover; mode: hover">? Test Div Help Content</button>
<helper hidden id="toggle-hover" div="test2"></helper>
<!--div uk-grid="" >
<div class="uk-width-auto@m uk-first-column ">
<div>

View File

@ -5,12 +5,14 @@ import { ClaimContextSearchFormComponent } from './claimContextSearchForm.compon
import{ContextsServiceModule} from './service/contextsService.module';
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
import { RouterModule } from '@angular/router';
import {HelperModule} from '../../utils/helper/helper.module';
@NgModule({
imports: [
SharedModule,RouterModule,
ContextsServiceModule,
StaticAutocompleteModule
StaticAutocompleteModule,
HelperModule
],
declarations: [

View File

@ -13,6 +13,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
template: `
<div>
<button class="uk-button" type="button" uk-toggle="target: #toggle-hover; mode: hover">? Test Div Help Content</button>
<helper hidden id="toggle-hover" div="test"></helper>
<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">

View File

@ -9,12 +9,13 @@ import {ClaimProjectsSearchFormComponent} from './claimProjectSearchForm.compone
import {ProjectServiceModule} from '../../landingPages/project/projectService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
import {HelperModule} from '../../utils/helper/helper.module';
@NgModule({
imports: [
SharedModule, CommonModule,
// LoadingModalModule,
ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule
ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule
],
providers:[
],

View File

@ -41,7 +41,8 @@ export class DatasetService {
res[1]['context'],
//res[1]['resulttype'],
res[0],
res[1]['creator']
res[1]['creator'],
res[1]['language']
]).map(res => this.parseDatasetInfo(res));
}
@ -68,7 +69,7 @@ export class DatasetService {
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
}
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
if(data[0]['bestaccessright'].hasOwnProperty("classid")) {
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
this.datasetInfo.title.accessMode = data[0]['bestaccessright'].classid;
}
if(data[1] != null) {
@ -190,6 +191,10 @@ export class DatasetService {
});
}
if(data[11] != null) {
this.datasetInfo.languages = this.parsingFunctions.parseLanguages(data[11]);
}
return this.datasetInfo;
}
}

View File

@ -32,7 +32,7 @@ import {Component, Input, ElementRef} from '@angular/core';
[queryParams]="{datasourceId: available.collectedId}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
{{available.collectedName}}
</a>
<span *ngIf="available.type || available.year">(<span *ngIf="available.type">{{available.type}}, </span><span *ngIf="available.year">{{available.year}}</span>)</span>
<span *ngIf="available.type || available.year">(<span *ngIf="available.type">{{available.type}}<span *ngIf="available.year">, </span></span><span *ngIf="available.year">{{available.year}}</span>)</span>
</div>
</div>
</dd>

View File

@ -525,4 +525,21 @@ export class ParsingFunctions {
}
}
}
parseLanguages(_languages: any) {
var languages = new Array<string>();
if(!Array.isArray(_languages)) {
if(_languages.classname != "Undetermined" && _languages.classname) {
languages.push(_languages.classname);
}
} else {
for(let i=0; i<_languages.length; i++) {
if(_languages[i].classname != "Undetermined" && _languages[i].classname) {
languages.push(_languages[i].classname);
}
}
}
return languages;
}
}

View File

@ -72,7 +72,7 @@ export class PublicationService {
}
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
if(data[0]['bestaccessright'].hasOwnProperty("classid")) {
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
this.publicationInfo.title.accessMode = data[0]['bestaccessright'].classid;
}
@ -171,19 +171,7 @@ export class PublicationService {
}
if(data[6] != null) {
this.publicationInfo.languages = new Array<string>();
if(!Array.isArray(data[6])) {
if(data[6].classname != "Undetermined" && data[6].classname) {
this.publicationInfo.languages.push(data[6].classname);
}
} else {
for(let i=0; i<data[6].length; i++) {
if(data[6][i].classname != "Undetermined" && data[6][i].classname) {
this.publicationInfo.languages.push(data[6][i].classname);
}
}
}
this.publicationInfo.languages = this.parsingFunctions.parseLanguages(data[6]);
}
if(data[7] != null) {

View File

@ -41,7 +41,8 @@ export class SoftwareService {
res[1]['context'],
//res[1]['resulttype'],
res[0],
res[1]['creator']
res[1]['creator'],
res[1]['language'],
]).map(res => this.parseSoftwareInfo(res));
}
@ -68,7 +69,7 @@ export class SoftwareService {
this.softwareInfo.embargoEndDate = data[0].embargoenddate;
}
this.softwareInfo.title = {"name": "", "url": "", "accessMode": ""};
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
if(data[0]['bestaccessright'] && data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
this.softwareInfo.title.accessMode = data[0]['bestaccessright'].classid;
}
if(data[1] != null) {
@ -191,6 +192,10 @@ export class SoftwareService {
});
}
if(data[11] != null) {
this.softwareInfo.languages = this.parsingFunctions.parseLanguages(data[11]);
}
return this.softwareInfo;
}
}

View File

@ -61,8 +61,9 @@
<div class="uk-grid uk-width-1-1">
<div *ngIf="showRefine" class="helper-left-right search-filters uk-visible@m">
<helper position="left"></helper>
<helper position="left" before="true"></helper>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)" [(connectCommunityId)]=connectCommunityId></search-filter>
<helper position="left" before="false"></helper>
</div>
<helper *ngIf="!showRefine" class="helper-left-right uk-visible@m" position="left"></helper>

View File

@ -170,7 +170,7 @@ export class SearchDatasetsService {
//result['title'].url = OpenaireProperties.getsearchLinkToDataset();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['bestaccessright'].hasOwnProperty("classid")) {
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
result['title'].accessMode = resData['bestaccessright'].classid;
}

View File

@ -204,7 +204,7 @@ export class SearchPublicationsService {
//result['title'].url = OpenaireProperties.getsearchLinkToPublication();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['bestaccessright'].hasOwnProperty("classid")) {
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
result['title'].accessMode = resData['bestaccessright'].classid;
}

View File

@ -170,7 +170,7 @@ export class SearchSoftwareService {
//result['title'].url = OpenaireProperties.getsearchLinkToSoftware();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
if(resData['bestaccessright'] && resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
result['title'].accessMode = resData['bestaccessright'].classid;
}

View File

@ -12,6 +12,7 @@ export class DatasetInfo {
"type": string, "year":string}[];
identifiers: Map<string, string[]>;
publisher: string;
languages: string[];
subjects: string[];
otherSubjects: Map<string, string[]>;
classifiedSubjects: Map<string, string[]>;

View File

@ -12,6 +12,7 @@ export class SoftwareInfo {
"type": string, "year":string}[];
identifiers: Map<string, string[]>;
publisher: string;
languages: string[];
subjects: string[];
otherSubjects: Map<string, string[]>;
classifiedSubjects: Map<string, string[]>;

View File

@ -17,6 +17,8 @@ export class HelperComponent {
texts=[];
@Input() style:boolean = false;
@Input() position:string = 'right';
@Input() before: boolean;
@Input() div: string;
@Input() styleName:string = '';
sub:any;
properties:EnvProperties;
@ -29,9 +31,11 @@ export class HelperComponent {
this.properties = data.envSpecific;
if(this.properties.enableHelper && location){
this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
//this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
this.sub = this._service.getHelper(location.pathname, this.position, this.before, this.div, this.properties).subscribe(
data => {
this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
//this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
this.texts = data;
},
err => {
console.log(err);

View File

@ -10,13 +10,20 @@ import { OpenaireProperties } from '../../utils/properties/openaireProperties';
@Injectable()
export class HelperService {
//, @Inject('config') private config:any
constructor(private http: Http) {}
config;
getHelper (router: string, properties:EnvProperties):any {
console.info("get router helpText for : "+router);
console.info("apiUrl from config:" + this.config.apiUrl);
let url = ((this.config)?this.config.apiUrl:properties.adminToolsAPIURL) + '?q=' + router;
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties):any {
console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
let url = properties.adminToolsAPIURL;
if(div) {
url += '/divhelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&div=' + div;
} else {
url += '/pagehelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&position=' + position;
if(before) {
url += '&before='+before;
}
}
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json());