|
46 | 46 | <RadzenDataGridColumn TItem="SelectableApiResource" Property="Value.Name" Title="Resource" Filterable="false" Sortable="false" Width="80px" /> |
47 | 47 | <RadzenDataGridColumn TItem="SelectableApiResource" Property="Value.Audience" Title="Audience" Filterable="false" Sortable="false" Width="80px" /> |
48 | 48 | <RadzenDataGridColumn TItem="SelectableApiResource" Property="Value.UpdateDateTime" Filterable="false" Sortable="true" FormatString="{0:dd/M/yyyy HH:mm:ss}" SortOrder="SortOrder.Descending" Title="Update datetime" Width="80px" /> |
| 49 | + <RadzenDataGridColumn TItem="SelectableApiResource" Filterable="false" Sortable="false" Width="80px" TextAlign="TextAlign.Center"> |
| 50 | + <Template Context="data"> |
| 51 | + <RadzenButton Icon="more_vert" Click="@(args => ShowMoreContextMenu(data, args))" /> |
| 52 | + </Template> |
| 53 | + </RadzenDataGridColumn> |
49 | 54 | </Columns> |
50 | 55 | </RadzenDataGrid> |
51 | 56 |
|
|
66 | 71 | notificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Success, Summary = Global.ScopeResourcesUpdated }); |
67 | 72 | StateHasChanged(); |
68 | 73 | }); |
| 74 | + SubscribeToAction<RemoveSelectedApiResourcesSuccessAction>((act) => |
| 75 | + { |
| 76 | + notificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Success, Summary = Global.ScopeResourcesRemoved }); |
| 77 | + StateHasChanged(); |
| 78 | + }); |
69 | 79 | grid.Reload(); |
70 | 80 | } |
71 | 81 | } |
|
93 | 103 | row.Attributes.Remove(className); |
94 | 104 | } |
95 | 105 |
|
| 106 | + void ShowMoreContextMenu(SelectableApiResource resource, MouseEventArgs args) |
| 107 | + { |
| 108 | + contextMenuService.Open(args, new List<ContextMenuItem> |
| 109 | + { |
| 110 | + new ContextMenuItem { Text = "Delete", Value = 1 } |
| 111 | + }, (a) => |
| 112 | + { |
| 113 | + if (a.Value.Equals(1)) |
| 114 | + { |
| 115 | + var resourceIds = searchApiResourcesState.Value.ApiResources.Where(s => s.IsSelected).Select(s => s.Value.Id).ToList(); |
| 116 | + if (!resourceIds.Contains(resource.Value.Id)) resourceIds.Add(resource.Value.Id); |
| 117 | + var act = new RemoveSelectedApiResourcesAction { ResourceIds = resourceIds }; |
| 118 | + dispatcher.Dispatch(act); |
| 119 | + contextMenuService.Close(); |
| 120 | + } |
| 121 | + }); |
| 122 | + } |
| 123 | + |
96 | 124 | void LoadData(LoadDataArgs args) |
97 | 125 | { |
98 | 126 | var act = new SearchApiResourcesAction { Filter = args.Filter, OrderBy = args.OrderBy, Skip = args.Skip, Take = args.Top, ScopeName = Scope.Name }; |
|
110 | 138 | }); |
111 | 139 | } |
112 | 140 |
|
113 | | - async void UpdateResource() |
| 141 | + void UpdateResource() |
114 | 142 | { |
115 | 143 | var selectedApiResources = searchApiResourcesState.Value.ApiResources.Where(r => r.IsSelected).Select(r => r.Value.Name); |
116 | 144 | dispatcher.Dispatch(new UpdateApiScopeResourcesAction { Name = Scope.Name, Resources = selectedApiResources }); |
|
0 commit comments