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