[Trunk|Library]: 1. Create Community Search Results

2. Add in Search Page  a new method for query params and lastIndex parameter with default value true 
3. Add a new sorting field for communities in search sorting 
4. Add parameter to modal-alert for position of okButton
5. Add COMMUNITIES_SEARCH_FIELDS in searchFields and searchLinkToCommunities in properties

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55209 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-04-05 17:21:23 +00:00
parent 0095d9c832
commit 2eef731273
15 changed files with 211 additions and 206 deletions

View File

@ -0,0 +1,39 @@
<ul [class]="'uk-list uk-list-divider uk-margin ' + custom_class">
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of results" class="uk-animation-fade uk-margin-auto" uk-grid>
<a class="uk-width-1-5 uk-height-small uk-card uk-card-default uk-card-body" (click)="confirmModalOpen(result.community)">
<div *ngIf="result.isSubscribed" class="uk-card-badge portal-card-badge uk-width-1-2 uk-position-top-left">Subscribed</div>
<img *ngIf= "result.community.logoUrl != null && result.community.logoUrl != '' " class="uk-padding uk-position-center" src="{{result.community.logoUrl}}" alt="{{(result.community.title)?result.community.title:result.community.shortTitle}} logo" >
<span *ngIf= "result.community.logoUrl == null || result.community.logoUrl == '' " class="uk-icon uk-padding uk-position-center">
<svg width="50" height="50" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle> <path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
</span>
</a>
<div class="uk-width-expand">
<h5 [title] = result.community.shortTitle>
<a (click)="confirmModalOpen(result.community)">
{{(result.community.title)?result.community.title:result.community.shortTitle}}
</a>
</h5>
<span *ngIf="result.community.type && result.community.type != ''" class="uk-label label-community" title="Type"> {{(result.community.type == 'ri')? 'research initiative': 'research community'}}</span>
<span *ngIf="result.community.status == 'manager'" class="uk-label label-community" title="Status">Private View</span>
<div *ngIf="result.community.description">
<div class="text-justify descriptionText">
{{result.community.description}}
</div>
</div>
<br>
<div *ngIf="result.community.date">
<span><b> Creation Date: </b></span>
<span>{{result.community.date | date:'dd-MM-yyyy'}}</span>
</div>
</div>
</li>
</ul>
<modal-alert #AlertModal (alertOutput)="goToCommunityPage($event)">
<div class="uk-text-center">
The profile will be presented in a new tab.<br>
Are you sure that you want to proceed?
</div>
</modal-alert>

View File

@ -0,0 +1,70 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {SearchResult} from "../../utils/entities/searchResult";
import {CommunityInfo} from "../../connect/community/communityInfo";
import {Router} from "@angular/router";
@Component({
selector: 'community-search-result',
templateUrl:'communitySearchResults.component.html'
})
export class CommunitySearchResultsComponent {
@Input() results: SearchResult[];
@Input() status: number;
@Input() type: string;
@Input() showLoading: boolean = false;
@Input() custom_class: string = "search-results";
@Input() properties: EnvProperties;
@ViewChild('AlertModal') modal;
public urlParam: string;
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
public errorMessage: string = "No results found";
public selectedCommunityId: string;
constructor(private router: Router) {}
ngOnInit() {
}
public quote(params: string):string {
return '"'+params+'"';
}
getProductionPrefix():string{
return (this.properties.environment =="beta")?"beta.":""
}
isProduction():boolean{
return this.properties.environment!="development";
}
public confirmModalOpen(community: CommunityInfo) {
this.selectedCommunityId = community.communityId;
this.modal.cancelButton = true;
this.modal.okButton = true;
this.modal.alertTitle = 'You have selected ' + community.title;
this.modal.alertMessage = false;
this.modal.okButtonLeft = false;
this.modal.okButtonText = 'Yes';
this.modal.cancelButtonText = 'No';
this.modal.open();
}
public goToCommunityPage(data: any) {
let url = '';
if(this.isProduction()) {
url = 'https://'+ this.getProductionPrefix() + this.selectedCommunityId +'.openaire.eu';
} else {
url = this.router.createUrlTree(['/'], {
queryParams: { 'communityId': this.selectedCommunityId} }).toString();
}
window.open(url, '_blank');
}
}

View File

