From 98aeab207b0ed2f0e6aa9fc65e00baefc00060c2 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 23 May 2018 13:24:13 +0000 Subject: [PATCH] 1. Bug fix: when filtering has no results in table view pages do not crash - enableSearchView input parameter added in searchPageTableView.component. (When status is not DONE, all forms and search view are disabled. When status is not LOADING or DONE, hide datatable and disable all forms but allow search view) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@52163 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../compatibleDataProvidersTable.component.ts | 18 +++++++++++------- .../entityRegistriesTable.component.ts | 18 +++++++++++------- .../dataProviders/journalsTable.component.ts | 17 +++++++++++------ .../searchPageTableView.component.html | 6 +++--- .../searchPageTableView.component.ts | 1 + 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts index 7c55a5fd..4e937283 100644 --- a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts +++ b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -20,6 +20,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [columnNames]="columnNames" [showResultCount]=false [disableForms]="disableForms" + [enableSearchView]="enableSearchView" [searchViewLink]="'/search/content-providers'" searchFormClass="compatibleDatasourcesTableSearchForm" formPlaceholderText="Search for OpenAIRE Content Providers"> @@ -48,6 +49,7 @@ export class SearchCompatibleDataprovidersTableComponent { public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ public disableForms: boolean = false; + public enableSearchView: boolean = true; properties:EnvProperties; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; @@ -86,6 +88,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.enableSearchView = false; this.results = []; this.searchUtils.totalResults = 0; @@ -106,10 +109,12 @@ properties:EnvProperties; this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = this.errorCodes.NONE; + } else { + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + this.disableForms = false; } - this.disableForms = false; - this.searchPage.triggerInitialLoad(); - this.searchPage.transform(this.results); + this.enableSearchView = true; }, err => { console.log(err); @@ -126,9 +131,7 @@ properties:EnvProperties; } else { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - - this.disableForms = false; - + this.enableSearchView = true; } ); } else { @@ -136,7 +139,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.NONE; - this.disableForms = false; + this.enableSearchView = true; } }, err => { @@ -154,6 +157,7 @@ properties:EnvProperties; } else { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } + this.enableSearchView = true; } ); diff --git a/searchPages/dataProviders/entityRegistriesTable.component.ts b/searchPages/dataProviders/entityRegistriesTable.component.ts index c92afff0..bc9d9183 100644 --- a/searchPages/dataProviders/entityRegistriesTable.component.ts +++ b/searchPages/dataProviders/entityRegistriesTable.component.ts @@ -19,6 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [columnNames]="columnNames" [showResultCount]=false [disableForms]="disableForms" + [enableSearchView]="enableSearchView" [searchViewLink]="'/search/entity-registries'" searchFormClass="entityRegistriesTableSearchForm" formPlaceholderText="Search for Registries/ Databases"> @@ -40,6 +41,7 @@ export class SearchEntityRegistriesTableComponent { public searchFields:SearchFields = new SearchFields(); public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS; public disableForms: boolean = false; + public enableSearchView: boolean = true; properties:EnvProperties; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; @@ -77,6 +79,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.enableSearchView = false; this.results = []; this.searchUtils.totalResults = 0; @@ -96,10 +99,12 @@ properties:EnvProperties; this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = this.errorCodes.NONE; + } else { + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + this.disableForms = false; } - this.disableForms = false; - this.searchPage.triggerInitialLoad(); - this.searchPage.transform(this.results); + this.enableSearchView = true; }, err => { console.log(err); @@ -116,9 +121,7 @@ properties:EnvProperties; } else { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - - this.disableForms = false; - + this.enableSearchView = true; } ); } else { @@ -126,7 +129,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.NONE; - this.disableForms = false; + this.enableSearchView = true; } }, err => { @@ -144,6 +147,7 @@ properties:EnvProperties; } else { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } + this.enableSearchView = true; } ); /* diff --git a/searchPages/dataProviders/journalsTable.component.ts b/searchPages/dataProviders/journalsTable.component.ts index a7f948a7..4bcf92de 100644 --- a/searchPages/dataProviders/journalsTable.component.ts +++ b/searchPages/dataProviders/journalsTable.component.ts @@ -21,6 +21,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [columnNames]="columnNames" [showResultCount]=false [disableForms]="disableForms" + [enableSearchView]="enableSearchView" [searchViewLink]="'/search/journals'" searchFormClass="journalsTableSearchForm" formPlaceholderText="Search for Journals"> @@ -49,6 +50,7 @@ properties:EnvProperties; public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ public disableForms: boolean = false; + public enableSearchView: boolean = true; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; @@ -88,6 +90,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.enableSearchView = false; this.results = []; this.searchUtils.totalResults = 0; @@ -108,10 +111,12 @@ properties:EnvProperties; this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = this.errorCodes.NONE; + } else { + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + this.disableForms = false; } - this.disableForms = false; - this.searchPage.triggerInitialLoad(); - this.searchPage.transform(this.results); + this.enableSearchView = true; }, err => { console.log(err); @@ -129,8 +134,7 @@ properties:EnvProperties; this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - this.disableForms = false; - + this.enableSearchView = true; } ); } else { @@ -138,7 +142,7 @@ properties:EnvProperties; //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.NONE; - this.disableForms = false; + this.enableSearchView = true; } }, err => { @@ -156,6 +160,7 @@ properties:EnvProperties; } else { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } + this.enableSearchView = true; } ); diff --git a/searchPages/searchUtils/searchPageTableView.component.html b/searchPages/searchUtils/searchPageTableView.component.html index f2aa074d..5cd28749 100644 --- a/searchPages/searchUtils/searchPageTableView.component.html +++ b/searchPages/searchUtils/searchPageTableView.component.html @@ -71,7 +71,7 @@

- +

@@ -81,7 +81,7 @@ -
+