[Trunk | Library]:

1. fetchResearchResults.class.ts & searchResearchResults.service.ts: Change queries when searching results of organizations/ projects/ dataproviders to sort by date (landing page tabs).
2. dataProvider.component & project.component: 
	a. Use <search-result> instead of <result-preview>.
	b. Add in "view all" link of search tabs parameter for sorting by date.
	c. [Bug fix] Show tabs loading only when tabs are not initialized (if not tabs, don't show loading forever).
3. project.component: 
	d. Make "#search_tab" template same as in "dataprovider.component" (will be possibly replaced by common component).
	e. In Deposit link use secondary button.
	f. In pie chart (in statistics), enable "dataLabels".


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58799 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-05-28 10:53:29 +00:00
parent 38584e213a
commit 8fdaac2d0d
8 changed files with 115 additions and 60 deletions

View File

@ -22,29 +22,29 @@
tab_error_class=true></errorMessages>
<div *ngIf="fetch.searchUtils.status == errorCodes.DONE">
<div *ngIf="fetch.searchUtils.totalResults > searchNumber" class="uk-inline uk-flex uk-flex-right">
<span class="uk-text-uppercase uk-position-left uk-text-middle uk-flex-middle uk-flex">
<span>Top {{searchNumber}}</span><span class="space uk-text-muted">{{getEntityName(type, true, true)}}</span>
</span>
<a [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
<button class="uk-button uk-button-small portal-button">
<span uk-icon="search"></span>
View all
</button>
<div class="tab-header">
<span *ngIf="type != 'organization' && type != 'dataprovider' && type != 'project'">Recent</span>
{{getEntityName(type, true, true)}}
</div>
<div class="uk-text-right">
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
View all {{getEntityName(type, true, true)}}
<span *ngIf="fetch.searchUtils.totalResults <= searchNumber">in search page</span>
</a>
</div>
<ul class="uk-list-divider uk-list uk-margin uk-margin-top">
<errorMessages [status]="[fetch.searchUtils.status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of fetch.results" class="uk-animation-fade">
<div>
<result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result, type)">
</result-preview>
</div>
</li>
</ul>
<search-result [properties]="properties"
[results]="fetch.results"
[status]="fetch.searchUtils.status"
[type]="type" urlParam="articleId">
</search-result>
<div class="uk-text-right">
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
View all {{getEntityName(type, true, true)}}
<span *ngIf="fetch.searchUtils.totalResults <= searchNumber">in search page</span>
</a>
</div>
</div>
</ng-template>
@ -810,7 +810,7 @@
</my-small-tabs>
</div>
<ng-template #loadingBlock>
<div class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<div *ngIf="!tabsAreInitialized" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center" ></span>
</div>
</ng-template>

View File

@ -376,7 +376,7 @@ export class DataProviderComponent {
// }
if(type) {
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1', 'type', 'qf'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId, type, "false"]);
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1', 'type', 'qf', 'sortBy'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId, type, "false", 'resultdateofacceptance,descending']);
} else {
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId]);
}

View File

