[Library|Trunk]

- remove search table view
- preview result: support projects urls with funder and grant id
- Search page changes:
	-clean up variables about showing graph info
 	- add variable about download results

Comment unused components that import datatables



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60605 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-03-08 15:32:33 +00:00
parent 5791c1452a
commit 8f917a2e2e
11 changed files with 37 additions and 985 deletions

View File

@ -1,3 +1,4 @@
/*
import {Component, ViewChild, ViewChildren, QueryList, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Params, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
@ -116,10 +117,10 @@ export class ClaimsByTokenComponent {
} ],
"order": [[ 2, 'desc' ]]
//"pagingType": 'full_numbers',
/*"language": {
/!*"language": {
"search": "",
"searchPlaceholder": "Search projects..."
}*/
}*!/
};
this.dtOptions[1] = {
@ -164,18 +165,18 @@ export class ClaimsByTokenComponent {
});
}
/*
/!*
Trigger a table draw in order to get the initial filtering
*/
*!/
triggerInitialLoad(){
this.triggered = true;
//console.info("triggerInitialLoad");
setTimeout(function(){
/*var table1 = <any>$('#table1').DataTable();
/!*var table1 = <any>$('#table1').DataTable();
table1.page( 0 ).draw( false );
var table2 = <any>$('#table2').DataTable();
table2.page( 0 ).draw( false );*/
table2.page( 0 ).draw( false );*!/
}, 500);
setTimeout(() => {
this.dtTrigger[0].next();
@ -321,7 +322,7 @@ export class ClaimsByTokenComponent {
this.pending_status = this.errorMessages.getErrorCode(err.status);
this.curated_status = this.pending_status;
/*if(err.status == '404') {
/!*if(err.status == '404') {
this.pending_status = this.errorCodes.NOT_FOUND;
this.curated_status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
@ -330,7 +331,7 @@ export class ClaimsByTokenComponent {
} else {
this.pending_status = this.errorCodes.NOT_AVAILABLE;
this.curated_status = this.errorCodes.NOT_AVAILABLE;
}*/
}*!/
this.showTables = true;
if(!this.triggered) {
@ -408,11 +409,11 @@ export class ClaimsByTokenComponent {
isSelected(id:string, set:Set<string>) {
return set.has(id);
}
/*
/!*
isSelectedWrong(id:string) {
return this.selectedWrong.has(id);
}
*/
*!/
isRight_CuratedMode(claim: any) {
if(this.isSelected(claim.id, this.selectedRight_CuratedMode)) {
return true;
@ -570,3 +571,4 @@ export class ClaimsByTokenComponent {
console.error("Claims Project Manager Page: "+message, error);
}
}
*/

View File

@ -1,3 +1,4 @@
/*
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@ -41,3 +42,4 @@ import {ErrorMessagesModule} from '../../utils/errorMessages.module';
]
})
export class ClaimsByTokenModule { }
*/

View File

@ -13,7 +13,7 @@
<icon name="arrow_left"></icon>
</span>
<span class="space">
Go back to pages list
Back to pages list
</span>
</a>
</div>

View File

@ -319,9 +319,7 @@
[isDisabled]="disableForms || disableRefineForms">
</search-sorting>
</div>
<!-- uk-flex uk-flex-middle-->
<div class="uk-width-auto@m uk-margin-small-bottom">
<!-- !showUnknownFilters && (searchUtils.totalResults > 0 || !loadPaging)-->
<div *ngIf="showDownload" class="uk-width-auto@m uk-margin-small-bottom">
<search-download
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[isDisabled]="disableForms || disableRefineForms"
@ -329,15 +327,6 @@
[piwikSiteId]="piwikSiteId">
</search-download>
<!--<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-link-text uk-margin-small-left'"
[routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
Table view
</a>
&lt;!&ndash; <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>&ndash;&gt;
</span>-->
</div>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"
@ -346,12 +335,6 @@
[isDisabled]="disableForms || disableRefineForms">
</search-paging>
</div>
<!-- <search-download *ngIf= "( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"-->
<!-- class="uk-width-1-1@s uk-hidden@m"-->
<!-- [isDisabled]="disableForms"-->
<!-- [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
<!-- </search-download>-->
<div *ngIf="(searchUtils.page <= pagingLimit) || (searchUtils.totalResults <= searchUtils.size*pagingLimit)" class="uk-margin-large-bottom">
<search-result *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[results]="results"
@ -400,8 +383,8 @@
[isDisabled]="disableForms || disableRefineForms">
</search-paging>
</div>
<div *ngIf=" searchUtils.status !==
errorCodes.LOADING && !(entityType == 'community' || entityType == 'stakeholder')" class="uk-margin-small-top uk-grid uk-child-width-1-2">
<div *ngIf=" showIndexInfo && searchUtils.status !== errorCodes.LOADING"
class="uk-margin-small-top uk-grid uk-child-width-1-2">
<!-- Last Index Info-->
<div class="">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
@ -409,12 +392,12 @@
</div>
<div class="uk-text-right">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
<a *ngIf="properties.showLastIndexInformationLink && lastIndex"
<a *ngIf="properties.showLastIndexInformationLink"
class="uk-link"
[href]="properties.lastIndexInformationLink" target="_blank">
Last update
</a><span *ngIf="!(properties.showLastIndexInformationLink && lastIndex) ">
</a><span *ngIf="!(properties.showLastIndexInformationLink) ">
Last update
</span>
of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
@ -423,12 +406,6 @@
</div>
</div>
<!-- </ng-template>-->
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
<!-- <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
<!-- </div>-->
<!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
<!-- </div>-->
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
[texts]="pageContents['bottom']"></helper>

View File

@ -74,7 +74,7 @@ export class NewSearchPageComponent {
@Input() tableViewLink: string;
@Input() usedBy: string = "search";
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@Input() showLastIndex: boolean = true;
@Input() showIndexInfo: boolean = true;
@Input() showResultCount: boolean = true;
@Input() showMoreFilterValuesInline: boolean = true;
@Input() filterValuesNum: number = 6;
@ -88,7 +88,7 @@ export class NewSearchPageComponent {
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
@Input() includeOnlyResultsAndFilter:boolean = false;
@Input() showBreadcrumb:boolean = false;
@Input() lastIndex: boolean = true;
@Input() showDownload: boolean = true;
public dashboard: boolean = properties.isDashboard;
subscriptions = [];

View File

@ -9,7 +9,6 @@ import {
} from '@angular/core';
import { Filter, Value} from './searchHelperClasses.class';
import {ActivatedRoute, Router} from "@angular/router";
import {properties} from "../../../../environments/environment";
import 'rxjs/add/operator/filter';
@Component({
selector: 'search-filter',

View File

@ -1,304 +0,0 @@
<ng-template #filters_column>
<div *ngIf="filters.length > 0" class=" search-filters ">
<div *ngIf="filters.length > 0">
<div class="uk-grid uk-flex uk-flex-bottom">
<h6 class="uk-text-bold">Filters</h6>
<a *ngIf="countFilters()>1" (click)="clearFilters()"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
</div>
<div *ngIf="countFilters()>0" class="uk-grid uk-grid-small uk-text-small uk-margin-medium-bottom" uk-grid>
<ng-container *ngFor="let filter of filters " >
<ng-container *ngIf = "filter.countSelectedValues > 0">
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "
[title]="'Remove '+value.name" (click) = "removeFilter(value, filter) " >
<!-- if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span -->
<span class="selectedFilterLabel ">
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left" [innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>
</a>
</span>
</span>
</ng-container>
</ng-container>
</div>
</div>
<div class="uk-margin-top">
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
</div>
</div>
</ng-template>
<ng-template #paging>
<div *ngIf="searchUtils.totalResults > 0" >
<div class= "paging-hr searchPaging uk-margin-small-bottom"
*ngIf="(results && searchUtils.totalResults > 0) || (searchUtils.status == errorCodes.LOADING)">
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle">
<div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase"
*ngIf="results && searchUtils.totalResults > 0">
<span class="uk-text-bold">{{searchUtils.totalResults|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
<span class="uk-text-bold">{{searchUtils.page | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span>
<span class="uk-text-bold">{{(totalPages()|number)}}</span>
</div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand" *ngIf=" searchUtils.status != errorCodes.LOADING">
<paging-no-load [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="searchUtils.size" (pageChange)="goTo($event.value)"></paging-no-load>
</div>
</div>
</div>
</div>
</ng-template>
<div *ngIf="!includeOnlyResultsAndFilter"
[class]=" (!customFilter || customFilter.queryFieldName != 'communityId') ?
' image-front-topbar uk-section-default uk-position-relative ' :
(' uk-padding-remove-bottom uk-padding-remove-top ')"
class="image-front-topbar uk-section-default uk-position-relative"
uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
<div style=" min-height: 220px; "
[class]="' uk-background-norepeat uk-background-cover uk-background-bottom-center uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed '+searchFormClass">
<div [class]="(!customFilter || customFilter.queryFieldName != 'communityId')?'uk-position-cover':''" ></div>
<div class="uk-width-1-1">
<breadcrumbs *ngIf="showBreadcrumb && !includeOnlyResultsAndFilter"
addClass=" uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top" [breadcrumbs]="breadcrumbs"></breadcrumbs>
<div class="uk-position-relative">
<div class="uk-container ">
<div class="uk-width-1-1">
<!-- <search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)" [placeholderText]="formPlaceholderText"></search-form>-->
<form class=" uk-margin uk-margin-top ">
<div class="uk-grid uk-margin-small-left">
<div *ngIf="enableEntitySelection" class="uk-margin-small-top uk-padding-remove-left">
<entities-selection [simpleView]="true" [currentEntity]="entityType"
[properties]="properties" [onChangeNavigate]="true" [customFilter]="customFilter"
></entities-selection>
</div>
<div class=" uk-padding-remove-left uk-margin-small-top" >
<div class="uk-inline">
<a *ngIf="searchUtils.keyword.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="searchUtils.keyword = ''; goTo(1);"
uk-icon="icon: close"></a>
<input type="text" class="uk-input uk-width-xlarge@l uk-width-large@m uk-width-medium"
[placeholder]="formPlaceholderText"
[(ngModel)]="searchUtils.keyword"
name="keyword">
</div>
</div>
<div class="uk-padding-remove-left uk-margin-small-top">
<button (click)="goTo(1)" type="submit"
class="uk-button portal-button uk-text-bold uk-padding uk-padding-remove-vertical uk-margin-small-left">
Search
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<schema2jsonld *ngIf="url" [URL]="url" type="search" [name]=pageTitle [searchAction]=false></schema2jsonld>
<div id="tm-main" class=" uk-section uk-padding-remove-top tm-middle " >
<div uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<breadcrumbs *ngIf="showBreadcrumb && includeOnlyResultsAndFilter"
addClass="uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top" [breadcrumbs]="breadcrumbs"></breadcrumbs>
<div class="uk-container uk-container-large">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<div class="uk-width-2-3@m uk-width-2-3@l uk-width-1-1@s">
<div *ngIf="filters.length > 0" class="uk-offcanvas-content uk-hidden@m">
<a href="#offcanvas-usage" uk-toggle>
<span class="uk-icon uk-margin-small-right uk-margin-small-left">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="settings">
<ellipse fill="none" stroke="#000" cx="6.11" cy="3.55" rx="2.11" ry="2.15"></ellipse>
<ellipse fill="none" stroke="#000" cx="6.11" cy="15.55" rx="2.11" ry="2.15"></ellipse>
<circle fill="none" stroke="#000" cx="13.15" cy="9.55" r="2.15"></circle>
<rect x="1" y="3" width="3" height="1"></rect>
<rect x="10" y="3" width="8" height="1"></rect>
<rect x="1" y="9" width="8" height="1"></rect>
<rect x="15" y="9" width="3" height="1"></rect>
<rect x="1" y="15" width="3" height="1"></rect>
<rect x="10" y="15" width="8" height="1"></rect>
</svg>
</span>
<span>Filters <span *ngIf="countFilters()>1">({{(countFilters())}})</span></span>
</a>
<div id="offcanvas-usage" uk-offcanvas overlay style="z-index:10000;">
<div class="uk-offcanvas-bar offcanvas-white">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
</div>
</div>
</div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-top">
<div *ngIf="filters.length > 0" class="uk-width-1-5@m search-filters uk-visible@m ">
<ng-container *ngTemplateOutlet="filters_column; context: {}" class=""></ng-container>
</div>
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" >
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !disableForms )"
class="uk-alert uk-text-center uk-margin-small-top ">
<span *ngIf="customFilter">The following results are related to <span class="portal-color"
>{{customFilter.valueName}}</span>.</span>
Are you interested to view more results? Visit
<a
class="uk-margin-top uk-link"
[href]="openaireLink"
target="_blank"> OpenAIRE - Explore</a>.
</div>
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom ">
<div class="uk-grid">
<div class="uk-width-expand@m uk-grid uk-grid-medium uk-margin-small-bottom">
<search-results-per-page class="uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>
</div>
<div class="uk-flex uk-flex-middle uk-width-auto@m uk-margin-small-bottom">
<span *ngIf="searchViewLink" class="uk-width-expand">
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="((disableForms
&& !enableSearchView)?'uk-disabled uk-link-muted':'') +'uk-link-text'"
[routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
List view
</a>
</span>
</div>
</div>
<ng-container *ngTemplateOutlet="paging; context: {}"></ng-container>
</div>
<!-- <div *ngIf="searchViewLink" class="uk-width-1-1@s uk-hidden@m">
<p>
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
</p>
</div> -->
<div *ngIf="searchUtils.totalResults <= 0" class="errors-in-searchTableView">
<errorMessages [status]="[searchUtils.status]" [type]="'results'"></errorMessages>
</div>
<div *ngIf="searchUtils.status == errorCodes.LOADING || searchUtils.status == errorCodes.DONE" class="uk-overflow-auto">
<!-- #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[mfData]="results | contentProvidersDatatable : [searchUtils, filters, triggerPipe, cd]"
-->
<table datatable class="uk-table uk-table-striped divider-table" [dtOptions]="dtOptions" id="dpTable" [dtTrigger]="dtTrigger" dtInstance="dtInstanceCallback">
<thead >
<tr>
<th *ngFor="let column of columnNames" class="uk-text-center">{{column}}</th>
</tr>
</thead>
<tbody>
<tr class="uk-table-middle" *ngFor="let result of results">
<td *ngIf="result.hasOwnProperty('title')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<a [queryParams]="{datasourceId: result.id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
<span *ngIf="result.title.name"
[innerHTML]="result.title.name">
</span>
<span *ngIf="!result.title.name">
[no title available]
</span>
</a>
</td>
<td *ngIf="result.hasOwnProperty('type')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngIf="result.type">{{result.type}}</span>
<span *ngIf="!result.type">-</span>
</td>
<td *ngIf="result.hasOwnProperty('countries')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngFor="let country of result['countries'].slice(0,5) let i = index">{{country}}{{(i < ( result['countries'].slice(0,5).length-1))?", ":""}}{{(i == result['countries'].slice(0,5).length-1 && result['countries'].length > 5)?"...":""}}</span>
<span *ngIf="result.countries.length == 0">-</span>
</td>
<td *ngIf="result.hasOwnProperty('organizations')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngFor="let org of result['organizations'].slice(0,5) let i = index">
<a *ngIf="org.id" [queryParams]="{organizationId: org.id}" routerLinkActive="router-link-active" routerLink="/search/organization">{{org.name}}</a><span *ngIf="!org.id">{{org.name}}</span>{{(i < ( result['organizations'].slice(0,5).length-1))?", ":""}}{{(i == result['organizations'].slice(0,5).length-1 && result['organizations'].length > 5)?"...":""}}
</span>
<span *ngIf="result.organizations.length == 0">-</span>
</td>
<td *ngIf="result.hasOwnProperty('compatibility')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngIf="result.compatibility">{{result.compatibility}}</span>
<span *ngIf="!result.compatibility">-</span>
</td>
<!--Community Projects-->
<td *ngIf="result.hasOwnProperty('acronym') && result.hasOwnProperty('name')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<a [queryParams]="(result.openaireId) ? {projectId: result.openaireId} : {grantId: encode(result.grantId), funder: encode(result.funder)}"
routerLinkActive="router-link-active" routerLink="/search/project">
<span *ngIf="result.name">{{result.name}}</span>
<span *ngIf="result.name && result.acronym">(</span
><span *ngIf="result.acronym">{{result.acronym}}</span
><span *ngIf="result.name && result.acronym">)</span>
<span *ngIf="!result.name && !result.acronym">[no title available]</span>
</a>
</td>
<td *ngIf="result.hasOwnProperty('grantId')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngIf="result.grantId">{{result.grantId}}</span>
<span *ngIf="!result.grantId">-</span>
</td>
<td *ngIf="result.hasOwnProperty('funder')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngIf="result.funder">{{result.funder}}</span>
<span *ngIf="!result.funder">-</span>
</td>
<!--Community Content Providers-->
<td *ngIf="!result.hasOwnProperty('acronym') && result.hasOwnProperty('name')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<a [queryParams]="{datasourceId: result.openaireId}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
<span *ngIf="result.name">{{result.name}}</span>
<span *ngIf="!result.name">[no name available]</span>
</a>
</td>
<td *ngIf="result.hasOwnProperty('officialname')" [class]="'uk-text-center uk-width-1-'+columnNames.length">
<span *ngIf="result.officialname">{{result.officialname}}</span>
<span *ngIf="!result.officialname">-</span>
</td>
</tr>
</tbody>
<!-- <thead *ngIf="searchUtils.totalResults > 0">
<tr><td colspan="5" class="uk-padding-remove-horizontal">
<span class="uk-h6">
{{searchUtils.totalResults}} content providers, page {{searchUtils.page}} of {{(totalPages())}}
</span>
<paging-no-load class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="rowsOnPage" (pageChange)="goTo($event.value, false)"></paging-no-load>
</td></tr>
</thead> -->
</table>
</div>
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<ng-container *ngTemplateOutlet="paging; context: {}"></ng-container>
</div>
<!--<a *ngIf="properties.showLastIndexInformationLink" class="last_index_info uk-button-text uk-button"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>-->
</div>
</div>
</div>
<modal-search-filter [filter]="currentFilter" [showResultCount]=showResultCount (modalChange)="filterChanged($event)"></modal-search-filter>
</div>
</div>
</div>

View File

@ -1,588 +0,0 @@
import {Component, Input} from '@angular/core';
import {ViewChild} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
import {OnInit, AfterViewInit} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {Subject, Subscriber} from 'rxjs';
import {DataTableDirective } from 'angular-datatables';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Filter, Value} from './searchHelperClasses.class';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils.class';
import {StringUtils} from '../../utils/string-utils.class';
import {ModalLoading} from '../../utils/modal/loading.component';
import {SearchFilterModalComponent} from './searchFilterModal.component';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {PiwikService} from '../../utils/piwik/piwik.service';
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
import {HelperService} from "../../utils/helper/helper.service";
import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'search-page-table',
templateUrl:'searchPageTableView.component.html',
styles: [`
#dpTable_info, #dpTable_paginate, #dpTable_length, #dpTable_filter{
display: none;
}
`],
encapsulation: ViewEncapsulation.None // this used in order styles to work
})
export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
@Input() piwikSiteId = null;
@Input() hasPrefix: boolean = true;
@Input() pageTitle = "";
@Input() results;
@Input() filters = [];
@Input() columnNames = [];
@Input() type:string = "";
@Input() entityType: string = "";
@Input() searchUtils:SearchUtilsClass;// = new SearchUtilsClass();
//@Output() downloadClick = new EventEmitter();
@Input() showResultCount:boolean = true;
@Input() showRefine:boolean = true;
@Input() refineFields = [];
//@Input() csvParams: string;
//@Input() csvPath: string;
@Input() openaireLink: string;
@Input() searchViewLink: string;
@Input() disableForms: boolean = false;
@Input() enableSearchView: boolean = true;
@Input() searchFormClass: string = "searchForm";
@Input() formPlaceholderText = "Type Keywords...";
@Input() mapUrl: string = "";
@Input() mapTooltipType: string ="content providers";
@ViewChild (ModalLoading) loading : ModalLoading ;
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
public parameterNames:string[] =[];
public parameterValues:string[] =[];
public isPiwikEnabled;
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
public currentFilter: Filter;
public errorCodes:ErrorCodes = new ErrorCodes();
subscriptions = [];
dtOptions: DataTables.Settings = {};
showTable = false; filteringAdded = false;
@ViewChild(DataTableDirective) datatableElement: DataTableDirective;
dtTrigger: Subject<any> = new Subject(); //necessary
properties:EnvProperties;
url = null;
public pageContents = null;
@Input() customFilter: SearchCustomFilter = null;
@Input() enableEntitySelection: boolean = false;
@Input() includeOnlyResultsAndFilter:boolean = false;
@Input() showBreadcrumb:boolean = false;
breadcrumbs:Breadcrumb[] = [];
constructor (private route: ActivatedRoute,
private router: Router,
private location: Location,
private _meta: Meta,
private _title: Title,
private _piwikService:PiwikService,
private seoService: SEOService,
private helper: HelperService) { }
ngOnInit() {
this.properties = properties;
this.getPageContents();
this.isPiwikEnabled =this.properties.enablePiwikTrack;
if(typeof window !== 'undefined') {
this.updateUrl(this.properties.domain+this.properties.baseLink+location.pathname);
this.url =this.properties.domain+this.properties.baseLink+location.pathname;
}
if(typeof document !== 'undefined' && this.isPiwikEnabled){
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe());
}
this.dtOptions = {
"paging": true,
"searching": false,
"lengthChange": false,
"pageLength": this.searchUtils.size
};
this.updateTitle(this.pageTitle);
var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle;
this.updateDescription(description);
this.seoService.createLinkForCanonicalURL(this.properties.domain+ this.properties.baseLink +this.router.url,false);
this.breadcrumbs.push({name: 'home', route: '/'}, {name: this.pageTitle, route: null});
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
try{
$.fn['dataTable'].ext.search.pop();
}catch(e){
console.error("An error occured in ngOnDestroy of SearchPageTableViewComponent ", e)
}
}
ngAfterViewInit(): void {
try{
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
//console.info(dataIndex+": "+data);
//console.info(this.results);
//if (this.filterData(this.results[dataIndex], this.searchUtils.keyword, this.filters)) {
if(this.filterAll(this.results[dataIndex], this.searchUtils.keyword.toLowerCase(),this.filters)) {
// console.info("filter true (keyword:"+this.searchUtils.keyword+")");
return true;
}
// console.info("filter false (keyword:"+this.searchUtils.keyword+")");
return false;
});
}catch(e){
console.error("An error occured in ngAfterViewInit of SearchPageTableViewComponent ", e)
}
}
totalPages(): number {
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
toggleModal($event) {
this.currentFilter = $event.value;
this.searchFilterModal.open();
}
updateDescription(description:string) {
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
}
updateTitle(title:string) {
var _prefix: string = "";
if(this.hasPrefix) {
_prefix = "OpenAIRE | ";
}
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
this._title.setTitle(_title);
this._meta.updateTag({content:_title},"property='og:title'");
}
updateUrl(url:string) {
this._meta.updateTag({content:url},"property='og:url'");
}
public getParametersFromUrl(params) {
for(var i=0; i< this.refineFields.length ; i++) {
var filterId = this.refineFields[i];
if(params[filterId] != undefined) {
if(this.queryParameters == undefined){
this.queryParameters = new Map<string,string>();
}
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
}
}
}
/*
* Mark as check the new filters that are selected, when you get them from search
*/
public checkSelectedFilters(filters:Filter[]){
this.filters = filters;
for(var i=0; i< filters.length ; i++){
var filter:Filter = filters[i];
filter.countSelectedValues = 0;
if(this.queryParameters[filter.filterId] != undefined) {
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
for(let filterValue of filter.values) {
if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
filterValue.selected = true;
filter.countSelectedValues++;
}else{
filterValue.selected = false;
}
}
}else{
for(let filterValue of filter.values) {
filterValue.selected = false;
}
}
}
return filters;
}
/*
*
*/
private createUrlParameters(filters:Filter[], includePage:boolean){
var allLimits="";//location.search.slice(1);
this.parameterNames.splice(0,this.parameterNames.length);
this.parameterValues.splice(0,this.parameterValues.length);
for (let filter of filters){
var filterLimits="";
if(filter.countSelectedValues > 0){
for (let value of filter.values){
if(value.selected == true){
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
}
}
this.queryParameters[filter.filterId]=filterLimits;
if(filterLimits.length > 0){
this.parameterNames.push(filter.filterId);
this.parameterValues.push(filterLimits);
}
allLimits+=(allLimits.length==0?"?":"&")+((filterLimits.length == 0 )?'':filter.filterId + '='+ filterLimits) ;
}
}
if(this.searchUtils.keyword.length > 0 ){
allLimits+=(allLimits.length==0?"?":"&")+'fv0=' + this.searchUtils.keyword;
this.parameterNames.push("fv0");
this.parameterValues.push(this.searchUtils.keyword);
}
return allLimits;
}
public isFiltered(){
var filtered=false;
for (let filter of this.filters){
if(filter.countSelectedValues > 0){
filtered = true;
break;
}
}
if(this.searchUtils.keyword.length > 0 ){
filtered = true;
}
return filtered;
}
private clearKeywords(){
if(this.searchUtils.keyword.length > 0 ){
this.searchUtils.keyword ='';
}
this.goTo(1);
}
private clearFilters(){
for (var i =0 ; i < this.filters.length; i++) {
for (var j=0; j < this.filters[i].values.length; j++) {
if(this.filters[i].values[j].selected) {
this.filters[i].values[j].selected = false;
}
}
this.filters[i].countSelectedValues = 0;
}
}
private removeFilter(value:Value,filter:Filter){
filter.countSelectedValues--;
if(value.selected == true){
value.selected = false;
}
this.goTo(1);
}
goTo(page:number = 1){
this.searchUtils.page=page;
var table = $('#dpTable').DataTable();
table.page( page - 1 ).draw( false );
// Object { page: 0, pages: 3, start: 0, end: 10, length: 10, recordsTotal: 28, recordsDisplay: 21, serverSide: false }
var info = table.page.info();
this.searchUtils.totalResults = info.recordsDisplay;
var urlParameters = this.createUrlParameters(this.filters,true);
this.location.go(location.pathname,urlParameters);
}
filterChanged($event){
this.goTo(1);
}
keywordChanged($event) {
this.searchUtils.keyword = $event.value;
this.goTo(1);
}
sizeChanged($event) {
this.searchUtils.size = $event;
var table = $('#dpTable').DataTable();
table.page.len( this.searchUtils.size ).draw();
this.goTo(1);
}
/*
downloadClicked($event) {
if($event.value == true) {
var queryParameters = this.createSearchQueryParameters(this.filters);
this.downloadClick.emit({
value: queryParameters
});
}
}
*/
getSelectedValues(filter):any{
var selected = [];
if(filter.countSelectedValues >0){
for (var i=0; i < filter.values.length; i++){
if(filter.values[i].selected){
selected.push(filter.values[i]);
}
}
}
return selected;
}
/*
Trigger a table draw in order to get the initial filtering
*/
triggerInitialLoad(){
setTimeout(function(){
var table = $('#dpTable').DataTable();
table.page( 0 ).draw( false );
}, 500);
}
/*
Transform initial - not filtered results to get the filtered number
*/
transform(results, searchUtils:SearchUtilsClass = null ): any {
if(searchUtils!=null) {
this.searchUtils = searchUtils;
}
if(results.length > 0) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
var result = results.filter(row=>this.filterAll(row, this.searchUtils.keyword.toLowerCase(),this.filters));
let oldTotal = this.searchUtils.totalResults;
//console.info(result);
this.searchUtils.totalResults = result.length;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
//this.searchUtils.status = errorCodes.NONE;
}
// if(oldTotal != this.searchUtils.totalResults) {
// args[3].detectChanges();
// }
return result;
}
return [];
}
filterAll(row: any, query: string, filters:Filter[]) {
let returnValue: boolean = false;
if(query) {
if(row.title && row.title.name.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.type && row.type.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.countries && row.countries.length > 0) {
for(let country of row.countries) {
if(country.toLowerCase().indexOf(query) > -1) {
returnValue = true;
break;
}
}
}
if(row.compatibility && row.compatibility.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.organizations && row.organizations.length > 0) {
for(let organization of row.organizations) {
if(organization.name.toLowerCase().indexOf(query) > -1) {
returnValue = true;
break;
}
}
}
if(row.name && row.name.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.acronym && row.acronym.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.grantId && row.grantId.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(row.funder && row.funder.toLowerCase().indexOf(query) > -1) {
returnValue = true;
}
if(!returnValue) {
return false;
}
}
for (let filter of filters){
if(filter.countSelectedValues > 0){
for (let value of filter.values){
if(value.selected == true){
// make it generic in future commit
let field:string = "";
/*
let index: number = -1;
for(let i=0; i<this.columnNames.length; i++) {
if(filter.title == this.columnNames[i]) {
index = i;
}
}
*/
if(filter.title == "Type") {
field = "type";
} else if(filter.title == "Compatibility") {
field = "compatibility";
} else if(filter.title == "Funder") {
field = "funder";
} else if(filter.title == "Country") {
field = "countries";
}
//console.info(row);
//console.info("|"+row[field]+"|"+" "+"|"+value.name+"|");
//if(row[field] == value.name) {
if(row[field] &&
((filter.valueIsExact && (row[field].trim() == value.name.trim()))
|| (!filter.valueIsExact && (row[field].includes(value.name))))){
returnValue = true;
if(filter.filterOperator == "or") {
break;
}
} else {
if(filter.filterOperator == "and") {
return false;
}
returnValue = false;
}
}
}
if(!returnValue) {
return false;
}
}
}
return true;
}
filterQuery(data, query){
if(data.toLowerCase().indexOf(query.toLowerCase()) > -1){
return true;
}else{
return false;
}
}
filterData(row: any, query: string, filters:Filter[]) {
let returnValue: boolean = false;
if(query) {
for(var i=0; i <this.columnNames.length; i++){
var r= this.filterQuery(row[i], query);
// console.log(query+" "+ row+" "+r);
if(r) {
returnValue = true;
break;
}
}
if(!returnValue) {
return false;
}
}
for (let filter of filters){
if(filter.countSelectedValues > 0){
for (let value of filter.values){
if(value.selected == true){
let field = 1;
/*if(filter.title == "Type") {
field = 1;
} else if(filter.title == "Compatibility Level") {
field = 4;
} else if(filter.title == "Funder") {
field = 3
}*/
for(let i=0; i<this.columnNames.length; i++) {
if(filter.title == this.columnNames[i]) {
field = i;
}
}
//if(row[field].trim() == value.name.trim()) {
if((filter.valueIsExact && (row[field].trim() == value.name.trim()))
|| (!filter.valueIsExact && (row[field].includes(value.name)))){
returnValue = true;
if(filter.filterOperator == "or") {
break;
}
} else {
if(filter.filterOperator == "and") {
return false;
}
returnValue = false;
}
}
}
if(!returnValue) {
return false;
}
}
}
return true;
}
public encode(param: string): string {
return StringUtils.URIEncode(param);
}
public countFilters():number{
var filters=0;
for (let filter of this.filters){
if(filter.countSelectedValues > 0){
filters+=filter.countSelectedValues;
}
}
return filters;
}
private getPageContents() {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : null, this.router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
}

View File

@ -1,49 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import{SearchPageTableViewComponent} from './searchPageTableView.component';
import{SearchFormModule} from './searchForm.module';
import{SearchResultsModule} from './searchResults.module';
import {SearchFilterModule} from './searchFilter.module';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import{SearchPagingModule} from './searchPaging.module';
import {SearchDownloadModule} from './searchDownload.module';
import {ModalModule} from '../../utils/modal/modal.module';
import {PagingModule} from '../../utils/paging.module';
import {SearchResultsPerPageModule} from './searchResultsPerPage.module';
import {DataTablesModule} from 'angular-datatables';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {HelperModule} from '../../utils/helper/helper.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {AdvancedSearchFormModule} from "./advancedSearchForm.module";
import {EntitiesSelectionModule} from "./entitiesSelection.module";
import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule,
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule,
DataTablesModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule,
Schema2jsonldModule, SEOServiceModule, SearchResultsPerPageModule, AdvancedSearchFormModule, EntitiesSelectionModule, BreadcrumbsModule
],
declarations: [
SearchPageTableViewComponent
],
providers:[
PreviousRouteRecorder
],
exports: [
SearchPageTableViewComponent
]
})
export class SearchPageTableViewModule { }

View File

@ -23,7 +23,7 @@
<div class="uk-margin-small-bottom">
<h6 class="uk-margin-remove">
<a *ngIf="result.id && !(result.resultType == 'dataprovider' && result.compatibilityUNKNOWN) "
(click)="onClick()" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)"
(click)="onClick()" [queryParams]="createParam()"
[routerLink]="url" class="uk-link uk-width-expand">
<div *ngIf="(result.title) || result.acronym">
<span *ngIf="result.acronym">

View File

@ -42,7 +42,12 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
this.urlParam = "orpId";
this.url = properties.searchLinkToOrp.split('?')[0];
} else if (this.result.resultType == "project") {
this.urlParam = "projectId";
if(this.result.id) {
this.urlParam = "projectId";
}else if(this.result.code && this.result.funderShortname){
this.result.id = this.result.code;
this.urlParam = "grantId";
}
this.url = properties.searchLinkToProject.split('?')[0];
} else if (this.result.resultType == "organization") {
this.urlParam = "organizationId";
@ -140,4 +145,12 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
this.modal.cancel();
}
}
createParam(){
if(this.urlParam == "grantId" ){
return this.routerHelper.createQueryParams([this.urlParam,"funder"],[this.result.id,this.result.funderShortname])
}
return this.routerHelper.createQueryParam(this.urlParam,this.result.id)
}
}