3 instantiations of ResourceViewModel
Aspire.Dashboard (1)
ResourceService\Partials.cs (1)
20
return
new
()
Aspire.Dashboard.Components.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
return new
ResourceViewModel
Aspire.Dashboard.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
return new
ResourceViewModel
97 references to ResourceViewModel
Aspire.Dashboard (63)
Components\Controls\ResourceDetails.razor.cs (3)
34
private
ResourceViewModel
? _resource;
146
ResourceName =
ResourceViewModel
.GetResourceName(match, ResourceByName),
177
ResourceName =
ResourceViewModel
.GetResourceName(otherResource, ResourceByName),
Components\Pages\ConsoleLogs.razor.cs (8)
81
private readonly ConcurrentDictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
186
void SetSelectedResourceOption(
ResourceViewModel
resource)
322
private string GetResourceName(
ResourceViewModel
resource) =>
ResourceViewModel
.GetResourceName(resource, _resourceByName);
325
ConcurrentDictionary<string,
ResourceViewModel
> resourcesByName,
362
SelectViewModel<ResourceTypeDetails> ToOption(
ResourceViewModel
resource, bool isReplica, string applicationName)
376
var resourceName =
ResourceViewModel
.GetResourceName(resource, resourcesByName);
457
private async Task OnResourceChanged(ResourceViewModelChangeType changeType,
ResourceViewModel
resource)
Components\Pages\Resources.razor.cs (12)
56
private
ResourceViewModel
? SelectedResource { get; set; }
59
private readonly ConcurrentDictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
72
private bool Filter(
ResourceViewModel
resource) => _visibleResourceTypes.ContainsKey(resource.ResourceType) && (_filter.Length == 0 || resource.MatchesFilter(_filter)) && !resource.IsHiddenState();
319
private async Task ShowResourceDetailsAsync(
ResourceViewModel
resource, string? buttonId)
332
var
current = resource;
365
private string GetResourceName(
ResourceViewModel
resource) =>
ResourceViewModel
.GetResourceName(resource, _resourceByName);
367
private bool HasMultipleReplicas(
ResourceViewModel
resource)
390
private string GetRowClass(
ResourceViewModel
resource)
393
private async Task ExecuteResourceCommandAsync(
ResourceViewModel
resource, CommandViewModel command)
398
private static string GetEndpointsTooltip(
ResourceViewModel
resource)
441
private static List<DisplayedEndpoint> GetDisplayedEndpoints(
ResourceViewModel
resource)
Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor.cs (1)
29
private (string? applicationName, int unviewedErrorCount) GetUnviewedErrorCount(
ResourceViewModel
resource)
Extensions\ResourceViewModelExtensions.cs (8)
10
public static bool IsHiddenState(this
ResourceViewModel
resource)
15
public static bool IsRunningState(this
ResourceViewModel
resource)
20
public static bool IsFinishedState(this
ResourceViewModel
resource)
25
public static bool IsStopped(this
ResourceViewModel
resource)
30
public static bool IsUnusableTransitoryState(this
ResourceViewModel
resource)
35
public static bool IsRuntimeUnhealthy(this
ResourceViewModel
resource)
40
public static bool IsUnknownState(this
ResourceViewModel
resource) => resource.KnownState is KnownResourceState.Unknown;
42
public static bool HasNoState(this
ResourceViewModel
resource) => string.IsNullOrEmpty(resource.State);
Model\DashboardCommandExecutor.cs (2)
19
public async Task ExecuteAsync(
ResourceViewModel
resource, CommandViewModel command, Func<
ResourceViewModel
, string> getResourceName)
Model\ResourceEndpointHelpers.cs (1)
14
public static List<DisplayedEndpoint> GetEndpoints(
ResourceViewModel
resource, bool includeInternalUrls = false)
Model\ResourceGridViewModel.cs (2)
37
public static List<ResourceGridViewModel> OrderNestedResources(List<ResourceGridViewModel> initialGridVMs, Func<
ResourceViewModel
, bool> isCollapsed)
59
void AddChildViewModel(
ResourceViewModel
resource, ResourceGridViewModel parent, int depth, bool hidden)
Model\ResourceOutgoingPeerResolver.cs (4)
14
private readonly ConcurrentDictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
33
foreach (
var
resource in snapshot)
67
internal static bool TryResolvePeerNameCore(IDictionary<string,
ResourceViewModel
> resources, KeyValuePair<string, string>[] attributes, out string? name)
105
name =
ResourceViewModel
.GetResourceName(resource, resources);
Model\ResourceSourceViewModel.cs (1)
13
internal static ResourceSourceViewModel? GetSourceViewModel(
ResourceViewModel
resource)
Model\ResourceStateViewModel.cs (3)
22
internal static ResourceStateViewModel GetStateViewModel(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
98
internal static string GetResourceStateTooltip(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
128
private static string GetStateText(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
Model\ResourceViewModel.cs (2)
98
public static string GetResourceName(
ResourceViewModel
resource, IDictionary<string,
ResourceViewModel
> allResources)
Model\ResourceViewModelExtensions.cs (11)
12
public static bool IsContainer(this
ResourceViewModel
resource)
17
public static bool IsProject(this
ResourceViewModel
resource)
22
public static bool IsExecutable(this
ResourceViewModel
resource, bool allowSubtypes)
37
public static bool TryGetExitCode(this
ResourceViewModel
resource, out int exitCode)
42
public static bool TryGetContainerImage(this
ResourceViewModel
resource, [NotNullWhen(returnValue: true)] out string? containerImage)
47
public static bool TryGetProjectPath(this
ResourceViewModel
resource, [NotNullWhen(returnValue: true)] out string? projectPath)
52
public static bool TryGetExecutablePath(this
ResourceViewModel
resource, [NotNullWhen(returnValue: true)] out string? executablePath)
57
public static bool TryGetExecutableArguments(this
ResourceViewModel
resource, out ImmutableArray<string> arguments)
62
private static bool TryGetCustomDataString(this
ResourceViewModel
resource, string key, [NotNullWhen(returnValue: true)] out string? s)
74
private static bool TryGetCustomDataStringArray(this
ResourceViewModel
resource, string key, out ImmutableArray<string> strings)
99
private static bool TryGetCustomDataInt(this
ResourceViewModel
resource, string key, out int i)
ResourceService\DashboardClient.cs (1)
42
private readonly Dictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
ResourceService\IDashboardClient.cs (2)
49
ImmutableArray<
ResourceViewModel
> InitialState,
54
ResourceViewModel
Resource);
ResourceService\Partials.cs (2)
16
public
ResourceViewModel
ToViewModel(BrowserTimeProvider timeProvider, IKnownPropertyLookup knownPropertyLookup)
57
throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(
ResourceViewModel
)}.", ex);
Aspire.Dashboard.Components.Tests (13)
Controls\ResourceDetailsTests.cs (8)
24
var
resource1 = ModelTestHelpers.CreateResource(
69
var
resource2 = ModelTestHelpers.CreateResource(
107
var
resource1 = ModelTestHelpers.CreateResource(
152
var
resource2 = ModelTestHelpers.CreateResource(
190
var
resource1 = ModelTestHelpers.CreateResource(
235
var
resource2 = ModelTestHelpers.CreateResource(
273
var
resource1 = ModelTestHelpers.CreateResource(
318
var
resource2 = ModelTestHelpers.CreateResource(
Pages\ConsoleLogsTests.cs (2)
68
var
testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running);
94
var
testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running);
Shared\TestDashboardClient.cs (2)
15
private readonly IList<
ResourceViewModel
>? _initialResources;
25
IList<
ResourceViewModel
>? initialResources = null)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
12
public static
ResourceViewModel
CreateResource(
Aspire.Dashboard.Tests (21)
ConsoleLogsTests\CreateResourceSelectModelsTests.cs (2)
19
var applications = new List<
ResourceViewModel
>
35
var resourcesByName = new ConcurrentDictionary<string,
ResourceViewModel
>(applications.ToDictionary(app => app.Name));
Integration\Playwright\Infrastructure\MockDashboardClient.cs (1)
25
public static readonly
ResourceViewModel
TestResource1 = ModelTestHelpers.CreateResource(
Model\ResourceEndpointHelpersTests.cs (1)
12
public static List<DisplayedEndpoint> GetEndpoints(
ResourceViewModel
resource, bool includeInternalUrls = false)
Model\ResourceSourceViewModelTests.cs (1)
29
var
resource = ModelTestHelpers.CreateResource(
Model\ResourceStateViewModelTests.cs (1)
71
var
resource = ModelTestHelpers.CreateResource(
Model\ResourceViewModelTests.cs (3)
31
var actualStatus =
ResourceViewModel
.ComputeHealthStatus(reports, state);
51
var
vm = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup());
98
var
viewModel = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup(123, kp));
ResourceOutgoingPeerResolverTests.cs (11)
15
private static
ResourceViewModel
CreateResource(string name, string? serviceAddress = null, int? servicePort = null, string? displayName = null)
27
var resources = new Dictionary<string,
ResourceViewModel
>
40
var resources = new Dictionary<string,
ResourceViewModel
>
53
var resources = new Dictionary<string,
ResourceViewModel
>
66
var resources = new Dictionary<string,
ResourceViewModel
>
80
var resources = new Dictionary<string,
ResourceViewModel
>
94
var resources = new Dictionary<string,
ResourceViewModel
>
108
var resources = new Dictionary<string,
ResourceViewModel
>
167
var resources = new Dictionary<string,
ResourceViewModel
>
181
var resources = new Dictionary<string,
ResourceViewModel
>
195
private static bool TryResolvePeerName(IDictionary<string,
ResourceViewModel
> resources, KeyValuePair<string, string>[] attributes, out string? peerName)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
12
public static
ResourceViewModel
CreateResource(