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