From a7680ac098bf35b8fc732640fb968c988aee13c6 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 18 Jan 2017 08:11:55 +0000 Subject: [PATCH] Changes in advanced Search page | loading modal in all search pages | changes to autocomplete git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45439 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../deposit/depositPublications.component.ts | 6 +- .../advancedSearchDataProviders.component.ts | 6 ++ .../advancedSearchDatasets.component.ts | 6 ++ .../advancedSearchOrganizations.component.ts | 7 ++ .../advancedSearchPeople.component.ts | 6 ++ .../advancedSearchProjects.component.ts | 6 ++ .../advancedSearchPublications.component.ts | 6 ++ .../compatibleDataProviders.component.ts | 6 ++ .../entityRegistries.component.ts | 6 ++ .../advancedSearchForm.component.ts | 85 +++++++++---------- .../advancedSearchPage.component.ts | 10 +++ .../searchUtils/browseEntities.component.ts | 4 - .../searchUtils/searchFilter.component.ts | 52 +++++++++--- .../searchUtils/searchPage.component.ts | 11 +++ .../simple/searchDataproviders.component.ts | 4 + .../simple/searchDatasets.component.ts | 4 + .../simple/searchOrganizations.component.ts | 4 + .../simple/searchPeople.component.ts | 4 + .../simple/searchProjects.component.ts | 5 ++ .../simple/searchPublications.component.ts | 4 + .../utils/entitiesAutoComplete.component.ts | 31 +++++-- .../src/app/utils/modal/loading.component.ts | 10 ++- .../app/utils/staticAutoComplete.component.ts | 40 ++++++--- 23 files changed, 243 insertions(+), 80 deletions(-) diff --git a/portal-2/src/app/deposit/depositPublications.component.ts b/portal-2/src/app/deposit/depositPublications.component.ts index 6612e6ee..eb31207f 100644 --- a/portal-2/src/app/deposit/depositPublications.component.ts +++ b/portal-2/src/app/deposit/depositPublications.component.ts @@ -4,9 +4,13 @@ import {Component} from '@angular/core'; selector: 'deposit-publications', template: ` + ` }) export class DepositPublicationsComponent { - + public mapUrl ="https://beta.openaire.eu/stats/markers.html"; } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts index bc354c92..2f227107 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts @@ -66,6 +66,8 @@ export class AdvancedSearchDataProvidersComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search Publications: Execute search query "+parameters); this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe( data => { @@ -78,6 +80,8 @@ export class AdvancedSearchDataProvidersComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -88,6 +92,8 @@ export class AdvancedSearchDataProvidersComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts index 948368c6..de1508d9 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts @@ -71,6 +71,8 @@ export class AdvancedSearchDatasetsComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search Datasets: Execute search query "+parameters); this._searchDatasetsService.advancedSearchDatasets(parameters, page, size).subscribe( data => { @@ -83,6 +85,8 @@ export class AdvancedSearchDatasetsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -93,6 +97,8 @@ export class AdvancedSearchDatasetsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts index 61f41048..06babe99 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -50,6 +50,7 @@ export class AdvancedSearchOrganizationsComponent { ngOnInit() { var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status =errorCodes.LOADING; + this.sub = this.route.queryParams.subscribe(params => { let page = (params['page']=== undefined)?1:+params['page']; this.searchUtils.page = ( page <= 0 ) ? 1 : page; @@ -68,6 +69,8 @@ export class AdvancedSearchOrganizationsComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search Organizations: Execute search query "+parameters); this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size).subscribe( data => { @@ -80,6 +83,8 @@ export class AdvancedSearchOrganizationsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -90,6 +95,8 @@ export class AdvancedSearchOrganizationsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts index 5e4b0ef8..51d97f68 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.component.ts @@ -70,6 +70,8 @@ export class AdvancedSearchPeopleComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search People: Execute search query "+parameters); this._searchPeopleService.advancedSearchPeople(parameters, page, size).subscribe( data => { @@ -82,6 +84,8 @@ export class AdvancedSearchPeopleComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -92,6 +96,8 @@ export class AdvancedSearchPeopleComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts index 5429ce71..e0d70134 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts @@ -69,6 +69,8 @@ export class AdvancedSearchProjectsComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search Publications: Execute search query "+parameters); this._searchProjectsService.advancedSearchProjects(parameters, page, size).subscribe( data => { @@ -81,6 +83,8 @@ export class AdvancedSearchProjectsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -91,6 +95,8 @@ export class AdvancedSearchProjectsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts index 1d8cdf0e..b85f0a54 100644 --- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts +++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts @@ -70,6 +70,8 @@ export class AdvancedSearchPublicationsComponent { public getResults(parameters:string, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + console.info("Advanced Search Publications: Execute search query "+parameters); this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe( data => { @@ -82,6 +84,8 @@ export class AdvancedSearchPublicationsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -92,6 +96,8 @@ export class AdvancedSearchPublicationsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.NOT_AVAILABLE; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts index 4726a434..11e3a575 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -82,6 +82,8 @@ export class SearchCompatibleDataprovidersComponent { private _getResults(parameters:string,refine:boolean, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -94,6 +96,8 @@ export class SearchCompatibleDataprovidersComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -103,6 +107,8 @@ export class SearchCompatibleDataprovidersComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts index fedc865d..a4c6e950 100644 --- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts @@ -83,6 +83,8 @@ export class SearchEntityRegistriesComponent { private _getResults(parameters:string,refine:boolean, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -95,6 +97,8 @@ export class SearchEntityRegistriesComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); + }, err => { console.log(err); @@ -104,6 +108,8 @@ export class SearchEntityRegistriesComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts b/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts index 0d7ed689..284499c6 100644 --- a/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchForm.component.ts @@ -10,55 +10,49 @@ import {Dates} from '../../utils/string-utils.class'; selector: 'advanced-search-form', template: `
-
+ + + - - - + + + + + + -
+
+ + + +
Search for: - - - - - - - + + + - + Yes
No
- - - - +
- + {{_formatName(value)}} ({{value.number}}) +
+
+
+ + {{_formatName(value)}} ({{value.number}}) +
+
-
+ ` }) @@ -44,7 +52,7 @@ export class SearchFilterComponent { @Input() filter:Filter; @Input() showResultCount:boolean = true; public showAll:boolean = false; - public _maxCharacters:number =30; + public _maxCharacters:number =28; constructor () { @@ -69,14 +77,38 @@ export class SearchFilterComponent { filterChange(selected:boolean){ if(selected){ this.filter.countSelectedValues++; - this.reorderFilterValues(); + // this.reorderFilterValues(); }else{ this.filter.countSelectedValues--; - this.reorderFilterValues(); + // this.reorderFilterValues(); } } + getSelectedValues(filter):any{ + var selected = []; + if(filter.countSelectedValues >0){ + for (var i=0; i < filter.values.length; i++){ + if(filter.values[i].selected){ + selected.push(filter.values[i]); + } + } + } + return selected; + } + getNotSelectedValues(filter):any{ + var notSselected = []; + if(filter.countSelectedValues >0){ + for (var i=0; i < filter.values.length; i++){ + if(!filter.values[i].selected){ + notSselected.push(filter.values[i]); + } + } + }else { + notSselected = filter.values; + } + return notSselected; + } reorderFilterValues() { for(let value of this.filter.values) { if(value.selected) { diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index c61f194d..675ed608 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -6,6 +6,7 @@ import {SearchResult} from '../../utils/entities/searchResult'; import {SearchFields} from '../../utils/properties/searchFields'; import {SearchUtilsClass} from './searchUtils.class'; import {DOI} from '../../utils/string-utils.class'; +import {ModalLoading} from '../../utils/modal/loading.component'; @Component({ selector: 'search-page', @@ -58,6 +59,8 @@ import {DOI} from '../../utils/string-utils.class';
+ + ` }) export class SearchPageComponent { @@ -72,6 +75,7 @@ export class SearchPageComponent { @Input() showResultCount:boolean = true; @Input() showRefine:boolean = true; @Input() refineFields = []; + @ViewChild (ModalLoading) loading : ModalLoading ; public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }}; private searchFieldsHelper:SearchFields = new SearchFields(); private queryParameters: Map = new Map(); @@ -470,5 +474,12 @@ export class SearchPageComponent { private quote(params: string):string { return encodeURIComponent('"'+params+'"'); } + // for loading + public openLoading(){ + this.loading.open(); + } + public closeLoading(){ + this.loading.close(); + } } diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts index ef099056..44604633 100644 --- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts @@ -218,6 +218,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -232,6 +234,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -241,6 +244,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); } ); } diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts index 54bc93bc..b5ad4e5d 100644 --- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts @@ -167,6 +167,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchDatasetsService.searchDatasets(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -180,6 +182,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -189,6 +192,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); } ); } diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts index 682a7d91..5247c911 100644 --- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts @@ -81,6 +81,8 @@ export class SearchOrganizationsComponent { } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchOrganizationsService.searchOrganizations(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -94,6 +96,7 @@ export class SearchOrganizationsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -103,6 +106,7 @@ export class SearchOrganizationsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); } ); } diff --git a/portal-2/src/app/searchPages/simple/searchPeople.component.ts b/portal-2/src/app/searchPages/simple/searchPeople.component.ts index 7ee413c1..4259066a 100644 --- a/portal-2/src/app/searchPages/simple/searchPeople.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPeople.component.ts @@ -154,6 +154,8 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){ private _getResults(parameters:string,refine:boolean, page: number, size: number){ var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this._searchPeopleService.searchPeople(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -166,6 +168,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -175,6 +178,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); } ); } diff --git a/portal-2/src/app/searchPages/simple/searchProjects.component.ts b/portal-2/src/app/searchPages/simple/searchProjects.component.ts index 6001f4d8..e09d667d 100644 --- a/portal-2/src/app/searchPages/simple/searchProjects.component.ts +++ b/portal-2/src/app/searchPages/simple/searchProjects.component.ts @@ -84,8 +84,11 @@ export class SearchProjectsComponent { if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); } + var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); + this.subResults = this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -100,6 +103,7 @@ export class SearchProjectsComponent { if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -109,6 +113,7 @@ export class SearchProjectsComponent { // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); } ); } diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index b50b709f..a6081e15 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -196,6 +196,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; + this.searchPage.openLoading(); this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; @@ -209,6 +210,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = errorCodes.NONE; } + this.searchPage.closeLoading(); }, err => { console.log(err); @@ -218,6 +220,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number // } var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.ERROR; + this.searchPage.closeLoading(); + } ); } diff --git a/portal-2/src/app/utils/entitiesAutoComplete.component.ts b/portal-2/src/app/utils/entitiesAutoComplete.component.ts index 22937f52..03c5de78 100644 --- a/portal-2/src/app/utils/entitiesAutoComplete.component.ts +++ b/portal-2/src/app/utils/entitiesAutoComplete.component.ts @@ -16,17 +16,23 @@ import {EntitiesSearchService} from '../services/entitySearch.service'; template: ` - {{showItem(item)}} + {{truncate(showItem(item),14)}} - Loading... - {{warningMessage}} -
+ +
@@ -66,7 +72,8 @@ export class EntitiesAutocompleteComponent { @Input() public funderId:string; @Input() public entityType:string ; @Input() public depositType:string ; - + public results = 0; + public focus:boolean = false; constructor (private _search:EntitiesSearchService, private myElement: ElementRef) { @@ -81,7 +88,7 @@ export class EntitiesAutocompleteComponent { .switchMap((term: string) => { var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":this.funderId)); this.showLoading = false; - // this.numFilteredResults = results.length; + this.results = results.length; return results; }); }else if(this.entityType == "organization" && this.depositType ){ @@ -90,7 +97,7 @@ export class EntitiesAutocompleteComponent { .switchMap((term: string) => { var results = this._search.searchByDepositType(term, this.depositType); this.showLoading = false; - // this.numFilteredResults = results.length; + this.results = results.length; return results; }); @@ -102,7 +109,7 @@ export class EntitiesAutocompleteComponent { .switchMap((term: string) => { var results = this._search.searchByType(term, this.entityType); this.showLoading = false; - // this.numFilteredResults = results.length; + this.results = results.length; return results; }); @@ -134,6 +141,7 @@ export class EntitiesAutocompleteComponent { this.searchTermStream.next(this.keyword); // if(this.numFilteredResults ==0){ this.showLoading = true; + this.focus = true; // } } @@ -216,6 +224,10 @@ export class EntitiesAutocompleteComponent { } } + truncate(str:string, size:number):string{ + if(str == null){return "";} + return (str.length > size)?str.substr(0,size)+'...':str; + } private getSelectedNameFromGivenId(){ if(this.selectedValue && this.selectedValue.length > 0 ){ @@ -242,6 +254,7 @@ export class EntitiesAutocompleteComponent { this.keyword = ""; // this.numFilteredResults = 0; this.searchTermStream.next(this.keyword); + this.focus=false; } } diff --git a/portal-2/src/app/utils/modal/loading.component.ts b/portal-2/src/app/utils/modal/loading.component.ts index 95d9ff75..da824f3c 100644 --- a/portal-2/src/app/utils/modal/loading.component.ts +++ b/portal-2/src/app/utils/modal/loading.component.ts @@ -3,19 +3,25 @@ import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmit @Component({ selector: 'modal-loading', template: ` -