+ class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
diff --git a/portal-2/src/app/landingPages/project/project.module.ts b/portal-2/src/app/landingPages/project/project.module.ts
index 09dd9802..81ac48b8 100644
--- a/portal-2/src/app/landingPages/project/project.module.ts
+++ b/portal-2/src/app/landingPages/project/project.module.ts
@@ -7,22 +7,23 @@ import { RouterModule } from '@angular/router';
import { ProjectServiceModule} from './projectService.module';
// import {HtmlProgressReportService} from './htmlProgressReport.service';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
+import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import { ProjectComponent } from './project.component';
import { ProjectRoutingModule } from './project-routing.module';
import {IFrameModule} from '../../utils/iframe.module';
-import {MetricsModule} from '../metrics.module';
+import {MetricsModule} from '../landing-utils/metrics.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
-import { LandingModule } from '../landing.module';
+import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, LandingModule,
- ProjectRoutingModule, LoadingModalModule,
+ ProjectRoutingModule, LoadingModalModule, ErrorMessagesModule,
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule,
PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule
],
diff --git a/portal-2/src/app/landingPages/publication/publication.module.ts b/portal-2/src/app/landingPages/publication/publication.module.ts
index ed6d05c9..77241d64 100644
--- a/portal-2/src/app/landingPages/publication/publication.module.ts
+++ b/portal-2/src/app/landingPages/publication/publication.module.ts
@@ -8,14 +8,14 @@ import { RouterModule } from '@angular/router';
import { PublicationService} from './publication.service';
import { PublicationComponent } from './publication.component';
import { PublicationRoutingModule } from './publication-routing.module';
-import {MetricsModule} from '../metrics.module';
+import {MetricsModule} from '../landing-utils/metrics.module';
import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import {PagingModule} from '../../utils/paging.module';
-import { ResultLandingModule } from '../resultLanding.module';
-import { LandingModule } from '../landing.module';
+import { ResultLandingModule } from '../landing-utils/resultLanding.module';
+import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts
index bbe605c7..85f620eb 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts
@@ -21,13 +21,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(searchUtils)] = "searchUtils"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/dataproviders"
- [disableForms]="disableForms">
+ [disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults">
`
})
export class AdvancedSearchDataProvidersComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@@ -41,27 +45,32 @@ export class AdvancedSearchDataProvidersComponent {
public resourcesQuery = "(oaftype exact datasource)";
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
-
this.results =[];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDataProviders;
console.info("Con -base url:"+this.searchUtils.baseUrl );
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
- let page = (params['page']=== undefined)?0:+params['page'];
- this.searchUtils.page = ( page < 1 ) ? 1 : page;
- this.searchPage.fieldIds = this.fieldIds;
- this.selectedFields =[];
- this.searchPage.selectedFields = this.selectedFields;
- this.searchPage.fieldIdsMap = this.fieldIdsMap;
- this.searchPage.getSelectedFiltersFromUrl(params);
- this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+ let page = (params['page']=== undefined)?0:+params['page'];
+ this.searchUtils.page = ( page < 1 ) ? 1 : page;
+ this.searchPage.fieldIds = this.fieldIds;
+ this.selectedFields =[];
+ this.searchPage.selectedFields = this.selectedFields;
+ this.searchPage.fieldIdsMap = this.fieldIdsMap;
+ this.searchPage.getSelectedFiltersFromUrl(params);
+ this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
@@ -75,37 +84,37 @@ export class AdvancedSearchDataProvidersComponent {
this.csvParams ="&type=datasources&query="+this.resourcesQuery;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
- console.info("Advanced Search for Publications: Execute search query "+parameters);
+ console.info("Advanced Search for Content Providers: Execute search query "+parameters);
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("Adv Search Content Providers total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
- // Page out of limit!!!
+ 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 = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -116,8 +125,15 @@ export class AdvancedSearchDataProvidersComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -125,6 +141,8 @@ export class AdvancedSearchDataProvidersComponent {
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts
index 87d8e260..d5a41f05 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.component.ts
@@ -20,44 +20,52 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/datasets"
- [disableForms]="disableForms">
+ [disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults">
`
})
export class AdvancedSearchDatasetsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
-
public searchFields:SearchFields = new SearchFields();
-
- public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
- public fieldIdsMap= this.searchFields.RESULT_FIELDS;
- public selectedFields:AdvancedField[] = [];
+ public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
+ public fieldIdsMap= this.searchFields.RESULT_FIELDS;
+ public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "( (oaftype exact result) and (resulttypeid exact dataset) )";
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
-
this.results =[];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDatasets;
}
ngOnInit() {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
- this.sub = this.route.queryParams.subscribe(params => {
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
+ this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@@ -80,8 +88,8 @@ export class AdvancedSearchDatasetsComponent {
this.csvParams ="&type=datasets&query="+this.resourcesQuery;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -94,15 +102,15 @@ export class AdvancedSearchDatasetsComponent {
console.info("search Research Data total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -110,7 +118,7 @@ export class AdvancedSearchDatasetsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -121,8 +129,16 @@ export class AdvancedSearchDatasetsComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -133,6 +149,8 @@ export class AdvancedSearchDatasetsComponent {
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts
index 9ad6f004..dffde579 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.component.ts
@@ -20,13 +20,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/organizations"
- [disableForms]="disableForms">
+ [disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults">
`
})
export class AdvancedSearchOrganizationsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@@ -37,25 +41,31 @@ export class AdvancedSearchOrganizationsComponent {
public selectedFields:AdvancedField[] = [];
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "(oaftype exact organization)";
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
-
this.results =[];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedOrganizations;
}
ngOnInit() {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
+
+ this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
- this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@@ -78,8 +88,8 @@ public resourcesQuery = "(oaftype exact organization)";
this.csvParams ="&type=organizations&query="+this.resourcesQuery;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -92,15 +102,15 @@ public resourcesQuery = "(oaftype exact organization)";
console.info("search Organizations total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -108,7 +118,7 @@ public resourcesQuery = "(oaftype exact organization)";
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -119,8 +129,16 @@ public resourcesQuery = "(oaftype exact organization)";
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -131,6 +149,8 @@ public resourcesQuery = "(oaftype exact organization)";
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts
index 8061b74d..bf1af211 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.component.ts
@@ -19,19 +19,22 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/projects"
- [disableForms]="disableForms">
+ [disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults">
`
})
export class AdvancedSearchProjectsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
-
- public searchFields:SearchFields = new SearchFields();
+ public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
@@ -41,21 +44,28 @@ export class AdvancedSearchProjectsComponent {
public resourcesQuery = "(oaftype exact project)";
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
this.results =[];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedProjects;
}
ngOnInit() {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
- this.sub = this.route.queryParams.subscribe(params => {
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
+ this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@@ -78,8 +88,8 @@ export class AdvancedSearchProjectsComponent {
this.csvParams ="&type=projects&query="+this.resourcesQuery;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -92,15 +102,15 @@ export class AdvancedSearchProjectsComponent {
console.info("Advanced Search for Projects total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -108,7 +118,7 @@ export class AdvancedSearchProjectsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -119,8 +129,16 @@ export class AdvancedSearchProjectsComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -132,6 +150,8 @@ export class AdvancedSearchProjectsComponent {
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts
index 1208e035..8f0cfa26 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.component.ts
@@ -20,24 +20,30 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/publications"
- [disableForms]="disableForms">
+ [disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults">
`
})
export class AdvancedSearchPublicationsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
- public searchUtils:SearchUtilsClass = new SearchUtilsClass();
+ public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
- public fieldIdsMap= this.searchFields.RESULT_FIELDS;
- public selectedFields:AdvancedField[] = [];
- public resourcesQuery = "((oaftype exact result) and (resulttypeid exact publication))";
- public csvParams: string;
- public disableForms: boolean = false;
+ public fieldIdsMap= this.searchFields.RESULT_FIELDS;
+ public selectedFields:AdvancedField[] = [];
+ public resourcesQuery = "((oaftype exact result) and (resulttypeid exact publication))";
+ public csvParams: string;
+ public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@@ -45,17 +51,22 @@ export class AdvancedSearchPublicationsComponent {
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
this.results =[];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPublications;
}
ngOnInit() {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
- this.sub = this.route.queryParams.subscribe(params => {
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
+ this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@@ -64,8 +75,7 @@ export class AdvancedSearchPublicationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
- this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
-
+ this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
@@ -79,8 +89,8 @@ export class AdvancedSearchPublicationsComponent {
this.csvParams ="&type=publications&query="+this.resourcesQuery;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -93,15 +103,15 @@ export class AdvancedSearchPublicationsComponent {
console.info("searchPubl total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -109,7 +119,7 @@ export class AdvancedSearchPublicationsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -120,8 +130,16 @@ export class AdvancedSearchPublicationsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.NOT_AVAILABLE;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -130,6 +148,8 @@ export class AdvancedSearchPublicationsComponent {
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);
diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts
index c80d9a50..4e842e97 100644
--- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts
@@ -31,6 +31,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchCompatibleDataprovidersComponent {
+ private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@@ -55,8 +56,8 @@ export class SearchCompatibleDataprovidersComponent {
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProviders();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@@ -91,8 +92,8 @@ export class SearchCompatibleDataprovidersComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -105,10 +106,10 @@ export class SearchCompatibleDataprovidersComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -120,8 +121,16 @@ export class SearchCompatibleDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts
index e6c85963..3b4e7c4f 100644
--- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts
@@ -27,6 +27,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchCompatibleDataprovidersTableComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -48,8 +50,8 @@ export class SearchCompatibleDataprovidersTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProvidersTable();
}
@@ -74,8 +76,8 @@ export class SearchCompatibleDataprovidersTableComponent {
private _getResults(){
//this.csvParams = this.resourcesQuery+"&type=datasources";
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@@ -93,10 +95,10 @@ export class SearchCompatibleDataprovidersTableComponent {
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
},
@@ -106,8 +108,16 @@ export class SearchCompatibleDataprovidersTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
this.disableForms = false;
}
@@ -115,8 +125,8 @@ export class SearchCompatibleDataprovidersTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@@ -126,8 +136,15 @@ export class SearchCompatibleDataprovidersTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts
index ba082d12..d3652b04 100644
--- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts
@@ -30,6 +30,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchEntityRegistriesComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -55,8 +57,8 @@ export class SearchEntityRegistriesComponent {
public csvParams: string;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchEntityRegistries();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@@ -91,8 +93,8 @@ export class SearchEntityRegistriesComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -105,10 +107,10 @@ export class SearchEntityRegistriesComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -120,8 +122,16 @@ export class SearchEntityRegistriesComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts
index 255cab62..c4c5a453 100644
--- a/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts
@@ -28,6 +28,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchEntityRegistriesTableComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -41,8 +43,8 @@ export class SearchEntityRegistriesTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
@@ -65,8 +67,8 @@ export class SearchEntityRegistriesTableComponent {
this.subResults.unsubscribe();
} }
private _getResults(parameters:string,refine:boolean, page: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@@ -83,10 +85,10 @@ export class SearchEntityRegistriesTableComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
@@ -97,8 +99,16 @@ export class SearchEntityRegistriesTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
this.disableForms = false;
}
@@ -106,8 +116,8 @@ export class SearchEntityRegistriesTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@@ -117,8 +127,15 @@ export class SearchEntityRegistriesTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
/*
diff --git a/portal-2/src/app/searchPages/dataProviders/journals.component.ts b/portal-2/src/app/searchPages/dataProviders/journals.component.ts
index b9f2dbcd..265d0126 100644
--- a/portal-2/src/app/searchPages/dataProviders/journals.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/journals.component.ts
@@ -29,6 +29,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchJournalsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -54,8 +56,8 @@ export class SearchJournalsComponent {
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchJournals();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@@ -90,8 +92,8 @@ export class SearchJournalsComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -104,10 +106,10 @@ export class SearchJournalsComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -119,8 +121,16 @@ export class SearchJournalsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
diff --git a/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts
index 15000828..4322a268 100644
--- a/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts
+++ b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts
@@ -27,6 +27,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchJournalsTableComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -48,8 +50,8 @@ export class SearchJournalsTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchJournalsTable();
}
@@ -74,8 +76,8 @@ export class SearchJournalsTableComponent {
private _getResults(){
//this.csvParams = this.resourcesQuery+"&type=datasources";
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@@ -93,10 +95,10 @@ export class SearchJournalsTableComponent {
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
},
@@ -106,8 +108,16 @@ export class SearchJournalsTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
this.disableForms = false;
}
@@ -115,8 +125,8 @@ export class SearchJournalsTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.NONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@@ -126,8 +136,15 @@ export class SearchJournalsTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
diff --git a/portal-2/src/app/searchPages/find/search.component.ts b/portal-2/src/app/searchPages/find/search.component.ts
index 4d70c9c3..4a01101e 100644
--- a/portal-2/src/app/searchPages/find/search.component.ts
+++ b/portal-2/src/app/searchPages/find/search.component.ts
@@ -142,8 +142,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchPublications() {
this.activeTab = "publications";
if( this.reloadPublications &&
- this.fetchPublications.searchUtils.status != this.errorCodes.NONE &&
- this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) {
+ ( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
+ this.fetchPublications.searchUtils.status == this.errorCodes.DONE )) {
this.reloadPublications = false;
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications();// + "?keyword=" + this.keyword;
@@ -152,8 +152,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDatasets() {
this.activeTab = "research data";
if(this.reloadDatasets &&
- this.fetchDatasets.searchUtils.status != this.errorCodes.NONE &&
- this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) {
+ ( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
+ this.fetchDatasets.searchUtils.status == this.errorCodes.DONE )) {
this.reloadDatasets = false;
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDatasets = OpenaireProperties.getLinkToSearchDatasets();// + "?keyword=" + this.keyword;
@@ -163,8 +163,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this.activeTab = "projects";
console.log("searchProjects");
if(this.reloadProjects &&
- this.fetchProjects.searchUtils.status != this.errorCodes.NONE &&
- this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) {
+ ( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
+ this.fetchProjects.searchUtils.status == this.errorCodes.DONE )) {
this.reloadProjects = false;
console.log("do the search searchProjects");
@@ -175,8 +175,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDataProviders() {
this.activeTab = "content providers";
if( this.reloadDataproviders &&
- this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE &&
- this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) {
+ ( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
+ this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE )) {
this.reloadDataproviders = false;
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();// + "?keyword=" + this.keyword;
@@ -185,8 +185,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchOrganizations() {
this.activeTab = "organizations";
if( this.reloadOrganizations &&
- this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE &&
- this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) {
+ ( this.fetchOrganizations.searchUtils.status == this.errorCodes.LOADING ||
+ this.fetchOrganizations.searchUtils.status == this.errorCodes.DONE )) {
this.reloadOrganizations = false;
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword;
@@ -234,7 +234,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
- this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
+ if(err.status == '404') {
+ this.fetchPublications.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.fetchPublications.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ //this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@@ -251,7 +258,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
- this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
+ if(err.status == '404') {
+ this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ //this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@@ -268,7 +282,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
- this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
+ if(err.status == '404') {
+ this.fetchProjects.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.fetchProjects.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ //this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@@ -289,7 +310,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
- this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
+ if(err.status == '404') {
+ this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+ //this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
}
);
diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.html b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.html
index ef3cddc7..fcae0007 100644
--- a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.html
+++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.html
@@ -21,7 +21,7 @@
-
+
diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts
index e4ebe4de..14acacef 100644
--- a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts
@@ -14,7 +14,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'advanced-search-page',
- templateUrl: 'advancedSearchPage.component.html'
+ templateUrl: 'advancedSearchPage.component.html'
})
export class AdvancedSearchPageComponent {
@Input() pageTitle = "";
@@ -31,6 +31,9 @@ export class AdvancedSearchPageComponent {
@Input() csvPath: string;
@Input() simpleSearchLink: string = "";
@Input() disableForms:boolean = false;
+ @Input() loadPaging: boolean = true;
+ @Input() oldTotalResults: number = 0;
+
piwiksub: any;
public parameterNames:string[] =[];
public parameterValues:string[] =[];
diff --git a/portal-2/src/app/searchPages/searchUtils/browseEntities.component.ts b/portal-2/src/app/searchPages/searchUtils/browseEntities.component.ts
index 767fea1f..e8285021 100644
--- a/portal-2/src/app/searchPages/searchUtils/browseEntities.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/browseEntities.component.ts
@@ -14,10 +14,12 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
selector: 'browse-entities',
template: `
-
+
+
@@ -81,7 +83,14 @@ private getStats(){
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- this.status = this.errorCodes.ERROR;
+ //this.status = this.errorCodes.ERROR;
+ if(err.status == '404') {
+ this.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.status = this.errorCodes.ERROR;
+ } else {
+ this.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
diff --git a/portal-2/src/app/searchPages/searchUtils/browseEntities.module.ts b/portal-2/src/app/searchPages/searchUtils/browseEntities.module.ts
index 163cb7dd..2d8d3cda 100644
--- a/portal-2/src/app/searchPages/searchUtils/browseEntities.module.ts
+++ b/portal-2/src/app/searchPages/searchUtils/browseEntities.module.ts
@@ -8,10 +8,11 @@ import {RefineFieldResultsServiceModule} from '../../services/refineFieldResults
import {BrowseEntitiesComponent} from './browseEntities.component';
import {BrowseStatisticComponent} from './browseStatistic.component';
+import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
- CommonModule, FormsModule,
+ CommonModule, FormsModule, ErrorMessagesModule,
RefineFieldResultsServiceModule, RouterModule
],
declarations: [
diff --git a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts
index 8814c41c..383b9e90 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts
@@ -9,7 +9,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'search-download',
template: `
-
+ 0 && totalResults <= 10000">
(CSV)
diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.html b/portal-2/src/app/searchPages/searchUtils/searchPage.component.html
index a992d6bf..55e3188c 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.html
+++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.html
@@ -1,66 +1,66 @@
-
-
+
+
-
-
diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts
index 293b2afe..55bba1ef 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts
@@ -40,6 +40,8 @@ export class SearchPageComponent {
@Input() advancedSearchLink: string = "";
@Input() tableViewLink: string;
@Input() disableForms: boolean = false;
+ @Input() loadPaging: boolean = true;
+ @Input() oldTotalResults: number = 0;
@Input() tableView: boolean = false;
@Input() searchFormClass: string = "searchForm";
@ViewChild (ModalLoading) loading : ModalLoading ;
@@ -118,12 +120,15 @@ export class SearchPageComponent {
public getQueryParametersFromUrl(params){
// var parameters = "";
var allFqs = "";
+
this.queryParameters = new Map
();
+
for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i];
if(params[filterId] != undefined) {
this.queryParameters[filterId]=StringUtils.URIDecode(params[filterId]);
+
let values = (StringUtils.URIDecode(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0;
var fq = "";
@@ -138,8 +143,6 @@ export class SearchPageComponent {
}
allFqs += fq;
}
-
-
}
var keyword = params['keyword'];
var doiQuery = "";
diff --git a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.html b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.html
index e97596f2..c6c09370 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.html
+++ b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.html
@@ -32,12 +32,14 @@
-
No Results found
+
+
+
-
0" class=" search-filters uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s uk-margin-large-top uk-visible@m">
+
0" class=" search-filters uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-margin-large-top uk-visible@m">
-
+
0">
-
+ |
{{searchUtils.totalResults}} content providers, page {{searchUtils.page}} of {{(totalPages())}}
@@ -75,16 +77,6 @@
- |
-
-
-
-
-
-
-
-
- |
@@ -155,9 +147,17 @@
-
-
+
diff --git a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.module.ts b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.module.ts
index 86de5549..2586914e 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.module.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.module.ts
@@ -23,11 +23,13 @@ import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {HelperModule} from '../../utils/helper/helper.module';
+import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule,
- ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule, PiwikServiceModule, HelperModule
+ ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule,
+ DataTableModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule
],
declarations: [
SearchPageTableViewComponent//,
diff --git a/portal-2/src/app/searchPages/searchUtils/searchPaging.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPaging.component.ts
index 1f8b4a64..a3ca6a6b 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchPaging.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchPaging.component.ts
@@ -1,15 +1,22 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
+import {ErrorCodes} from '../../utils/properties/openaireProperties';
@Component({
selector: 'search-paging',
template: `
-
-
0">
- {{searchUtils.totalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages())}}
+
+
0">
+ {{searchUtils.totalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages(searchUtils.totalResults))}}
-
searchUtils.size">
-
+
0 && searchUtils.status == errorCodes.LOADING">
+ {{oldTotalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages(oldTotalResults))}}
+
+
+
searchUtils.size && searchUtils.status == errorCodes.LOADING">
+
`
@@ -23,16 +30,24 @@ export class SearchPagingComponent {
@Input() parameterNames:string[];
@Input() parameterValues:string[];
+ @Input() loadPaging: boolean = true;
+ @Input() oldTotalResults: number = 0;
+
+ public totalResults: number = 0;
+ public errorCodes:ErrorCodes = new ErrorCodes();
+
// @Input() totalResults:number = 0;
- constructor () {
- }
+ constructor () {}
ngOnInit() {
-
+ // this.totalResults = this.searchUtils.totalResults;
+ // if(!this.loadPaging && this.totalResults == 0) {
+ // this.totalResults = this.oldTotalResults;
+ // }
}
- totalPages(): number {
- let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
+ totalPages(totalResults: number): number {
+ let totalPages:any = totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.html b/portal-2/src/app/searchPages/searchUtils/searchResult.component.html
index 8a0ebbf8..4d408432 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.html
+++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.html
@@ -1,10 +1,11 @@
- No Results found
+
+
-
diff --git a/portal-2/src/app/searchPages/searchUtils/searchResults.module.ts b/portal-2/src/app/searchPages/searchUtils/searchResults.module.ts
index 9c85670c..0ca38971 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchResults.module.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchResults.module.ts
@@ -1,15 +1,17 @@
-import { NgModule} from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { FormsModule } from '@angular/forms';
+import { NgModule} from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { RouterModule } from '@angular/router';
-import {SearchResult} from '../../utils/entities/searchResult';
-import {SearchResultComponent} from './searchResult.component';
-import { RouterModule } from '@angular/router';
+import {ErrorMessagesModule} from '../../utils/errorMessages.module';
+
+import {SearchResult} from '../../utils/entities/searchResult';
+import {SearchResultComponent} from './searchResult.component';
@NgModule({
imports: [
CommonModule, FormsModule,
- RouterModule
+ RouterModule, ErrorMessagesModule
],
declarations: [
SearchResultComponent,
diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts
index 1b0da1cd..8e57cd16 100644
--- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts
+++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts
@@ -20,12 +20,16 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasources" advancedSearchLink="/search/advanced/dataproviders"
[disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults"
searchFormClass="datasourcesSearchForm">
`
})
export class SearchDataprovidersComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public totalResults:number = 0 ;
@@ -35,7 +39,7 @@ export class SearchDataprovidersComponent {
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS;
- public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
+ public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
@@ -43,12 +47,14 @@ export class SearchDataprovidersComponent {
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
}
@@ -59,17 +65,22 @@ export class SearchDataprovidersComponent {
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
- this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
- var refine = true;
- if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
- refine = false;
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
- }
- firstLoad = false;
- this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
+ this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
+ var refine = true;
+ if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
+ refine = false;
- var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
- this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
+ }
+ firstLoad = false;
+ this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
+
+ var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
+ this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@@ -83,8 +94,8 @@ export class SearchDataprovidersComponent {
}
public getNumForEntity(entity: string, id:string) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@@ -92,10 +103,10 @@ export class SearchDataprovidersComponent {
data => {
this.searchUtils.totalResults = data;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -104,25 +115,33 @@ export class SearchDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getNumForSearch(keyword: string) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.numOfDataproviders(keyword).subscribe(
data => {
this.searchUtils.totalResults = data;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -131,8 +150,15 @@ export class SearchDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -148,10 +174,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -160,8 +186,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -181,10 +214,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -193,8 +226,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -208,10 +248,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -220,8 +260,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -239,8 +286,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
@@ -258,15 +305,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -274,7 +321,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -284,8 +331,16 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -297,6 +352,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}
diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts
index 5a335f16..60a8099a 100644
--- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts
+++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts
@@ -22,12 +22,16 @@ import {DOI} from '../../utils/string-utils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasets" advancedSearchLink="/search/advanced/datasets"
[disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults"
searchFormClass="datasetsSearchForm">
`
})
export class SearchDatasetsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters: Filter[] =[];
// public totalResults:number = 0 ;
@@ -43,12 +47,14 @@ export class SearchDatasetsComponent {
private _location:Location;
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
@@ -60,6 +66,11 @@ export class SearchDatasetsComponent {
this.searchPage.type = "research data";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@@ -99,10 +110,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Research Data for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -111,8 +122,15 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -134,10 +152,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -146,8 +164,15 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -175,8 +200,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -192,15 +217,15 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -208,7 +233,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -218,8 +243,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -233,6 +266,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts
index e28cca90..12c5d7ec 100644
--- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts
+++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts
@@ -20,6 +20,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="organizations" advancedSearchLink="/search/advanced/organizations"
[disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults"
searchFormClass="organizationsSearchForm">
@@ -27,6 +29,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchOrganizationsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public baseUrl:string;
@@ -40,13 +44,15 @@ export class SearchOrganizationsComponent {
public _location:Location;
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
@@ -57,6 +63,11 @@ export class SearchOrganizationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@@ -94,8 +105,8 @@ export class SearchOrganizationsComponent {
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -111,15 +122,15 @@ export class SearchOrganizationsComponent {
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -127,7 +138,7 @@ export class SearchOrganizationsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -137,8 +148,16 @@ export class SearchOrganizationsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -147,6 +166,8 @@ export class SearchOrganizationsComponent {
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
diff --git a/portal-2/src/app/searchPages/simple/searchProjects.component.ts b/portal-2/src/app/searchPages/simple/searchProjects.component.ts
index 8b80ae3b..0c7bbb5f 100644
--- a/portal-2/src/app/searchPages/simple/searchProjects.component.ts
+++ b/portal-2/src/app/searchPages/simple/searchProjects.component.ts
@@ -20,12 +20,16 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="projects" advancedSearchLink="/search/advanced/projects"
[disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults"
searchFormClass="projectsSearchForm">
`
})
export class SearchProjectsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters: Filter[] =[];
public baseUrl:string;
@@ -39,14 +43,16 @@ export class SearchProjectsComponent {
public _location:Location;
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService) {
console.info(" constructor SearchProjectsComponent "+this.refineFields.length);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
@@ -59,19 +65,23 @@ export class SearchProjectsComponent {
//get refine field filters from url parameters
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
- //get keyword from url parameters
- this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
- var refine = true;
- if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
- refine = false;
+ //get keyword from url parameters
+ this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
+ var refine = true;
+ if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
+ refine = false;
- }
- firstLoad = false;
- //get page from url parameters
- this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
- var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
- this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
+ }
+ firstLoad = false;
+ //get page from url parameters
+ this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
+ var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
+ this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@@ -98,8 +108,8 @@ export class SearchProjectsComponent {
// this.searchPage = new SearchPageComponent(this._location);
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -116,15 +126,15 @@ export class SearchProjectsComponent {
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -132,7 +142,7 @@ export class SearchProjectsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -142,8 +152,16 @@ export class SearchProjectsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
}
@@ -158,10 +176,10 @@ export class SearchProjectsComponent {
console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -170,14 +188,23 @@ export class SearchProjectsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public queryChanged($event) {
+ this.loadPaging = true;
+
this.urlParams = undefined;
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts
index 466c38f0..2d667f14 100644
--- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts
+++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts
@@ -25,6 +25,8 @@ import {DOI} from '../../utils/string-utils.class';
[csvParams]="csvParams" csvPath="publications"
advancedSearchLink="/search/advanced/publications"
[disableForms]="disableForms"
+ [loadPaging]="loadPaging"
+ [oldTotalResults]="oldTotalResults"
searchFormClass="publicationsSearchForm">
@@ -32,6 +34,8 @@ import {DOI} from '../../utils/string-utils.class';
})
export class SearchPublicationsComponent {
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@@ -54,10 +58,12 @@ export class SearchPublicationsComponent {
public CSVDownloaded = false;
public csvParams: string;
public disableForms: boolean = false;
+ public loadPaging: boolean = true;
+ public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
@@ -69,6 +75,11 @@ export class SearchPublicationsComponent {
this.searchPage.type = "publications";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
+ if(params['page'] && this.searchUtils.page != params['page']) {
+ this.loadPaging = false;
+ this.oldTotalResults = this.searchUtils.totalResults;
+ }
+
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@@ -106,10 +117,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -118,8 +129,15 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -141,10 +159,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -153,8 +171,15 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
@@ -185,8 +210,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// this.searchPage = new SearchPageComponent(this._location);
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@@ -203,16 +228,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
- var errorCodes:ErrorCodes = new ErrorCodes();
+ //var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
- if(this.searchUtils.status == errorCodes.DONE) {
+ if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@@ -220,7 +245,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
- this.searchUtils.status = errorCodes.OUT_OF_BOUND;
+ this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@@ -230,8 +255,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
//this.searchPage.closeLoading();
this.disableForms = false;
@@ -263,6 +296,8 @@ public getAggregatorResults(id:string, page: number, size: number){
}*/
public queryChanged($event) {
+ this.loadPaging = true;
+
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
console.info("Search Pubs::page "+this.searchUtils.page);
diff --git a/portal-2/src/app/services/searchDatasets.service.ts b/portal-2/src/app/services/searchDatasets.service.ts
index 3e203c20..df5910de 100644
--- a/portal-2/src/app/services/searchDatasets.service.ts
+++ b/portal-2/src/app/services/searchDatasets.service.ts
@@ -78,7 +78,7 @@ export class SearchDatasetsService {
.do(res => {
this._cache.set(key, res);
})
- .map(res => this.parseRefineResults(id, res['refineResults']));
+ .map(res => this.parseRefineResults(id, res['refineResults']))
}
searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
diff --git a/portal-2/src/app/utils/errorMessages.component.ts b/portal-2/src/app/utils/errorMessages.component.ts
new file mode 100644
index 00000000..aeb43d66
--- /dev/null
+++ b/portal-2/src/app/utils/errorMessages.component.ts
@@ -0,0 +1,51 @@
+import {Component, Input} from '@angular/core';
+import {ErrorCodes} from './properties/openaireProperties';
+
+@Component({
+ selector: 'errorMessages',
+ template: `
+
+
No {{type}} available
+
+ An Error Occured
+
+
+ Service temprorarily unavailable. Please try again later.
+
+
+ No {{type}} found
+
+ Requested page out of bounds
+ `
+ })
+
+ export class ErrorMessagesComponent {
+ @Input() status: Array;
+ @Input() type: string;
+
+ public errorCodes:ErrorCodes;
+
+ constructor () {}
+
+ ngOnInit() {
+ this.errorCodes = new ErrorCodes();
+ console.info("ngOnInit");
+ if(!this.status) {
+ this.status = [this.errorCodes.LOADING];
+ }
+ }
+
+ ngOnDestroy() {}
+
+ public checkErroCode(code: number) {
+ return function(status: number) {
+ return (status == code);
+ }
+ }
+ }
diff --git a/portal-2/src/app/utils/errorMessages.module.ts b/portal-2/src/app/utils/errorMessages.module.ts
new file mode 100644
index 00000000..9f7315af
--- /dev/null
+++ b/portal-2/src/app/utils/errorMessages.module.ts
@@ -0,0 +1,19 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import {ErrorMessagesComponent} from './errorMessages.component';
+
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule
+ ],
+ declarations: [
+ ErrorMessagesComponent
+ ],
+ exports: [
+ ErrorMessagesComponent
+ ]
+})
+export class ErrorMessagesModule { }
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
index 3bc41131..1ef9125c 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDataproviders.class.ts
@@ -3,6 +3,8 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchDataproviders {
+ private errorCodes: ErrorCodes;
+
public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
@@ -14,8 +16,8 @@ export class FetchDataproviders {
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
}
@@ -34,8 +36,8 @@ export class FetchDataproviders {
parameters = "q=" + keyword;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,null, page, size,[]).subscribe(
@@ -44,10 +46,10 @@ export class FetchDataproviders {
console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //ar errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -56,15 +58,22 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getNumForEntity(entity: string, id:string) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@@ -72,10 +81,10 @@ export class FetchDataproviders {
data => {
this.searchUtils.totalResults = data;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -84,24 +93,31 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getNumForSearch(keyword: string) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.numOfSearchDataproviders(keyword).subscribe(
data => {
this.searchUtils.totalResults = data;
- this.searchUtils.status = errorCodes.DONE;
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0) {
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -110,15 +126,22 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getResultsForDeposit(id:string, type:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
if(id != "") {
@@ -128,10 +151,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -140,25 +163,32 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -167,15 +197,22 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
@@ -191,10 +228,10 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -203,16 +240,23 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsForDataproviders(id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size).subscribe(
data => {
@@ -220,10 +264,10 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -232,8 +276,15 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
index d6d65727..9e6916b6 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
@@ -5,6 +5,8 @@ import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject';
export class FetchDatasets{
+ private errorCodes: ErrorCodes;
+
public results =[];
public requestComplete: Subject;
@@ -16,8 +18,8 @@ export class FetchDatasets{
constructor ( private _searchDatasetsService: SearchDatasetsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject();
}
@@ -50,8 +52,8 @@ export class FetchDatasets{
}
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDatasetsService.searchDatasets(parameters,null, page, size, []).subscribe(
data => {
@@ -59,10 +61,10 @@ export class FetchDatasets{
console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -71,15 +73,22 @@ export class FetchDatasets{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getNumForEntity(entity:string, id:string){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@@ -87,10 +96,10 @@ public getNumForEntity(entity:string, id:string){
data => {
this.searchUtils.totalResults = data;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -99,16 +108,23 @@ public getNumForEntity(entity:string, id:string){
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
@@ -124,10 +140,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Research Data for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -136,16 +152,23 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
var parameters;
if(resultsFrom == "collectedFrom") {
@@ -162,10 +185,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -174,39 +197,55 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getAggregatorResults(id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDatasetsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
this.requestComplete.complete();
},
err => {
- this.requestComplete.complete();
console.log(err);
+ console.info("status: "+err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
+ this.requestComplete.complete();
}
);
}
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts
index 0124ce01..07cb4c61 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchOrganizations.class.ts
@@ -3,6 +3,8 @@
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchOrganizations {
+ private errorCodes: ErrorCodes;
+
public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@@ -13,8 +15,8 @@ export class FetchOrganizations {
constructor ( private _searchOrganizationsService: SearchOrganizationsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
}
@@ -35,8 +37,8 @@ export class FetchOrganizations {
parameters = "q=" + keyword;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
data => {
@@ -44,10 +46,10 @@ export class FetchOrganizations {
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -56,8 +58,16 @@ export class FetchOrganizations {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
index 1c0214ee..d31a3232 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
@@ -3,6 +3,8 @@ import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchProjects{
+ private errorCodes: ErrorCodes;
+
public results =[];
public filters; // for getResultsForOrganizations
@@ -14,8 +16,8 @@ export class FetchProjects{
constructor (private _searchProjectsService: SearchProjectsService) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
}
@@ -34,8 +36,8 @@ export class FetchProjects{
parameters = "q=" + keyword;
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
data => {
@@ -43,10 +45,10 @@ export class FetchProjects{
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -55,15 +57,22 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getResultsForDataproviders(id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchProjectsService.getProjectsforDataProvider(id, page, size).subscribe(
data => {
@@ -71,10 +80,10 @@ export class FetchProjects{
console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -83,15 +92,22 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getNumForEntity(entity: string, id:string) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@@ -99,10 +115,10 @@ export class FetchProjects{
data => {
this.searchUtils.totalResults = data;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -111,16 +127,24 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
data => {
@@ -156,10 +180,10 @@ export class FetchProjects{
console.log(" this.funders:"+ this.funders);
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -168,8 +192,15 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
index e46b08e8..9e6959f1 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
@@ -7,6 +7,8 @@ import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject';
export class FetchPublications {
+ private errorCodes: ErrorCodes;
+
public results =[];
public requestComplete: Subject;
@@ -30,8 +32,8 @@ export class FetchPublications {
public csvParams: string;
constructor ( private _searchPublicationsService: SearchPublicationsService ) {
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status =errorCodes.LOADING;
+ this.errorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
// this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
this.requestComplete = new Subject();
@@ -64,8 +66,8 @@ export class FetchPublications {
}
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchPublicationsService.searchPublications(parameters,null, page, size, []).subscribe(
data => {
@@ -73,10 +75,10 @@ export class FetchPublications {
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -85,16 +87,22 @@ export class FetchPublications {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
-
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
if(entity == "project") {
@@ -111,10 +119,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -123,16 +131,24 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
var parameters;
if(resultsFrom == "collectedFrom") {
@@ -149,10 +165,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@@ -161,39 +177,54 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
}
);
}
}
public getAggregatorResults(id:string, page: number, size: number){
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.LOADING;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchPublicationsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.DONE;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
- this.searchUtils.status = errorCodes.NONE;
+ this.searchUtils.status = this.errorCodes.NONE;
}
this.requestComplete.complete();
},
err => {
- this.requestComplete.complete();
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
- var errorCodes:ErrorCodes = new ErrorCodes();
- this.searchUtils.status = errorCodes.ERROR;
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.searchUtils.status = errorCodes.ERROR;
+ if(err.status == '404') {
+ this.searchUtils.status = this.errorCodes.NOT_FOUND;
+ } else if(err.status == '500') {
+ this.searchUtils.status = this.errorCodes.ERROR;
+ } else {
+ this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
+ }
+
+ this.requestComplete.complete();
}
);
}
diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts
index 3df9808e..fc500c65 100644
--- a/portal-2/src/app/utils/properties/openaireProperties.ts
+++ b/portal-2/src/app/utils/properties/openaireProperties.ts
@@ -375,4 +375,5 @@ export class ErrorCodes {
public ERROR = 3;
public NOT_AVAILABLE = 4;
public OUT_OF_BOUND = 5;
+ public NOT_FOUND = 6;
}
diff --git a/portal-2/src/assets/discover-custom.css b/portal-2/src/assets/discover-custom.css
index 3ddd9463..a0d24eac 100644
--- a/portal-2/src/assets/discover-custom.css
+++ b/portal-2/src/assets/discover-custom.css
@@ -86,6 +86,9 @@ h2 .custom-external {
.search-results {
min-height: 1100px;
}
+.searchPaging {
+ min-height: 46px;
+}
.other-results {
min-height: 300px;
}