[Library|Trunk]
Linking: rename attribute title to pageTitle or sectionTitle to avoid showing default html tooltip use default or communty colors for the linking banner Search datacite: fix bug when searching with DOIs enable searching with more than one DOI git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56908 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8df218bff9
commit
1f942d09dd
|
@ -12,7 +12,8 @@ import {ClaimEntity, ClaimResult} from './claimHelper.class';
|
|||
import {DOI, StringUtils} from '../../utils/string-utils.class';
|
||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||
import {Filter, Value} from "../../searchPages/searchUtils/searchHelperClasses.class";
|
||||
|
||||
import {Observable, forkJoin} from "rxjs";
|
||||
import 'rxjs/add/observable/forkJoin'
|
||||
@Component({
|
||||
selector: 'claim-result-search-form',
|
||||
templateUrl: 'claimResultSearchForm.component.html',
|
||||
|
@ -652,11 +653,22 @@ export class ClaimResultSearchFormComponent {
|
|||
private getDataciteResults(term: string, size: number, page: number) {
|
||||
this.dataciteStatus = this.errorCodes.LOADING;
|
||||
if (this.DOIs.length > 0) {
|
||||
this._searchDataciteService.getDataciteResultByDOI(term, this.properties, true).subscribe(
|
||||
let doiObservables: Array<Observable<any>> = new Array();
|
||||
for(let doi of this.DOIs){
|
||||
let ob = this._searchDataciteService.getDataciteResultByDOI(doi, this.properties, true);
|
||||
doiObservables.push(ob);
|
||||
|
||||
}
|
||||
Observable.forkJoin(doiObservables).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data[1];
|
||||
//if DOI not found or an error occured the result will be null -- remove null values
|
||||
for(let result of data){
|
||||
if(result){
|
||||
this.dataciteResults.push(result)
|
||||
}
|
||||
}
|
||||
this.datacitePage = page;
|
||||
this.dataciteResultsNum = data[0];
|
||||
this.dataciteResultsNum = this.dataciteResults.length;
|
||||
this.dataciteStatus = this.errorCodes.DONE;
|
||||
if (this.dataciteResultsNum == 0) {
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
||||
|
@ -678,36 +690,9 @@ export class ClaimResultSearchFormComponent {
|
|||
ClaimResultSearchFormComponent.handleError("Error getting datacite results for term: " + term, err);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
err => {
|
||||
if (err.status == "404") {
|
||||
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
||||
data => {
|
||||
this.dataciteResults = data[1];
|
||||
this.datacitePage = page;
|
||||
this.dataciteResultsNum = data[0];
|
||||
this.dataciteStatus = this.errorCodes.DONE;
|
||||
if (this.dataciteResultsNum == 0) {
|
||||
this.dataciteStatus = this.errorCodes.NONE;
|
||||
}
|
||||
|
||||
},
|
||||
err => {
|
||||
|
||||
this.dataciteStatus = this.errorCodes.ERROR;
|
||||
|
||||
console.log(err);
|
||||
ClaimResultSearchFormComponent.handleError("Error getting datacite results for term: " + term, err);
|
||||
});
|
||||
} else {
|
||||
this.dataciteStatus = this.errorCodes.ERROR;
|
||||
//console.log(err);
|
||||
ClaimResultSearchFormComponent.handleError("Error getting datacite results for term: " + term, err);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
);
|
||||
} else {
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import {throwError as observableThrowError} from 'rxjs';
|
||||
import {Observable, throwError as observableThrowError} from 'rxjs';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Response} from '@angular/http';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {EnvProperties} from '../../../utils/properties/env-properties';
|
||||
import {ClaimEntity, ClaimResult} from '../claimHelper.class';
|
||||
import {map} from "rxjs/operators";
|
||||
|
||||
import 'rxjs/add/operator/catch';
|
||||
import 'rxjs/add/observable/of';
|
||||
@Injectable()
|
||||
export class SearchDataciteService {
|
||||
constructor(private http: HttpClient ) {}
|
||||
|
@ -25,7 +26,7 @@ export class SearchDataciteService {
|
|||
let key = url;
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(request => [1, (parse ? SearchDataciteService.parse(request["data"]) : request)]));
|
||||
.pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request))).catch(e => Observable.of(null));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<linking-generic *ngIf="validInput" [localStoragePrefix]="localStoragePrefix" [results]="results" [sources]="sources"
|
||||
[communityId]="communityId" [inlineEntity]="inlineEntity" [showOptions]="showOptions"
|
||||
[piwikSiteId]="piwikSiteId" title="Direct Linking">
|
||||
[piwikSiteId]="piwikSiteId" pageTitle="Direct Linking">
|
||||
</linking-generic>
|
||||
|
||||
<div *ngIf="!validInput" id="tm-main" class=" uk-section uk-margin-small-top tm-middle">
|
||||
<div *ngIf="validInput== false" id="tm-main" class=" uk-section uk-margin-small-top uk-padding-remove-top tm-middle">
|
||||
<div class="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
|
||||
Link to
|
||||
</div>
|
||||
<div class="uk-width-1-1">
|
||||
</div>
|
||||
|
|
|
@ -271,11 +271,9 @@ export class BulkClaimComponent {
|
|||
|
||||
searchInDatacite(id: string, accessMode: string, date: string, row: number) {
|
||||
this._searchDataciteService.getDataciteResultByDOI(id, this.properties, true).subscribe(
|
||||
items => {
|
||||
|
||||
if (items[1].length > 0) {
|
||||
var result = items[1][0];
|
||||
result => {
|
||||
|
||||
if (result) {
|
||||
this.foundIds.push(id);
|
||||
result.result.accessRights = accessMode;
|
||||
result.result.embargoEndDate = date;
|
||||
|
|
|
@ -37,8 +37,8 @@ import {
|
|||
|
||||
<div>
|
||||
<div *ngIf="!claiming " (click)="insert()" style="width: 350px;"
|
||||
[class]="(((sources.length>0||inlineEntity) && results.length > 0 && (!claiming && errors.length == 0))?'linksbaskettitlesPortalColor ':'uk-disabled')+ ' linksbaskettitles uk-padding-small uk-text-center'">CONFIRM LINKING
|
||||
<span class="uk-icon uk-float-right uk-text-bold uk-margin-small-right">
|
||||
[class]="getButtonClass()">CONFIRM LINKING
|
||||
<span [class]="(defaultColors?'':' uk-margin-small-top ')+'uk-icon uk-float-right uk-text-bold uk-margin-small-right'">
|
||||
<svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
|
||||
icon="chevron-right" ratio="1.5"><polyline fill="none" stroke="#000" stroke-width="1.03"
|
||||
points="7 4 13 10 7 16"></polyline></svg>
|
||||
|
@ -71,6 +71,7 @@ export class ClaimInsertComponent {
|
|||
@ViewChild(AlertModal) alert;
|
||||
@Input() errors: ClaimsErrorMessage[];
|
||||
@Output() insertFinished = new EventEmitter();
|
||||
@Input() defaultColors:boolean;
|
||||
|
||||
public claiming = false;
|
||||
|
||||
|
@ -491,4 +492,27 @@ export class ClaimInsertComponent {
|
|||
|
||||
console.error("Insert Claim (component): " + message, error);
|
||||
}
|
||||
|
||||
getButtonClass(){
|
||||
// [class]="(((sources.length>0||inlineEntity) && results.length > 0 && (!claiming && errors.length == 0))?' ':'uk-disabled')+ ' uk-button uk-button-large uk-text-center'+((defaultColors)?'':'')">CONFIRM LINKING
|
||||
// <span class=" uk-margin-small-top uk-icon uk-float-right uk-text-bold uk-margin-small-right"> }
|
||||
// [class]="(((sources.length>0||inlineEntity) && results.length > 0 && (!claiming && errors.length == 0))?'linksbaskettitlesPortalColor ':'uk-disabled')+ ' linksbaskettitles uk-padding-small uk-text-center'">CONFIRM LINKING
|
||||
// <span class="uk-icon uk-float-right uk-text-bold uk-margin-small-right">
|
||||
let buttonClass= "";
|
||||
if((this.sources.length>0||this.inlineEntity) && this.results.length > 0 && (!this.claiming && this.errors.length == 0)){
|
||||
if(this.defaultColors){
|
||||
buttonClass+=" linksbaskettitlesPortalColor ";
|
||||
}
|
||||
}else{
|
||||
buttonClass+=" uk-disabled ";
|
||||
|
||||
}
|
||||
if(this.defaultColors){
|
||||
buttonClass+=" linksbaskettitles uk-padding-small ";
|
||||
}else{
|
||||
buttonClass+=" uk-button uk-button-large ";
|
||||
}
|
||||
return buttonClass + "uk-text-center ";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<metadata-preview *ngIf="showOptions.show=='claim' && properties" class="uk-margin-top"
|
||||
[results]="results" [sources]="sources"
|
||||
[localStoragePrefix]="localStoragePrefix" [inlineEntity]="inlineEntity"
|
||||
[showOptions]="showOptions" [properties]=properties [pageContents]="pageContents">
|
||||
[showOptions]="showOptions" [properties]=properties [pageContents]="pageContents"
|
||||
[defaultColors]="(communityId?false:true)"
|
||||
>
|
||||
</metadata-preview>
|
||||
<div id="tm-main" class="uk-section uk-padding-remove-top tm-middle" *ngIf="showOptions.show != 'claim'">
|
||||
<div class="uk-grid">
|
||||
|
@ -213,7 +215,7 @@
|
|||
class="uk-alert uk-alert-warning uk-text-center">
|
||||
Basket reached the size limit. No more entities can be added.
|
||||
</div>
|
||||
<claim-selected-results title="Selected Results" [results]="results"
|
||||
<claim-selected-results sectionTitle="Selected Results" [results]="results"
|
||||
[localStoragePrefix]="localStoragePrefix+'results'">
|
||||
</claim-selected-results>
|
||||
<div *ngIf="(results.length) == 0 " class="uk-alert no-selected-message uk-text-center">
|
||||
|
|
|
@ -21,7 +21,7 @@ declare var UIkit:any;
|
|||
})
|
||||
export class LinkingGenericComponent {
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() title: string = null;
|
||||
@Input() pageTitle: string = null;
|
||||
piwiksub:any;
|
||||
|
||||
@Input() communityId:string= null;
|
||||
|
@ -64,14 +64,14 @@ export class LinkingGenericComponent {
|
|||
this.url = data.envSpecific.baseLink+this._router.url;
|
||||
|
||||
var description = "Openaire, linking, claim, publication, research data, software, other research product, project, community";
|
||||
this.updateTitle(this.title);
|
||||
this.updateTitle(this.pageTitle);
|
||||
this.updateDescription(description);
|
||||
this.updateUrl(this.url);
|
||||
|
||||
this.seoService.createLinkForCanonicalURL(this.url, false);
|
||||
|
||||
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe();
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
|
||||
}
|
||||
|
||||
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<div class="uk-section uk-padding-remove-top uk-padding-remove-bottom communityToolBarSection">
|
||||
<div class="linkingToolbar uk-padding-small uk-margin-small-top">
|
||||
<div class="uk-section uk-padding-remove-top uk-padding-remove-bottom ">
|
||||
<div
|
||||
[class]="((defaultColors)?'linkingToolbar':'communityPanelBackground')+' uk-padding-small uk-margin-small-top'">
|
||||
<div class="uk-container uk-container-large uk-margin-small-top uk-padding-small">
|
||||
<div class="uk-grid">
|
||||
<div class="uk-padding-remove-left uk-margin-auto-vertical back">
|
||||
<div class="uk-padding-remove-left uk-margin-auto-vertical back uk-link">
|
||||
<span
|
||||
(click)="showOptions.showLinkTo()"
|
||||
style="cursor:pointer">
|
||||
|
@ -21,7 +22,8 @@
|
|||
</div>
|
||||
<claim-insert [results]="results" [sources]="sources" [inlineEntity]="inlineEntity"
|
||||
[properties]=properties [localStoragePrefix]=localStoragePrefix
|
||||
class=" " [errors]="errors" (insertFinished)="runValidation(false); updateLocalStorage();">
|
||||
class=" " [errors]="errors" (insertFinished)="runValidation(false); updateLocalStorage();"
|
||||
[defaultColors]="defaultColors">
|
||||
</claim-insert>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@ export class MetadataPreviewComponent {
|
|||
@Input() showOptions:ShowOptions;
|
||||
@Input() public properties: EnvProperties;
|
||||
@Input() pageContents;
|
||||
|
||||
@Input() defaultColors:boolean=true;
|
||||
@ViewChild(AlertModal) alertApplyAll;
|
||||
@Input() localStoragePrefix: string = "";
|
||||
errors:ClaimsErrorMessage[] = [];
|
||||
|
|
|
@ -8,7 +8,7 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
|||
})
|
||||
export class ClaimSelectedResultsComponent {
|
||||
@Input() results: ClaimEntity[];
|
||||
@Input() title: string = "Research Results";
|
||||
@Input() sectionTitle: string = "Research Results";
|
||||
@Input() localStoragePrefix: string = "";
|
||||
@Input() enableRemove:boolean = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue