[Library|Trunk]
New search page: Search research outcomes page: 1. add selection for result types 2. add Open Access as quick filter git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58072 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8b6b61f9c3
commit
32e65be516
|
@ -13,6 +13,7 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-research-results',
|
selector: 'search-research-results',
|
||||||
template: `
|
template: `
|
||||||
|
{{resultType}}
|
||||||
<new-search-page
|
<new-search-page
|
||||||
pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ getEntityName(resultType, true, true) | titlecase }}"
|
pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ getEntityName(resultType, true, true) | titlecase }}"
|
||||||
[entityType]="resultType"
|
[entityType]="resultType"
|
||||||
|
@ -38,7 +39,7 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SearchResearchResultsComponent {
|
export class SearchResearchResultsComponent {
|
||||||
@Input() resultType: string = "publication";
|
@Input() resultType: string = "result";
|
||||||
|
|
||||||
simpleSearchLink: string = "";
|
simpleSearchLink: string = "";
|
||||||
advancedSearchLink: string = "";
|
advancedSearchLink: string = "";
|
||||||
|
@ -113,7 +114,6 @@ export class SearchResearchResultsComponent {
|
||||||
refine = false;
|
refine = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
firstLoad = false;
|
|
||||||
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||||
this.searchUtils.page = (page <= 0) ? 1 : page;
|
this.searchUtils.page = (page <= 0) ? 1 : page;
|
||||||
|
|
||||||
|
@ -127,8 +127,10 @@ export class SearchResearchResultsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedFields = [];
|
this.selectedFields = [];
|
||||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params);
|
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params, this.resultType);
|
||||||
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params));
|
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
|
firstLoad = false;
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +158,7 @@ export class SearchResearchResultsComponent {
|
||||||
this.results = [];
|
this.results = [];
|
||||||
this.searchUtils.totalResults = 0;
|
this.searchUtils.totalResults = 0;
|
||||||
// TODO update the following method to get more than one types
|
// TODO update the following method to get more than one types
|
||||||
this._searchResearchResultsService.advancedSearch(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.searchUtils.totalResults = data[0];
|
this.searchUtils.totalResults = data[0];
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
|
@ -223,6 +225,8 @@ export class SearchResearchResultsComponent {
|
||||||
return "software";
|
return "software";
|
||||||
} else if (entityType == "other") {
|
} else if (entityType == "other") {
|
||||||
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
||||||
|
} else if (entityType == "result") {
|
||||||
|
return (full ? ("research outcome" + (plural ? "s" : "")) : "result");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
|
|
||||||
import {SearchResearchResultsServiceModule} from '../services/searchResearchResultsService.module';
|
import {SearchResearchResultsServiceModule} from '../services/searchResearchResultsService.module';
|
||||||
import {FreeGuard} from '../login/freeGuard.guard';
|
import {FreeGuard} from '../login/freeGuard.guard';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<form [class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-margin-small-top uk-padding-small':'advancedSearchForm uk-tile uk-margin-small-top uk-padding-small'">
|
<form
|
||||||
|
[class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-margin-small-top uk-padding-small':'advancedSearchForm uk-tile uk-margin-small-top uk-padding-small'">
|
||||||
<div *ngIf="!simpleView">
|
<div *ngIf="!simpleView">
|
||||||
<div class="uk-article-title custom-article-title uk-text-center">
|
<div class="uk-article-title custom-article-title uk-text-center">
|
||||||
{{pageTitle}}
|
{{pageTitle}}
|
||||||
|
@ -10,6 +11,9 @@
|
||||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
||||||
</span-->
|
</span-->
|
||||||
</a>
|
</a>
|
||||||
|
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
|
||||||
|
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
|
||||||
|
></quick-selections>
|
||||||
<table class=" uk-table uk-table-responsive uk-table-small">
|
<table class=" uk-table uk-table-responsive uk-table-small">
|
||||||
<tr *ngFor="let selectedField of selectedFields; let i = index" class="-row ">
|
<tr *ngFor="let selectedField of selectedFields; let i = index" class="-row ">
|
||||||
<td *ngIf="i==0 " class="">Search for:</td>
|
<td *ngIf="i==0 " class="">Search for:</td>
|
||||||
|
@ -74,12 +78,12 @@
|
||||||
icon="minus" ratio="0.8"><rect height="1" width="18" y="9"
|
icon="minus" ratio="0.8"><rect height="1" width="18" y="9"
|
||||||
x="1"></rect></svg></span>
|
x="1"></rect></svg></span>
|
||||||
</span>
|
</span>
|
||||||
<!-- <span *ngIf="selectedFields.length == 1" type="button" class="uk-icon-button icon-button-small" disabled>-->
|
<!-- <span *ngIf="selectedFields.length == 1" type="button" class="uk-icon-button icon-button-small" disabled>-->
|
||||||
<!-- <span class="uk-icon">-->
|
<!-- <span class="uk-icon">-->
|
||||||
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="minus"-->
|
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="minus"-->
|
||||||
<!-- ratio="0.8"><rect height="1" width="18" y="9" x="1"></rect></svg>-->
|
<!-- ratio="0.8"><rect height="1" width="18" y="9" x="1"></rect></svg>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
<span *ngIf="i == selectedFields.length-1 " type="button" class="uk-icon-button icon-button-small"
|
<span *ngIf="i == selectedFields.length-1 " type="button" class="uk-icon-button icon-button-small"
|
||||||
(click)="addField()">
|
(click)="addField()">
|
||||||
<span class="uk-icon">
|
<span class="uk-icon">
|
||||||
|
@ -120,6 +124,9 @@
|
||||||
<search-form *ngIf="selectedFields.length > 0" [isDisabled]="isDisabled" [(keyword)]="selectedFields[0].value"
|
<search-form *ngIf="selectedFields.length > 0" [isDisabled]="isDisabled" [(keyword)]="selectedFields[0].value"
|
||||||
(keywordChange)="simpleKeywordChanged($event)"
|
(keywordChange)="simpleKeywordChanged($event)"
|
||||||
[placeholderText]="formPlaceholderText"></search-form>
|
[placeholderText]="formPlaceholderText"></search-form>
|
||||||
|
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
|
||||||
|
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null">
|
||||||
|
</quick-selections>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
|
||||||
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
import {AdvancedField, Filter} from '../searchUtils/searchHelperClasses.class';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {Dates} from '../../utils/string-utils.class';
|
import {Dates} from '../../utils/string-utils.class';
|
||||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||||
|
@ -23,7 +23,8 @@ export class AdvancedSearchFormComponent {
|
||||||
@Input() formPlaceholderText = "Type Keywords...";
|
@Input() formPlaceholderText = "Type Keywords...";
|
||||||
@Input() pageTitle;
|
@Input() pageTitle;
|
||||||
@Output() queryChange = new EventEmitter();
|
@Output() queryChange = new EventEmitter();
|
||||||
|
@Input() @Output() resultTypes;
|
||||||
|
@Input() quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};
|
||||||
validDateFrom: boolean = true;
|
validDateFrom: boolean = true;
|
||||||
validDateTo: boolean = true;
|
validDateTo: boolean = true;
|
||||||
|
|
||||||
|
@ -31,9 +32,11 @@ export class AdvancedSearchFormComponent {
|
||||||
newFieldName:string;
|
newFieldName:string;
|
||||||
fieldList:{[id:string]:any[]} = {};
|
fieldList:{[id:string]:any[]} = {};
|
||||||
public searchFields:SearchFields = new SearchFields();
|
public searchFields:SearchFields = new SearchFields();
|
||||||
properties:EnvProperties;
|
properties:EnvProperties;
|
||||||
public operators: {name:string, id:string}[] = this.searchFields.ADVANCED_SEARCH_OPERATORS;
|
public operators: {name:string, id:string}[] = this.searchFields.ADVANCED_SEARCH_OPERATORS;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute) {
|
constructor (private route: ActivatedRoute) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -53,6 +56,7 @@ properties:EnvProperties;
|
||||||
this.queryChanged();
|
this.queryChanged();
|
||||||
}
|
}
|
||||||
queryChanged() {
|
queryChanged() {
|
||||||
|
console.log("Q CHanged!")
|
||||||
this.validDateFrom = true;
|
this.validDateFrom = true;
|
||||||
this.validDateTo = true;
|
this.validDateTo = true;
|
||||||
|
|
||||||
|
@ -72,7 +76,6 @@ properties:EnvProperties;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(this.validDateFrom && this.validDateTo) {
|
if(this.validDateFrom && this.validDateTo) {
|
||||||
//console.info("emit");
|
|
||||||
|
|
||||||
this.queryChange.emit({
|
this.queryChange.emit({
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
import { NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
import{AdvancedSearchFormComponent} from './advancedSearchForm.component';
|
import {AdvancedSearchFormComponent} from './advancedSearchForm.component';
|
||||||
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
|
import {EntitiesAutocompleteModule} from '../../utils/entitiesAutoComplete/entitiesAutoComplete.module';
|
||||||
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
|
import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAutoComplete.module';
|
||||||
import {DateFilterModule} from './dateFilter.module';
|
import {DateFilterModule} from './dateFilter.module';
|
||||||
import{SearchFormModule} from './searchForm.module';
|
import {SearchFormModule} from './searchForm.module';
|
||||||
|
import {QuickSelectionsModule} from "./quick-selections.module";
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule
|
CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule, QuickSelectionsModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AdvancedSearchFormComponent,
|
AdvancedSearchFormComponent,
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
[(fieldIds)]="fieldIds"
|
[(fieldIds)]="fieldIds"
|
||||||
[(fieldIdsMap)]="fieldIdsMap"
|
[(fieldIdsMap)]="fieldIdsMap"
|
||||||
[(selectedFields)]="selectedFields"
|
[(selectedFields)]="selectedFields"
|
||||||
(queryChange)="queryChanged($event)"
|
(queryChange)="queryChanged()"
|
||||||
[isDisabled]="disableForms"
|
[isDisabled]="disableForms"
|
||||||
[simpleSearchLink]="simpleSearchLink"
|
[simpleSearchLink]="simpleSearchLink"
|
||||||
[advancedSearchLink]="advancedSearchLink"
|
[advancedSearchLink]="advancedSearchLink"
|
||||||
[advancedSearchLinkParameters]
|
[advancedSearchLinkParameters]
|
||||||
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
|
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
|
||||||
[pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
|
[pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
|
||||||
|
[(resultTypes)]="resultTypes" [quickFilter]="quickFilter"
|
||||||
>
|
>
|
||||||
</advanced-search-form>
|
</advanced-search-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,14 +46,13 @@
|
||||||
<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 || mapUrl" 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>
|
||||||
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
|
|
||||||
</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'"
|
||||||
|
@ -109,14 +109,13 @@
|
||||||
<div *ngIf="showRefine" class="uk-margin-top uk-width-1-4@m search-filters uk-visible@m">
|
<div *ngIf="showRefine" class="uk-margin-top 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 || mapUrl" 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>
|
||||||
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
|
|
||||||
</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'"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, Input, ViewChild} from '@angular/core';
|
import {Component, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {Location} from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Meta, Title} from '@angular/platform-browser';
|
import {Meta, Title} from '@angular/platform-browser';
|
||||||
|
@ -47,14 +47,13 @@ export class NewSearchPageComponent {
|
||||||
//From simple:
|
//From simple:
|
||||||
@Input() refineFields = [];
|
@Input() refineFields = [];
|
||||||
@Input() filters = [];
|
@Input() filters = [];
|
||||||
selectedFilters:number = 0;
|
selectedFilters: number = 0;
|
||||||
private searchFieldsHelper: SearchFields = new SearchFields();
|
private searchFieldsHelper: SearchFields = new SearchFields();
|
||||||
@Input() newQueryButton: boolean = true;
|
@Input() newQueryButton: boolean = true;
|
||||||
public showUnknownFilters: boolean = false; // when a filter exists in query but has no results, so no filters returned from the query
|
public showUnknownFilters: boolean = false; // when a filter exists in query but has no results, so no filters returned from the query
|
||||||
URLCreatedFilters: Filter[] = [];
|
URLCreatedFilters: Filter[] = [];
|
||||||
@Input() showRefine: boolean = true;
|
@Input() showRefine: boolean = true;
|
||||||
@Input() tableViewLink: string;
|
@Input() tableViewLink: string;
|
||||||
@Input() mapUrl: string = "";
|
|
||||||
@Input() usedBy: string = "search";
|
@Input() usedBy: string = "search";
|
||||||
@Input() showResultCount: boolean = true;
|
@Input() showResultCount: boolean = true;
|
||||||
@Input() showMoreFilterValuesInline: boolean = false;
|
@Input() showMoreFilterValuesInline: boolean = false;
|
||||||
|
@ -62,6 +61,13 @@ export class NewSearchPageComponent {
|
||||||
@Input() keywordFields = [];
|
@Input() keywordFields = [];
|
||||||
@Input() simpleView: boolean = true;
|
@Input() simpleView: boolean = true;
|
||||||
@Input() formPlaceholderText = "Type Keywords...";
|
@Input() formPlaceholderText = "Type Keywords...";
|
||||||
|
@Input() @Output() resultTypes = null;
|
||||||
|
@Input() @Output() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
|
||||||
|
filter: null,
|
||||||
|
selected: true,
|
||||||
|
filterId: "resultbestaccessright",
|
||||||
|
value: "Open Access"
|
||||||
|
};
|
||||||
|
|
||||||
piwiksub: any;
|
piwiksub: any;
|
||||||
public parameterNames: string[] = [];
|
public parameterNames: string[] = [];
|
||||||
|
@ -168,6 +174,9 @@ export class NewSearchPageComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.selectedFilters = 0;
|
this.selectedFilters = 0;
|
||||||
|
if (this.quickFilter) {
|
||||||
|
this.removeValueFromQuickFilter();
|
||||||
|
}
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
// this.clearKeywords();
|
// this.clearKeywords();
|
||||||
}
|
}
|
||||||
|
@ -187,15 +196,11 @@ export class NewSearchPageComponent {
|
||||||
/* End Piwik Code */
|
/* End Piwik Code */
|
||||||
}
|
}
|
||||||
|
|
||||||
queryChanged($event) {
|
queryChanged() {
|
||||||
|
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageChanged($event) {
|
|
||||||
this.searchUtils.page = +$event.value;
|
|
||||||
this.goTo(this.searchUtils.page);
|
|
||||||
}
|
|
||||||
|
|
||||||
sizeChanged($event) {
|
sizeChanged($event) {
|
||||||
this.searchUtils.size = $event.value;
|
this.searchUtils.size = $event.value;
|
||||||
|
@ -286,7 +291,6 @@ export class NewSearchPageComponent {
|
||||||
var filter: Filter = filters[i];
|
var filter: Filter = filters[i];
|
||||||
filter.countSelectedValues = 0;
|
filter.countSelectedValues = 0;
|
||||||
if (this.parameterNames.indexOf(filter.filterId) != -1) {
|
if (this.parameterNames.indexOf(filter.filterId) != -1) {
|
||||||
console.log(filter.filterId + " "+this.parameterNames.indexOf(filter.filterId) )
|
|
||||||
let values = (decodeURIComponent(this.parameterValues[this.parameterNames.indexOf(filter.filterId)])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
|
let values = (decodeURIComponent(this.parameterValues[this.parameterNames.indexOf(filter.filterId)])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
|
||||||
for (let filterValue of filter.values) {
|
for (let filterValue of filter.values) {
|
||||||
if (values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
|
if (values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
|
||||||
|
@ -297,11 +301,23 @@ export class NewSearchPageComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (this.quickFilter.filterId == filter.filterId && this.quickFilter.selected) {
|
||||||
|
for (let filterValue of filter.values) {
|
||||||
|
if (filterValue.id == this.quickFilter.value) {
|
||||||
|
filterValue.selected = true;
|
||||||
|
filter.countSelectedValues++;
|
||||||
|
} else {
|
||||||
|
filterValue.selected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let filterValue of filter.values) {
|
for (let filterValue of filter.values) {
|
||||||
filterValue.selected = false;
|
filterValue.selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (filter.filterId == this.quickFilter.filterId) {
|
||||||
|
this.quickFilter.filter = filter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.filterFilterValues(this.filters);
|
this.filterFilterValues(this.filters);
|
||||||
return filters;
|
return filters;
|
||||||
|
@ -345,7 +361,7 @@ export class NewSearchPageComponent {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public countSelectedFilters(filters:Filter[]): number {
|
public countSelectedFilters(filters: Filter[]): number {
|
||||||
this.selectedFilters = 0;
|
this.selectedFilters = 0;
|
||||||
for (let filter of filters) {
|
for (let filter of filters) {
|
||||||
if (filter.countSelectedValues > 0) {
|
if (filter.countSelectedValues > 0) {
|
||||||
|
@ -368,6 +384,9 @@ export class NewSearchPageComponent {
|
||||||
if (value.selected == true) {
|
if (value.selected == true) {
|
||||||
value.selected = false;
|
value.selected = false;
|
||||||
}
|
}
|
||||||
|
if (this.quickFilter && this.quickFilter.filterId == filter.filterId) {
|
||||||
|
this.removeValueFromQuickFilter();
|
||||||
|
}
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -386,7 +405,26 @@ export class NewSearchPageComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
filterChanged($event) {
|
filterChanged($event) {
|
||||||
|
if (this.quickFilter) {
|
||||||
|
this.removeValueFromQuickFilter();
|
||||||
|
}
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if there is a change in the values of the quick filter, this function has to be run, to also update the quickFilter
|
||||||
|
*/
|
||||||
|
removeValueFromQuickFilter() {
|
||||||
|
if (this.quickFilter.filter.countSelectedValues == 0) {
|
||||||
|
this.quickFilter.selected = false;
|
||||||
|
} else {
|
||||||
|
let isQuickEnabled = false;
|
||||||
|
for (let filterValue of this.quickFilter.filter.values) {
|
||||||
|
isQuickEnabled = (filterValue.name == this.quickFilter.value)
|
||||||
|
}
|
||||||
|
this.quickFilter.selected = (isQuickEnabled && this.quickFilter.filter.countSelectedValues == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for loading
|
// for loading
|
||||||
|
@ -511,7 +549,7 @@ export class NewSearchPageComponent {
|
||||||
* Create Search API query based on the filters of refine fields
|
* Create Search API query based on the filters of refine fields
|
||||||
* @param URLparams
|
* @param URLparams
|
||||||
*/
|
*/
|
||||||
getSearchAPIQueryForRefineFields(URLparams) {
|
getSearchAPIQueryForRefineFields(URLparams, firstLoad: boolean) {
|
||||||
|
|
||||||
var allFqs = "";
|
var allFqs = "";
|
||||||
for (var i = 0; i < this.refineFields.length; i++) {
|
for (var i = 0; i < this.refineFields.length; i++) {
|
||||||
|
@ -539,6 +577,33 @@ export class NewSearchPageComponent {
|
||||||
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.quickFilter) {
|
||||||
|
if ((this.entityType == "result" && firstLoad && URLparams[this.quickFilter.filterId] == undefined && (URLparams["qf"] == undefined || URLparams["qf"] == "true"))
|
||||||
|
|| ((this.entityType == "result" && URLparams[this.quickFilter.filterId] != undefined && StringUtils.URIDecode(URLparams[this.quickFilter.filterId]).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1).indexOf(StringUtils.quote(this.quickFilter.value)) != -1))) {
|
||||||
|
this.quickFilter.selected = true;
|
||||||
|
} else {
|
||||||
|
this.quickFilter.selected = false;
|
||||||
|
}
|
||||||
|
if (this.entityType == "result" && firstLoad && URLparams[this.quickFilter.filterId] == undefined && (URLparams["qf"] == undefined || URLparams["qf"] == "true")) {
|
||||||
|
allFqs += "&fq=resultbestaccessright exact " + StringUtils.quote(this.quickFilter.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.entityType == "result") {
|
||||||
|
if (URLparams["type"]) {
|
||||||
|
for (let type of URLparams["type"].split(",")) {
|
||||||
|
allFqs += "&type=" + type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this.entityType == "publication") {
|
||||||
|
allFqs += "&type=publications";
|
||||||
|
} else if (this.entityType == "dataset") {
|
||||||
|
allFqs += "&type=datasets";
|
||||||
|
} else if (this.entityType == "software") {
|
||||||
|
allFqs += "&type=software";
|
||||||
|
} else if (this.entityType == "other") {
|
||||||
|
allFqs += "&type=other";
|
||||||
|
}
|
||||||
// var keyword = URLparams['keyword'];
|
// var keyword = URLparams['keyword'];
|
||||||
// var doiQuery = "";
|
// var doiQuery = "";
|
||||||
// var keywordQuery = "";
|
// var keywordQuery = "";
|
||||||
|
@ -576,8 +641,6 @@ export class NewSearchPageComponent {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//TODO add DOI?
|
//TODO add DOI?
|
||||||
// console.log(this.parameterNames)
|
|
||||||
// console.log(this.parameterValues)
|
|
||||||
return allFqs;
|
return allFqs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -588,7 +651,7 @@ export class NewSearchPageComponent {
|
||||||
* @param filters either query filters or filters defined by the URL parameters
|
* @param filters either query filters or filters defined by the URL parameters
|
||||||
* @param includePage
|
* @param includePage
|
||||||
*/
|
*/
|
||||||
buildPageURLParameters(filters:Filter[],includePage: boolean) {
|
buildPageURLParameters(filters: Filter[], includePage: boolean) {
|
||||||
this.parameterNames.splice(0, this.parameterNames.length);
|
this.parameterNames.splice(0, this.parameterNames.length);
|
||||||
this.parameterValues.splice(0, this.parameterValues.length);
|
this.parameterValues.splice(0, this.parameterValues.length);
|
||||||
var fields: { [key: string]: { values: string[], operators: string[] } } = {};
|
var fields: { [key: string]: { values: string[], operators: string[] } } = {};
|
||||||
|
@ -653,6 +716,30 @@ export class NewSearchPageComponent {
|
||||||
this.parameterValues.push(this.searchUtils.keyword);
|
this.parameterValues.push(this.searchUtils.keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.resultTypes && this.entityType == "result") {
|
||||||
|
let values = [];
|
||||||
|
if (this.resultTypes.publication) {
|
||||||
|
values.push("publications");
|
||||||
|
}
|
||||||
|
if (this.resultTypes.dataset) {
|
||||||
|
values.push("datasets");
|
||||||
|
}
|
||||||
|
if (this.resultTypes.software) {
|
||||||
|
values.push("software");
|
||||||
|
}
|
||||||
|
if (this.resultTypes.other) {
|
||||||
|
values.push("other");
|
||||||
|
}
|
||||||
|
if (values.length > 0) {
|
||||||
|
this.parameterNames.push("type");
|
||||||
|
this.parameterValues.push(values.join(","));
|
||||||
|
}
|
||||||
|
if(this.quickFilter) {
|
||||||
|
this.parameterNames.push("qf");
|
||||||
|
this.parameterValues.push("" + this.quickFilter.selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (this.searchUtils.size != this.resultsPerPage) {
|
// if (this.searchUtils.size != this.resultsPerPage) {
|
||||||
// // allLimits += ((allLimits.length == 0) ? '?' : '&') + 'size=' + this.searchUtils.size;
|
// // allLimits += ((allLimits.length == 0) ? '?' : '&') + 'size=' + this.searchUtils.size;
|
||||||
// this.parameterNames.push("size");
|
// this.parameterNames.push("size");
|
||||||
|
@ -695,11 +782,46 @@ export class NewSearchPageComponent {
|
||||||
filters.push(filter)
|
filters.push(filter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log("Empty Filters");
|
|
||||||
// console.log(filters);
|
|
||||||
this.URLCreatedFilters = filters;
|
|
||||||
// return filters;
|
|
||||||
|
|
||||||
|
if (this.quickFilter) {
|
||||||
|
if (this.entityType == "result" && (URLparams[this.quickFilter.filterId] == undefined) && (URLparams["qf"] == undefined || URLparams["qf"] == "true")) {
|
||||||
|
let filter = new Filter();
|
||||||
|
filter.title = fields.getFieldName(this.quickFilter.filterId, "publication");
|
||||||
|
filter.filterId = this.quickFilter.filterId;
|
||||||
|
filter.originalFilterId = this.quickFilter.filterId;
|
||||||
|
filter.values = [];
|
||||||
|
let v: Value = new Value();
|
||||||
|
v.name = this.quickFilter.value;
|
||||||
|
v.id = this.quickFilter.value;
|
||||||
|
v.selected = true;
|
||||||
|
filter.values.push(v);
|
||||||
|
filter.countSelectedValues = 1;
|
||||||
|
filters.push(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.entityType == "result") {
|
||||||
|
this.resultTypes = null;
|
||||||
|
this.resultTypes = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
if (URLparams["type"]) {
|
||||||
|
|
||||||
|
this.resultTypes['publication'] = (URLparams["type"].split(",").indexOf("publications") != -1);
|
||||||
|
this.resultTypes['dataset'] = (URLparams["type"].split(",").indexOf("datasets") != -1);
|
||||||
|
this.resultTypes['software'] = (URLparams["type"].split(",").indexOf("software") != -1);
|
||||||
|
this.resultTypes['other'] = (URLparams["type"].split(",").indexOf("other") != -1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.resultTypes['publication'] = true;
|
||||||
|
this.resultTypes['dataset'] = true;
|
||||||
|
this.resultTypes['software'] = true;
|
||||||
|
this.resultTypes['other'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.URLCreatedFilters = filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -708,11 +830,11 @@ export class NewSearchPageComponent {
|
||||||
* Count the checked
|
* Count the checked
|
||||||
* @param filters
|
* @param filters
|
||||||
*/
|
*/
|
||||||
public prepareFiltersToShow(filters:Filter[]):Filter[]{
|
public prepareFiltersToShow(filters: Filter[]): Filter[] {
|
||||||
if (this.URLCreatedFilters.length > 0 && this.searchUtils.totalResults == 0) {
|
if (this.URLCreatedFilters.length > 0 && this.searchUtils.totalResults == 0) {
|
||||||
this.showUnknownFilters = true;
|
this.showUnknownFilters = true;
|
||||||
this.filters = this.URLCreatedFilters;
|
this.filters = this.URLCreatedFilters;
|
||||||
} else if (this.searchUtils.totalResults != 0 ) {
|
} else if (this.searchUtils.totalResults != 0) {
|
||||||
this.showUnknownFilters = false;
|
this.showUnknownFilters = false;
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
}
|
}
|
||||||
|
@ -731,7 +853,8 @@ export class NewSearchPageComponent {
|
||||||
* @param customFilter
|
* @param customFilter
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
prepareSearchPage(fieldIds, selectedFields, refineFields,fieldIdsMap, customFilter, params){
|
prepareSearchPage(fieldIds, selectedFields, refineFields, fieldIdsMap, customFilter, params, entityType) {
|
||||||
|
this.entityType = entityType;
|
||||||
this.fieldIds = fieldIds;
|
this.fieldIds = fieldIds;
|
||||||
this.selectedFields = selectedFields;
|
this.selectedFields = selectedFields;
|
||||||
this.refineFields = refineFields;
|
this.refineFields = refineFields;
|
||||||
|
@ -739,5 +862,5 @@ export class NewSearchPageComponent {
|
||||||
this.customFilter = customFilter;
|
this.customFilter = customFilter;
|
||||||
this.getRefineFiltersFromURL(params);
|
this.getRefineFiltersFromURL(params);
|
||||||
this.createAdvancedSearchSelectedFiltersFromURLParameters(params);
|
this.createAdvancedSearchSelectedFiltersFromURLParameters(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
|
||||||
|
import {FormBuilder, FormGroup} from "@angular/forms";
|
||||||
|
import {Filter} from "./searchHelperClasses.class";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'quick-selections',
|
||||||
|
template: `
|
||||||
|
<form *ngIf="resultTypes" [formGroup]="control">
|
||||||
|
<div>
|
||||||
|
<mat-slide-toggle *ngIf="quickFilter"
|
||||||
|
class="example-margin" formControlName="QFselected" (change)="quickFilterChanged()">
|
||||||
|
{{quickFilter.value}}
|
||||||
|
</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
|
<span *ngIf="resultTypes">
|
||||||
|
<span> <input type="checkbox" id="publ" name="Publications" formControlName="publication" (change)="changed()">Publications </span>
|
||||||
|
<span> <input type="checkbox" formControlName="dataset" (change)="changed()"> Research Data </span>
|
||||||
|
<span> <input type="checkbox" formControlName="software" (change)="changed()"> Software </span>
|
||||||
|
<span> <input type="checkbox" formControlName="other" (change)="changed()"> Other Research outcomes </span>
|
||||||
|
</span>
|
||||||
|
</form>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
|
||||||
|
export class QuickSelectionsComponent implements OnChanges {
|
||||||
|
@Input() resultTypes;
|
||||||
|
@Output() typeChange = new EventEmitter();
|
||||||
|
@Input() isDisabled;
|
||||||
|
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
|
||||||
|
@Input() QFselected: boolean;
|
||||||
|
control: FormGroup;
|
||||||
|
initialized = false;
|
||||||
|
|
||||||
|
constructor(private _fb: FormBuilder) {
|
||||||
|
|
||||||
|
this.control = this._fb.group({
|
||||||
|
publication: true,
|
||||||
|
dataset: true,
|
||||||
|
software: true,
|
||||||
|
other: true,
|
||||||
|
QFselected: true
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
changed(typeChanged: boolean = true) {
|
||||||
|
if (!this.initialized && this.isDisabled) {
|
||||||
|
this.initialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let value = this.control.getRawValue();
|
||||||
|
this.resultTypes.publication = value.publication;
|
||||||
|
this.resultTypes.dataset = value.dataset;
|
||||||
|
this.resultTypes.software = value.software;
|
||||||
|
this.resultTypes.other = value.other;
|
||||||
|
// this.resultTypes.open = value.open;
|
||||||
|
if (typeChanged && this.resultTypes && !this.resultTypes.publication && !this.resultTypes.dataset && !this.resultTypes.software && !this.resultTypes.other) {
|
||||||
|
this.resultTypes.publication = true;
|
||||||
|
this.resultTypes.dataset = true;
|
||||||
|
this.resultTypes.software = true;
|
||||||
|
this.resultTypes.other = true;
|
||||||
|
this.setFormValues();
|
||||||
|
}
|
||||||
|
this.typeChange.emit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
quickFilterChanged() {
|
||||||
|
let value = this.control.getRawValue();
|
||||||
|
this.quickFilter.selected = value.QFselected;
|
||||||
|
if (value.QFselected) {
|
||||||
|
for (let filterValue of this.quickFilter.filter.values) {
|
||||||
|
filterValue.selected = (filterValue.name == this.quickFilter.value)
|
||||||
|
}
|
||||||
|
this.quickFilter.filter.countSelectedValues = 1;
|
||||||
|
} else {
|
||||||
|
for (let filterValue of this.quickFilter.filter.values) {
|
||||||
|
filterValue.selected = false;
|
||||||
|
}
|
||||||
|
this.quickFilter.filter.countSelectedValues = 0;
|
||||||
|
}
|
||||||
|
this.typeChange.emit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
if (this.resultTypes) {
|
||||||
|
this.setFormValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
if (changes.isDisabled) {
|
||||||
|
if (changes.isDisabled.currentValue == true) {
|
||||||
|
this.control.disable();
|
||||||
|
} else if (changes.isDisabled.currentValue == false) {
|
||||||
|
this.control.enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changes.QFselected) {
|
||||||
|
let value = this.control.getRawValue();
|
||||||
|
if (changes.QFselected.currentValue != value.QFselected) {
|
||||||
|
this.setFormValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setFormValues() {
|
||||||
|
this.control.setValue({
|
||||||
|
publication: this.resultTypes.publication,
|
||||||
|
dataset: this.resultTypes.dataset,
|
||||||
|
software: this.resultTypes.software,
|
||||||
|
other: this.resultTypes.software,
|
||||||
|
QFselected: this.QFselected
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {RouterModule} from '@angular/router';
|
||||||
|
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
|
||||||
|
import {QuickSelectionsComponent} from "./quick-selections.component";
|
||||||
|
import {MatCheckboxModule, MatSlideToggleModule} from "@angular/material";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule, FormsModule,
|
||||||
|
RouterModule, ShowAuthorsModule, MatCheckboxModule, ReactiveFormsModule, MatSlideToggleModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
QuickSelectionsComponent,
|
||||||
|
],
|
||||||
|
providers:[
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
QuickSelectionsComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class QuickSelectionsModule { }
|
|
@ -0,0 +1,33 @@
|
||||||
|
import {Component, Input} from '@angular/core';
|
||||||
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
||||||
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'select-content-tabs',
|
||||||
|
template: `
|
||||||
|
|
||||||
|
`
|
||||||
|
})
|
||||||
|
|
||||||
|
export class SelectAllContentTabsComponent {
|
||||||
|
@Input() searchAll: boolean;
|
||||||
|
@Input() status: number;
|
||||||
|
@Input() type: string;
|
||||||
|
@Input() urlParam: string;
|
||||||
|
@Input() showLoading: boolean = false;
|
||||||
|
@Input() showOrganizations: boolean = true;
|
||||||
|
|
||||||
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
|
public errorMessage: string = "No results found";
|
||||||
|
constructor () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {}
|
||||||
|
|
||||||
|
public quote(params: string):string {
|
||||||
|
return '"'+params+'"';
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,6 +102,28 @@ export class SearchResearchResultsService {
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
url += "&format=json";
|
url += "&format=json";
|
||||||
|
|
||||||
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
|
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
|
||||||
|
}
|
||||||
|
advancedSearchResults (resultType:string, params: string, page: number, size: number, sortBy: string, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
|
||||||
|
let url = properties.searchAPIURLLAst+"results/?format=json";
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url +="&query=(" + params + ")";
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
if(sortBy) {
|
||||||
|
let sortOptions = sortBy.split(",");
|
||||||
|
url += "sortBy "+sortOptions[0]+"/sort."+sortOptions[1]+" ";
|
||||||
|
}
|
||||||
|
if(refineQuery) {
|
||||||
|
url += "&" + refineQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
// url += "&format=json";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue