Skip to content

Commit 8756622

Browse files
committed
Add Select All button in role edit
1 parent 9d7645f commit 8756622

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/IoTHub.Portal.Client/Components/Roles/EditRole.razor

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
<MudSelectItem Value="@act">@act</MudSelectItem>
2424
}
2525
</MudSelect>
26-
<MudButton Variant="Variant.Outlined" Disabled="string.IsNullOrEmpty(resourceFilter) && string.IsNullOrEmpty(actionFilter)" OnClick="ClearFilters">Réinitialiser</MudButton>
26+
<MudButton Variant="Variant.Outlined" Disabled="string.IsNullOrEmpty(resourceFilter) && string.IsNullOrEmpty(actionFilter)" OnClick="ClearFilters">Clear</MudButton>
27+
<MudButton Variant="Variant.Filled" OnClick="SelectAll">Select All</MudButton>
2728
<MudSpacer />
2829
<MudChip Color="Color.Primary" Variant="Variant.Outlined">@FilteredPermissions.Count() / @AllPermissions.Length</MudChip>
2930
</MudStack>
@@ -61,11 +62,11 @@
6162
@code {
6263
[Parameter] public RoleDetailsModel Role { get; set; } = default!;
6364
[Parameter] public EventCallback OnSaved { get; set; }
64-
[Parameter] public bool IsEdit { get; set; } = false;
65+
[Parameter] public bool IsEdit { get; set; }
6566

6667
private MudForm form = default!;
67-
private bool isProcessing = false;
68-
private string ButtonText => IsEdit ? "Enregistrer" : "Créer";
68+
private bool isProcessing;
69+
private string ButtonText => "Save";
6970

7071
private HashSet<string> SelectedPermissions { get; set; } = new();
7172
private string[] AllPermissions = Array.Empty<string>();
@@ -100,6 +101,14 @@
100101
actionFilter = null;
101102
}
102103

104+
private void SelectAll()
105+
{
106+
foreach (var permission in FilteredPermissions)
107+
{
108+
_ = SelectedPermissions.Add(permission);
109+
}
110+
}
111+
103112
protected override async Task OnParametersSetAsync()
104113
{
105114
if (Role?.Actions != null && Role.Actions.Any())

0 commit comments

Comments
 (0)