Skip to content

Commit

Permalink
Fix Persontile
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Mar 8, 2024
1 parent 4fe62a4 commit c9d2594
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
7 changes: 2 additions & 5 deletions Damselfly.Web.Client/Pages/PeoplePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@

private IEnumerable<Person> People => filteredPeople;

private void RefreshData()
private async Task RefreshData()
{
_ = LoadData();
await LoadData();
}

private void DoSearch(string searchTerm)
Expand Down Expand Up @@ -129,9 +129,6 @@

private async Task LoadData()
{
filteredPeople = null;
StateHasChanged();

var names = await faceService.GetAllPeople();
filteredPeople = names.Where(x => FilterFunc(x))
.ToList();
Expand Down
28 changes: 21 additions & 7 deletions Damselfly.Web.Client/Shared/PersonTile.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@
<img @key="@Person.PersonId" title="@PersonTitle" src="@FaceLink">
</NavLink>
</div>
<div class="damselfly-personfield">
<MudTextField @key="@Person.PersonId" @bind-Value="@Name" ReadOnly="false" Variant="UIConstants.MudVariant"/>
</div>
@if( processingUpdate )
{
<div class="damselfly-personfield">
Updating name...
</div>
}
else
{
<div class="damselfly-personfield">
<MudTextField @key="@Person.PersonId" @bind-Value="@Name" ReadOnly="false" Variant="UIConstants.MudVariant"/>
</div>
}
</div>

@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
{
Expand All @@ -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;
Expand Down Expand Up @@ -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}'");
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/Shared/PersonTile.razor.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.damselfly-persontile {
display: flex;
flex: 0 0 auto;
flex: 0 0 200px;
flex-direction: column;
align-items: center;
margin: 4px;
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/wwwroot/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const CACHE_VERSION='4.1.0-20240308225414'
const CACHE_VERSION='4.1.0-20240308231548'

0 comments on commit c9d2594

Please sign in to comment.