@ -38,8 +38,9 @@ import {LandingHeaderModule} from "../landing-utils/landing-header/landing-heade
import {AlertModalModule} from "../../utils/modal/alertModal.module";
import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module";
import {FeedbackModule} from "../feedback/feedback.module";
import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
//import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
import {TabsModule} from "../../utils/tabs/tabs.module";
import {SearchResultsModule} from "../../searchPages/searchUtils/searchResults.module";
@NgModule({
imports:
@ -48,7 +49,7 @@ import {TabsModule} from "../../utils/tabs/tabs.module";
DataProvidersServiceModule, ProjectsServiceModule, SearchResearchResultsServiceModule,
PagingModule, Schema2jsonldModule, SEOServiceModule, ShowPublisherModule, HelperModule,
LandingHeaderModule, AlertModalModule, NoLoadPaging, FeedbackModule,
ResultPreviewModule, TabsModule
TabsModule, SearchResultsModule//, ResultPreviewModule
],
declarations:
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,

View File

@ -91,35 +91,60 @@
</div>
</ng-template>
<ng-template #search_tab let-fetch="fetch" let-type="type" let-urlParam="urlParam">
<ng-template #search_tab let-fetch="fetch" let-type="type" let-urlParam="urlParam"
let-searchLinkToAdvancedPage="searchLinkToAdvancedPage" let-params="params">
<errorMessages [status]="[fetch.searchUtils.status]" [type]="getEntityName(type, true, true)"
tab_error_class=true></errorMessages>
<div *ngIf="fetch.searchUtils.status == errorCodes.DONE">
<div *ngIf="fetch.searchUtils.totalResults > searchNumber" class="uk-inline uk-flex uk-flex-right">
<span class="uk-text-uppercase uk-position-left uk-text-middle uk-flex-middle uk-flex">
<span>Top {{searchNumber}}</span><span class="space uk-text-muted">{{getEntityName(type, true, true)}}</span>
</span>
<a [queryParams]="routerHelper.createQueryParams(['f0', 'fv0', 'type', 'qf'], ['relprojectid', projectId, getEntityName(type, true, false), 'false'])"
[routerLink]="properties.searchLinkToAdvancedResults">
<button class="uk-button uk-button-small portal-button">
<span uk-icon="search"></span>
View all
</button>
</a>
<!-- <div *ngIf="fetch.searchUtils.totalResults > searchNumber" class="uk-inline uk-flex uk-flex-right">-->
<!-- <span class="uk-text-uppercase uk-position-left uk-text-middle uk-flex-middle uk-flex">-->
<!-- <span>Top {{searchNumber}}</span><span class="space uk-text-muted">{{getEntityName(type, true, true)}}</span>-->
<!-- </span>-->
<!-- <a [queryParams]="routerHelper.createQueryParams(['f0', 'fv0', 'type', 'qf'], ['relprojectid', projectId, getEntityName(type, true, false), 'false'])"-->
<!-- [routerLink]="properties.searchLinkToAdvancedResults">-->
<!-- <button class="uk-button uk-button-small portal-button">-->
<!-- <span uk-icon="search"></span>-->
<!-- View all-->
<!-- </button>-->
<!-- </a>-->
<!-- </div>-->
<div class="tab-header">
<span *ngIf="type != 'organization' && type != 'dataprovider' && type != 'project'">Recent</span>
{{getEntityName(type, true, true)}}
</div>
<div class="uk-text-right">
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
View all {{getEntityName(type, true, true)}}
<span *ngIf="fetch.searchUtils.totalResults <= searchNumber">in search page</span>
</a>
</div>
<ul class="uk-list-divider uk-list uk-margin uk-margin-top">
<errorMessages [status]="[fetch.searchUtils.status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of fetch.results" class="uk-animation-fade">
<div>
<result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result, type)">
</result-preview>
</div>
</li>
</ul>
<!-- <ul class="uk-list-divider uk-list uk-margin uk-margin-top">-->
<!-- <errorMessages [status]="[fetch.searchUtils.status]" [type]="'results'"></errorMessages>-->
<!-- <li *ngFor="let result of fetch.results" class="uk-animation-fade">-->
<!-- <div>-->
<!-- <result-preview [properties]="properties" [showOrganizations]="true"-->
<!-- [showSubjects]="true" [result]="getResultPreview(result, type)">-->
<!-- </result-preview>-->
<!-- </div>-->
<!-- </li>-->
<!-- </ul>-->
<search-result [properties]="properties"
[results]="fetch.results"
[status]="fetch.searchUtils.status"
[type]="type" urlParam="articleId">
</search-result>
<div class="uk-text-right">
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
View all {{getEntityName(type, true, true)}}
<span *ngIf="fetch.searchUtils.totalResults <= searchNumber">in search page</span>
</a>
</div>
</div>
</ng-template>
@ -643,14 +668,14 @@
<li *ngIf="isRouteAvailable('participate/deposit/learn-how')">
<a class="uk-link-text uk-text-bold uk-text-uppercase"
routerLinkActive="router-link-active" routerLink="/participate/deposit/learn-how">
<span class="uk-icon uk-icon-button uk-button-primary">
<span class="uk-icon uk-icon-button uk-button-secondary">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1">
<polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline>
<rect x="3" y="17" width="13" height="1"></rect>
<line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line>
</svg>
</span>
<span class="uk-margin-small-left">Deposit your research</span>
<span class="uk-margin-small-left"><u>Deposit your research</u></span>
</a>
</li>
<li>
@ -895,7 +920,9 @@
<!-- </search-result>-->
<!-- </div>-->
<ng-container *ngTemplateOutlet="search_tab;
context: { fetch: fetchPublications, type: 'publication', urlParam: 'articleId'}">
context: { fetch: fetchPublications, type: 'publication', urlParam: 'articleId',
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('publications')}">
</ng-container>
</div>
@ -917,7 +944,9 @@
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<ng-container *ngTemplateOutlet="search_tab;
context: { fetch: fetchDatasets, type: 'dataset', urlParam: 'datasetId'}">
context: { fetch: fetchDatasets, type: 'dataset', urlParam: 'datasetId',
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('datasets')}">
</ng-container>
</div>
@ -931,7 +960,9 @@
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<ng-container *ngTemplateOutlet="search_tab;
context: { fetch: fetchSoftware, type: 'software', urlParam: 'softwareId'}">
context: { fetch: fetchSoftware, type: 'software', urlParam: 'softwareId',
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('software')}">
</ng-container>
</div>
@ -947,7 +978,9 @@
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<ng-container *ngTemplateOutlet="search_tab;
context: { fetch: fetchOrps, type: 'other', urlParam: 'orpId'}">
context: { fetch: fetchOrps, type: 'other', urlParam: 'orpId',
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('other')}">
</ng-container>
</div>
@ -1061,7 +1094,7 @@
</my-small-tabs>
</div>
<ng-template #loadingBlock>
<div class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<div *ngIf="!tabsAreInitialized" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center" ></span>
</div>
</ng-template>

