116 references to CommandViewModelState
Aspire.Dashboard (33)
Components\Controls\MissingParametersPanel.razor.cs (2)
120command.State != CommandViewModelState.Hidden); 178editor.Command.State == CommandViewModelState.Disabled ||
Components\Controls\ParameterOverview.razor.cs (4)
57SetCommand.State == CommandViewModelState.Disabled || 61DeleteCommand.State == CommandViewModelState.Disabled || 84command.State != CommandViewModelState.Hidden); 88command.State != CommandViewModelState.Hidden);
Components\Controls\ResourceActions.razor.cs (1)
57_highlightedCommands.AddRange(Resource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden).Take(MaxHighlightedCount));
Components\Controls\TerminalDisconnectedBanner.razor.cs (3)
93var commands = resource.Commands.Where(c => c.State != CommandViewModelState.Hidden && 95return commands.OrderBy(c => c.State != CommandViewModelState.Enabled) 100private bool RestartDisabled => _executing || RestartCommand is not { State: CommandViewModelState.Enabled } command ||
Components\Layout\ResourcesLayout.razor.cs (5)
1866.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden) 1873c.State != CommandViewModelState.Hidden).Take(1) 1886.SelectMany(name => resource.Commands.Where(c => c.Name == name && c.State != CommandViewModelState.Hidden)) 1897.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden && 1959DashboardClient.IsReadOnly || command.State == CommandViewModelState.Disabled || DashboardCommandExecutor.IsExecuting(resource.Name, command.Name);
Components\Legacy\Pages\ConsoleLogs.razor.cs (1)
573_highlightedCommands.AddRange(selectedResource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden).Take(DashboardUIHelpers.MaxHighlightedCommands));
Components\Legacy\Pages\Resources.razor.cs (1)
630if (command.IsHighlighted && command.State != CommandViewModelState.Hidden)
Components\Legacy\Pages\Terminals.razor.cs (1)
259_highlightedCommands.AddRange(resource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden)
Components\Pages\ConsoleLogs.razor.cs (1)
677_highlightedCommands.AddRange(selectedResource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden).Take(DashboardUIHelpers.MaxHighlightedCommands));
Components\Pages\Resources.razor.cs (1)
655if (command.IsHighlighted && command.State != CommandViewModelState.Hidden)
Components\Pages\Terminals.razor.cs (1)
289_highlightedCommands.AddRange(resource.Commands.Where(c => c.IsHighlighted && c.State != CommandViewModelState.Hidden)
Model\DashboardCommandExecutor.cs (1)
62if (command is not { State: CommandViewModelState.Enabled } ||
Model\ResourceMenuBuilder.cs (4)
313.Where(command => command.State != CommandViewModelState.Hidden) 341!resource.IsParameter && !_dashboardClient.IsReadOnly && command.State == CommandViewModelState.Enabled && !isCommandExecuting(resource, command); 360.Where(c => c.State != CommandViewModelState.Hidden) 409_dashboardClient.IsReadOnly || command.State == CommandViewModelState.Disabled || isCommandExecuting(resource, command));
Model\ResourceViewModel.cs (2)
316public CommandViewModelState State { get; } 326public CommandViewModel(string name, CommandViewModelState state, string displayName, string displayDescription, string confirmationMessage, ImmutableArray<InteractionInput> argumentInputs, bool isHighlighted, string iconName, IconVariant iconVariant)
Model\TelemetryExportService.cs (1)
773.Where(c => c.State == CommandViewModelState.Enabled)
ServiceClient\Partials.cs (4)
138static CommandViewModelState MapState(ResourceCommandState state) 142ResourceCommandState.Enabled => CommandViewModelState.Enabled, 143ResourceCommandState.Disabled => CommandViewModelState.Disabled, 144ResourceCommandState.Hidden => CommandViewModelState.Hidden,
Aspire.Dashboard.Components.Tests (55)
Controls\MissingParametersPanelTests.cs (1)
141new(CommandViewModel.SetParameterCommand, CommandViewModelState.Enabled, "Set", string.Empty, string.Empty, [input], isHighlighted: false, iconName: string.Empty, iconVariant: Microsoft.FluentUI.AspNetCore.Components.IconVariant.Regular);
Controls\ResourceDetailsTests.cs (3)
799CommandViewModelState.Enabled, 845CommandViewModelState.Enabled, 891CommandViewModelState.Enabled,
Controls\TerminalDisconnectedBannerTests.cs (5)
161[CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Hidden)]); 169commands: [CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Disabled)]))]); 173commands: [CreateCommand(CommandViewModel.RestartCommand, CommandViewModelState.Disabled), 205private static CommandViewModel CreateCommand(string name, CommandViewModelState state = CommandViewModelState.Enabled) =>
Controls\TerminalViewTests.cs (1)
624commands: [new CommandViewModel(CommandViewModel.StartCommand, CommandViewModelState.Enabled,
Layout\ResourcesLayoutTests.cs (40)
636static CommandViewModel Command(string name, CommandViewModelState state) => new(name, state, name, "", 644Command("enabled", CommandViewModelState.Enabled), 645Command("disabled", CommandViewModelState.Disabled), 646Command("hidden", CommandViewModelState.Hidden) 1544var command = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: iconName, iconVariant: IconVariant.Filled); 1586var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled); 1587var other = new CommandViewModel("custom", CommandViewModelState.Enabled, "Custom command", "", confirmationMessage: "", argumentInputs: [], isHighlighted: false, iconName: string.Empty, iconVariant: IconVariant.Regular); 1616static CommandViewModel Stop(CommandViewModelState state) => 1618var enabled = Stop(CommandViewModelState.Enabled); 1623ModelTestHelpers.CreateResource("worker", commands: [Stop(CommandViewModelState.Disabled)]), 1626new CommandViewModel(CommandViewModel.SetParameterCommand, CommandViewModelState.Enabled, "Set parameter", "", 1673var command = new CommandViewModel("refresh", CommandViewModelState.Enabled, "Refresh", "", 1712var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled); 1746static CommandViewModel Command(string name, CommandViewModelState state, bool highlighted) => 1751Command(CommandViewModel.StartCommand, CommandViewModelState.Hidden, false), 1752Command(CommandViewModel.StopCommand, CommandViewModelState.Enabled, true), 1753Command(CommandViewModel.RestartCommand, CommandViewModelState.Enabled, false) 1783static CommandViewModel Command(string name, CommandViewModelState state, bool highlighted) => 1790Command(CommandViewModel.StopCommand, CommandViewModelState.Enabled, false), 1791Command("hidden", CommandViewModelState.Hidden, true), 1792Command("deploy", CommandViewModelState.Enabled, true), 1793Command("inspect", CommandViewModelState.Disabled, true), 1794Command("extra", CommandViewModelState.Enabled, true) 1824[InlineData(CommandViewModelState.Enabled, false, false, ResourceListDensity.Comfortable)] 1825[InlineData(CommandViewModelState.Enabled, true, false, ResourceListDensity.Compact)] 1826[InlineData(CommandViewModelState.Disabled, true, false, ResourceListDensity.Comfortable)] 1827[InlineData(CommandViewModelState.Enabled, true, true, ResourceListDensity.Compact)] 1828[InlineData(CommandViewModelState.Hidden, true, false, ResourceListDensity.Comfortable)] 1831CommandViewModelState? setState, bool highlighted, bool readOnly, ResourceListDensity density) 1834static CommandViewModel Command(string name, string displayName, CommandViewModelState state, bool highlighted) => 1838Command("custom", "Custom", CommandViewModelState.Enabled, true), 1839Command(CommandViewModel.DeleteParameterCommand, "Delete parameter", CommandViewModelState.Enabled, true) 1866if (setState is null or CommandViewModelState.Hidden) 1874Assert.Equal(readOnly || setState == CommandViewModelState.Disabled, setButton.HasAttribute("disabled")); 1890static CommandViewModel Command(string name, CommandViewModelState state) => 1895Command(CommandViewModel.StopCommand, CommandViewModelState.Enabled), 1896Command("hidden", CommandViewModelState.Hidden), 1897Command("deploy", CommandViewModelState.Enabled), 1898Command("inspect", CommandViewModelState.Disabled) 2012var stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
Model\DashboardCommandExecutorTests.cs (1)
81state: CommandViewModelState.Enabled,
Pages\ConsoleLogsTests.cs (3)
839commands: [new CommandViewModel("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]); 906CommandViewModelState.Enabled, 948commands: [new CommandViewModel("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]);
Pages\ResourcesTests.cs (1)
277CommandViewModelState.Enabled,
Aspire.Dashboard.Playwright.Tests (2)
Integration\Playwright\ResourcePaneResponsiveTests.cs (2)
264commands: [new("inspect", CommandViewModelState.Enabled, "Inspect", "", "", [], 2847new(name, CommandViewModelState.Enabled, name, "", confirmationMessage: "", argumentInputs: [],
Aspire.Dashboard.Tests (26)
Model\DashboardClientTests.cs (1)
1511CommandViewModelState.Enabled,
Model\DashboardCommandExecutorTests.cs (6)
90[InlineData(CommandViewModelState.Disabled, "")] 91[InlineData(CommandViewModelState.Hidden, "")] 92[InlineData(CommandViewModelState.Enabled, "Are you sure?")] 93public async Task ExecuteGraphGameCommandAsync_ReportsUnavailableCommandWithoutRunningIt(CommandViewModelState state, string confirmationMessage) 429private static CommandViewModel CreateCommand(string name = "test-command", CommandViewModelState state = CommandViewModelState.Enabled, string confirmationMessage = "")
Model\ResourceMenuBuilderTests.cs (19)
90CreateCommand("Refresh", CommandViewModelState.Disabled), 91CreateCommand("Unavailable", CommandViewModelState.Disabled) 93var first = ModelTestHelpers.CreateResource(resourceName: "first", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 94var second = ModelTestHelpers.CreateResource(resourceName: "second", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 96CreateCommand("Refresh", CommandViewModelState.Hidden), 97CreateCommand("Hidden", CommandViewModelState.Hidden) 99var busy = ModelTestHelpers.CreateResource(resourceName: "busy", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 100var removed = ModelTestHelpers.CreateResource(resourceName: "removed", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 128var newlyAdded = ModelTestHelpers.CreateResource(resourceName: "new", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 144[InlineData(true, CommandViewModelState.Enabled)] 145[InlineData(false, CommandViewModelState.Disabled)] 146public async Task CreateTagGroupMenuItems_RechecksAvailabilityOnClick(bool readOnly, CommandViewModelState latestState) 150var member = ModelTestHelpers.CreateResource(resourceName: "first", commands: [CreateCommand("Refresh", CommandViewModelState.Enabled)]); 160private static CommandViewModel CreateCommand(string name, CommandViewModelState state) => 411CommandViewModelState.Enabled, 421CommandViewModelState.Enabled, 459CommandViewModelState.Enabled, 504CommandViewModelState.Enabled, 547CommandViewModelState.Enabled,