102 references to ResourceCommandState
Aspire.Hosting (28)
ApplicationModel\CommandOptions.cs (1)
51public Func<UpdateCommandStateContext, ResourceCommandState>? UpdateState { get; set; }
ApplicationModel\CommandsConfigurationExtensions.cs (10)
37return ResourceCommandState.Disabled; 41return ResourceCommandState.Enabled; 45return ResourceCommandState.Hidden; 70return ResourceCommandState.Disabled; 74return ResourceCommandState.Enabled; 78return ResourceCommandState.Hidden; 110return ResourceCommandState.Disabled; 114return ResourceCommandState.Enabled; 171? ResourceCommandState.Enabled 172: ResourceCommandState.Disabled;
ApplicationModel\CustomResourceSnapshot.cs (1)
296public sealed record ResourceCommandSnapshot(string Name, ResourceCommandState State, string DisplayName, string? DisplayDescription, object? Parameter, string? ConfirmationMessage, string? IconName, IconVariant? IconVariant, bool IsHighlighted);
ApplicationModel\ResourceCommandAnnotation.cs (2)
20Func<UpdateCommandStateContext, ResourceCommandState> updateState, 60public Func<UpdateCommandStateContext, ResourceCommandState> UpdateState { get; }
ApplicationModel\ResourceNotificationService.cs (2)
760var newState = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = _serviceProvider }); 803var state = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = serviceProvider });
Dashboard\proto\Partials.cs (4)
145private static ResourceCommandState MapCommandState(Hosting.ApplicationModel.ResourceCommandState state) 149Hosting.ApplicationModel.ResourceCommandState.Enabled => ResourceCommandState.Enabled, 150Hosting.ApplicationModel.ResourceCommandState.Disabled => ResourceCommandState.Disabled, 151Hosting.ApplicationModel.ResourceCommandState.Hidden => ResourceCommandState.Hidden,
Orchestrator\ParameterProcessor.cs (3)
205updateState: _ => ResourceCommandState.Enabled, 221updateState: _ => HasParameterValue(parameterResource) ? ResourceCommandState.Enabled : ResourceCommandState.Hidden,
ResourceBuilderExtensions.cs (5)
2206return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, commandOptions.UpdateState ?? (c => ResourceCommandState.Enabled), executeCommand, commandOptions.Description, commandOptions.Parameter, commandOptions.ConfirmationMessage, commandOptions.IconName, commandOptions.IconVariant, commandOptions.IsHighlighted)); 2251Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null, 2271return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, updateState ?? (c => ResourceCommandState.Enabled), executeCommand, displayDescription, parameter, confirmationMessage, iconName, iconVariant, isHighlighted)); 2456return targetRunning ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Azure.Kusto (8)
AzureKustoBuilderExtensions.cs (8)
340static ResourceCommandState UpdateStateDesktop(UpdateCommandStateContext context) 345return ResourceCommandState.Hidden; 348return context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ? ResourceCommandState.Enabled : ResourceCommandState.Disabled; 351static ResourceCommandState UpdateStateWeb(IResourceBuilder<AzureKustoClusterResource> resourceBuilder, UpdateCommandStateContext context) 356return ResourceCommandState.Hidden; 359return context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Tests (66)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (3)
121new ResourceCommandSnapshot("start", ResourceCommandState.Enabled, "Start", "Start the resource", null, null, null, null, false), 122new ResourceCommandSnapshot("stop", ResourceCommandState.Disabled, "Stop", "Stop the resource", null, null, null, null, false), 123new ResourceCommandSnapshot("restart", ResourceCommandState.Hidden, "Restart", null, null, null, null, null, true)
Dashboard\DashboardServiceTests.cs (1)
160UpdateState = c => Aspire.Hosting.ApplicationModel.ResourceCommandState.Enabled,
ResourceCommandAnnotationTests.cs (52)
13[InlineData("start", "Starting", ResourceCommandState.Disabled)] 14[InlineData("start", "Stopping", ResourceCommandState.Hidden)] 15[InlineData("start", "Running", ResourceCommandState.Hidden)] 16[InlineData("start", "Exited", ResourceCommandState.Enabled)] 17[InlineData("start", "Finished", ResourceCommandState.Enabled)] 18[InlineData("start", "FailedToStart", ResourceCommandState.Enabled)] 19[InlineData("start", "Unknown", ResourceCommandState.Enabled)] 20[InlineData("start", "Waiting", ResourceCommandState.Enabled)] 21[InlineData("start", "Building", ResourceCommandState.Disabled)] 22[InlineData("start", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 23[InlineData("start", "", ResourceCommandState.Disabled)] 24[InlineData("start", null, ResourceCommandState.Disabled)] 25[InlineData("stop", "Starting", ResourceCommandState.Hidden)] 26[InlineData("stop", "Stopping", ResourceCommandState.Disabled)] 27[InlineData("stop", "Running", ResourceCommandState.Enabled)] 28[InlineData("stop", "Exited", ResourceCommandState.Hidden)] 29[InlineData("stop", "Finished", ResourceCommandState.Hidden)] 30[InlineData("stop", "FailedToStart", ResourceCommandState.Hidden)] 31[InlineData("stop", "Unknown", ResourceCommandState.Hidden)] 32[InlineData("stop", "Waiting", ResourceCommandState.Hidden)] 33[InlineData("stop", "Building", ResourceCommandState.Hidden)] 34[InlineData("stop", "RuntimeUnhealthy", ResourceCommandState.Hidden)] 35[InlineData("stop", "", ResourceCommandState.Hidden)] 36[InlineData("stop", null, ResourceCommandState.Hidden)] 37[InlineData("restart", "Starting", ResourceCommandState.Disabled)] 38[InlineData("restart", "Stopping", ResourceCommandState.Disabled)] 39[InlineData("restart", "Running", ResourceCommandState.Enabled)] 40[InlineData("restart", "Exited", ResourceCommandState.Disabled)] 41[InlineData("restart", "Finished", ResourceCommandState.Disabled)] 42[InlineData("restart", "FailedToStart", ResourceCommandState.Disabled)] 43[InlineData("restart", "Unknown", ResourceCommandState.Disabled)] 44[InlineData("restart", "Waiting", ResourceCommandState.Disabled)] 45[InlineData("restart", "Building", ResourceCommandState.Disabled)] 46[InlineData("restart", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 47[InlineData("restart", "", ResourceCommandState.Disabled)] 48[InlineData("restart", null, ResourceCommandState.Disabled)] 49public void LifeCycleCommands_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 59var state = startCommand.UpdateState(new UpdateCommandStateContext 120[InlineData("rebuild", "Starting", ResourceCommandState.Disabled)] 121[InlineData("rebuild", "Stopping", ResourceCommandState.Disabled)] 122[InlineData("rebuild", "Running", ResourceCommandState.Enabled)] 123[InlineData("rebuild", "Exited", ResourceCommandState.Enabled)] 124[InlineData("rebuild", "Finished", ResourceCommandState.Enabled)] 125[InlineData("rebuild", "FailedToStart", ResourceCommandState.Enabled)] 126[InlineData("rebuild", "Unknown", ResourceCommandState.Disabled)] 127[InlineData("rebuild", "Waiting", ResourceCommandState.Enabled)] 128[InlineData("rebuild", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 129[InlineData("rebuild", "Building", ResourceCommandState.Disabled)] 130[InlineData("rebuild", "", ResourceCommandState.Disabled)] 131[InlineData("rebuild", null, ResourceCommandState.Disabled)] 132public void RebuildCommand_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 139var state = rebuildCommand.UpdateState(new UpdateCommandStateContext
WithHttpCommandTests.cs (10)
428Assert.Equal(ResourceCommandState.Disabled, startingEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 440e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Enabled).DefaultTimeout(); 442Assert.Equal(ResourceCommandState.Enabled, runningEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 466return enableCommand ? ResourceCommandState.Enabled : ResourceCommandState.Hidden; 483e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Hidden).DefaultTimeout(); 485Assert.Equal(ResourceCommandState.Hidden, runningEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 497e => e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Enabled).DefaultTimeout(); 500Assert.Equal(ResourceCommandState.Enabled, enabledEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 539e.Snapshot.Commands.FirstOrDefault(c => c.Name == commandName)?.State == ResourceCommandState.Enabled).DefaultTimeout();