Search pages: when query has no results, page is not out of bounds | Publication landing: under curation status was not parsed until now | htmlProjectProgressReport: messages added - button moved on the right, under the title - table width is limited - metatags added
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48222 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
629c38512b
commit
3b0ed7c3fd
|
@ -1,35 +1,48 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ActivatedRoute, Params} from '@angular/router';
|
||||
import {ActivatedRoute, Params, Router} from '@angular/router';
|
||||
import {isBrowser, isNode} from 'angular2-universal';
|
||||
import {HtmlProjectReportService} from './htmlProjectReport.service';
|
||||
import {ProjectService} from '../project/project.service';
|
||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
|
||||
@Component({
|
||||
selector: 'htmlProjectReport',
|
||||
template: `
|
||||
<div class="uk-container uk-margin-top">
|
||||
<button class="uk-icon-clipboard uk-button uk-button-primary btn" (click)="copied = true;">
|
||||
Copy to clipboard
|
||||
</button>
|
||||
<div class="uk-container uk-margin-top">
|
||||
<div *ngIf="warningMessage" class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
|
||||
<div *ngIf="showLoading" class="uk-alert uk-alert-primary" role="alert">Loading...</div>
|
||||
|
||||
<div *ngIf="!showLoading && !warningMessage">
|
||||
<!--span *ngIf="copied" class="uk-badge uk-badge-success">Success</span-->
|
||||
<div *ngIf="copied" class="uk-alert" data-uk-alert>
|
||||
<p>Raw html is copied. Please paste it on an html file.</p>
|
||||
<div *ngIf="copied" class="uk-alert uk-alert-success" role="alert">
|
||||
Raw html is copied. Please paste it on an html file.
|
||||
</div>
|
||||
|
||||
<h1>{{header1}}</h1>
|
||||
<h2>{{header2}}</h2>
|
||||
<div id="clipboard" [innerHTML]="htmlResult"></div>
|
||||
</div>
|
||||
<h1 *ngIf="header1">{{header1}}</h1>
|
||||
<h2 *ngIf="header1 || htmlResult">{{header2}}</h2>
|
||||
|
||||
<div class="uk-clearfix uk-margin-bottom">
|
||||
<button *ngIf="htmlResult" class="uk-icon-clipboard uk-button uk-button-primary clipBtn uk-float-right" (click)="copied = true;">
|
||||
Copy to clipboard
|
||||
</button>
|
||||
</div>
|
||||
<!--div class="uk-panel-scrollable custom-html-table-height" *ngIf="htmlResult" id="clipboard" [innerHTML]="htmlResult"></div-->
|
||||
<div class="uk-overflow-auto custom-html-table-height" *ngIf="htmlResult" id="clipboard" [innerHTML]="htmlResult"></div>
|
||||
|
||||
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class HtmlProjectReportComponent{
|
||||
public projectId: string;
|
||||
public totalResults: number;
|
||||
public totalResults: number = 10;
|
||||
public resultsType: string = "publication";
|
||||
|
||||
public header1: string;
|
||||
public header2: string;
|
||||
public header1: string = "";
|
||||
public header2: string = "";
|
||||
public htmlResult: string = "";
|
||||
|
||||
public sub;
|
||||
|
@ -37,22 +50,46 @@ export class HtmlProjectReportComponent{
|
|||
public subHTMLInfo;
|
||||
|
||||
public copied: boolean = false;
|
||||
public warningMessage: string = "";
|
||||
public errorMessage: string = "";
|
||||
public showLoading: boolean = true;
|
||||
|
||||
constructor ( private route: ActivatedRoute,
|
||||
private htmlService: HtmlProjectReportService,
|
||||
private _projectService: ProjectService) {
|
||||
private htmlService: HtmlProjectReportService,
|
||||
private _projectService: ProjectService,
|
||||
private _meta: Meta, private _router: Router) {
|
||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.projectId = params['projectId'];
|
||||
this.totalResults = params['size'];
|
||||
if(params['type'] && (params['type'] == "dataset" || params['type'] == "publication")){
|
||||
this.resultsType = params['type'];
|
||||
|
||||
if (params['size'] == parseInt(params['size'], 10)) {
|
||||
this.totalResults = params['size'];
|
||||
} else {
|
||||
this.showLoading = false;
|
||||
this.warningMessage="Requested size is not an integer";
|
||||
}
|
||||
|
||||
this.createHeaders();
|
||||
this.createClipboard();
|
||||
if(params['type'] && (params['type'] == "dataset" || params['type'] == "publication")){
|
||||
this.resultsType = params['type'];
|
||||
this.updateTitle("Project's "+this.resultsType+" report");
|
||||
this.updateDescription("project, funding, open access, publications, datasets, ");
|
||||
} else {
|
||||
this.showLoading = false;
|
||||
this.warningMessage="Requested type should be publication or dataset";
|
||||
}
|
||||
|
||||
//showLoading is true if no warnings
|
||||
if(this.showLoading) {
|
||||
if(this.projectId) {
|
||||
this.createHeaders();
|
||||
} else {
|
||||
this.showLoading = false;
|
||||
this.warningMessage="No valid project id";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -65,6 +102,7 @@ export class HtmlProjectReportComponent{
|
|||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.createClipboard();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -77,19 +115,17 @@ export class HtmlProjectReportComponent{
|
|||
intro += '<head>';
|
||||
intro += '<title>'+this.header1+'</title>'
|
||||
intro += '</head>';
|
||||
intro += '<body>';
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType).subscribe(
|
||||
data => {
|
||||
let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>';
|
||||
|
||||
this.htmlResult = data;
|
||||
|
||||
let clipboard;
|
||||
let Clipboard;
|
||||
Clipboard = require('clipboard');
|
||||
clipboard = new Clipboard('.btn', {
|
||||
clipboard = new Clipboard('.clipBtn', {
|
||||
/*target: function(trigger) {
|
||||
return document.getElementById("clipboard");
|
||||
}*/
|
||||
|
@ -97,16 +133,19 @@ export class HtmlProjectReportComponent{
|
|||
return body;//document.getElementById("clipboard").getAttribute('innerHTML');//"aaaa"+tmp+"oo";
|
||||
}
|
||||
});
|
||||
|
||||
this.showLoading = false;
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
this.errorMessage = 'Service not available';
|
||||
this.showLoading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
createHeader1(data: {"title": string, "acronym": string, "callIdentifier": string}) {
|
||||
console.info(data);
|
||||
this.header1 = ((this.resultsType == "publication")?"Publications":"Datasets") + " of Project ";
|
||||
|
||||
if(data != undefined) {
|
||||
|
@ -130,5 +169,21 @@ export class HtmlProjectReportComponent{
|
|||
this.header1 += ")";
|
||||
}
|
||||
}
|
||||
|
||||
this.createClipboard();
|
||||
}
|
||||
|
||||
updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateProperty("og:description", description);
|
||||
}
|
||||
updateTitle(title:string){
|
||||
var _suffix ="| OpenAIRE";
|
||||
var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateProperty("og:title",_title);
|
||||
}
|
||||
updateUrl(url:string){
|
||||
this._meta.updateProperty("og:url", url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@
|
|||
<!--li (click)="showHTML()"-->
|
||||
<li>
|
||||
View {{projectInfo.funder}} progress report (HTML) for <a target="_blank"
|
||||
href="/project-report?projectId={{projectId}}&size={{fetchPublications.searchUtils.totalResults}}">
|
||||
href="/project-report?projectId={{projectId}}&size={{fetchPublications.searchUtils.totalResults}}&type=publication">
|
||||
publications
|
||||
</a>/ <a target="_blank"
|
||||
href="/project-report?projectId={{projectId}}&size={{fetchDatasets.searchUtils.totalResults}}&type=dataset">
|
||||
|
|
|
@ -701,6 +701,12 @@ export class PublicationService {
|
|||
}
|
||||
}
|
||||
|
||||
if(data[12] != null && data[12] == "under curation") {
|
||||
this.publicationInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.publicationInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
return this.publicationInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,14 +97,16 @@ export class AdvancedSearchDataProvidersComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -102,14 +102,16 @@ export class AdvancedSearchDatasetsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -100,14 +100,16 @@ public resourcesQuery = "(oaftype exact organization)";
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -100,14 +100,16 @@ export class AdvancedSearchProjectsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -101,14 +101,16 @@ export class AdvancedSearchPublicationsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -265,14 +265,16 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -198,14 +198,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -117,14 +117,16 @@ export class SearchOrganizationsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -122,14 +122,16 @@ export class SearchProjectsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -210,14 +210,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
if(this.searchUtils.status == errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
|
|
|
@ -120,6 +120,10 @@
|
|||
min-height: 600px;
|
||||
}
|
||||
|
||||
.custom-html-table-height {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.filterItem span {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue