From c9d25949092000a82d7ea86e875cc4e5e9b7e10f Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Fri, 8 Mar 2024 23:16:52 +0000 Subject: [PATCH] Fix Persontile --- Damselfly.Web.Client/Pages/PeoplePage.razor | 7 ++--- Damselfly.Web.Client/Shared/PersonTile.razor | 28 ++++++++++++++----- .../Shared/PersonTile.razor.css | 2 +- Damselfly.Web.Client/wwwroot/version.js | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Damselfly.Web.Client/Pages/PeoplePage.razor b/Damselfly.Web.Client/Pages/PeoplePage.razor index ece12ce5..b498ebc9 100644 --- a/Damselfly.Web.Client/Pages/PeoplePage.razor +++ b/Damselfly.Web.Client/Pages/PeoplePage.razor @@ -86,9 +86,9 @@ private IEnumerable People => filteredPeople; - private void RefreshData() + private async Task RefreshData() { - _ = LoadData(); + await LoadData(); } private void DoSearch(string searchTerm) @@ -129,9 +129,6 @@ private async Task LoadData() { - filteredPeople = null; - StateHasChanged(); - var names = await faceService.GetAllPeople(); filteredPeople = names.Where(x => FilterFunc(x)) .ToList(); diff --git a/Damselfly.Web.Client/Shared/PersonTile.razor b/Damselfly.Web.Client/Shared/PersonTile.razor index f2fdbaa2..556100d6 100644 --- a/Damselfly.Web.Client/Shared/PersonTile.razor +++ b/Damselfly.Web.Client/Shared/PersonTile.razor @@ -11,19 +11,29 @@ -
- -
+ @if( processingUpdate ) + { +
+ Updating name... +
+ } + else + { +
+ +
+ } @code { private string PersonTitle => $"{Person.Name}\nState: {Person.State}\nFace Data Sets: {Person.FaceData.Count}"; - + private bool processingUpdate = false; + [Parameter] public Person Person { get; set; } [Parameter] - public Action? PersonChanged { get; set; } + public EventCallback PersonChanged { get; set; } public string Name { @@ -38,6 +48,9 @@ { if( !string.IsNullOrEmpty(newName) && !newName.Equals(Person.Name) ) { + processingUpdate = true; + StateHasChanged(); + var allNames = await peopleService.GetPeopleNames(newName); bool canRename = true; bool merge = false; @@ -74,8 +87,9 @@ // number of imageObjects could be cached with the old name. So evict them all. // Performance hit, of course, but better than showing stale names. await imageCache.ClearCache(); - - PersonChanged?.Invoke(); + + await PersonChanged.InvokeAsync(); + processingUpdate = false; StateHasChanged(); statusService.UpdateStatus($"Name set to '{newName}'"); diff --git a/Damselfly.Web.Client/Shared/PersonTile.razor.css b/Damselfly.Web.Client/Shared/PersonTile.razor.css index d86d9de3..b2187884 100644 --- a/Damselfly.Web.Client/Shared/PersonTile.razor.css +++ b/Damselfly.Web.Client/Shared/PersonTile.razor.css @@ -1,7 +1,7 @@  .damselfly-persontile { display: flex; - flex: 0 0 auto; + flex: 0 0 200px; flex-direction: column; align-items: center; margin: 4px; diff --git a/Damselfly.Web.Client/wwwroot/version.js b/Damselfly.Web.Client/wwwroot/version.js index 2d8892fb..174d9f0c 100644 --- a/Damselfly.Web.Client/wwwroot/version.js +++ b/Damselfly.Web.Client/wwwroot/version.js @@ -1 +1 @@ -const CACHE_VERSION='4.1.0-20240308225414' +const CACHE_VERSION='4.1.0-20240308231548'