From 88b81bf39ee192bf8738824147a241022ef68365 Mon Sep 17 00:00:00 2001 From: mdelez <60604010+mdelez@users.noreply.github.com> Date: Thu, 12 May 2022 16:14:54 +0200 Subject: [PATCH] feat(link-value): UI now shows that there are no search results (#736) --- .../resource/values/link-value/link-value.component.html | 3 +++ .../resource/values/link-value/link-value.component.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/app/workspace/resource/values/link-value/link-value.component.html b/src/app/workspace/resource/values/link-value/link-value.component.html index 46c1b6e8fb..61b2be6865 100644 --- a/src/app/workspace/resource/values/link-value/link-value.component.html +++ b/src/app/workspace/resource/values/link-value/link-value.component.html @@ -14,6 +14,9 @@ + + No results were found. + Create New: {{rc?.label}} diff --git a/src/app/workspace/resource/values/link-value/link-value.component.ts b/src/app/workspace/resource/values/link-value/link-value.component.ts index 37860190b5..8996ffdc85 100644 --- a/src/app/workspace/resource/values/link-value/link-value.component.ts +++ b/src/app/workspace/resource/values/link-value/link-value.component.ts @@ -71,6 +71,7 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On properties: ResourcePropertyDefinition[]; loadingResults = false; + showNoResultsMessage = false; constructor( private _dialog: MatDialog, @@ -98,6 +99,8 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On * @param searchTerm label to be searched */ searchByLabel(searchTerm: string) { + this.showNoResultsMessage = false; + // at least 3 characters are required if (typeof searchTerm === 'string' && searchTerm.length >= 3) { this.loadingResults = true; @@ -106,6 +109,7 @@ export class LinkValueComponent extends BaseValueDirective implements OnInit, On (response: ReadResourceSequence) => { this.resources = response.resources; this.loadingResults = false; + this.showNoResultsMessage = this.resources.length > 0 ? false : true; }); } else { this.resources = [];