21 instantiations of CommandViewModel
Aspire.Dashboard (1)
ServiceClient\Partials.cs (1)
134.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 (13)
Controls\ResourceDetailsTests.cs (3)
799var setCommand = new CommandViewModel( 845var setCommand = new CommandViewModel( 891var setCommand = new CommandViewModel(
Controls\TerminalDisconnectedBannerTests.cs (1)
206new(name, state, name, string.Empty, string.Empty, [], false, "ArrowClockwise", IconVariant.Regular);
Controls\TerminalViewTests.cs (1)
624commands: [new CommandViewModel(CommandViewModel.StartCommand, CommandViewModelState.Enabled,
Layout\ResourcesLayoutTests.cs (3)
543var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled); 544var other = new CommandViewModel("custom", CommandViewModelState.Enabled, "Custom command", "", confirmationMessage: "", argumentInputs: [], isHighlighted: false, iconName: string.Empty, iconVariant: IconVariant.Regular); 576var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
Model\DashboardCommandExecutorTests.cs (1)
79var command = 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)
237new CommandViewModel(
Aspire.Dashboard.Tests (7)
Model\DashboardClientTests.cs (1)
1509return new CommandViewModel(
Model\DashboardCommandExecutorTests.cs (1)
336return new CommandViewModel(
Model\ResourceMenuBuilderTests.cs (5)
330var startCommand = new CommandViewModel( 340var stopCommand = new CommandViewModel( 378var command = new CommandViewModel( 423var command = new CommandViewModel( 466var command = new CommandViewModel(
156 references to CommandViewModel
Aspire.Dashboard (77)
Components\Controls\ApplicationSummary.razor.cs (4)
615private Task ExecuteCommandAsync(ResourceViewModel resource, CommandViewModel command) => 643EventCallback.Factory.Create<CommandViewModel>(this, command => ExecuteCommandAsync(resource, command)), 665private Task ExecuteCardCommandAsync(ResourceViewModel resource, CommandViewModel command) 667if (string.Equals(command.Name, CommandViewModel.SetParameterCommand, StringComparisons.CommandName))
Components\Controls\MissingParametersPanel.razor.cs (7)
45public required Func<ResourceViewModel, CommandViewModel, Task> OnExecuteCommandAsync { get; set; } 48public required Func<ResourceViewModel, CommandViewModel, ExecuteResourceCommandOptions, Task> OnExecuteCommandWithOptionsAsync { get; set; } 51public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 103private static CommandViewModel? GetSetParameterCommand(ResourceViewModel parameter) => 105string.Equals(command.Name, CommandViewModel.SetParameterCommand, StringComparisons.CommandName) && 120var command = GetSetParameterCommand(parameter); 308CommandViewModel Command,
Components\Controls\ParameterOverview.razor.cs (7)
38public required Func<ResourceViewModel, CommandViewModel, Task> OnExecuteCommandAsync { get; set; } 41public required Func<ResourceViewModel, CommandViewModel, ExecuteResourceCommandOptions, Task> OnExecuteCommandWithOptionsAsync { get; set; } 44public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 49private CommandViewModel? SetCommand { get; set; } 50private CommandViewModel? DeleteCommand { get; set; } 83string.Equals(command.Name, CommandViewModel.SetParameterCommand, StringComparisons.CommandName) && 87string.Equals(command.Name, CommandViewModel.DeleteParameterCommand, StringComparisons.CommandName) &&
Components\Controls\ResourceActions.razor.cs (6)
30public required EventCallback<CommandViewModel> CommandSelected { get; set; } 33public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 53private readonly List<CommandViewModel> _highlightedCommands = new(); 85private string GetCardCommandText(CommandViewModel command) 87if (string.Equals(command.Name, CommandViewModel.SetParameterCommand, StringComparisons.CommandName)) 94return string.Equals(command.Name, CommandViewModel.DeleteParameterCommand, StringComparisons.CommandName)
Components\Controls\ResourceDetails.razor.cs (4)
41public required EventCallback<CommandViewModel> CommandSelected { get; set; } 44public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 221["OnExecuteCommandAsync"] = (Func<ResourceViewModel, CommandViewModel, Task>)ExecuteResourceCommandAsync, 311private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
Components\Controls\TerminalDisconnectedBanner.razor.cs (4)
82private CommandViewModel? RestartCommand 94c.Name is CommandViewModel.RestartCommand or CommandViewModel.StartCommand); 96.ThenBy(c => c.Name != CommandViewModel.RestartCommand).FirstOrDefault();
Components\Layout\ResourcesLayout.razor.cs (5)
1336private static IEnumerable<CommandViewModel> GetHighlightedCommands(ResourceViewModel resource) => resource.Commands 1340private bool IsCommandDisabled(ResourceViewModel resource, CommandViewModel command) => 1365EventCallback.Factory.Create<CommandViewModel>(this, command => ExecuteResourceCommandAsync(resource, command)), 1395private Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command) 1398string.Equals(command.Name, CommandViewModel.SetParameterCommand, StringComparisons.CommandName))
Components\Legacy\Pages\ConsoleLogs.razor.cs (3)
165private readonly List<CommandViewModel> _highlightedCommands = new(); 585EventCallback.Factory.Create<CommandViewModel>(this, ExecuteResourceCommandAsync), 626private async Task ExecuteResourceCommandAsync(CommandViewModel command)
Components\Legacy\Pages\Resources.razor.cs (3)
621foreach (var command in resource.Commands) 715EventCallback.Factory.Create<CommandViewModel>(this, (command) => ExecuteResourceCommandAsync(resource, command)), 830private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
Components\Legacy\Pages\Terminals.razor.cs (3)
24private readonly List<CommandViewModel> _highlightedCommands = []; 264EventCallback.Factory.Create<CommandViewModel>(this, ExecuteResourceCommandAsync), 270private Task ExecuteResourceCommandAsync(CommandViewModel command)
Components\Pages\ConsoleLogs.razor.cs (3)
183private readonly List<CommandViewModel> _highlightedCommands = new(); 652EventCallback.Factory.Create<CommandViewModel>(this, ExecuteResourceCommandAsync), 693private async Task ExecuteResourceCommandAsync(CommandViewModel command)
Components\Pages\ResourceOverview.Details.cs (2)
112["OnExecuteCommandAsync"] = (Func<ResourceViewModel, CommandViewModel, Task>)ExecuteResourceCommandAsync, 113["IsCommandExecuting"] = (Func<ResourceViewModel, CommandViewModel, bool>)((r, command) => DashboardCommandExecutor.IsExecuting(r.Name, command.Name)),
Components\Pages\ResourceOverview.razor.cs (2)
670private Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command) 673private Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command, ExecuteResourceCommandOptions options)
Components\Pages\Resources.razor.cs (3)
622foreach (var command in resource.Commands) 747EventCallback.Factory.Create<CommandViewModel>(this, (command) => ExecuteResourceCommandAsync(resource, command)), 869private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
Components\Pages\Terminals.razor.cs (3)
24private readonly List<CommandViewModel> _highlightedCommands = []; 294EventCallback.Factory.Create<CommandViewModel>(this, ExecuteResourceCommandAsync), 300private Task ExecuteResourceCommandAsync(CommandViewModel command)
Model\DashboardCommandExecutor.cs (4)
44CommandViewModel command, 98CommandViewModel command, 354private static NotificationAction CreateViewResponseNotificationAction(IStringLocalizer<Dashboard.Resources.Resources> loc, CommandViewModel command, ResourceCommandResponseViewModel response) 369private static async Task OpenViewResponseDialogAsync(DashboardDialogService dialogService, CommandViewModel command, ResourceCommandResponseViewModel response)
Model\ResourceMenuBuilder.cs (8)
71EventCallback<CommandViewModel> commandSelected, 72Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, 285private void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, EventCallback<CommandViewModel> commandSelected, Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting) 302foreach (var highlightedCommand in highlightedMenuCommands) 313foreach (var command in otherMenuCommands) 328foreach (var command in otherMenuCommands) 334MenuButtonItem CreateMenuItem(CommandViewModel command)
Model\ResourceViewModel.cs (1)
42public required ImmutableArray<CommandViewModel> Commands { get; init; }
ServiceClient\DashboardClient.cs (1)
1090public async Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
ServiceClient\IDashboardClient.cs (1)
75Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken);
ServiceClient\Partials.cs (1)
131ImmutableArray<CommandViewModel> GetCommands()
ServiceClient\SelectedDashboardClient.cs (1)
66public 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 (39)
Controls\ResourceActionsTests.cs (1)
142.Add(component => component.CommandSelected, EventCallback<CommandViewModel>.Empty)
Controls\ResourceDetailsTests.cs (14)
799var setCommand = new CommandViewModel( 800CommandViewModel.SetParameterCommand, 822CommandViewModel? capturedCommand = null; 827builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, c => capturedCommand = c)); 837Assert.Equal(CommandViewModel.SetParameterCommand, capturedCommand!.Name); 845var setCommand = new CommandViewModel( 846CommandViewModel.SetParameterCommand, 868CommandViewModel? capturedCommand = null; 873builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, c => capturedCommand = c)); 875currentResource.Name == resource.Name && command.Name == CommandViewModel.SetParameterCommand); 891var setCommand = new CommandViewModel( 892CommandViewModel.SetParameterCommand, 918builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, _ => Task.CompletedTask)); 985ImmutableArray<CommandViewModel>? commands = null)
Controls\TerminalDisconnectedBannerTests.cs (13)
56[InlineData(CommandViewModel.StartCommand, ResourceCommandResponseKind.Succeeded)] 57[InlineData(CommandViewModel.RestartCommand, ResourceCommandResponseKind.Succeeded)] 58[InlineData(CommandViewModel.StartCommand, ResourceCommandResponseKind.Failed)] 59[InlineData(CommandViewModel.RestartCommand, ResourceCommandResponseKind.Cancelled)] 107displayName: "shell", commands: [CreateCommand(CommandViewModel.RestartCommand)]); 119commands: [CreateCommand(CommandViewModel.RestartCommand)], state: KnownResourceState.Finished, properties: new() 134toasts.WaitForAssertion(() => Assert.Equal($"shell \"{CommandViewModel.RestartCommand}\" succeeded", 145commands: [CreateCommand(CommandViewModel.RestartCommand)]); 161[CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Hidden)]); 169commands: [CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Disabled)]))]); 173commands: [CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Disabled), 174CreateCommand(CommandViewModel.StartCommand)]))]); 205private static CommandViewModel CreateCommand(string name, CommandViewModelState state = CommandViewModelState.Enabled) =>
Controls\TerminalViewTests.cs (1)
624commands: [new CommandViewModel(CommandViewModel.StartCommand, CommandViewModelState.Enabled,
Layout\ResourcesLayoutTests.cs (3)
543var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled); 544var other = new CommandViewModel("custom", CommandViewModelState.Enabled, "Custom command", "", confirmationMessage: "", argumentInputs: [], isHighlighted: false, iconName: string.Empty, iconVariant: IconVariant.Regular); 576var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
Model\DashboardCommandExecutorTests.cs (1)
79var command = new CommandViewModel(
Pages\ResourcesTests.cs (2)
258builder.Add(component => component.CommandSelected, EventCallback.Factory.Create<CommandViewModel>(this, _ => Task.CompletedTask)); 259builder.Add(component => component.IsCommandExecuting, (ResourceViewModel _, CommandViewModel _) => false);
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24ImmutableArray<CommandViewModel>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
25private readonly Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand; 63Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null, 101public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Aspire.Dashboard.Playwright.Tests (5)
tests\Aspire.Dashboard.Tests\Shared\MockDashboardClient.cs (1)
54public 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)
25private readonly Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand; 63Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null, 101public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Aspire.Dashboard.Tests (35)
Model\DashboardClientTests.cs (1)
1507private static CommandViewModel CreateCommand()
Model\DashboardCommandExecutorTests.cs (8)
37var command = CreateCommand(); 50var command = CreateCommand(); 78var command = CreateCommand(); 130var command = CreateCommand(); 174var command = CreateCommand(); 214var command = CreateCommand(); 258var command = CreateCommand(); 334private static CommandViewModel CreateCommand()
Model\ResourceMenuBuilderTests.cs (18)
100EventCallback<CommandViewModel>.Empty, 152EventCallback<CommandViewModel>.Empty, 187EventCallback<CommandViewModel>.Empty, 240EventCallback<CommandViewModel>.Empty, 278EventCallback<CommandViewModel>.Empty, 313EventCallback<CommandViewModel>.Empty, 330var startCommand = new CommandViewModel( 331CommandViewModel.StartCommand, 340var stopCommand = new CommandViewModel( 341CommandViewModel.StopCommand, 361EventCallback<CommandViewModel>.Empty, 378var command = new CommandViewModel( 379CommandViewModel.StartCommand, 401EventCallback<CommandViewModel>.Empty, 423var command = new CommandViewModel( 444EventCallback<CommandViewModel>.Empty, 466var command = new CommandViewModel( 487EventCallback<CommandViewModel>.Empty,
Model\SqliteResourceRepositoryTests.cs (1)
482var command = Assert.Single(actual.Commands);
ResourceOutgoingPeerResolverTests.cs (1)
696public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Shared\MockDashboardClient.cs (1)
54public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Terminal\DefaultTerminalConnectionResolverTests.cs (1)
196public 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)
25private readonly Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand; 63Func<string, string, CommandViewModel, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null, 101public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType, CommandViewModel command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)