From 5b00bd7a5bce26e6b5a70d15b451b5675d3d74f5 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 8 Feb 2022 21:01:13 +0100 Subject: [PATCH] Add file count and search duration display Signed-off-by: trivernis --- .../sidebar/file-search/file-search.component.html | 4 ++++ .../sidebar/file-search/file-search.component.scss | 5 +++++ .../shared/sidebar/file-search/file-search.component.ts | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.html b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.html index b8218d8..0a615da 100644 --- a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.html +++ b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.html @@ -40,6 +40,10 @@ id="sort-button"> + +

{{this.state.files.value.length}} files found + in {{this.searchDuration < 0.1 ? " < 0.1" : this.searchDuration}} + seconds

{{contextTags.length}} Tags

diff --git a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.scss b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.scss index e4273c7..2c19341 100644 --- a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.scss +++ b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.scss @@ -19,6 +19,11 @@ height: calc(3em + 10px); } +.search-result-display { + text-align: center; + width: 100%; +} + #delete-all-tags-button { position: absolute; top: 0; diff --git a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.ts b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.ts index 7c6f149..97d1c46 100644 --- a/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.ts +++ b/mediarepo-ui/src/app/components/shared/sidebar/file-search/file-search.component.ts @@ -53,8 +53,10 @@ export class FileSearchComponent implements AfterViewChecked, OnInit { public displayImported = true; public displayArchived = true; public displayDeleted = false; + public searchDuration = 0; private needsScroll = false; + private searchStart = Date.now(); constructor( private logger: LoggingService, @@ -69,6 +71,13 @@ export class FileSearchComponent implements AfterViewChecked, OnInit { this.assignDisplayedFilters(); }); this.state.sortingPreset.subscribe(s => this.sortingPreset = s); + this.state.loading.subscribe(l => { + if (l) { + this.searchStart = Date.now(); + } else { + this.searchDuration = Math.round((Date.now() - this.searchStart) / 100) / 10; + } + }); this.applyStatusFromFilters(); this.needsScroll = true; this.assignDisplayedFilters();