diff --git a/deposit/datasets/depositBySubjectResult.component.ts b/deposit/datasets/depositBySubjectResult.component.ts
index 6f3f61e0..e0702c5f 100644
--- a/deposit/datasets/depositBySubjectResult.component.ts
+++ b/deposit/datasets/depositBySubjectResult.component.ts
@@ -21,38 +21,24 @@ import {ZenodoInformationClass} from '../utils/zenodoInformation.class';
@Component({
selector: 'deposit-by-subject-result',
- templateUrl: 'depositBySubjectResult.component.html'
+ template: `
+
+
+ `
+ //templateUrl: 'depositBySubjectResult.component.html'
})
export class DepositBySubjectResultComponent {
- @Input() compatibility: string = '';
-
- // Type of entity: Publication or Research Data
- @Input() requestFor: string = "Research Data";
- @Input() subject: string = "";
@Input() piwikSiteId = null;
- public newSubject: string= "";
-
- public fetchDataproviders : FetchDataproviders;
- public linkToSearchDataproviders = "";
-
- // url of Zenodo
- public zenodo: string;
-
- public page: number = 1;
-
- public status: number;
-
- public routerHelper:RouterHelper = new RouterHelper();
- public errorCodes:ErrorCodes = new ErrorCodes();
-
- sub: any;
- piwiksub: any;
- properties:EnvProperties;
- url=null;
-
@Input() zenodoInformation: ZenodoInformationClass;
+ public subject: string = "";
+ properties:EnvProperties;
+
+ constructor (private route: ActivatedRoute) {}
+
constructor (private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
@@ -78,13 +64,6 @@ export class DepositBySubjectResultComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
- this.updateUrl(data.envSpecific.baseLink+this._router.url);
- this.zenodo = this.properties.zenodo;
- this.url = data.envSpecific.baseLink+this._router.url;
-
- if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
- this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
- }
if(!this.zenodoInformation.url) {
this.zenodoInformation.url = this.properties.zenodo;
@@ -92,69 +71,6 @@ export class DepositBySubjectResultComponent {
if(!this.zenodoInformation.name) {
this.zenodoInformation.name = "Zenodo";
}
-
});
- console.info('depositResult init');
-
- this.sub = this.route.queryParams.subscribe(params => {
- this.subject = params['subject'];
- this.newSubject = this.subject;
- this.searchDataproviders();
- });
- }
-
- // ngDoCheck() {
- // if(this.organizationId == "" || this.organizationId == undefined) {
- // this.organizationId = "";
- // this.status = this.errorCodes.ERROR;
- // }
- // }
-
- ngOnDestroy() {
- this.sub.unsubscribe();
- if(this.piwiksub){
- this.piwiksub.unsubscribe();
- }
- }
-
- public totalPages(): number {
- let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
- if(!(Number.isInteger(totalPages))) {
- totalPages = (parseInt(totalPages, 10) + 1);
- }
- return totalPages;
- }
-
- public searchDataproviders() {
- this.subject = this.newSubject;
- this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10, this.properties);
- this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;
- }
-
- public goToDeposit() {
- if(this.requestFor == "Publications") {
- this._router.navigate( ['participate/deposit-publications'] );
- } else if(this.requestFor == "Research Data") {
- this._router.navigate( ['participate/deposit-datasets'] );
- }
- }
- public pageChange($event) {
- this.page = +$event.value;
- this.searchDataproviders();
- }
-
- private updateDescription(description:string) {
- this._meta.updateTag({content:description},"name='description'");
- this._meta.updateTag({content:description},"property='og:description'");
- }
- private updateTitle(title:string) {
- var _prefix ="OpenAIRE | ";
- var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
-
- this._title.setTitle(_title);
- this._meta.updateTag({content:_title},"property='og:title'");
- }
- private updateUrl(url:string) {
- this._meta.updateTag({content:url},"property='og:url'");
}
}
diff --git a/deposit/deposit.module.ts b/deposit/deposit.module.ts
index 1ad7098f..c07d8e0f 100644
--- a/deposit/deposit.module.ts
+++ b/deposit/deposit.module.ts
@@ -17,7 +17,8 @@ import { DepositBySubjectComponent } from './datasets/depositBySubject.component
import {IFrameModule} from '../utils/iframe.module';
import {Schema2jsonldModule} from '../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../sharedComponents/SEO/SEOService.module';
-
+import{SearchPagingModule} from '../searchPages/searchUtils/searchPaging.module';
+import {ApprovedByCommunityModule} from '../connect/approvedByCommunity/approved.module';
@NgModule({
@@ -30,7 +31,8 @@ import { SEOServiceModule } from '../sharedComponents/SEO/SEOService.module';
SearchResultsModule,
PiwikServiceModule,
HelperModule,
- IFrameModule, Schema2jsonldModule, SEOServiceModule
+ IFrameModule, Schema2jsonldModule, SEOServiceModule,
+ SearchPagingModule, ApprovedByCommunityModule
],
declarations: [
DepositComponent,
diff --git a/deposit/depositResult.component.ts b/deposit/depositResult.component.ts
index 2bf953f2..d8e20e02 100644
--- a/deposit/depositResult.component.ts
+++ b/deposit/depositResult.component.ts
@@ -25,18 +25,13 @@ import {ZenodoInformationClass} from './utils/zenodoInformation.class';
-
+
+ Deposit {{requestFor}}
+
-
-
-
-
+
0))"
+ class="organization">
+
+ {{organization['name']}}
+
+ {{organization['name']}}
+
-
0">
-
+
+
+
0" class=" uk-text-center ">
+
Keywords: {{subject}}
+
+
+
+
-
-
-
0">
-
Please use the information below and contact your repository to deposit your {{requestFor}}.
-
-
-
-
-
-
-
-
+
+
0)">
+ Please use the information below and contact your repository to deposit your {{requestFor}}.
+
+
+
0)"
+ class="uk-align-center uk-margin-remove-bottom">
+
+
+
+
+
+
+
+
+
+
+
[no title available]
+
+
+
+
{{result['type']}}
+
{{result.compatibility}}
+
+
-
- No organization with ID: {{organizationId}} found.
+
0">
+ Country: {{country}}{{(i < ( result['countries'].slice(0,10).length-1))?", ":""}}{{(i == result['countries'].slice(0,10).length-1 && result['countries'].length > 10)?"...":""}}
-
+
+
+
+
0">
+ Subject: {{subject}}{{(i < ( result['subjects'].slice(0,10).length-1))?", ":""}}{{(i == result['subjects'].slice(0,10).length-1 && result['subjects'].length > 10)?"...":""}}
+
+
+
+
+
+
+
+ No organization with ID: {{organizationId}} found.
+
+
+ An error occured.
+
+
+ Service temprorarily unavailable. Please try again later.
+
+
+ No ID for organization.
+
+
+
+
+
An error occured.
-
-
+
+
Service temprorarily unavailable. Please try again later.
-
- No ID for organization.
+
+ Requested page out of bounds.
+
+
+
+ No content providers found with classification "{{subject}}".
-
-
+
@@ -132,9 +209,12 @@ import {ZenodoInformationClass} from './utils/zenodoInformation.class';
+
0" class="uk-card uk-card-default uk-card-body portal-card uk-margin-small-top">
+ Compatibility is mpla mpla
+
+
-
diff --git a/searchPages/searchUtils/searchPage.component.ts b/searchPages/searchUtils/searchPage.component.ts
index 4fc1742d..d71ceb0a 100644
--- a/searchPages/searchUtils/searchPage.component.ts
+++ b/searchPages/searchUtils/searchPage.component.ts
@@ -52,6 +52,9 @@ export class SearchPageComponent {
@Input() openaireLink: string;
@Input() connectCommunityId: string;
@Input() sort: boolean = false;
+ @Input() mapUrl: string = "";
+ @Input() mapTooltipType: string ="content providers";
+ @Input() newQueryButton: boolean = true;
//@Input() sortBy: string = "";
@ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
@@ -481,7 +484,9 @@ export class SearchPageComponent {
}
var errorCodes:ErrorCodes = new ErrorCodes();
if(this.queryParameters.keys() && this.searchUtils.totalResults == 0 && this.searchUtils.status !=errorCodes.LOADING ){
- this.showUnknownFilters = true;
+ if(this.newQueryButton) {
+ this.showUnknownFilters = true;
+ }
}
return filters;
}
diff --git a/searchPages/searchUtils/searchPage.module.ts b/searchPages/searchUtils/searchPage.module.ts
index bd7fb194..3a72b706 100644
--- a/searchPages/searchUtils/searchPage.module.ts
+++ b/searchPages/searchUtils/searchPage.module.ts
@@ -22,12 +22,12 @@ import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.gua
import {HelperModule} from '../../utils/helper/helper.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
-
+import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
@NgModule({
imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule,
- LoadingModalModule, ReportsServiceModule,
+ LoadingModalModule, ReportsServiceModule, SearchDataproviderMapModule,
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule
],
declarations: [
diff --git a/searchPages/searchUtils/searchPageTableView.component.html b/searchPages/searchUtils/searchPageTableView.component.html
index 26694092..b7b3373d 100644
--- a/searchPages/searchUtils/searchPageTableView.component.html
+++ b/searchPages/searchUtils/searchPageTableView.component.html
@@ -61,7 +61,7 @@
-
-
diff --git a/searchPages/searchUtils/searchPageTableView.component.ts b/searchPages/searchUtils/searchPageTableView.component.ts
index ae94217e..661d8216 100644
--- a/searchPages/searchUtils/searchPageTableView.component.ts
+++ b/searchPages/searchUtils/searchPageTableView.component.ts
@@ -59,6 +59,8 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
@Input() enableSearchView: boolean = true;
@Input() searchFormClass: string = "searchForm";
@Input() formPlaceholderText = "Type Keywords...";
+ @Input() mapUrl: string = "";
+ @Input() mapTooltipType: string ="content providers";
@ViewChild (ModalLoading) loading : ModalLoading ;
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map
= new Map();
@@ -126,8 +128,10 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
ngAfterViewInit(): void {
try{
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
-
- if (this.filterData(data, this.searchUtils.keyword, this.filters)) {
+//console.info(dataIndex+": "+data);
+//console.info(this.results);
+ //if (this.filterData(this.results[dataIndex], this.searchUtils.keyword, this.filters)) {
+ if(this.filterAll(this.results[dataIndex], this.searchUtils.keyword.toLowerCase(),this.filters)) {
// console.info("filter true (keyword:"+this.searchUtils.keyword+")");
return true;
@@ -359,12 +363,13 @@ Transform initial - not filtered results to get the filtered number
var result = results.filter(row=>this.filterAll(row, this.searchUtils.keyword.toLowerCase(),this.filters));
let oldTotal = this.searchUtils.totalResults;
+ //console.info(result);
this.searchUtils.totalResults = result.length;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ //this.searchUtils.status = errorCodes.NONE;
}
// if(oldTotal != this.searchUtils.totalResults) {
@@ -451,9 +456,16 @@ Transform initial - not filtered results to get the filtered number
field = "compatibility";
} else if(filter.title == "Funder") {
field = "funder";
+ } else if(filter.title == "Country") {
+ field = "countries";
}
+ //console.info(row);
+console.info("|"+row[field]+"|"+" "+"|"+value.name+"|");
+ //if(row[field] == value.name) {
+ if(row[field] &&
+ ((filter.valueIsExact && (row[field].trim() == value.name.trim()))
+ || (!filter.valueIsExact && (row[field].includes(value.name))))){
- if(row[field] == value.name) {
returnValue = true;
if(filter.filterOperator == "or") {
break;
@@ -519,7 +531,9 @@ Transform initial - not filtered results to get the filtered number
}
}
- if(row[field].trim() == value.name.trim()) {
+ //if(row[field].trim() == value.name.trim()) {
+ if((filter.valueIsExact && (row[field].trim() == value.name.trim()))
+ || (!filter.valueIsExact && (row[field].includes(value.name)))){
returnValue = true;
if(filter.filterOperator == "or") {
break;
diff --git a/searchPages/searchUtils/searchPageTableView.module.ts b/searchPages/searchUtils/searchPageTableView.module.ts
index 2fe07fff..99395ddc 100644
--- a/searchPages/searchUtils/searchPageTableView.module.ts
+++ b/searchPages/searchUtils/searchPageTableView.module.ts
@@ -23,6 +23,7 @@ import {HelperModule} from '../../utils/helper/helper.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
+import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
@NgModule({
@@ -30,7 +31,7 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule,
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule,
DataTablesModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule,
- Schema2jsonldModule, SEOServiceModule, SearchResultsPerPageModule
+ Schema2jsonldModule, SEOServiceModule, SearchResultsPerPageModule, SearchDataproviderMapModule
],
declarations: [
SearchPageTableViewComponent
diff --git a/searchPages/searchUtils/tabResult.component.html b/searchPages/searchUtils/tabResult.component.html
index cc8d3214..39d02fef 100644
--- a/searchPages/searchUtils/tabResult.component.html
+++ b/searchPages/searchUtils/tabResult.component.html
@@ -15,10 +15,17 @@
-->
+
+
[no title available]
+
diff --git a/searchPages/simple/searchDataproviders.component.ts b/searchPages/simple/searchDataproviders.component.ts
index 806e8a4a..c0680bfa 100644
--- a/searchPages/simple/searchDataproviders.component.ts
+++ b/searchPages/simple/searchDataproviders.component.ts
@@ -24,7 +24,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
- searchFormClass="datasourcesSearchForm">
+ searchFormClass="datasourcesSearchForm"
+ [mapUrl]="mapUrl">
`
@@ -52,6 +53,8 @@ export class SearchDataprovidersComponent {
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
pagingLimit = 0;
+ public mapUrl: string;
+
properties: EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
@@ -67,7 +70,7 @@ properties: EnvProperties;
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToDataProviders;
this.pagingLimit = data.envSpecific.pagingLimit;
-
+ this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=all";
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
diff --git a/services/organization.service.ts b/services/organization.service.ts
index 69b5083c..a7bf60b7 100644
--- a/services/organization.service.ts
+++ b/services/organization.service.ts
@@ -28,6 +28,16 @@ export class OrganizationService {
}
+ getOrganizationNameAndUrlById(id: string, properties: EnvProperties): any {
+ console.info("getOrganizationNameById service");
+ let url = properties.searchAPIURLLAst+"organizations/"+id+"?format=json";
+
+ return this.http.get((properties.useCache) ? (properties.cacheUrl+encodeURIComponent(url)): url)
+ .map(res =>
res.json())
+ .map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
+ .map(res => this.parseOrganizationNameAndUrl(res));
+ }
+
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@@ -163,4 +173,23 @@ export class OrganizationService {
}
+ parseOrganizationNameAndUrl(organization: any): any {
+ console.info("parseOrganizationNameAndUrl");
+ let title: {"name": string, "url": string} = {"name": "", "url": ""};
+
+ if(organization != null) {
+ if(organization.hasOwnProperty("websiteurl")) {
+ title = {"name": organization.legalshortname, "url": organization.websiteurl};
+ } else {
+ title = {"name": organization.legalshortname, "url": ''};
+ }
+
+ if(title.name == '') {
+ title.name = organization.legalname;
+ }
+ }
+
+ return title;
+ }
+
}
diff --git a/services/searchDataproviders.service.ts b/services/searchDataproviders.service.ts
index e6274dc0..e8b540e9 100644
--- a/services/searchDataproviders.service.ts
+++ b/services/searchDataproviders.service.ts
@@ -146,9 +146,11 @@ export class SearchDataprovidersService {
let link = properties.searchResourcesAPIURL;
var compatibilities = "";
if(type == "Research Data"){
- compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
+ //compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
+ compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)";
}else if(type == "Publications"){
- compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
+ //compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
+ compatibilities = " and (datasourcecompatibilityid <> openaire2.0_data)";
}
let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact "+id+")";
url += "&page="+(page-1)+"&size="+size+"&format=json";
@@ -300,9 +302,13 @@ export class SearchDataprovidersService {
result['OAIPMHURL'] = OAIPMHURL;
}
}
- result['compatibility'] = this.getDataproviderCompatibility(resData);
+ let compatibility = this.getDataproviderCompatibility(resData);
+ result['compatibility'] = compatibility.classname;
+ if(compatibility.classid == "UNKNOWN") {
+ result['compatibilityUNKNOWN'] = true;
+ }
} else {
- result['compatibility'] = '';
+ result['compatibility'] = "";
}
result['websiteURL'] = resData.websiteurl;
@@ -335,11 +341,11 @@ export class SearchDataprovidersService {
}
}
- getDataproviderCompatibility(resData: any): string {
+ getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
if(resData.hasOwnProperty('openairecompatibility')) {
- return resData['openairecompatibility'].classname;
+ return {"classid": resData['openairecompatibility'].classid, "classname": resData['openairecompatibility'].classname};
} else {
- return '';
+ return {"classid": "", "classname": ""};
}
}
diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts
index eed34270..4110382d 100644
--- a/utils/entities/searchResult.ts
+++ b/utils/entities/searchResult.ts
@@ -5,7 +5,7 @@ export class SearchResult {
//publications & datasets & orp & organizations:
projects: {"funderShortname": string, "funderName": string, "acronym": string, "title": string, "code": string, "id": string}[];
- //datasets & orp & publications
+ //datasets & orp & publications & software
description: string;
year: string;
embargoEndDate: string;
@@ -36,6 +36,7 @@ export class SearchResult {
websiteURL: string;
OAIPMHURL: string;
compatibility: string;
+ compatibilityUNKNOWN: boolean;
countries: string[];
subjects: string[];
diff --git a/utils/entitiesAutoComplete/entitySearch.service.ts b/utils/entitiesAutoComplete/entitySearch.service.ts
index 71b14287..8de8806c 100644
--- a/utils/entitiesAutoComplete/entitySearch.service.ts
+++ b/utils/entitiesAutoComplete/entitySearch.service.ts
@@ -46,12 +46,23 @@ export class EntitiesSearchService {
let url = link+"?query=";
if(keyword!= null && keyword != '' ) {
- url += "((oaftype exact organization and deletedbyinference=false and "+
+ /*url += "((oaftype exact organization and deletedbyinference=false and "+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
- "and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
+ "and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/
+ // in search there is this filter:
+ //reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*
+
+
+ //url += "((oaftype exact organization and deletedbyinference=false )"+
+ url += "((oaftype exact organization and deletedbyinference=false and"+
+ "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
+ " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
+ // "and " + this.quote(params) + " " +
+ //"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
+ ")";
}
url += "&page=0&size=10";
diff --git a/utils/fetchEntitiesClasses/fetchDataproviders.class.ts b/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
index 89dd27d3..cbc2f3d5 100644
--- a/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
+++ b/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
@@ -14,7 +14,8 @@ export class FetchDataproviders {
};
public CSVDownloaded = false;
public csvParams: string;
-
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
this.errorCodes = new ErrorCodes();
@@ -174,6 +175,9 @@ export class FetchDataproviders {
public getResultsForDeposit(id:string, type:string, page: number, size: number, properties:EnvProperties){
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
+ this.results = [];
+ this.searchUtils.totalResults = 0;
+ this.loadPaging = false;
if(id != "") {
@@ -188,6 +192,20 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
+
+ if(this.searchUtils.status == this.errorCodes.DONE) {
+ // Page out of limit!!!
+ let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
+ if(!(Number.isInteger(totalPages))) {
+ totalPages = (parseInt(totalPages, 10) + 1);
+ }
+ if(totalPages < page) {
+ this.searchUtils.totalResults = 0;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
+ }
+ }
+ this.loadPaging = true;
+ this.oldTotalResults = this.searchUtils.totalResults;
},
err => {
console.log(err);
@@ -204,13 +222,20 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number,
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
+ this.loadPaging = true;
+ this.oldTotalResults = 0;
}
);
}
}
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number, properties:EnvProperties){
//var errorCodes:ErrorCodes = new ErrorCodes();
+
this.searchUtils.status = this.errorCodes.LOADING;
+ this.results = [];
+ this.searchUtils.totalResults = 0;
+ this.loadPaging = false;
+
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
@@ -222,6 +247,19 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
+ if(this.searchUtils.status == this.errorCodes.DONE) {
+ // Page out of limit!!!
+ let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
+ if(!(Number.isInteger(totalPages))) {
+ totalPages = (parseInt(totalPages, 10) + 1);
+ }
+ if(totalPages < page) {
+ this.searchUtils.totalResults = 0;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
+ }
+ }
+ this.loadPaging = true;
+ this.oldTotalResults = this.searchUtils.totalResults;
},
err => {
console.log(err);
@@ -238,6 +276,8 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
+ this.loadPaging = true;
+ this.oldTotalResults = 0;
}
);