[Library|Trunk]

Use searchDataproviders Component for Deposit, Registries, Journals and Compatible pages
Update searchDataproviders Component to support the above search pages

Entities autocomplete: show "no title available" when the entity with the selected id is not found  




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58244 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-03-12 17:03:35 +00:00
parent 91a6a82977
commit b28f08e4b8
9 changed files with 194 additions and 126 deletions

View File

@ -5,15 +5,14 @@ import {SearchDataprovidersService} from '../services/searchDataproviders.servic
import {ErrorCodes} from '../utils/properties/errorCodes'; import {ErrorCodes} from '../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../utils/errorMessages.component'; import {ErrorMessagesComponent} from '../utils/errorMessages.component';
import {SearchFields} from '../utils/properties/searchFields'; import {SearchFields} from '../utils/properties/searchFields';
import {SearchPageComponent } from '../searchPages/searchUtils/searchPage.component';
import {SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class';
import {EnvProperties} from '../utils/properties/env-properties'; import {EnvProperties} from '../utils/properties/env-properties';
import {StringUtils} from "../utils/string-utils.class";
import {ZenodoInformationClass} from "./utils/zenodoInformation.class"; import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
import {RouterHelper} from "../utils/routerHelper.class"; import {RouterHelper} from "../utils/routerHelper.class";
@Component({ @Component({
selector: 'search-dataproviders', selector: 'deposit-search-dataproviders',
template: ` template: `
<div class="uk-section uk-padding-remove-bottom uk-padding-remove-top"> <div class="uk-section uk-padding-remove-bottom uk-padding-remove-top">
@ -29,22 +28,8 @@ import {RouterHelper} from "../utils/routerHelper.class";
</div> </div>
</div> </div>
</div> </div>
<search-page pageTitle="Deposit Browse & Search repositories" [hasPrefix]=false <search-dataproviders [simpleView]="true" type="deposit" simpleSearchLink="/participate/deposit/search" >
formPlaceholderText = "Search by title, country, organization, subject, type..." </search-dataproviders>
type="content providers" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[csvParams]="csvParams" csvPath="datasources"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
[searchFormClass]="''"
[usedBy]="'deposit'"
[showMoreFilterValuesInline]=true
[filterValuesNum]=4
[lastIndex]=false
[zenodoInformation]="zenodoInformation">
</search-page>
` `
}) })
export class SearchDataprovidersToDepositComponent { export class SearchDataprovidersToDepositComponent {
@ -71,7 +56,7 @@ export class SearchDataprovidersToDepositComponent {
properties:EnvProperties; properties:EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; // @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@Input() public communityId: string = null; @Input() public communityId: string = null;
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); @Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@ -94,34 +79,34 @@ export class SearchDataprovidersToDepositComponent {
this.baseUrl = this.properties.depositSearchPage; this.baseUrl = this.properties.depositSearchPage;
this.pagingLimit = this.properties.pagingLimit; this.pagingLimit = this.properties.pagingLimit;
}); });
this.searchPage.refineFields = this.refineFields; // this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap; // this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.keywordFields = this.keywordFields; // this.searchPage.keywordFields = this.keywordFields;
var firstLoad =true; // var firstLoad =true;
//
this.sub = this.route.queryParams.subscribe(params => { // this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true; // this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) { // if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false; // this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults; // this.oldTotalResults = this.searchUtils.totalResults;
} // }
//
this.searchUtils.keyword = (params['keyword']?params['keyword']:''); // this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true; // var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){ // if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false; // refine = false;
//
} // }
firstLoad = false; // firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; // this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.size = (params['size']=== undefined)?5:+params['size']; // this.searchUtils.size = (params['size']=== undefined)?5:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) { // if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 5; // this.searchUtils.size = 5;
} // }
this.searchPage.usedBy = "deposit"; // this.searchPage.usedBy = "deposit";
var queryParameters = this.searchPage.getQueryParametersFromUrl(params); // var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size); // this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
}); // });
} }
public ngOnDestroy() { public ngOnDestroy() {
@ -133,7 +118,7 @@ export class SearchDataprovidersToDepositComponent {
} }
} }
public getResults(keyword:string,refine:boolean, page: number, size: number){ /*public getResults(keyword:string,refine:boolean, page: number, size: number){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){
//parameters = "q="+ keyword; //parameters = "q="+ keyword;
@ -201,7 +186,7 @@ export class SearchDataprovidersToDepositComponent {
); );
} }
} }
*/
private handleError(message: string, error) { private handleError(message: string, error) {
console.error("Content Providers simple Search Page: "+message, error); console.error("Content Providers simple Search Page: "+message, error);

View File

@ -9,16 +9,17 @@ import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.mod
import {DataProvidersServiceModule} from '../services/dataProvidersService.module'; import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module'; import {SearchFormModule} from '../searchPages/searchUtils/searchForm.module';
import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module'; // import {SearchPageModule} from '../searchPages/searchUtils/searchPage.module';
import {FreeGuard} from'../login/freeGuard.guard'; import {FreeGuard} from'../login/freeGuard.guard';
import {IsRouteEnabled} from '../error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../error/isRouteEnabled.guard';
import {SearchDataProvidersModule} from "../searchPages/searchDataProviders.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
RouterModule, RouterModule,
DataProvidersServiceModule, DataProvidersServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule SearchFormModule, SearchResultsModule, SearchDataProvidersModule
], ],
declarations: [ declarations: [

View File

@ -31,11 +31,13 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
[openaireLink]=openaireLink [openaireLink]=openaireLink
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
searchFormClass="datasourcesSearchForm" [searchFormClass]="type!='deposit'?'datasourcesSearchForm':''"
[entitiesSelection]="type=='all'" [showAdvancedSearchLink]="type=='all'" [entitiesSelection]="type=='all'" [showAdvancedSearchLink]="type=='all'"
[filters]="filters" [filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..." [simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..."
[showResultCount]="type!='registries'"> [showResultCount]="(type=='all' || type == 'deposit')" [showLastIndex]="type!='deposit'"
[tableViewLink]="tableViewLink">
</new-search-page> </new-search-page>
` `
@ -46,6 +48,7 @@ export class SearchDataProvidersComponent {
private errorMessages: ErrorMessagesComponent; private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null; @Input() piwikSiteId = null;
@Input() customFilter:SearchCustomFilter= null; @Input() customFilter:SearchCustomFilter= null;
@Input() tableViewLink;
public results =[]; public results =[];
public filters =[]; public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -63,9 +66,9 @@ export class SearchDataProvidersComponent {
public pagingLimit: number = 0; public pagingLimit: number = 0;
public isPiwikEnabled; public isPiwikEnabled;
properties:EnvProperties; properties:EnvProperties;
@Input() type: "all" | "registries" | "journals" | "compatible" ="all"; @Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" = "all";
public refineFields: string[] = DatasourcesHelperClass.getrefineFields(this.type); public refineFields: string[];
pageTitle = DatasourcesHelperClass.getTitle(this.type); pageTitle;
@ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
@Input() simpleView: boolean = true; @Input() simpleView: boolean = true;
@Input() simpleSearchLink: string = ""; @Input() simpleSearchLink: string = "";
@ -79,11 +82,10 @@ export class SearchDataProvidersComponent {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent(); this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
//console.info("Con -base url:"+this.searchUtils.baseUrl );
} }
ngOnInit() { ngOnInit() {
this.refineFields = DatasourcesHelperClass.getrefineFields(this.type);
this.pageTitle = DatasourcesHelperClass.getTitle(this.type);
this.route.data this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific; this.properties= data.envSpecific;
@ -119,6 +121,11 @@ export class SearchDataProvidersComponent {
this.searchPage.fieldIds = this.fieldIds; this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[]; this.selectedFields =[];
if(this.type == "deposit"){
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider"); this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
}); });
@ -153,12 +160,13 @@ export class SearchDataProvidersComponent {
//console.info("Advanced Search for Content Providers: Execute search query "+parameters); //console.info("Advanced Search for Content Providers: Execute search query "+parameters);
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and ':'') + parameters, page, size, this.properties, (refine && this.type=="all") ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; this.searchUtils.totalResults = data[0];
this.results = data[1]; this.results = data[1];
console.log(this.results);
if (refine) { if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(this.type=="all"?data[2]:this.filters); this.filters = this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters);
}else{ }else{
this.searchPage.buildPageURLParameters(this.filters, [], false); this.searchPage.buildPageURLParameters(this.filters, [], false);
} }

View File

@ -3,7 +3,8 @@ import {SearchFields} from "../../utils/properties/searchFields";
export class DatasourcesHelperClass { export class DatasourcesHelperClass {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible") { public static getrefineFields(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
console.log("Get RF "+ type)
let searchFields:SearchFields = new SearchFields(); let searchFields:SearchFields = new SearchFields();
if (type == "registries") { if (type == "registries") {
return searchFields.ENTITY_REGISTRIES_FIELDS; return searchFields.ENTITY_REGISTRIES_FIELDS;
@ -12,24 +13,25 @@ export class DatasourcesHelperClass {
} else if (type == "compatible") { } else if (type == "compatible") {
return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
} else if (type == "deposit") {
return searchFields.DEPOSIT_DATASOURCE_REFINE_FIELDS;
} else { } else {
return searchFields.DATASOURCE_REFINE_FIELDS; return searchFields.DATASOURCE_REFINE_FIELDS;
} }
} }
public static getTitle(type: "all" | "registries" | "journals" | "compatible") { public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
if (type == "registries") { if (type == "registries") {
return "Entity Registries" return "Entity Registries"
} else if (type == "journals") { } else if (type == "journals") {
return "Journals" return "Journals"
} else if (type == "compatible") { } else if (type == "compatible") {
return "Compatible Content Providers"; return "Compatible Content Providers";
} else { } else {
return "Content Providers" return "Content Providers"
} }
} }
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible"): string { public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
if (type == "registries") { if (type == "registries") {
return ' datasourcetypeuiid = other '; return ' datasourcetypeuiid = other ';
} else if (type == "journals") { } else if (type == "journals") {
@ -38,12 +40,14 @@ export class DatasourcesHelperClass {
} else if (type == "compatible") { } else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" '; return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
}else if (type == "deposit") {
return ' oaftype exact datasource ';
} else { } else {
return ""; return "";
} }
} }
public static createFilters(type: "all" | "registries" | "journals" | "compatible"): Filter[] { public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
if (type == "registries") { if (type == "registries") {
return this.createRegistriesFilters(); return this.createRegistriesFilters();
} else if (type == "journals") { } else if (type == "journals") {

View File

@ -1,8 +1,16 @@
<div *ngIf="!includeOnlyResultsAndFilter" class="image-front-topbar uk-section-default uk-position-relative" <div *ngIf="!includeOnlyResultsAndFilter" [class]="usedBy != 'deposit' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
' image-front-topbar uk-section-default uk-position-relative ' :
(' uk-section uk-padding-remove-bottom uk-padding-remove-top ' + (usedBy
== 'deposit' ? ' uk-padding-remove-top ' : ' '))"
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"> 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="box-sizing: border-box; " [class]="' uk-background-norepeat uk-background-cover uk-background-bottom-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed advancedSearchFormBackground '+searchFormClass"> <div style="box-sizing: border-box; "
<div class="uk-position-cover" style="/*background-color: rgba(255, 255, 255, 0.37);*/"></div> [class]="' uk-background-norepeat uk-background-bottom-center uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed '+searchFormClass
+ (usedBy != 'deposit' && (!customFilter || customFilter.queryFieldName != 'communityId') ?
' searchFormMinHeight uk-padding-remove-bottom uk-section ' : '')
+(simpleView?'':' advancedSearchFormBackground ')">
<div class="uk-position-cover" ></div>
<div class="uk-width-1-1"> <div class="uk-width-1-1">
<div class="uk-position-relative"> <div class="uk-position-relative">
<div class="uk-container uk-margin-large-top"> <div class="uk-container uk-margin-large-top">
@ -71,14 +79,14 @@
<button class="uk-offcanvas-close" type="button" uk-close></button> <button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-width-1-1 uk-margin-small-bottom uk-margin-top"> <div class="uk-width-1-1 uk-margin-small-bottom uk-margin-top">
<span *ngIf="tableViewLink " class="uk-width-expand"> <!-- <span *ngIf="tableViewLink " class="uk-width-expand">-->
<span *ngIf="tableViewLink"> <!-- <span *ngIf="tableViewLink">-->
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink > <!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [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> <!-- <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>-->
</a> <!-- </a>-->
<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> <!-- <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>-->
</span> <!-- </span>-->
</span> <!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=--> <!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'funder') && usedBy == 'search'"--> <!-- 'community' && entityType != 'funder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">--> <!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
@ -173,14 +181,14 @@
<div *ngIf="showRefine" class="uk-width-1-4@m search-filters uk-visible@m"> <div *ngIf="showRefine" class="uk-width-1-4@m search-filters uk-visible@m">
<!-- top: #container-1; bottom: #true; --> <!-- top: #container-1; bottom: #true; -->
<!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> --> <!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> -->
<span *ngIf="tableViewLink" class="uk-width-expand"> <!-- <span *ngIf="tableViewLink" class="uk-width-expand">-->
<span *ngIf="tableViewLink"> <!-- <span *ngIf="tableViewLink">-->
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink > <!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [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> <!-- <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>-->
</a> <!-- </a>-->
<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> <!-- <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>-->
</span> <!-- </span>-->
</span> <!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=--> <!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'funder') && usedBy == 'search'"--> <!-- 'community' && entityType != 'funder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">--> <!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
@ -272,6 +280,16 @@
[loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils"
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"> [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download> </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>
<!-- <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>-->
</span>
</div> </div>
</div> </div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging> <search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
@ -280,11 +298,18 @@
<search-download class="uk-width-1-1@s uk-hidden@m" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download> <search-download class="uk-width-1-1@s uk-hidden@m" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-large-bottom"> <div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-large-bottom">
<search-result [results]="results" <search-result *ngIf="usedBy == 'search'" [results]="results"
[status]=searchUtils.status [status]=searchUtils.status
[type]="entityType" [type]="entityType"
[showLoading]="true" [(properties)]=properties> [showLoading]="true" [properties]=properties>
</search-result> </search-result>
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[zenodoInformation]="zenodoInformation"
[properties]=properties>
</deposit-result>
</div> </div>
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)"> <div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
@ -300,7 +325,7 @@
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging> <search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div> </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"> [href]="properties.lastIndexInformationLink" target="_blank">
Last index information Last index information
</a> </a>

View File

@ -17,6 +17,7 @@ import {HelperService} from "../../utils/helper/helper.service";
import {SearchFields} from "../../utils/properties/searchFields"; import {SearchFields} from "../../utils/properties/searchFields";
import {RefineResultsUtils} from "../../services/servicesUtils/refineResults.class"; import {RefineResultsUtils} from "../../services/servicesUtils/refineResults.class";
import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class"; import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class";
import {ZenodoInformationClass} from "../../deposit/utils/zenodoInformation.class";
@Component({ @Component({
selector: 'new-search-page', selector: 'new-search-page',
@ -60,6 +61,8 @@ export class NewSearchPageComponent {
@Input() showRefine: boolean = true; @Input() showRefine: boolean = true;
@Input() tableViewLink: string; @Input() tableViewLink: string;
@Input() usedBy: string = "search"; @Input() usedBy: string = "search";
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
@Input() showLastIndex: boolean = true;
@Input() showResultCount: boolean = true; @Input() showResultCount: boolean = true;
@Input() showMoreFilterValuesInline: boolean = true; @Input() showMoreFilterValuesInline: boolean = true;
@Input() filterValuesNum: number = 6; @Input() filterValuesNum: number = 6;
@ -663,14 +666,37 @@ export class NewSearchPageComponent {
} }
} }
if (doisParams.length > 0) { if (doisParams.length > 0) {
params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true, true) + " or " + doisParams; params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId ,countParams,true, true) + " or " + doisParams;
} else { } else {
params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true); params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId,countParams,true);
} }
//TODO deposit case
console.log(this.usedBy)
console.log(this.keywordFields)
if(this.usedBy == "deposit") {
if(this.keywordFields.length > 0) {
params += " or ("
}
for(let j=0; j< this.keywordFields.length ; j++) {
if(j > 0) {
params += " or "
}
params += this.createQuotedKeywordQuery(this.selectedFields[i].value, this.keywordFields[j].name, " or ", countParams,false);
// let field = this.keywordFields[i];
//keywordQuery += field.name+field.equalityOperator+StringUtils.URIEncode(keyword);
// params += field.name+field.equalityOperator+StringUtils.quote(StringUtils.URIEncode(keyword));
}
if(this.keywordFields.length > 0) {
params += " ) "
}
}
} else if (countParams == 0 && this.selectedFields[i].operatorId == "not" && this.fieldIdsMap[this.selectedFields[i].id].equalityOperator != "=") { } else if (countParams == 0 && this.selectedFields[i].operatorId == "not" && this.fieldIdsMap[this.selectedFields[i].id].equalityOperator != "=") {
params += " " + this.selectedFields[i].id + " <> " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " "; params += " " + this.selectedFields[i].id + " <> " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " ";
} else if(this.fieldIdsMap[this.selectedFields[i].id].equalityOperator == "=") { } else if(this.fieldIdsMap[this.selectedFields[i].id].equalityOperator == "=") {
params+=this.createQuotedKeywordQuery(this.selectedFields[i], countParams, false); params+=this.createQuotedKeywordQuery(this.selectedFields[i].value, this.selectedFields[i].id, this.selectedFields[i].operatorId, countParams, false);
}else{ }else{
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " "; params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
@ -688,26 +714,26 @@ export class NewSearchPageComponent {
return params; return params;
} }
createQuotedKeywordQuery(field:AdvancedField, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){ createQuotedKeywordQuery(fieldValue, fieldId, fieldOperator, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){
let params = ""; let params = "";
let quotedParts = (field.value)?field.value.match(/(["'])(.*?)*?\1/g):[]; let quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[];
params+= (countParams == 0 ? "" : field.operatorId) + " ("; params+= (countParams == 0 ? "" : fieldOperator) + " (";
if(forceQuotted){ if(forceQuotted){
return this.getQuotedQueryPart(field.id, '"'+ field.value+'"',isSearchAll); return this.getQuotedQueryPart(fieldId, '"'+ fieldValue+'"',isSearchAll);
} }
if(quotedParts && quotedParts.length == 1 && quotedParts[0] == field.value ){ if(quotedParts && quotedParts.length == 1 && quotedParts[0] == fieldValue ){
params+=this.getQuotedQueryPart(field.id, field.value,isSearchAll); params+=this.getQuotedQueryPart(fieldId, fieldValue,isSearchAll);
}else if( quotedParts && quotedParts.length > 0){ }else if( quotedParts && quotedParts.length > 0){
for(let i=0; i< quotedParts.length; i++){ for(let i=0; i< quotedParts.length; i++){
params+=(i>0)?" and ":""; params+=(i>0)?" and ":"";
params+=this.getQuotedQueryPart(field.id, quotedParts[i],isSearchAll); params+=this.getQuotedQueryPart(fieldId, quotedParts[i],isSearchAll);
} }
let startPoint = 0; let startPoint = 0;
let endPoint = 0; let endPoint = 0;
for(let i=0; i< quotedParts.length; i++){ for(let i=0; i< quotedParts.length; i++){
let index = field.value.indexOf(quotedParts[i]); let index = fieldValue.indexOf(quotedParts[i]);
endPoint = (i+1<quotedParts.length)? field.value.indexOf(quotedParts[i+1]):field.value.length; endPoint = (i+1<quotedParts.length)? fieldValue.indexOf(quotedParts[i+1]):fieldValue.length;
// console.log(field.value.indexOf(quotedParts[i+1]) +" - "+field.value.length); // console.log(fieldValue.indexOf(quotedParts[i+1]) +" - "+fieldValue.length);
// console.log(" SP "+ startPoint+" EP: "+endPoint); // console.log(" SP "+ startPoint+" EP: "+endPoint);
if(index==startPoint){ if(index==startPoint){
startPoint +=quotedParts[i].length; startPoint +=quotedParts[i].length;
@ -715,31 +741,31 @@ export class NewSearchPageComponent {
endPoint = index; endPoint = index;
} }
// console.log(" SP "+ startPoint+" EP: "+endPoint); // console.log(" SP "+ startPoint+" EP: "+endPoint);
if(decodeURIComponent(field.value.substring(startPoint,endPoint)).split(" ").join("").length > 0) { if(decodeURIComponent(fieldValue.substring(startPoint,endPoint)).split(" ").join("").length > 0) {
params += " and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint, endPoint), isSearchAll); params += " and " + this.getNoQuotedQueryPart(fieldId, fieldValue.substring(startPoint, endPoint), isSearchAll);
} }
// console.log("For "+i+" " +params+" SP "+ startPoint+" EP: "+endPoint); // console.log("For "+i+" " +params+" SP "+ startPoint+" EP: "+endPoint);
// startPoint = (i+1<quotedParts.length)? field.value.indexOf(quotedParts[i+i]):field.value.length;//(startPoint<index )?(index + quotedParts[i].length):field.value.length; // startPoint = (i+1<quotedParts.length)? fieldValue.indexOf(quotedParts[i+i]):fieldValue.length;//(startPoint<index )?(index + quotedParts[i].length):fieldValue.length;
startPoint = ((i+1<quotedParts.length)?(field.value.indexOf(quotedParts[i+1])+quotedParts[i+1].length):(endPoint== index?(index+quotedParts[i].length):endPoint)); startPoint = ((i+1<quotedParts.length)?(fieldValue.indexOf(quotedParts[i+1])+quotedParts[i+1].length):(endPoint== index?(index+quotedParts[i].length):endPoint));
} }
if(startPoint !=field.value.length && decodeURIComponent(field.value.substring(startPoint,field.value.length)).split(" ").join("").length > 0){ if(startPoint !=fieldValue.length && decodeURIComponent(fieldValue.substring(startPoint,fieldValue.length)).split(" ").join("").length > 0){
params+=" and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint,field.value.length),isSearchAll); params+=" and " + this.getNoQuotedQueryPart(fieldId, fieldValue.substring(startPoint,fieldValue.length),isSearchAll);
} }
}else{ }else{
params+=this.getNoQuotedQueryPart(field.id, field.value,isSearchAll); params+=this.getNoQuotedQueryPart(fieldId, fieldValue,isSearchAll);
} }
params += " )"; params += " )";
return params; return params;
} }
private getQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){ private getQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
return " ("+(isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value)+")"; return (isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value);
} }
private getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){ private getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
if(isSearchAll){ if(isSearchAll){
return " (" + value + ")" return value ;
}else{ }else{
return " ("+fieldId+"="+ StringUtils.URIEncode(value)+")"; return fieldId+"="+ StringUtils.URIEncode(value);
} }
} }
@ -751,6 +777,7 @@ export class NewSearchPageComponent {
getSearchAPIQueryForRefineFields(URLparams, firstLoad: boolean) { getSearchAPIQueryForRefineFields(URLparams, firstLoad: boolean) {
var allFqs = ""; var allFqs = "";
console.log(this.refineFields)
for (var i = 0; i < this.refineFields.length; i++) { for (var i = 0; i < this.refineFields.length; i++) {
var filterId = this.refineFields[i]; var filterId = this.refineFields[i];
@ -1246,12 +1273,15 @@ export class NewSearchPageComponent {
* @param fieldIds * @param fieldIds
* @param selectedFields * @param selectedFields
* @param refineFields * @param refineFields
* @param rangeFields
* @param fieldIdsMap * @param fieldIdsMap
* @param customFilter * @param customFilter
* @param params * @param params
* @param entityType
* @param quickFilter
*/ */
prepareSearchPage(fieldIds, selectedFields, refineFields, rangeFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null){ prepareSearchPage(fieldIds, selectedFields, refineFields, rangeFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null){
//console.log("prepareSearchPage"); console.log(this.refineFields);
this.entityType = entityType; this.entityType = entityType;
this.fieldIds = fieldIds; this.fieldIds = fieldIds;
this.selectedFields = selectedFields; this.selectedFields = selectedFields;

View File

@ -51,7 +51,7 @@
</div> </div>
</div!--> </div!-->
<div class="uk-container"> <div class="uk-container uk-container-large">
<helper position="top"></helper> <helper position="top"></helper>
<div class="uk-width-2-3@m uk-width-2-3@l uk-width-1-1@s"> <div class="uk-width-2-3@m uk-width-2-3@l uk-width-1-1@s">
@ -99,17 +99,18 @@
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'"> <a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All Clear All
</a> </a>
<span *ngIf="searchViewLink" class="uk-width-expand"> <!-- <span *ngIf="searchViewLink" class="uk-width-expand">
<p> <p>
<span uk-tooltip="title: Table view" 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 uk-tooltip="title: Table view" 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> </span>
<a uk-tooltip="title: List view" routerLinkActive="router-link-active" [class]="(disableForms && !enableSearchView)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink > <a uk-tooltip="title: List view" 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> <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> </a>
<search-dataprovider-map [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map> <search-dataprovider-map [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p> </p>
</span> </span>-->
</div> </div>
</div> </div>
@ -163,7 +164,7 @@
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'"> <a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All Clear All
</a> </a>
<span *ngIf="searchViewLink" class="uk-width-expand"> <!-- <span *ngIf="searchViewLink" class="uk-width-expand">
<p> <p>
<span uk-tooltip="title: Table view" 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> <span uk-tooltip="title: Table view" 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>
@ -172,7 +173,7 @@
</a> </a>
<search-dataprovider-map class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map> <search-dataprovider-map class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</p> </p>
</span> </span>-->
</div> </div>
</div> </div>
@ -183,9 +184,21 @@
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" > <div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" >
<div *ngIf="openaireLink"> <a class="uk-margin-top uk-button uk-button-text" [href]=openaireLink target="_blank" >Results in OpenAIRE</a></div> <div *ngIf="openaireLink"> <a class="uk-margin-top uk-button uk-button-text" [href]=openaireLink target="_blank" >Results in OpenAIRE</a></div>
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> <div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom ">
<div class="uk-margin-top uk-margin-bottom"> <div class="uk-grid">
<search-results-per-page class="uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page> <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> </div>
<div class="searchPaging uk-panel uk-margin-top uk-margin-bottom uk-grid"> <div class="searchPaging uk-panel uk-margin-top uk-margin-bottom uk-grid">
<span class="uk-width-1-1@s uk-width-1-2@m"> <span class="uk-width-1-1@s uk-width-1-2@m">

View File

@ -36,9 +36,8 @@ export class SearchDataprovidersService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)])); .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
} }
//((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb")) //((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any { advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false ):any {
// &type=datasources let url = properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
let url = properties.searchAPIURLLAst+"resources2/?format=json";
if(params!= null && params != '' ) { if(params!= null && params != '' ) {
url +="&query=(" + params + ")"; url +="&query=(" + params + ")";
@ -358,7 +357,7 @@ export class SearchDataprovidersService {
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1; let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects']; let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
if(subject.content) { if(subject && subject.content) {
subjects.push(subject.content); subjects.push(subject.content);
} }
} }

View File

@ -240,7 +240,10 @@ export class EntitiesAutocompleteComponent {
} }
showItem(item:any):string{ showItem(item:any):string{
//console.log(item); //console.log(item);
if (item.projectName || item.projectAcronym || item.code){ //project if(!item){
return "[No title available]"
}
else if (item.projectName || item.projectAcronym || item.code){ //project
return ((item.projectAcronym)?"["+item.projectAcronym+"] ":"")+item.projectName+((item.code)?" ("+item.code+")":""); return ((item.projectAcronym)?"["+item.projectAcronym+"] ":"")+item.projectName+((item.code)?" ("+item.code+")":"");
}else if (item.name){ //search }else if (item.name){ //search
return item.name; return item.name;