4 instantiations of ResourceViewModel
Aspire.Dashboard (1)
ResourceService\Partials.cs (1)
25return new()
Aspire.Dashboard.Components.Tests (2)
Pages\ResourcesTests.cs (1)
232return new ResourceViewModel
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
25return new ResourceViewModel
Aspire.Dashboard.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
25return new ResourceViewModel
139 references to ResourceViewModel
Aspire.Dashboard (86)
Components\Controls\ResourceDetails.razor.cs (3)
38private ResourceViewModel? _resource; 173ResourceName = ResourceViewModel.GetResourceName(match, ResourceByName), 204ResourceName = ResourceViewModel.GetResourceName(otherResource, ResourceByName),
Components\Pages\ConsoleLogs.razor.cs (9)
95private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 190if (ResourceViewModel.TryGetResourceByName(ResourceName, _resourceByName, out var selectedResource)) 232void SetSelectedResourceOption(ResourceViewModel resource) 378private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName); 381ConcurrentDictionary<string, ResourceViewModel> resourcesByName, 418SelectViewModel<ResourceTypeDetails> ToOption(ResourceViewModel resource, bool isReplica, string applicationName) 432var resourceName = ResourceViewModel.GetResourceName(resource, resourcesByName); 558private async Task OnResourceChanged(ResourceViewModelChangeType changeType, ResourceViewModel resource)
Components\Pages\Resources.razor.cs (15)
83private ResourceViewModel? SelectedResource { get; set; } 86private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 117private bool Filter(ResourceViewModel resource) 288bool UpdateFromResource(ResourceViewModel resource, Func<string, bool> resourceTypeVisible, Func<string, bool> stateVisible, Func<string, bool> healthStatusVisible) 369internal IEnumerable<ResourceViewModel> GetFilteredResources() 515private async Task ShowContextMenuAsync(ResourceViewModel resource, int screenWidth, int screenHeight, int clientX, int clientY) 551private async Task ShowResourceDetailsAsync(ResourceViewModel resource, string? buttonId) 564var current = resource; 602private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName); 604private bool HasMultipleReplicas(ResourceViewModel resource) 627private string GetRowClass(ResourceViewModel resource) 630private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command) 635private static string GetUrlsTooltip(ResourceViewModel resource) 715private static List<DisplayedUrl> GetDisplayedUrls(ResourceViewModel resource)
Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor.cs (1)
29private (string? applicationName, int unviewedErrorCount) GetUnviewedErrorCount(ResourceViewModel resource)
Extensions\ResourceViewModelExtensions.cs (10)
10public static bool IsHiddenState(this ResourceViewModel resource) 15public static bool IsRunningState(this ResourceViewModel resource) 20public static bool IsFinishedState(this ResourceViewModel resource) 25public static bool IsExitedState(this ResourceViewModel resource) 30public static bool IsStopped(this ResourceViewModel resource) 35public static bool IsUnusableTransitoryState(this ResourceViewModel resource) 40public static bool IsRuntimeUnhealthy(this ResourceViewModel resource) 45public static bool IsNotStarted(this ResourceViewModel resource) 50public static bool IsUnknownState(this ResourceViewModel resource) => resource.KnownState is KnownResourceState.Unknown; 52public static bool HasNoState(this ResourceViewModel resource) => string.IsNullOrEmpty(resource.State);
Model\DashboardCommandExecutor.cs (4)
31public async Task ExecuteAsync(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName) 62public async Task ExecuteAsyncCore(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName)
Model\ResourceGraph\ResourceGraphMapper.cs (4)
17public static ResourceDto MapResource(ResourceViewModel r, IDictionary<string, ResourceViewModel> resourcesByName, IStringLocalizer<Columns> columnsLoc) 36var resourceName = ResourceViewModel.GetResourceName(r, resourcesByName); 47DisplayName = ResourceViewModel.GetResourceName(r, resourcesByName),
Model\ResourceGridViewModel.cs (2)
36public static List<ResourceGridViewModel> OrderNestedResources(List<ResourceGridViewModel> initialGridVMs, Func<ResourceViewModel, bool> isCollapsed) 58void AddChildViewModel(ResourceViewModel resource, ResourceGridViewModel parent, int depth, bool hidden)
Model\ResourceIconHelpers.cs (1)
13public static Icon GetIconForResource(ResourceViewModel resource, IconSize desiredSize)
Model\ResourceMenuItems.cs (3)
25ResourceViewModel resource, 28Func<ResourceViewModel, string> getResourceName, 33Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting,
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 (2)
15internal static ResourceSourceViewModel? GetSourceViewModel(ResourceViewModel resource) 42static CommandLineInfo? GetCommandLineInfo(ResourceViewModel resourceViewModel)
Model\ResourceStateViewModel.cs (4)
23internal static ResourceStateViewModel GetStateViewModel(ResourceViewModel resource, IStringLocalizer<Columns> loc) 31private static (Icon icon, Color color) GetStateIcon(ResourceViewModel resource) 104internal static string GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer<Columns> loc) 134private static string GetStateText(ResourceViewModel resource, IStringLocalizer<Columns> loc)
Model\ResourceUrlHelpers.cs (1)
11public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false, bool includeNonEndpointUrls = false)
Model\ResourceViewModel.cs (4)
97public static string GetResourceName(ResourceViewModel resource, IDictionary<string, ResourceViewModel> allResources) 122public static bool TryGetResourceByName(string resourceName, IDictionary<string, ResourceViewModel> resourceByName, [NotNullWhen(true)] out ResourceViewModel? resource)
Model\ResourceViewModelExtensions.cs (14)
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) 62public static bool TryGetAppArgs(this ResourceViewModel resource, out ImmutableArray<string> arguments) 67public static bool TryGetAppArgsSensitivity(this ResourceViewModel resource, out ImmutableArray<bool> argParams) 72private static bool TryGetCustomDataString(this ResourceViewModel resource, string key, [NotNullWhen(returnValue: true)] out string? s) 84private static bool TryGetCustomDataStringArray(this ResourceViewModel resource, string key, out ImmutableArray<string> strings) 109private static bool TryGetCustomDataBoolArray(this ResourceViewModel resource, string key, out ImmutableArray<bool> bools) 134private 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)
51ImmutableArray<ResourceViewModel> InitialState, 56ResourceViewModel Resource);
ResourceService\Partials.cs (2)
21public ResourceViewModel ToViewModel(BrowserTimeProvider timeProvider, IKnownPropertyLookup knownPropertyLookup, ILogger logger) 48throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(ResourceViewModel)}.", ex);
Aspire.Dashboard.Components.Tests (31)
Controls\ResourceDetailsTests.cs (16)
25var resource1 = ModelTestHelpers.CreateResource( 38builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 71var resource2 = ModelTestHelpers.CreateResource( 109var resource1 = ModelTestHelpers.CreateResource( 122builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 155var resource2 = ModelTestHelpers.CreateResource( 193var resource1 = ModelTestHelpers.CreateResource( 206builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 239var resource2 = ModelTestHelpers.CreateResource( 277var resource1 = ModelTestHelpers.CreateResource( 290builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 323var resource2 = ModelTestHelpers.CreateResource(
Pages\ConsoleLogsTests.cs (8)
45var testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running); 46var testResource2 = ModelTestHelpers.CreateResource(appName: "test-resource2", state: KnownResourceState.Running); 127var testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running); 177var testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running); 234var testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running); 288var testResource = ModelTestHelpers.CreateResource( 352var testResource = ModelTestHelpers.CreateResource( 415var testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running);
Pages\ResourcesTests.cs (4)
27var initialResources = new List<ResourceViewModel> 116var initialResources = new List<ResourceViewModel> 178var initialResources = new List<ResourceViewModel> 230private static ResourceViewModel CreateResource(string name, string type, string? state, ImmutableArray<HealthReportViewModel>? healthReports)
Shared\TestDashboardClient.cs (2)
16private readonly IList<ResourceViewModel>? _initialResources; 27IList<ResourceViewModel>? initialResources = null)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
12public static ResourceViewModel CreateResource(
Aspire.Dashboard.Tests (22)
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\ResourceSourceViewModelTests.cs (1)
40var resource = ModelTestHelpers.CreateResource(
Model\ResourceStateViewModelTests.cs (1)
79var resource = ModelTestHelpers.CreateResource(
Model\ResourceUrlHelpersTests.cs (1)
12public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false)
Model\ResourceViewModelTests.cs (4)
31var actualStatus = ResourceViewModel.ComputeHealthStatus(reports, state); 51var vm = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup(), NullLogger.Instance); 79var vm = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup(), NullLogger.Instance); 129var viewModel = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup(123, kp), NullLogger.Instance);
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(