69 references to ResourceCommandState
Aspire.Hosting (23)
ApplicationModel\CommandOptions.cs (1)
50
public Func<UpdateCommandStateContext,
ResourceCommandState
>? UpdateState { get; set; }
ApplicationModel\CommandsConfigurationExtensions.cs (8)
34
return
ResourceCommandState
.Disabled;
38
return
ResourceCommandState
.Enabled;
42
return
ResourceCommandState
.Hidden;
67
return
ResourceCommandState
.Disabled;
71
return
ResourceCommandState
.Enabled;
75
return
ResourceCommandState
.Hidden;
101
return
ResourceCommandState
.Disabled;
105
return
ResourceCommandState
.Enabled;
ApplicationModel\CustomResourceSnapshot.cs (1)
296
public 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)
20
Func<UpdateCommandStateContext,
ResourceCommandState
> updateState,
60
public Func<UpdateCommandStateContext,
ResourceCommandState
> UpdateState { get; }
ApplicationModel\ResourceNotificationService.cs (2)
701
var
newState = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = _serviceProvider });
744
var
state = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, ServiceProvider = serviceProvider });
Dashboard\proto\Partials.cs (4)
140
private static ResourceCommandState MapCommandState(Hosting.ApplicationModel.
ResourceCommandState
state)
144
Hosting.ApplicationModel.
ResourceCommandState
.Enabled => ResourceCommandState.Enabled,
145
Hosting.ApplicationModel.
ResourceCommandState
.Disabled => ResourceCommandState.Disabled,
146
Hosting.ApplicationModel.
ResourceCommandState
.Hidden => ResourceCommandState.Hidden,
ResourceBuilderExtensions.cs (5)
1651
return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, commandOptions.UpdateState ?? (c =>
ResourceCommandState
.Enabled), executeCommand, commandOptions.Description, commandOptions.Parameter, commandOptions.ConfirmationMessage, commandOptions.IconName, commandOptions.IconVariant, commandOptions.IsHighlighted));
1696
Func<UpdateCommandStateContext,
ResourceCommandState
>? updateState = null,
1716
return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, updateState ?? (c =>
ResourceCommandState
.Enabled), executeCommand, displayDescription, parameter, confirmationMessage, iconName, iconVariant, isHighlighted));
1911
commandOptions.UpdateState = context => targetRunning ?
ResourceCommandState
.Enabled :
ResourceCommandState
.Disabled;
Aspire.Hosting.Tests (46)
Dashboard\DashboardServiceTests.cs (1)
158
UpdateState = c => ApplicationModel.
ResourceCommandState
.Enabled,
ResourceCommandAnnotationTests.cs (35)
11
[InlineData("resource-start", "Starting",
ResourceCommandState
.Disabled)]
12
[InlineData("resource-start", "Stopping",
ResourceCommandState
.Hidden)]
13
[InlineData("resource-start", "Running",
ResourceCommandState
.Hidden)]
14
[InlineData("resource-start", "Exited",
ResourceCommandState
.Enabled)]
15
[InlineData("resource-start", "Finished",
ResourceCommandState
.Enabled)]
16
[InlineData("resource-start", "FailedToStart",
ResourceCommandState
.Enabled)]
17
[InlineData("resource-start", "Unknown",
ResourceCommandState
.Enabled)]
18
[InlineData("resource-start", "Waiting",
ResourceCommandState
.Enabled)]
19
[InlineData("resource-start", "RuntimeUnhealthy",
ResourceCommandState
.Disabled)]
20
[InlineData("resource-start", "",
ResourceCommandState
.Disabled)]
21
[InlineData("resource-start", null,
ResourceCommandState
.Disabled)]
22
[InlineData("resource-stop", "Starting",
ResourceCommandState
.Hidden)]
23
[InlineData("resource-stop", "Stopping",
ResourceCommandState
.Disabled)]
24
[InlineData("resource-stop", "Running",
ResourceCommandState
.Enabled)]
25
[InlineData("resource-stop", "Exited",
ResourceCommandState
.Hidden)]
26
[InlineData("resource-stop", "Finished",
ResourceCommandState
.Hidden)]
27
[InlineData("resource-stop", "FailedToStart",
ResourceCommandState
.Hidden)]
28
[InlineData("resource-stop", "Unknown",
ResourceCommandState
.Hidden)]
29
[InlineData("resource-stop", "Waiting",
ResourceCommandState
.Hidden)]
30
[InlineData("resource-stop", "RuntimeUnhealthy",
ResourceCommandState
.Hidden)]
31
[InlineData("resource-stop", "",
ResourceCommandState
.Hidden)]
32
[InlineData("resource-stop", null,
ResourceCommandState
.Hidden)]
33
[InlineData("resource-restart", "Starting",
ResourceCommandState
.Disabled)]
34
[InlineData("resource-restart", "Stopping",
ResourceCommandState
.Disabled)]
35
[InlineData("resource-restart", "Running",
ResourceCommandState
.Enabled)]
36
[InlineData("resource-restart", "Exited",
ResourceCommandState
.Disabled)]
37
[InlineData("resource-restart", "Finished",
ResourceCommandState
.Disabled)]
38
[InlineData("resource-restart", "FailedToStart",
ResourceCommandState
.Disabled)]
39
[InlineData("resource-restart", "Unknown",
ResourceCommandState
.Disabled)]
40
[InlineData("resource-restart", "Waiting",
ResourceCommandState
.Disabled)]
41
[InlineData("resource-restart", "RuntimeUnhealthy",
ResourceCommandState
.Disabled)]
42
[InlineData("resource-restart", "",
ResourceCommandState
.Disabled)]
43
[InlineData("resource-restart", null,
ResourceCommandState
.Disabled)]
44
public void LifeCycleCommands_CommandState(string commandName, string? resourceState,
ResourceCommandState
commandState)
54
var
state = startCommand.UpdateState(new UpdateCommandStateContext
WithHttpCommandTests.cs (10)
379
ResourceCommandState
? commandState = null;
388
if (commandState ==
ResourceCommandState
.Enabled)
406
Assert.Equal(
ResourceCommandState
.Disabled, commandState);
417
Assert.Equal(
ResourceCommandState
.Enabled, commandState);
444
return enableCommand ?
ResourceCommandState
.Enabled :
ResourceCommandState
.Hidden;
449
ResourceCommandState
? commandState = null;
458
if (commandState ==
ResourceCommandState
.Enabled)
476
Assert.Equal(
ResourceCommandState
.Hidden, commandState);
488
Assert.Equal(
ResourceCommandState
.Enabled, commandState);