@ -0,0 +1,24 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {CommunitySearchResultsComponent} from "./communitySearchResults.component";
import {AlertModalModule} from "../../utils/modal/alertModal.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, ErrorMessagesModule,
AlertModalModule
],
declarations: [
CommunitySearchResultsComponent
],
providers:[
],
exports: [
CommunitySearchResultsComponent
]
})
export class CommunitySearchResultsModule { }

View File

@ -7,14 +7,14 @@
<div class="searchFilterBoxValues ">
<div *ngFor = "let value of getSelectedValues(filter,'num')" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}">
<input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<input [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>
<!-- <hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small"-->
<div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:5-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}"> <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<span class="filterName"><div title = "{{value.name}}"> <input [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>

View File

@ -77,7 +77,7 @@
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community'" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
@ -136,7 +136,7 @@
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community'" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" [(connectCommunityId)]=connectCommunityId></search-filter>
@ -154,29 +154,23 @@
<!-- <search-results-per-page class="uk-width-1-2@m uk-width-1-1" [(searchUtils)] = "searchUtils" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-results-per-page> -->
<!-- <search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(searchUtils)] = "searchUtils" [(sortBy)]="sortBy" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-sorting> -->
<search-results-per-page class="uk-width-1-2@m uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>
<search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>
<search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [entityType]="entityType" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<!-- *ngIf="tableViewLink || searchUtils.totalResults <= csvLimit" -->
<!-- <div class="uk-width-1-1@s uk-hidden@m">
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<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>
<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>
</span>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div> -->
<div *ngIf="(searchUtils.page <= pagingLimit)" class="">
<search-result *ngIf="!tableView"
<search-result *ngIf="entityType != 'community' && !tableView"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showLoading]="true" [(properties)]=properties>
</search-result>
<community-search-result *ngIf="entityType == 'community' && !tableView"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showLoading]="true" [(properties)]=properties>
</community-search-result>
</div>
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
@ -190,12 +184,11 @@
<!-- <search-results-per-page class="uk-width-1-2@m uk-width-1-1"></search-results-per-page> -->
<!--[(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"-->
<!-- <search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(searchUtils)] = "searchUtils" [(sortBy)]="sortBy" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-sorting> -->
<search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>
<search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [entityType]="entityType" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<a *ngIf="properties.showLastIndexInformationLink" class="last_index_info uk-button-text"
<a *ngIf="properties.showLastIndexInformationLink && lastIndex" class="last_index_info uk-button-text"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>

View File

@ -5,16 +5,11 @@ import {Location} from '@angular/common';
import {Router, ActivatedRoute} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import {Filter, Value} from './searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass} from './searchUtils.class';
import {DOI, StringUtils} from '../../utils/string-utils.class';
import {ModalLoading} from '../../utils/modal/loading.component';
import {SearchFilterComponent} from './searchFilter.component';
import {SearchFilterModalComponent} from './searchFilterModal.component';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {PiwikService} from '../../utils/piwik/piwik.service';
import {EnvProperties} from '../../utils/properties/env-properties';
@ -55,6 +50,7 @@ export class SearchPageComponent {
@Input() mapUrl: string = "";
@Input() mapTooltipType: string ="content providers";
@Input() newQueryButton: boolean = true;
@Input() lastIndex: boolean = true;
//@Input() sortBy: string = "";
@ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
@ -70,7 +66,7 @@ export class SearchPageComponent {
// public currentFilter: Filter;
public csvLimit: number = 0;
public pagingLimit: number = 0;
public resultsPerPage: number = 0;
public resultsPerPage: number = 10;
public isPiwikEnabled;
properties:EnvProperties;
public errorCodes:ErrorCodes = new ErrorCodes();
@ -91,7 +87,6 @@ export class SearchPageComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.pagingLimit = data.envSpecific.pagingLimit;
this.resultsPerPage =data.envSpecific.resultsPerPage;
this.csvLimit = data.envSpecific.csvLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
if(typeof window !== 'undefined') {
@ -110,18 +105,13 @@ export class SearchPageComponent {
this.updateDescription(description);
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this.router.url,false);
}
ngAfterViewChecked(){
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
// toggleModal($event) {
// this.currentFilter = $event.value;
// //this.searchFilterModal.open();
// }
updateDescription(description:string) {
this._meta.updateTag({content:description},"name='description'");
@ -137,6 +127,17 @@ export class SearchPageComponent {
this._meta.updateTag({content:url},"property='og:url'");
}
public getQueryParamsFromUrl(params) {
this.queryParameters = new Map<string,string>();
for(let i=0; i< this.refineFields.length ; i++) {
let filterId = this.refineFields[i];
if (params[filterId] != undefined) {
this.queryParameters.set(filterId, StringUtils.URIDecode(params[filterId]));
}
}
return this.queryParameters;
}
public getQueryParametersFromUrl(params){ // called by ngOnInit function of search find pages
// var parameters = "";
var allFqs = "";
@ -359,7 +360,7 @@ export class SearchPageComponent {
if(this.searchUtils.page != 1 && includePage){
allLimits+=((allLimits.length == 0)?'?':'&') + 'page=' + this.searchUtils.page;
}
if(this.searchUtils.size != 10) {
if(this.searchUtils.size != this.resultsPerPage) {
allLimits+=((allLimits.length == 0)?'?':'&') + 'size=' + this.searchUtils.size;
this.parameterNames.push("size");
this.parameterValues.push(""+this.searchUtils.size);
@ -534,8 +535,8 @@ export class SearchPageComponent {
/* End Piwik Code */
this.queryChange.emit({
value: queryParameters,
index:indexQuery
index:indexQuery,
params: this.queryParameters
});
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();

View File

@ -5,10 +5,6 @@ import { RouterModule } from '@angular/router';
import{SearchPageComponent} from './searchPage.component';
import{SearchFormModule} from './searchForm.module';
import{SearchResultsModule} from './searchResults.module';
//import{DatasourceTableViewModule} from './datasourceTableView.module';
//import{SearchFilterComponent} from './searchFilter.component';
//import{SearchFilterModalComponent} from './searchFilterModal.component';
import {SearchFilterModule} from './searchFilter.module';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
@ -23,12 +19,14 @@ import {HelperModule} from '../../utils/helper/helper.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
import {CommunitySearchResultsModule} from "./communitySearchResults.module";
import {SearchResultsModule} from "./searchResults.module";
@NgModule({
imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule,
CommonModule, FormsModule, RouterModule, SearchFormModule, SearchResultsModule, CommunitySearchResultsModule,
LoadingModalModule, ReportsServiceModule, SearchDataproviderMapModule,
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule, SearchResultsModule
],
declarations: [
SearchPageComponent

View File

@ -1,9 +1,4 @@
<ul [class]="'uk-list uk-list-divider uk-margin '+custom_class">
<!--div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
<div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="status == errorCodes.OUT_OF_BOUND" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">Requested page out of bounds</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="status == errorCodes.LOADING && showLoading" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><span class="loading-gif uk-align-center" ></span></div-->
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of results" class="uk-animation-fade">
@ -19,13 +14,6 @@
<span *ngIf="result.languages && result.languages.length > 0" class="uk-label custom-label label-language " title="Language">{{result.languages.join(", ")}}</span>
<span *ngIf="result.countriesForResults && result.countriesForResults.length > 0" class="uk-label custom-label label-country " title="Country">{{result.countriesForResults.join(", ")}}</span>
<span *ngIf="result.title && result.title.accessMode" [class]="'uk-label custom-label label-'+ result.title.accessMode " title="Access Mode">{{result.title.accessMode}}</span>
<!-- <span *ngIf="result['funders'] && result['funders'].length > 0" class="uk-label custom-label label-funder " title="Funder"><span *ngFor="let funder of result['funders'] let i=index">
<span *ngIf="funder.funderShortname">
{{funder.funderShortname}}</span><span
*ngIf="i < result['funders'].length-1">, </span>
</span></span> -->
<span *ngIf="result['funderShortname']" class="uk-label custom-label label-funder " title="Funder">{{result['funderShortname']}}</span>
<span *ngIf="result.openAccessMandatePublications != undefined && result.openAccessMandatePublications && (result.openAccessMandateDatasets == undefined || !result.openAccessMandateDatasets)"
class="uk-label custom-label label-openaccessmandate " title="Open Access mandate for Publications">Open Access mandate for Publications</span>
@ -38,10 +26,6 @@
<div class="uk-margin-small">
<span *ngIf="result['authors'] != undefined" class="resultsAuthors uk-margin-small-top" style="font-style: italic;">
<span *ngFor="let author of result['authors'].slice(0,15)">
<!--a href="{{author['url']}}"-->
<!--a [queryParams]="routerHelper.createQueryParams(['author','at'],[quote(author['name']),'and'])" routerLinkActive="router-link-active" [routerLink]="linkToAdvancedSearchPage">
{{author['name']}};
</a-->
{{author}};
</span>
<span *ngIf="result['authors'].length > 15">...</span>
@ -52,20 +36,12 @@
</div>
<div *ngIf="result.publisher != undefined && result.publisher != ''"><span class="uk-text-bold">Publisher:</span> {{result.publisher}}</div>
<!-- <div *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''">
Compatibility: {{result.compatibility}}
</div> -->
<!-- <approved-by-community [contentProviderId]="result.id"></approved-by-community> -->
<span *ngIf="result['type'] != undefined && result['type'] != ''" class="uk-label custom-label label-blue label-dataprovider" title="Type"> {{result['type']}}</span>
<!-- <div *ngIf="result['type'] != undefined && result['type'] != ''">Type: {{result['type']}}</div> -->
<span *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''" class="uk-label custom-label label-compatibility" title="Compatibility">{{result.compatibility}}</span>
<!-- <div *ngIf="result.country != undefined && result.country != ''">Country: {{result.country}}</div> -->
<span *ngIf="result.country != undefined && result.country != ''" class="uk-label custom-label label-country" title="Country"> {{result.country}}</span>
<div *ngIf="result['projects'] != undefined">
<span> Project: </span>
<span *ngFor="let project of result['projects'].slice(0,15) let i=index">
<!--a *ngIf="project.url != undefined" href="{{project.url}}"-->
<a *ngIf="project.id" [queryParams]="{projectId: project.id}" routerLinkActive="router-link-active" routerLink="/search/project">
{{project['funderShortname']?project['funderShortname']:project['funderName']}}
| {{ project['acronym']?project['acronym']:(project['title'].length>25?project['title'].substring(0,25)+'...':project['title'])}} ({{project.code}})</a><span
@ -86,24 +62,10 @@
</div>
<mark *ngIf="result.embargoEndDate != undefined && result.embargoEndDate != ''">Embargo End Date: {{result.embargoEndDate}}</mark>
<!-- <div *ngIf="result['funders'] != undefined">
<span> Funder: </span>
<span *ngFor="let funder of result['funders'] let i=index">
<span *ngIf="funder.funderShortname">
{{funder.funderShortname}}</span><span
*ngIf="i < result['funders'].length-1">,</span>
</span>
<span *ngIf="result.startYear && result.endYear"> (start {{result.startYear}} - end {{result.endYear}})</span>
</div> -->
<div *ngIf="result.startYear && result.endYear"> Start year: {{result.startYear}} - End year: {{result.endYear}}</div>
<div *ngIf="showOrganizations && result['organizations'] != undefined && result['organizations'].length > 0">
<span> Organization: </span>
<span *ngFor="let organization of result['organizations'].slice(0,10) let i=index">
<!--a *ngIf="organization.url != undefined" href="{{organization.url}}"-->
<a *ngIf="organization.id" [queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization">
{{organization.name}}</a><span

View File

@ -14,18 +14,14 @@ import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/appro
CommonModule, FormsModule,
RouterModule, ErrorMessagesModule,
ApprovedByCommunityModule
],
],
declarations: [
SearchResultComponent,
],
SearchResultComponent
],
providers:[
],
exports: [
SearchResultComponent
]
SearchResultComponent
]
})
export class SearchResultsModule { }

View File

@ -1,55 +1,8 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {Router, ActivatedRoute} from '@angular/router';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'search-results-per-page',
template: `
<!--div class= "searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"-->
<!--form class="uk-form-horizontal uk-width-1-2">
<div class="uk-form-label inherit-color">Results per page:</div>
<div class="uk-form-controls">
<select class="uk-select" id="form-horizontal-select" name="select_results_per_page"
[(ngModel)]="searchUtils.size" (ngModelChange)="navigate(searchUtils.size)">
<option [ngValue]="5" > 5</option>
<option [ngValue]="10">10</option>
<option [ngValue]="20">20</option>
<option [ngValue]="50">50</option>
</select>
</div>
</form-->
<!--select class="uk-select uk-width-2-3" id="form-horizontal-select" name="select_results_per_page"
[(ngModel)]="searchUtils.size" (ngModelChange)="navigate(searchUtils.size)">
<option [ngValue]="5" > 5 Results per page</option>
<option [ngValue]="10">10 Results per page</option>
<option [ngValue]="20">20 Results per page</option>
<option [ngValue]="50">50 Results per page</option>
</select-->
<!--/div-->
<!--span>Results per page:</span>
<span>
<ul class="uk-subnav uk-subnav-divider">
<li [class]="searchUtils.size == 5 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',5)" routerLinkActive="router-link-active" [routerLink]=baseUrl> 5</a></li>
<li [class]="searchUtils.size == 10 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',10)" routerLinkActive="router-link-active" [routerLink]=baseUrl>10</a></li>
<li [class]="searchUtils.size == 20 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',20)" routerLinkActive="router-link-active" [routerLink]=baseUrl>20</a></li>
<li [class]="searchUtils.size == 50 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',50)" routerLinkActive="router-link-active" [routerLink]=baseUrl>50</a></li>
</ul>
</span-->
<!--ul class="uk-subnav uk-subnav-divider">
<li>Results per page:</li>
<li [class]="searchUtils.size == 5 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',5)" routerLinkActive="router-link-active" [routerLink]=baseUrl> 5</a></li>
<li [class]="searchUtils.size == 10 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',10)" routerLinkActive="router-link-active" [routerLink]=baseUrl>10</a></li>
<li [class]="searchUtils.size == 20 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',20)" routerLinkActive="router-link-active" [routerLink]=baseUrl>20</a></li>
<li [class]="searchUtils.size == 50 ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsResultsPerPage(parameterNames,parameterValues,'size',50)" routerLinkActive="router-link-active" [routerLink]=baseUrl>50</a></li>
</ul-->
<!--[(ngModel)]="searchUtils.size" (ngModelChange)="navigate(searchUtils.size)"-->
<!--[(ngModel)]="=size" (ngModelChange)="sizeChanged()"-->
template: `
<span class="uk-width-2-3@m uk-width-1-1@s">
<span class="uk-width-5-6@m"> Results per page:</span>
<select class="uk-select uk-width-1-6@m uk-width-auto" id="form-horizontal-select" name="select_results_per_page"
@ -76,10 +29,4 @@ export class SearchResultsPerPageComponent {
value: this.size
});
}
/*navigate(size: number) {
this.searchUtils.page = 1;
console.info(size);
console.info(this.baseUrl);
this._router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParamsResultsPerPage(this.parameterNames,this.parameterValues,'size',size)});
}*/
}

View File

@ -1,78 +1,37 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Router, ActivatedRoute} from '@angular/router';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'search-sorting',
template: `
<!--form class="uk-form-horizontal uk-width-1-1">
<div class="uk-form-label inherit-color">Sort By:</div>
<div class="uk-form-controls">
<select class="uk-select" id="form-horizontal-select" name="select_sort_results"
[(ngModel)]="sortBy" (ngModelChange)="navigateSort(sortBy)">
<option value="">Relevance score</option>
<option value="resultdateofacceptance,descending">Year</option>
</select>
</div>
</form-->
<!--select class="uk-select uk-width-2-3 uk-float-right" id="form-horizontal-select" name="select_sort_results"
[(ngModel)]="sortBy" (ngModelChange)="navigateSort(sortBy)">
<option value="">Most relevant first</option>
<option value="resultdateofacceptance,descending">Most recent first</option>
</select-->
template: `
<span class="uk-width-2-3@m uk-width-1-1@s uk-float-right">
<span class="uk-width-1-4"> Sort by:</span>
<select class="uk-select uk-width-3-4@m uk-width-auto" id="form-horizontal-select" name="select_results_per_page"
<select *ngIf="entityType != 'community'" class="uk-select uk-width-3-4@m uk-width-auto" id="form-horizontal-select" name="select_results_per_page"
[(ngModel)]="sortBy" (ngModelChange)="sortByChanged()">
<option value="">Relevance</option>
<option value="resultdateofacceptance,descending">Date (most recent)</option>
<option value="resultdateofacceptance,ascending">Date (least recent)</option>
</select>
<select *ngIf="entityType == 'community'" class="uk-select uk-width-3-4@m uk-width-auto" id="form-horizontal-select" name="select_results_per_page"
[(ngModel)]="sortBy" (ngModelChange)="sortByChanged()">
<option value="">Title</option>
<option value="creationdate,descending">Creation Date (most recent)</option>
<option value="creationdate,ascending">Creation Date (least recent)</option>
</select>
</span>
<!--ul class="uk-subnav uk-subnav-pill">
<li [class]="sortBy == '' ? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParams(parameterNames,parameterValues)" routerLinkActive="router-link-active" [routerLink]=baseUrl>Sort by Relevance</a></li>
<li [class]="sortBy == 'resultdateofacceptance,descending'? 'uk-active' : ''"><a [queryParams]="routerHelper.createQueryParamsSortBy(parameterNames,parameterValues,'sortBy',sortBy)" routerLinkActive="router-link-active" [routerLink]=baseUrl>Sort by Date</a></li>
</ul-->
`
})
export class SearchSortingComponent {
/*@Input() searchUtils;
@Input() baseUrl;
@Input() parameterNames:string[];
@Input() parameterValues:string[];
*/
@Input() sortBy: string="";
@Input() sortBy: string = '';
@Input() entityType: string = '';
@Output() sortByChange = new EventEmitter();
//public routerHelper:RouterHelper = new RouterHelper();
constructor (/*private route: ActivatedRoute, private _router: Router*/) {}
constructor () {}
ngOnInit() {}
/*navigateSort(sortBy: string) {
this.searchUtils.page = 1;
console.info("sortBy="+sortBy);
if(sortBy) {
this._router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParamsSortBy(this.parameterNames, this.parameterValues, 'sortBy', sortBy)});
} else {
let index: number = this.parameterNames.findIndex(function(element) {
return element == "sortBy";
});
console.info("index of sortby: "+index);
if(index >= 0) {
this.parameterNames.splice(index, 1);
this.parameterValues.splice(index, 1);
}
this._router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)});
}
}*/
sortByChanged() {
this.sortByChange.emit({

View File

@ -1,3 +1,5 @@
import {CommunityInfo} from "../../connect/community/communityInfo";
export class SearchResult {
title: { "name": string, "accessMode": string, "sc39": string};
id:string;
@ -50,6 +52,11 @@ export class SearchResult {
entityType: string;
types: string[];
// communities
community: CommunityInfo;
isSubscribed: boolean;
isManager: boolean;
constructor(){}
}

View File

@ -1,7 +1,4 @@
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
// import { DynamicComponentLoader} from '@angular/core';
import {Open} from './open.component';
import {Component, ViewEncapsulation, ElementRef, EventEmitter, Output} from '@angular/core';
@Component({
selector: 'modal-alert',
@ -18,13 +15,21 @@ import {Open} from './open.component';
</div>
<ng-content></ng-content>
</div>
<div class=" uk-text-right" [hidden]=!alertFooter>
<div *ngIf="okButtonLeft" class=" uk-text-right" [hidden]=!alertFooter>
<span [hidden]=!okButton >
<button class=" uk-button uk-button-default " (click)="ok()">{{okButtonText}}</button>
</span>
<span [hidden]=!cancelButton>
</span>
<span [hidden]=!cancelButton>
<button class=" uk-button uk-button-default" (click)="cancel()">{{cancelButtonText}}</button>
</span>
</span>
</div>
<div *ngIf="!okButtonLeft" class=" uk-text-right" [hidden]=!alertFooter>
<span [hidden]=!cancelButton>
<button class=" uk-button uk-button-default" (click)="cancel()">{{cancelButtonText}}</button>
</span>
<span [hidden]=!okButton >
<button class=" uk-button uk-button-default " (click)="ok()">{{okButtonText}}</button>
</span>
</div>
</div>
@ -84,6 +89,8 @@ export class AlertModal{
* if the value is true alert will be visible or else it will be hidden.
*/
public isOpen:boolean=false;
public okButtonLeft: boolean = true;
/**
* Emitted when a ok button was clicked
* or when Ok method is called.

View File

@ -108,6 +108,7 @@ export class EnvProperties {
searchLinkToOrp;
searchLinkToOrganization;
//Search pages
searchLinkToCommunities;
searchLinkToPublications;
searchLinkToDataProviders;
searchLinkToProjects;

View File

@ -134,6 +134,7 @@ export class SearchFields {
public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
public COMMUNITIES_SEARCH_FIELDS:string[] = ["type","status"];
constructor (){
}
getFieldName(fieldId:string,fieldType:string):string{