15 instantiations of CommandViewModel
Aspire.Dashboard (1)
ServiceClient\Partials.cs (1)
122.Select(c => new CommandViewModel(c.Name, MapState(c.State), c.DisplayName, c.DisplayDescription, c.ConfirmationMessage, c.ArgumentInputs.ToImmutableArray(), c.IsHighlighted, c.IconName, MapIconVariant(c.IconVariant)))
Aspire.Dashboard.Components.Tests (7)
Controls\ResourceDetailsTests.cs (3)
731var setCommand = new CommandViewModel( 777var setCommand = new CommandViewModel( 823var setCommand = new CommandViewModel(
Pages\ConsoleLogsTests.cs (3)
793commands: [new CommandViewModel("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]); 858new CommandViewModel( 902commands: [new CommandViewModel("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]);
Pages\ResourcesTests.cs (1)
157new CommandViewModel(
Aspire.Dashboard.Tests (7)
Model\DashboardClientTests.cs (1)
832return new CommandViewModel(
Model\DashboardCommandExecutorTests.cs (1)
240return new CommandViewModel(
Model\ResourceMenuBuilderTests.cs (5)
288var startCommand = new CommandViewModel( 298var stopCommand = new CommandViewModel( 335var command = new CommandViewModel( 379var command = new CommandViewModel( 421var command = new CommandViewModel(
82 references to CommandViewModel
Aspire.Dashboard (31)
Components\Controls\ResourceActions.razor.cs (3)
39public required EventCallback<CommandViewModel> CommandSelected { get; set; } 42public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 59private readonly List<CommandViewModel> _highlightedCommands = new();
Components\Controls\ResourceDetails.razor.cs (4)
38public required EventCallback<CommandViewModel> CommandSelected { get; set; } 41public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 225["OnExecuteCommandAsync"] = (Func<ResourceViewModel, CommandViewModel, Task>)ExecuteResourceCommandAsync, 314private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
Components\Pages\ConsoleLogs.razor.cs (3)
190private readonly List<CommandViewModel> _highlightedCommands = new(); 796EventCallback.Factory.Create<CommandViewModel>(this, ExecuteResourceCommandAsync), 836private async Task ExecuteResourceCommandAsync(CommandViewModel command)
Components\Pages\Resources.razor.cs (3)
564foreach (var command in resource.Commands) 658EventCallback.Factory.Create<CommandViewModel>(this, (command) => ExecuteResourceCommandAsync(resource, command)), 766private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
Model\DashboardCommandExecutor.cs (4)
36public async Task ExecuteAsync(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName) 88public async Task ExecuteAsyncCore(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName) 337private static NotificationAction CreateViewResponseNotificationAction(IStringLocalizer<Dashboard.Resources.Resources> loc, CommandViewModel command, ResourceCommandResponseViewModel response) 352private static async Task OpenViewResponseDialogAsync(DashboardDialogService dialogService, CommandViewModel command, ResourceCommandResponseViewModel response)
Model\ResourceMenuBuilder.cs (8)
67EventCallback<CommandViewModel> commandSelected, 68Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, 257private void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, EventCallback<CommandViewModel> commandSelected, Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting) 274foreach (var highlightedCommand in highlightedMenuCommands) 285foreach (var command in otherMenuCommands) 300foreach (var command in otherMenuCommands) 306MenuButtonItem CreateMenuItem(CommandViewModel command)
Model\ResourceViewModel.cs (1)
42public required ImmutableArray<CommandViewModel> Commands { get; init; }
ServiceClient\DashboardClient.cs (1)
1033public async Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
ServiceClient\IDashboardClient.cs (1)
65Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken);
ServiceClient\Partials.cs (1)
119ImmutableArray<CommandViewModel> GetCommands()
ServiceClient\SelectedDashboardClient.cs (1)
61public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Telemetry\TelemetryPropertyValues.cs (1)
15return CommandViewModel.IsKnownCommand(commandName)
Aspire.Dashboard.Components.Tests (20)
Controls\ResourceDetailsTests.cs (14)
731var setCommand = new CommandViewModel( 732CommandViewModel.SetParameterCommand, 754CommandViewModel? capturedCommand = null; 759builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, c => capturedCommand = c)); 769Assert.Equal(CommandViewModel.SetParameterCommand, capturedCommand!.Name); 777var setCommand = new CommandViewModel( 778CommandViewModel.SetParameterCommand, 800CommandViewModel? capturedCommand = null; 805builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, c => capturedCommand = c)); 807currentResource.Name == resource.Name && command.Name == CommandViewModel.SetParameterCommand); 823var setCommand = new CommandViewModel( 824CommandViewModel.SetParameterCommand, 850builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, _ => Task.CompletedTask)); 917ImmutableArray<CommandViewModel>? commands = null)
Pages\ResourcesTests.cs (2)
178builder.Add(component => component.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, _ => Task.CompletedTask)); 179builder.Add(component => component.IsCommandExecuting, (ResourceViewModel _, CommandViewModel _) => false);
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24ImmutableArray<CommandViewModel>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
22private readonly Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand; 43Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null, 73public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Aspire.Dashboard.Tests (31)
Integration\Playwright\Infrastructure\MockDashboardClient.cs (1)
51public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Model\DashboardClientTests.cs (1)
830private static CommandViewModel CreateCommand()
Model\DashboardCommandExecutorTests.cs (5)
40var command = CreateCommand(); 84var command = CreateCommand(); 124var command = CreateCommand(); 168var command = CreateCommand(); 238private static CommandViewModel CreateCommand()
Model\ResourceMenuBuilderTests.cs (17)
99EventCallback<CommandViewModel>.Empty, 150EventCallback<CommandViewModel>.Empty, 201EventCallback<CommandViewModel>.Empty, 238EventCallback<CommandViewModel>.Empty, 272EventCallback<CommandViewModel>.Empty, 288var startCommand = new CommandViewModel( 289CommandViewModel.StartCommand, 298var stopCommand = new CommandViewModel( 299CommandViewModel.StopCommand, 319EventCallback<CommandViewModel>.Empty, 335var command = new CommandViewModel( 336CommandViewModel.StartCommand, 358EventCallback<CommandViewModel>.Empty, 379var command = new CommandViewModel( 400EventCallback<CommandViewModel>.Empty, 421var command = new CommandViewModel( 442EventCallback<CommandViewModel>.Empty,
Model\SqliteResourceRepositoryTests.cs (1)
442var command = Assert.Single(actual.Commands);
ResourceOutgoingPeerResolverTests.cs (1)
695public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Terminal\DefaultTerminalConnectionResolverTests.cs (1)
152public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24ImmutableArray<CommandViewModel>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
22private readonly Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand; 43Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null, 73public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)