Skip to content

Commit

Permalink
fixed issue with editing/enabling libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
revenz committed Mar 20, 2024
1 parent daac34f commit 434ca33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
15 changes: 6 additions & 9 deletions Client/Components/Common/FlowSwitch/FlowSwitch.razor.cs
Expand Up @@ -11,15 +11,7 @@ public partial class FlowSwitch: ComponentBase
public bool Value
{
get => _Value;
set
{
if(_Value != value)
{
_Value = value;
if(ValueChanged.HasDelegate)
ValueChanged.InvokeAsync(value);
}
}
set => _Value = value;
}

[Parameter]
Expand All @@ -41,7 +33,12 @@ private void OnChange(ChangeEventArgs args)

private void ToggleValue(EventArgs args)
{
if (ReadOnly)
return;

this.Value = !this.Value;
if(ValueChanged.HasDelegate)
ValueChanged.InvokeAsync(this.Value);
}
}
}
2 changes: 1 addition & 1 deletion Client/Pages/Libraries/Libraries.razor
Expand Up @@ -63,7 +63,7 @@
@Globals.lblEnabled
</Header>
<Cell Context="item">
<FlowSwitch Value="@item.Enabled" ValueChanged="@(args => { item.Enabled= args; _ = Enable(args, item); })" />
<FlowSwitch Value="@item.Enabled" ValueChanged="@(args => { item.Enabled = args; _ = Enable(args, item); })" />
</Cell>
</FlowTableColumn>
<FlowTableColumn TItem="Library" Width="16rem" MobileWidth="0" NoHeight="true">
Expand Down
4 changes: 0 additions & 4 deletions Client/Pages/ListPage.cs
Expand Up @@ -171,9 +171,6 @@ public void ShowEditHttpError<U>(RequestResult<U> result, string defaultMessage

public async Task Enable(bool enabled, T item)
{
#if (DEMO)
return;
#else
Blocker.Show();
this.StateHasChanged();
Data.Clear();
Expand All @@ -186,7 +183,6 @@ public async Task Enable(bool enabled, T item)
Blocker.Hide();
this.StateHasChanged();
}
#endif
}

protected virtual string DeleteMessage => "Labels.DeleteItems";
Expand Down

0 comments on commit 434ca33

Please sign in to comment.