Add searchForm input in all search pages
This commit is contained in:
parent
73b6704124
commit
d17f9b4d5c
|
@ -59,7 +59,7 @@ import {properties} from "../../../environments/environment";
|
|||
|
||||
</form>
|
||||
</div>
|
||||
<search-dataproviders [simpleView]="true" type="deposit" simpleSearchLink="/participate/deposit/search" [includeOnlyResultsAndFilter]="true" >
|
||||
<search-dataproviders [simpleView]="true" [searchForm]="{class: null, dark: false}" type="deposit" simpleSearchLink="/participate/deposit/search" [includeOnlyResultsAndFilter]="true" >
|
||||
</search-dataproviders>
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -8,7 +8,7 @@ import {SearchFields} from '../utils/properties/searchFields';
|
|||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||
|
||||
import {EnvProperties} from '../utils/properties/env-properties';
|
||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||
import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
|
@ -34,7 +34,7 @@ import {properties} from "../../../environments/environment";
|
|||
[openaireLink]=openaireLink
|
||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||
[searchForm]="{class: '', dark: false}"
|
||||
[searchForm]="searchForm"
|
||||
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
|
||||
[filters]="filters"
|
||||
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
|
||||
|
@ -53,6 +53,7 @@ export class SearchDataProvidersComponent {
|
|||
@Input() piwikSiteId = null;
|
||||
@Input() customFilter:SearchCustomFilter= null;
|
||||
@Input() tableViewLink;
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
public results =[];
|
||||
public filters =[];
|
||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
|||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||
import {EnvProperties} from '../utils/properties/env-properties';
|
||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@ import {properties} from "../../../environments/environment";
|
|||
[openaireLink]=openaireLink
|
||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||
[searchForm]="searchForm"
|
||||
[sort]="false"
|
||||
[filters]="filters"
|
||||
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
||||
|
@ -46,6 +47,7 @@ export class SearchOrganizationsComponent {
|
|||
private errorMessages: ErrorMessagesComponent;
|
||||
properties:EnvProperties;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
public results =[];
|
||||
public filters =[];
|
||||
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
|||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||
import {EnvProperties} from '../utils/properties/env-properties';
|
||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
|
@ -30,6 +30,7 @@ import {properties} from "../../../environments/environment";
|
|||
[oldTotalResults]="oldTotalResults"
|
||||
[openaireLink]=openaireLink
|
||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||
[searchForm]="searchForm"
|
||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
|
||||
[filters]="filters"
|
||||
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
||||
|
@ -47,6 +48,7 @@ export class SearchProjectsComponent {
|
|||
private errorMessages: ErrorMessagesComponent;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() customFilter: SearchCustomFilter = null;
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
public results = [];
|
||||
public filters = [];
|
||||
public rangeFilters: RangeFilter[] = [];
|
||||
|
@ -138,6 +140,7 @@ export class SearchProjectsComponent {
|
|||
firstLoad = false;
|
||||
}));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.searchResultsSub) {
|
||||
this.searchResultsSub.unsubscribe();
|
||||
|
@ -154,7 +157,11 @@ export class SearchProjectsComponent {
|
|||
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
|
||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||
this.disableRefineForms = true;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
});
|
||||
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
||||
//.switchMap(
|
||||
.subscribe(
|
||||
|
@ -172,7 +179,11 @@ export class SearchProjectsComponent {
|
|||
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
|
||||
|
||||
this.disableRefineForms = false;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -209,7 +220,11 @@ export class SearchProjectsComponent {
|
|||
}
|
||||
|
||||
this.disableRefineForms = false;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
})
|
||||
}
|
||||
|
||||
public getResults(parameters: string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null) {
|
||||
|
@ -232,7 +247,11 @@ export class SearchProjectsComponent {
|
|||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
});
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
|
@ -265,7 +284,11 @@ export class SearchProjectsComponent {
|
|||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
})
|
||||
this.searchPage.hideFilters = false;
|
||||
}
|
||||
);
|
||||
|
@ -306,7 +329,11 @@ export class SearchProjectsComponent {
|
|||
}
|
||||
|
||||
this.disableForms = false;
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
|
||||
this.searchPageUpdates.emit({
|
||||
disableForms: this.disableForms,
|
||||
disableRefineForms: this.disableRefineForms,
|
||||
searchUtils: this.searchUtils
|
||||
})
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
|||
import {SearchFields} from '../utils/properties/searchFields';
|
||||
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
|
||||
import {EnvProperties} from '../utils/properties/env-properties';
|
||||
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
|
||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
||||
|
@ -31,6 +31,7 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
|||
[oldTotalResults]="oldTotalResults"
|
||||
[openaireLink]=openaireLink
|
||||
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
|
||||
[searchForm]="searchForm"
|
||||
[filters]="filters" [quickFilter]="quickFilter"
|
||||
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
|
||||
[simpleView]="simpleView" formPlaceholderText="Search by title, author, abstract, DOI, orcid..."
|
||||
|
@ -39,7 +40,6 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
|||
[stickyForm]="stickyForm"
|
||||
>
|
||||
</new-search-page>
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
|
@ -53,6 +53,7 @@ export class SearchResearchResultsComponent {
|
|||
private errorMessages: ErrorMessagesComponent;
|
||||
@Input() piwikSiteId = properties.piwikSiteId;
|
||||
@Input() hasPrefix: boolean = true;
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
public results = [];
|
||||
public filters = [];
|
||||
public rangeFilters: RangeFilter[] = [];
|
||||
|
|
|
@ -26,6 +26,11 @@ import {Subscriber} from "rxjs";
|
|||
import {IndexInfoService} from "../../utils/indexInfo.service";
|
||||
import { Option } from '../../sharedComponents/input/input.component';
|
||||
|
||||
export interface SearchForm {
|
||||
class: string,
|
||||
dark: boolean
|
||||
}
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
@Component({
|
||||
|
@ -59,10 +64,7 @@ export class NewSearchPageComponent {
|
|||
@Input() customFilter: SearchCustomFilter;
|
||||
@Input() sort: boolean = true;
|
||||
@Input() sortedByChanged: string = "";
|
||||
@Input() searchForm = {
|
||||
class: 'search-form',
|
||||
dark: true
|
||||
};
|
||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: true};
|
||||
//From simple:
|
||||
@Input() rangeFilters: RangeFilter[] = [];
|
||||
@Input() rangeFields: string[][] = [];
|
||||
|
|
|
@ -17,7 +17,7 @@ import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
|
|||
@Component({
|
||||
selector: '[search-input]',
|
||||
template: `
|
||||
<div class="uk-flex uk-flex-right uk-width-1-1">
|
||||
<div *ngIf="initialized" class="uk-flex uk-flex-right uk-width-1-1">
|
||||
<div #searchInput click-outside-or-esc (clickOutside)="click($event)" class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass">
|
||||
<div class="uk-flex uk-flex-middle">
|
||||
<div class="uk-width-expand">
|
||||
|
@ -53,6 +53,7 @@ export class SearchInputComponent implements OnInit {
|
|||
@ViewChild('searchInput') searchInput: ElementRef;
|
||||
@ViewChild('input') input: InputComponent;
|
||||
public expanded: boolean = true;
|
||||
public initialized: boolean = false;
|
||||
|
||||
constructor(private cdr: ChangeDetectorRef) {
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ export class SearchInputComponent implements OnInit {
|
|||
|
||||
ngOnInit() {
|
||||
this.expanded = !this.expandable;
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
expand(value: boolean) {
|
||||
|
|
Loading…
Reference in New Issue