View File

@ -427,7 +427,7 @@ export class ProjectComponent {
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"pie","query":{"name":"projOA","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Access mode of research outcomes"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Access mode"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
this.chartDatasourcesUrl = this.properties.statisticsFrameNewAPIURL +
'chart?json='+StringUtils.URIEncode(
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"bar","query":{"name":"projPubsRepos","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Research outcomes per datasource"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Datasource"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"bar","query":{"name":"projPubsRepos","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Research outcomes per datasource"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Datasource"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
} else {
this.chartScientificResultsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
this.chartAccessModeUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
@ -779,6 +779,14 @@ export class ProjectComponent {
HelperFunctions.scroll();
}
public getParamsForSearchLink(type: string = "") {
if(type) {
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]);
}
}
public get hasPrimaryInfo(): boolean {
return !!this.projectInfo && (
!!this.projectInfo.description

View File

@ -29,7 +29,7 @@ import {FeedbackModule} from "../feedback/feedback.module";
import {AltMetricsModule} from "../../utils/altmetrics.module";
import {TabsModule} from "../../utils/tabs/tabs.module";
import {SearchResultsModule} from "../../searchPages/searchUtils/searchResults.module";
import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
//import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
import {ModalSelectModule} from "../../utils/modal-select/modal-select.module";
@NgModule({
@ -40,7 +40,7 @@ import {ModalSelectModule} from "../../utils/modal-select/modal-select.module";
SearchResearchResultsServiceModule, ProjectServiceModule,
Schema2jsonldModule, SEOServiceModule, HelperModule,
LandingHeaderModule, MatSelectModule, FeedbackModule, AltMetricsModule,
TabsModule, ResultPreviewModule, ModalSelectModule
TabsModule, ModalSelectModule, SearchResultsModule//, ResultPreviewModule
],
declarations: [
ProjectComponent

View File

@ -130,7 +130,16 @@ export class SearchResearchResultsService {
searchResultForEntity (resultType:string, params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst;
let url = link+params+"/"+this.getEntityName(resultType,true)+ "?format=json";
//let url = link+params+"/"+this.getEntityName(resultType,true)+ "?format=json";
//url += "&page="+(page-1)+"&size="+size;
//url += "&sortBy=resultdateofacceptance,descending";
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityName(resultType,true);
let url = link+"/"+this.getEntityName(resultType,true);
url += "?format=json";
url += "&fq="+params;
url += "&sortBy=resultdateofacceptance,descending";
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
@ -139,7 +148,9 @@ export class SearchResearchResultsService {
//???? why different from above?
searchForDataproviders(resultType:string, params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst;
let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
let url = link+params;
url += "&sortBy=resultdateofacceptance,descending";
url += "&page="+(page-1)+"&size="+size + "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
}

View File

@ -139,9 +139,11 @@ export class FetchResearchResults {
var parameters = "";
if(entity == "project") {
parameters = "projects/"+id;
//parameters = "projects/"+id;
parameters = '(relprojectid exact "'+id+'")';
} else if(entity == "organization") {
parameters = "organizations/"+id;
//parameters = "organizations/"+id;
parameters = '(relorganizationid exact "'+id+'")';
}
if(parameters != "") {