| | | 1 | | using System.Reflection; |
| | | 2 | | using Elsa.Workflows.Runtime.Options; |
| | | 3 | | using Elsa.Workflows.UIHints.Dropdown; |
| | | 4 | | using Microsoft.Extensions.Options; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Runtime.UIHints; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides options for activities that dispatch workflows to channels. |
| | | 10 | | /// </summary> |
| | | 11 | | public class DispatcherChannelOptionsProvider : DropDownOptionsProviderBase |
| | | 12 | | { |
| | | 13 | | private readonly WorkflowDispatcherOptions _options; |
| | | 14 | | |
| | | 15 | | /// <inheritdoc /> |
| | 17461 | 16 | | public DispatcherChannelOptionsProvider(IOptions<WorkflowDispatcherOptions> options) |
| | | 17 | | { |
| | 17461 | 18 | | _options = options.Value; |
| | 17461 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <inheritdoc /> |
| | | 22 | | protected override ValueTask<ICollection<SelectListItem>> GetItemsAsync(PropertyInfo propertyInfo, object? context, |
| | | 23 | | { |
| | 556 | 24 | | var channelNames = _options.Channels.Select(x => x.Name).ToList(); |
| | 556 | 25 | | var selectListItems = new List<SelectListItem> { new("Default", "") }; |
| | | 26 | | |
| | 556 | 27 | | selectListItems.AddRange(channelNames.Select(x => new SelectListItem(x, x))); |
| | | 28 | | |
| | 556 | 29 | | return new(selectListItems); |
| | | 30 | | } |
| | | 31 | | } |