[Library | Trunk]: Add dmps on project
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60614 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
cca8a3c7f3
commit
a9c25698dd
|
@ -90,7 +90,8 @@
|
|||
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
|
||||
[texts]="pageContents['top']"></helper>
|
||||
<div *ngIf="projectInfo != null" class="uk-grid uk-margin-remove-left uk-margin-large-bottom">
|
||||
<div class="uk-width-2-3@m uk-width-1-1@s uk-margin-bottom uk-padding uk-padding-remove-left uk-padding-remove-vertical">
|
||||
<div
|
||||
class="uk-width-2-3@m uk-width-1-1@s uk-margin-bottom uk-padding uk-padding-remove-left uk-padding-remove-vertical">
|
||||
<schema2jsonld *ngIf="projectInfo" [data]=projectInfo
|
||||
[URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId"
|
||||
type="project"></schema2jsonld>
|
||||
|
@ -103,20 +104,25 @@
|
|||
</landing-header>
|
||||
<!-- Labels -->
|
||||
<div class="uk-margin-top uk-margin-bottom">
|
||||
<span *ngIf="projectInfo.openAccessMandatePublications != undefined && projectInfo.openAccessMandatePublications && projectInfo.openAccessMandateDatasets != undefined && projectInfo.openAccessMandateDatasets"
|
||||
class="uk-label custom-label label-open" title="Open Access mandate for Publications and Research Data">
|
||||
<span
|
||||
*ngIf="projectInfo.openAccessMandatePublications != undefined && projectInfo.openAccessMandatePublications && projectInfo.openAccessMandateDatasets != undefined && projectInfo.openAccessMandateDatasets"
|
||||
class="uk-label custom-label label-open"
|
||||
title="Open Access mandate for Publications and Research Data">
|
||||
<span class="uk-visible@m">Open Access mandate for Publications and Research Data</span>
|
||||
<span class="uk-hidden@m">Open Access mandate for ...</span>
|
||||
</span>{{" "}}
|
||||
<span *ngIf="projectInfo.openAccessMandatePublications != undefined && projectInfo.openAccessMandatePublications && (projectInfo.openAccessMandateDatasets == undefined || !projectInfo.openAccessMandateDatasets)"
|
||||
<span
|
||||
*ngIf="projectInfo.openAccessMandatePublications != undefined && projectInfo.openAccessMandatePublications && (projectInfo.openAccessMandateDatasets == undefined || !projectInfo.openAccessMandateDatasets)"
|
||||
class="uk-label custom-label label-open" title="Open Access mandate for Publications">
|
||||
Open Access mandate for Publications
|
||||
</span>{{" "}}
|
||||
<span *ngIf="projectInfo.openAccessMandateDatasets != undefined && projectInfo.openAccessMandateDatasets && (projectInfo.openAccessMandatePublications == undefined || !projectInfo.openAccessMandatePublications)"
|
||||
<span
|
||||
*ngIf="projectInfo.openAccessMandateDatasets != undefined && projectInfo.openAccessMandateDatasets && (projectInfo.openAccessMandatePublications == undefined || !projectInfo.openAccessMandatePublications)"
|
||||
class="uk-label custom-label label-open" title="Open Access mandate for Research Data">
|
||||
Open Access mandate for Research Data
|
||||
</span>{{" "}}
|
||||
<span *ngIf="projectInfo.funding && projectInfo.funding.funderName" class="uk-label custom-label label-funder" title="Funder">
|
||||
<span *ngIf="projectInfo.funding && projectInfo.funding.funderName"
|
||||
class="uk-label custom-label label-funder" title="Funder">
|
||||
{{projectInfo.funding.funderName}}
|
||||
</span>{{" "}}
|
||||
<span *ngIf="projectInfo.specialClause39"
|
||||
|
@ -172,7 +178,8 @@
|
|||
<div class="uk-text-muted">Start Date</div>
|
||||
<div>{{projectInfo.startDate | date: 'dd MMM yyyy'}}</div>
|
||||
</span>
|
||||
<span *ngIf="projectInfo.endDate" [class]="'uk-width-1-2 ' + (projectInfo.startDate ? 'uk-text-right' : '')">
|
||||
<span *ngIf="projectInfo.endDate"
|
||||
[class]="'uk-width-1-2 ' + (projectInfo.startDate ? 'uk-text-right' : '')">
|
||||
<div class="uk-text-muted">End Date</div>
|
||||
<div>{{projectInfo.endDate | date: 'dd MMM yyyy'}}</div>
|
||||
</span>
|
||||
|
@ -191,13 +198,15 @@
|
|||
|| (projectInfo.openAccessMandateDatasets != undefined && !projectInfo.openAccessMandateDatasets)">
|
||||
<div>Open Access mandate</div>
|
||||
<div>
|
||||
<span *ngIf="projectInfo.openAccessMandatePublications != undefined && !projectInfo.openAccessMandatePublications"
|
||||
<span
|
||||
*ngIf="projectInfo.openAccessMandatePublications != undefined && !projectInfo.openAccessMandatePublications"
|
||||
class="uk-margin-right">
|
||||
<span class="uk-text-muted">Publications: </span>
|
||||
<!-- <span *ngIf="projectInfo.openAccessMandatePublications">Yes</span>-->
|
||||
<span>No</span>
|
||||
</span>
|
||||
<span *ngIf="projectInfo.openAccessMandateDatasets != undefined && !projectInfo.openAccessMandateDatasets">
|
||||
<span
|
||||
*ngIf="projectInfo.openAccessMandateDatasets != undefined && !projectInfo.openAccessMandateDatasets">
|
||||
<span class="uk-text-muted">Research Data: </span>
|
||||
<!-- <span *ngIf="projectInfo.openAccessMandateDatasets">Yes</span>-->
|
||||
<span>No</span>
|
||||
|
@ -210,7 +219,9 @@
|
|||
<div class="uk-width-1-3@m uk-width-1-1@s uk-padding-remove">
|
||||
<ul class="user-actions uk-list uk-card uk-card-default uk-padding">
|
||||
<!-- NEW-->
|
||||
<li><addThis></addThis></li>
|
||||
<li>
|
||||
<addThis></addThis>
|
||||
</li>
|
||||
<li *ngIf="isRouteAvailable('participate/direct-claim')">
|
||||
<a class="uk-link-text uk-text-bold uk-text-uppercase" (click)="openLinkProjectModal()">
|
||||
<span class="uk-icon-button portal-button uk-icon">
|
||||
|
@ -265,7 +276,8 @@
|
|||
<li>
|
||||
<a class="uk-link-text uk-text-bold uk-text-uppercase" (click)="openShareResultsModal()">
|
||||
<span class="uk-icon uk-icon-button uk-button-primary">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="code" ratio="1">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="code"
|
||||
ratio="1">
|
||||
<polyline fill="none" stroke="#000" stroke-width="1.01" points="13,4 19,10 13,16"></polyline>
|
||||
<polyline fill="none" stroke="#000" stroke-width="1.01" points="7,4 1,10 7,16"></polyline>
|
||||
</svg>
|
||||
|
@ -302,7 +314,8 @@
|
|||
<li>
|
||||
<a class="uk-link-text uk-text-bold uk-text-uppercase" (click)="openDownloadReportModal()">
|
||||
<span class="uk-icon uk-icon-button uk-button-primary">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download" ratio="1">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download"
|
||||
ratio="1">
|
||||
<polyline fill="none" stroke="#000" points="14,10 9.5,14.5 5,10"></polyline>
|
||||
<rect x="3" y="17" width="13" height="1"></rect>
|
||||
<line fill="none" stroke="#000" x1="9.5" y1="13.91" x2="9.5" y2="3"></line>
|
||||
|
@ -444,7 +457,8 @@
|
|||
<div class="uk-text-muted">Partners</div>
|
||||
<div class="uk-margin-medium-bottom">
|
||||
<div class="uk-height-max-medium uk-overflow-auto">
|
||||
<span *ngFor="let organization of projectInfo.organizations.slice(0, showNumOrganizations) let i=index"
|
||||
<span
|
||||
*ngFor="let organization of projectInfo.organizations.slice(0, showNumOrganizations) let i=index"
|
||||
[attr.uk-tooltip]="organization.acronym && organization.name ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
||||
[title]="organization.name">
|
||||
<a *ngIf="organization.id"
|
||||
|
@ -459,9 +473,11 @@
|
|||
</span>
|
||||
<span *ngIf="(i < projectInfo.organizations.length-1)">, </span>
|
||||
</span>
|
||||
<span *ngIf="showNumOrganizations == thresholdOrganizations && projectInfo.organizations.length > thresholdOrganizations"> ... </span>
|
||||
<span
|
||||
*ngIf="showNumOrganizations == thresholdOrganizations && projectInfo.organizations.length > thresholdOrganizations"> ... </span>
|
||||
</div>
|
||||
<div *ngIf="showNumOrganizations == thresholdOrganizations && projectInfo.organizations.length > thresholdOrganizations"
|
||||
<div
|
||||
*ngIf="showNumOrganizations == thresholdOrganizations && projectInfo.organizations.length > thresholdOrganizations"
|
||||
class="uk-width-1-1 uk-text-right uk-margin-small-top">
|
||||
<a (click)="showNumOrganizations = projectInfo.organizations.length;">
|
||||
View all {{projectInfo.organizations.length | number}} organizations
|
||||
|
@ -553,6 +569,19 @@
|
|||
</div>
|
||||
<!-- </my-tab>-->
|
||||
</ng-template>
|
||||
<ng-template #dmps_tab>
|
||||
<div class="uk-padding">
|
||||
<div class="uk-alert uk-alert-primary uk-margin-top">
|
||||
<span *ngIf="fetchDmps.searchUtils.totalResults == 0">No Data Management Plans (DMPs) available. </span>
|
||||
<span>Link existing DMPs with this project or start a new DMP in <a href="https://argos.openaire.eu/splash/" target="_blank">Argos</a>.</span>
|
||||
</div>
|
||||
<search-tab [fetch]="fetchDmps" customTitle="Data Management Plans"
|
||||
[params]="getParamsForSearchLink('publications', 'Data Management Plan')"
|
||||
[searchLinkToAdvancedPage]="properties.searchLinkToAdvancedResults"
|
||||
[properties]="properties">
|
||||
</search-tab>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #statistics_tab>
|
||||
<!-- <my-tab *ngIf="(fetchPublications.searchUtils.totalResults > 0 || fetchDatasets.searchUtils.totalResults > 0-->
|
||||
<!-- || fetchSoftware.searchUtils.totalResults > 0 || fetchOrps.searchUtils.totalResults > 0)"-->
|
||||
|
@ -569,17 +598,23 @@
|
|||
|| fetchSoftware.searchUtils.status == errorCodes.DONE || fetchOrps.searchUtils.status == errorCodes.DONE)"
|
||||
class="uk-grid uk-child-width-1-1 uk-child-width-1-2@m">
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Produced research
|
||||
outcomes per year</div>
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Produced
|
||||
research
|
||||
outcomes per year
|
||||
</div>
|
||||
<i-frame [url]=chartScientificResultsUrl></i-frame>
|
||||
</div>
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Access mode of research
|
||||
outcomes</div>
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Access mode of
|
||||
research
|
||||
outcomes
|
||||
</div>
|
||||
<i-frame [url]=chartAccessModeUrl></i-frame>
|
||||
</div>
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research outcomes per datasource</div>
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research
|
||||
outcomes per datasource
|
||||
</div>
|
||||
<i-frame [url]=chartDatasourcesUrl></i-frame>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -625,6 +660,11 @@
|
|||
[tabId]="'other'">
|
||||
<ng-container *ngTemplateOutlet="other_tab;"></ng-container>
|
||||
</my-tab>
|
||||
<my-tab
|
||||
[tabTitle]="'Dmps'" [tabNumber]="fetchDmps.searchUtils.totalResults"
|
||||
[tabId]="'dmps'">
|
||||
<ng-container *ngTemplateOutlet="dmps_tab;"></ng-container>
|
||||
</my-tab>
|
||||
<!-- [class]="(firstTab === 'statistics')?'uk-active':''"-->
|
||||
<my-tab *ngIf="(fetchPublications.searchUtils.totalResults > 0 || fetchDatasets.searchUtils.totalResults > 0
|
||||
|| fetchSoftware.searchUtils.totalResults > 0 || fetchOrps.searchUtils.totalResults > 0)"
|
||||
|
@ -671,6 +711,11 @@
|
|||
[tabId]="'other'">
|
||||
<ng-container *ngTemplateOutlet="other_tab;"></ng-container>
|
||||
</my-tab>
|
||||
<my-tab
|
||||
[tabTitle]="'Dmps'" [tabNumber]="fetchDmps.searchUtils.totalResults"
|
||||
[tabId]="'dmps'">
|
||||
<ng-container *ngTemplateOutlet="dmps_tab;"></ng-container>
|
||||
</my-tab>
|
||||
<!-- [class]="(firstTab === 'statistics')?'uk-active':''"-->
|
||||
<my-tab *ngIf="(fetchPublications.searchUtils.totalResults > 0 || fetchDatasets.searchUtils.totalResults > 0
|
||||
|| fetchSoftware.searchUtils.totalResults > 0 || fetchOrps.searchUtils.totalResults > 0)"
|
||||
|
@ -690,7 +735,8 @@
|
|||
<!-- Last Index Info-->
|
||||
<div class="uk-width-2-3@m uk-width-1-2">
|
||||
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
|
||||
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
|
||||
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a
|
||||
href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
|
||||
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
|
||||
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
|
||||
</span>
|
||||
|
@ -729,16 +775,20 @@
|
|||
|| fetchSoftware.searchUtils.status == errorCodes.DONE || fetchOrps.searchUtils.status == errorCodes.DONE)">
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Produced research
|
||||
outcomes per year</div>
|
||||
outcomes per year
|
||||
</div>
|
||||
<i-frame [url]=chartScientificResultsUrl></i-frame>
|
||||
</div>
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Access mode of research
|
||||
outcomes</div>
|
||||
outcomes
|
||||
</div>
|
||||
<i-frame [url]=chartAccessModeUrl></i-frame>
|
||||
</div>
|
||||
<div class="uk-padding uk-padding-remove-top">
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research outcomes per datasource</div>
|
||||
<div *ngIf="!properties.useNewStatistisTool" class="uk-text-center uk-text-large">Research outcomes per
|
||||
datasource
|
||||
</div>
|
||||
<i-frame [url]=chartDatasourcesUrl></i-frame>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -86,6 +86,7 @@ export class ProjectComponent {
|
|||
private reloadDatasets: boolean = true;
|
||||
private reloadSoftware: boolean = true;
|
||||
private reloadOrps: boolean = true;
|
||||
private reloadDmps: boolean = true;
|
||||
|
||||
// Variables for entity selections on the right column
|
||||
public share_research_results_type: string = "results";
|
||||
|
@ -96,6 +97,7 @@ export class ProjectComponent {
|
|||
public fetchDatasets: FetchResearchResults;
|
||||
public fetchSoftware: FetchResearchResults;
|
||||
public fetchOrps: FetchResearchResults;
|
||||
public fetchDmps: FetchResearchResults;
|
||||
public searchNumber: number = 5;
|
||||
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
|
@ -159,7 +161,7 @@ export class ProjectComponent {
|
|||
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
||||
|
||||
this.fetchDmps = new FetchResearchResults(this._searchResearchResultsService);
|
||||
var title = "Project";
|
||||
var description = "";
|
||||
|
||||
|
@ -251,6 +253,7 @@ export class ProjectComponent {
|
|||
this.fetchDatasets.getNumForEntity("dataset", "project", this.projectId, this.properties);
|
||||
this.fetchSoftware.getNumForEntity("software", "project", this.projectId, this.properties);
|
||||
this.fetchOrps.getNumForEntity("other", "project", this.projectId, this.properties);
|
||||
this.searchDmps(1, this.searchNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +266,8 @@ export class ProjectComponent {
|
|||
this.fetchDatasets.clearSubscriptions();
|
||||
this.fetchPublications.clearSubscriptions();
|
||||
this.fetchSoftware.clearSubscriptions();
|
||||
this.fetchPublications.clearSubscriptions();
|
||||
this.fetchOrps.clearSubscriptions();
|
||||
this.fetchDmps.clearSubscriptions();
|
||||
}
|
||||
|
||||
private createClipboard() {
|
||||
|
@ -286,6 +290,17 @@ export class ProjectComponent {
|
|||
this.reloadPublications = false;
|
||||
}
|
||||
|
||||
public searchDmps(page: number, size: number) {
|
||||
if (this.reloadDmps &&
|
||||
(this.fetchDmps.searchUtils.status == this.errorCodes.LOADING ||
|
||||
(this.fetchDmps.searchUtils.status == this.errorCodes.DONE && this.fetchDmps.searchUtils.totalResults > 0)
|
||||
)
|
||||
) {
|
||||
this.fetchDmps.getDmps("project", this.projectId, page, size, this.properties);
|
||||
}
|
||||
this.reloadDmps = false;
|
||||
}
|
||||
|
||||
public searchDatasets(page: number, size: number) {
|
||||
if (this.reloadDatasets &&
|
||||
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
||||
|
@ -659,6 +674,9 @@ export class ProjectComponent {
|
|||
} else if (activeTabId == 'statistics') {
|
||||
this.activeTab = 'statistics';
|
||||
this.statsClicked = true;
|
||||
} else if (activeTabId == 'dmps') {
|
||||
this.activeTab = 'dmps';
|
||||
this.searchDmps(1, this.searchNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -747,9 +765,13 @@ export class ProjectComponent {
|
|||
HelperFunctions.scroll();
|
||||
}
|
||||
|
||||
public getParamsForSearchLink(type: string = "") {
|
||||
public getParamsForSearchLink(type: string = null, subtype: string = null) {
|
||||
if(type) {
|
||||
if(subtype) {
|
||||
return this.routerHelper.createQueryParams(['f0', 'fv0', 'type', 'instancetypename', 'qf', 'sortBy'], ['relprojectid', this.projectId, type, subtype, 'false', 'resultdateofacceptance,descending']);
|
||||
} else {
|
||||
return this.routerHelper.createQueryParams(['f0', 'fv0', 'type', 'qf', 'sortBy'], ['relprojectid', this.projectId, type, 'false', 'resultdateofacceptance,descending']);
|
||||
}
|
||||
} else {
|
||||
return this.routerHelper.createQueryParams(['f0', 'fv0'], ['relprojectid', this.projectId]);
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ export class SearchResearchResultsService {
|
|||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
}
|
||||
|
||||
advancedSearchResults(resultType: string, params: string, page: number, size: number, sortBy: string, properties: EnvProperties, refineParams: string = null, refineFields: string[] = null, refineQuery: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + "resources2/?format=json";
|
||||
if (params != null && params != '') {
|
||||
|
@ -148,6 +149,7 @@ export class SearchResearchResultsService {
|
|||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
}
|
||||
|
||||
//???? why different from above?
|
||||
searchForDataproviders(resultType: string, params: string, page: number, size: number, properties: EnvProperties): any {
|
||||
let link = properties.searchAPIURLLAst;
|
||||
|
@ -318,7 +320,11 @@ export class SearchResearchResultsService {
|
|||
for (let i = 0; i < length; i++) {
|
||||
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||
if (author) {
|
||||
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending};
|
||||
result['authors'][author.rank] = {
|
||||
"fullName": author.content,
|
||||
"orcid": author.orcid,
|
||||
"orcid_pending": author.orcid_pending
|
||||
};
|
||||
}
|
||||
}
|
||||
result.authors = result.authors.filter(function (item) {
|
||||
|
@ -361,15 +367,18 @@ export class SearchResearchResultsService {
|
|||
return results;
|
||||
}
|
||||
|
||||
parseProjects(projects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[], relation: any ) : {
|
||||
parseProjects(projects: {
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[] {
|
||||
"code": string
|
||||
}[], relation: any): {
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string
|
||||
}[] {
|
||||
if (projects == undefined) {
|
||||
projects = new Array<
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
projects = new Array<{
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string
|
||||
}>();
|
||||
|
@ -410,6 +419,7 @@ export class SearchResearchResultsService {
|
|||
|
||||
return projects;
|
||||
}
|
||||
|
||||
parseRefineResults(id: string, data: any): any {
|
||||
var results: any = [];
|
||||
if (data.hasOwnProperty("resulthostingdatasource")) {
|
||||
|
@ -442,6 +452,7 @@ export class SearchResearchResultsService {
|
|||
let url = properties.searchAPIURLLAst + parameters + "?format=json";
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
numOfResearchOutcomes(params: string, properties: EnvProperties, refineParams: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + "resources2/?format=json&size=0&type=results";
|
||||
if (params.length > 0) {
|
||||
|
@ -465,6 +476,7 @@ export class SearchResearchResultsService {
|
|||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
|
||||
numOfSearchResults(resultType: string, params: string, properties: EnvProperties, refineParams: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + this.getEntityName(resultType, true) + "/count?format=json";
|
||||
if (params.length > 0) {
|
||||
|
@ -486,6 +498,7 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
numOfSearchResultsLinkedToPub(resultType: string, properties: EnvProperties): any {
|
||||
let url = properties.searchAPIURLLAst + "resources?query=" + encodeURIComponent("( (oaftype exact result) and (resulttypeid exact " + resultType + ") and (relresulttype=publication) )") + "&page=0&size=0&format=json";
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
|
@ -496,6 +509,7 @@ export class SearchResearchResultsService {
|
|||
let url = properties.searchAPIURLLAst + this.getEntityName(resultType, true) + "/count?format=json" + refineParams;
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
/*
|
||||
private quote(word: any): string {
|
||||
return '"'+word+'"';
|
||||
|
|
|
@ -171,10 +171,52 @@ export class FetchResearchResults {
|
|||
}
|
||||
}
|
||||
|
||||
public getDmps(entity:string, id:string, page: number, size: number, properties:EnvProperties) {
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
let parameters = "";
|
||||
if(entity == "project") {
|
||||
parameters = '(relprojectid exact "'+id+'") and (instancetypename exact "Data Management Plan")';
|
||||
} else if(entity == "organization") {
|
||||
parameters = '(relorganizationid exact "'+id+'") and (instancetypename exact "Data Management Plan")';
|
||||
}
|
||||
if(parameters != "") {
|
||||
this.subscriptions.push(this._searchResearchResultsService.searchResultForEntity('publication', parameters, page, size, properties).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
this.results = data[1];
|
||||
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if (this.searchUtils.totalResults == 0) {
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
/*console.log(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.ERROR;
|
||||
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}*/
|
||||
this.handleError("Error getting dmps for " + entity + " with id: " + id, err);
|
||||
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public getResultsForEntity(resultType: string, entity:string, id:string, page: number, size: number, properties:EnvProperties){
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
var parameters = "";
|
||||
let parameters = "";
|
||||
if(entity == "project") {
|
||||
//parameters = "projects/"+id;
|
||||
parameters = '(relprojectid exact "'+id+'")';
|
||||
|
|
|
@ -5,12 +5,12 @@ import {ErrorCodes} from "../../properties/errorCodes";
|
|||
@Component({
|
||||
selector: 'search-tab',
|
||||
template: `
|
||||
<errorMessages [status]="[fetch.searchUtils.status]" [type]="getEntityName(resultType, true, true)"
|
||||
<errorMessages *ngIf="resultType" [status]="[fetch.searchUtils.status]" [type]="getEntityName(resultType, true, true)"
|
||||
tab_error_class=true></errorMessages>
|
||||
|
||||
<div *ngIf="fetch.searchUtils.status == errorCodes.DONE">
|
||||
<div class="tab-header">
|
||||
<span *ngIf="!customTitle"><span *ngIf="resultType != 'organization' && resultType != 'dataprovider' && resultType != 'project'">Recent</span>
|
||||
<span *ngIf="!customTitle && resultType"><span *ngIf="resultType != 'organization' && resultType != 'dataprovider' && resultType != 'project'">Recent</span>
|
||||
{{getEntityName(resultType, true, true)}}
|
||||
</span>
|
||||
<span *ngIf="customTitle">{{customTitle}}</span>
|
||||
|
|
Loading…
Reference in New Issue