Skip to content

Commit 91a8565

Browse files
authored
[ZEPPELIN-6248] Display a message when no search results
### What is this PR for? Added a "no results found" message in the new Angular UI when search returns no results. ### What type of PR is it? Improvement ### Todos * Add "no results found" message ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-6248 ### How should this be tested? ### Screenshots (if appropriate) <img width="1487" height="281" alt="image" src="https://github.com/user-attachments/assets/6dd8264a-8dc4-4490-a8c3-85f629d2e019" /> ### Questions: * Does the license files need to update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Closes #4990 from proceane/feature/ZEPPELIN-6248. Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>
1 parent 6edb9f1 commit 91a8565

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

zeppelin-web-angular/src/app/pages/workspace/notebook-search/notebook-search.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
<zeppelin-notebook-search-result-item *ngFor="let item of results"
1414
[result]="item">
1515
</zeppelin-notebook-search-result-item>
16+
17+
<div *ngIf="hasNoResults" class="search-no-result-found">
18+
<i nz-icon nzType="search" nzTheme="outline"></i>
19+
We couldn't find any notebook matching <strong>'{{searchTerm}}'</strong>
20+
</div>
1621
</div>
1722

zeppelin-web-angular/src/app/pages/workspace/notebook-search/notebook-search.component.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@
2121
margin-bottom: 16px;
2222
display: block;
2323
}
24+
25+
.search-no-result-found {
26+
border: 1px solid;
27+
margin: 150px 150px;
28+
padding: 15px 10px 15px 0px;
29+
color: #3071A9;
30+
text-align: center;
31+
background-color: #f4f6f8;
32+
}
2433
});

zeppelin-web-angular/src/app/pages/workspace/notebook-search/notebook-search.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,20 @@ export class NotebookSearchComponent implements OnInit, OnDestroy {
2929
takeUntil(this.destroy$),
3030
map(params => params.queryStr),
3131
filter(queryStr => typeof queryStr === 'string' && !!queryStr.trim()),
32-
tap(() => (this.searching = true)),
32+
tap(queryStr => {
33+
this.searching = true;
34+
this.searchTerm = queryStr;
35+
}),
3336
switchMap(queryStr => this.notebookSearchService.search(queryStr))
3437
);
3538

3639
results: NotebookSearchResultItem[] = [];
3740
searching = false;
41+
searchTerm = '';
42+
43+
get hasNoResults(): boolean {
44+
return !this.searching && this.results.length === 0 && this.searchTerm.length > 0;
45+
}
3846

3947
constructor(
4048
private cdr: ChangeDetectorRef,

zeppelin-web-angular/src/app/pages/workspace/notebook-search/notebook-search.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ import { FormsModule } from '@angular/forms';
1717
import { NzCardModule } from 'ng-zorro-antd/card';
1818

1919
import { ShareModule } from '@zeppelin/share';
20+
import { NzIconModule } from 'ng-zorro-antd/icon';
2021

2122
import { NotebookSearchRoutingModule } from './notebook-search-routing.module';
2223
import { NotebookSearchComponent } from './notebook-search.component';
2324
import { NotebookSearchResultItemComponent } from './result-item/result-item.component';
2425

2526
@NgModule({
2627
declarations: [NotebookSearchComponent, NotebookSearchResultItemComponent],
27-
imports: [CommonModule, NotebookSearchRoutingModule, ShareModule, NzCardModule, FormsModule]
28+
imports: [CommonModule, NotebookSearchRoutingModule, ShareModule, NzCardModule, FormsModule, NzIconModule]
2829
})
2930
export class NotebookSearchModule {}

0 commit comments

Comments
 (0)