From f32dfc0ac6f0cee8cf591915d6f02a850a6e84e5 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 9 Sep 2024 13:15:10 +0300 Subject: [PATCH] [recommendations-and-nl-search | DONE | FIXED]: Fixed when and how error messages are displayed on NL Search page. 1. natural-language-search.component.html: Added check if results.data also exist. 2. natural-language-search.component.ts: In method "search()" initialize also results to null and added check if response has at least 1 row of results. 3. libOrp.module.ts: Changed order of imports to be loaded and initialized correctly - first OrpRoutingModule which is more specific and then ResultLandingModule. --- src/app/landingPages/orp/libOrp.module.ts | 2 +- .../natural-language-search.component.html | 2 +- .../natural-language-search.component.ts | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/app/landingPages/orp/libOrp.module.ts b/src/app/landingPages/orp/libOrp.module.ts index 8f6bac8..175c036 100644 --- a/src/app/landingPages/orp/libOrp.module.ts +++ b/src/app/landingPages/orp/libOrp.module.ts @@ -6,7 +6,7 @@ import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousR import {OrpRoutingModule} from './orp-routing.module'; @NgModule({ - imports: [ResultLandingModule, OrpRoutingModule], + imports: [OrpRoutingModule, ResultLandingModule], declarations:[OpenaireOrpComponent], providers:[FreeGuard, PreviousRouteRecorder], exports:[OpenaireOrpComponent] diff --git a/src/app/natural-language-search/natural-language-search.component.html b/src/app/natural-language-search/natural-language-search.component.html index 8967acb..7ab37a5 100644 --- a/src/app/natural-language-search/natural-language-search.component.html +++ b/src/app/natural-language-search/natural-language-search.component.html @@ -53,7 +53,7 @@ No results found for your query - +
OpenAIRE { - if(data && data['columns']) { - for(let i = 0; i < data['columns'].length - 1; i++) { - if(data['columns'][i] == 'id') { - this.indexColumnId = i; - break; + if(data && data['data'] && data['data'].length > 0) { + if(data && data['columns']) { + for(let i = 0; i < data['columns'].length - 1; i++) { + if(data['columns'][i] == 'id') { + this.indexColumnId = i; + break; + } } } + this.results = data; + } else { + this.results = []; } - this.results = data; + this.showLoading = false; }, error => { if(error.status == 500) {