4 instantiations of ResourceViewModel
Aspire.Dashboard (1)
ServiceClient\Partials.cs (1)
23return new()
Aspire.Dashboard.Components.Tests (2)
Pages\ResourcesTests.cs (1)
358return new ResourceViewModel
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
30return new ResourceViewModel
Aspire.Dashboard.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
30return new ResourceViewModel
327 references to ResourceViewModel
Aspire.Dashboard (208)
Components\Controls\PropertyValues\ResourceHealthStateValue.razor.cs (1)
22public required ResourceViewModel Resource { get; set; }
Components\Controls\PropertyValues\ResourceNameButtonValue.razor.cs (1)
33private ResourceViewModel? _resource;
Components\Controls\PropertyValues\ResourceNameValue.razor.cs (2)
18public required ResourceViewModel Resource { get; set; } 21public required Func<ResourceViewModel, string> FormatName { get; set; }
Components\Controls\PropertyValues\ResourceStateValue.razor.cs (1)
22public required ResourceViewModel Resource { get; set; }
Components\Controls\ResourceActions.razor.cs (4)
53public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 59public required ResourceViewModel Resource { get; set; } 62public required Func<ResourceViewModel, string> GetResourceName { get; set; } 68public required ConcurrentDictionary<string, ResourceViewModel> ResourceByName { get; set; }
Components\Controls\ResourceDetails.razor.cs (10)
24public required ResourceViewModel Resource { get; set; } 27public required ConcurrentDictionary<string, ResourceViewModel> ResourceByName { get; set; } 59private ResourceViewModel? _resource; 171Parameters = { ["Resource"] = _resource, ["FormatName"] = new Func<ResourceViewModel, string>(FormatName) } 220foreach (var match in matches) 222items.Add(ResourceDetailRelationshipViewModel.Create(match, ResourceViewModel.GetResourceName(match, ResourceByName), resourceRelationships)); 242foreach (var otherResource in otherResources) 248items.Add(ResourceDetailRelationshipViewModel.Create(otherResource, ResourceViewModel.GetResourceName(otherResource, ResourceByName), resourceRelationships)); 307private string FormatName(ResourceViewModel resource) 309return ResourceViewModel.GetResourceName(resource, ResourceByName);
Components\Pages\ConsoleLogs.razor.cs (23)
40public ResourceViewModel Resource { get; } 47public ConsoleLogsSubscription(ResourceViewModel resource, ILogger logger) 143private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 248foreach (var resource in snapshot) 259if (ResourceViewModel.TryGetResourceByName(ResourceName, _resourceByName, out var selectedResource)) 301void SetSelectedResourceOption(ResourceViewModel resource) 410else if (selectedResourceName is not null && _resourceByName.TryGetValue(selectedResourceName, out var resource)) 449var selectedResource = GetSelectedResource(); 527private ResourceViewModel? GetSelectedResource() 534_resourceByName.TryGetValue(name, out var resource); 561var selectedResource = GetSelectedResource(); 618foreach (var resource in availableResources) 626private Task SubscribeToSingleResourceAsync(ResourceViewModel resource) 653private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName); 656ConcurrentDictionary<string, ResourceViewModel> resourcesByName, 686foreach (var resource in grouping.Select(g => g.Value).OrderBy(r => r, ResourceViewModelNameComparer.Instance)) 707SelectViewModel<ResourceTypeDetails> ToOption(ResourceViewModel resource, bool isReplica, string resourceName) 721var resourceName = ResourceViewModel.GetResourceName(resource, resourcesByName); 785var resourcePrefix = ResourceViewModel.GetResourceName(subscription.Resource, _resourceByName, _showHiddenResources); 866private async Task OnResourceChanged(ResourceViewModelChangeType changeType, ResourceViewModel resource) 1059ResourceViewModel? TryGetSingleResource()
Components\Pages\Resources.razor.cs (22)
106private ResourceViewModel? SelectedResource { get; set; } 109private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 138private bool Filter(ResourceViewModel resource) 269foreach (var resource in snapshot) 329private bool UpdateFromResource(ResourceViewModel resource) 342private bool UpdateFromResource(ResourceViewModel resource, Func<string, bool> resourceTypeVisible, Func<string, bool> stateVisible, Func<string, bool> healthStatusVisible) 406if (resources._resourceByName.TryGetValue(id, out var resource)) 419if (resources._resourceByName.TryGetValue(id, out var resource)) 429internal IEnumerable<ResourceViewModel> GetFilteredResources() 568if (_resourceByName.TryGetValue(ResourceName, out var selectedResource)) 602private async Task ShowContextMenuAsync(ResourceViewModel resource, int screenWidth, int screenHeight, int clientX, int clientY) 642private async Task ShowResourceDetailsAsync(ResourceViewModel resource, string? buttonId) 657var current = resource; 702private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName, _showHiddenResources); 704private bool HasMultipleReplicas(ResourceViewModel resource) 727private string GetRowClass(ResourceViewModel resource) 730private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command) 735private static string GetUrlsTooltip(ResourceViewModel resource) 789foreach (var resource in resourcesWithChildren) 796foreach (var resource in resourcesWithChildren) 815private static List<DisplayedUrl> GetDisplayedUrls(ResourceViewModel resource)
Components\ResourcesGridColumns\StateColumnDisplay.razor.cs (1)
15public required ResourceViewModel Resource { get; set; }
Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor.cs (2)
17public required ResourceViewModel Resource { get; set; } 30private (string? resourceName, int unviewedErrorCount) GetUnviewedErrorCount(ResourceViewModel resource)
Components\ResourcesGridColumns\UrlsColumnDisplay.razor.cs (1)
14public required ResourceViewModel Resource { get; set; }
Components_Controls_ResourceActions_razor.g.cs (1)
401() => NavigationManager.NavigateTo(Aspire.Dashboard.Utils.DashboardUrls.ConsoleLogsUrl(resource: ResourceViewModel.GetResourceName(Resource, ResourceByName)))
Components_Controls_ResourceDetails_razor.g.cs (5)
254DashboardUrls.ConsoleLogsUrl(ResourceViewModel.GetResourceName(Resource, ResourceByName)) 2325), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2359), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 2761), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2795), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)(
Components_Pages_Resources_razor.g.cs (11)
1795), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 1829), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 1909), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2005), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2309), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2419), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::Aspire.Dashboard.Model.CommandViewModel, global::System.Boolean>)( 2453), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2470), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 2504), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>( 3012), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 3029), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>(
Components_ResourcesGridColumns_ResourceNameDisplay_razor.g.cs (2)
381public required ResourceViewModel Resource { get; set; } 384public required Func<ResourceViewModel, string> FormatName { get; set; }
Components_ResourcesGridColumns_StartTimeColumnDisplay_razor.g.cs (1)
227public required ResourceViewModel Resource { get; set; }
Components_ResourcesGridColumns_StateColumnDisplay_razor.g.cs (1)
259), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
Extensions\ResourceViewModelExtensions.cs (10)
10public static bool IsRunningState(this ResourceViewModel resource) 15public static bool IsFinishedState(this ResourceViewModel resource) 20public static bool IsExitedState(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 IsNotStarted(this ResourceViewModel resource) 45public static bool IsWaiting(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\Assistant\AIHelpers.cs (8)
145internal static string GetResponseGraphJson(List<ResourceViewModel> resources) 176static List<object> GetResourceRelationships(List<ResourceViewModel> allResources, ResourceViewModel resourceViewModel) 187foreach (var match in matches) 200static string? GetResourceHealthStatus(ResourceViewModel resource) 215static string? GetReportHealthStatus(ResourceViewModel resource, HealthReportViewModel report) 317public static bool TryGetResource(IReadOnlyList<ResourceViewModel> resources, string resourceName, [NotNullWhen(true)] out ResourceViewModel? resource)
Model\Assistant\AssistantChatDataContext.cs (3)
57public IReadOnlyList<ResourceViewModel> GetResources() 234if (AIHelpers.TryGetResource(resources, resourceName, out var resource)) 351if (!AIHelpers.TryGetResource(resources, resourceName, out var resource))
Model\Assistant\Markdown\AspireEnrichmentParser.cs (2)
54if (AIHelpers.TryGetResource(resources, text, out var resource)) 56var resourceName = ResourceViewModel.GetResourceName(resource, resources);
Model\Assistant\Markdown\ResourceInline.cs (1)
11public required ResourceViewModel Resource { get; init; }
Model\Assistant\Prompts\IceBreakersBuilder.cs (3)
28public void ResourceDetails(BuildIceBreakersContext context, ResourceViewModel resource) 47private InitialPrompt CreateAnalyzeResource(ResourceViewModel resource) 77public void ConsoleLogs(BuildIceBreakersContext context, ResourceViewModel resource)
Model\Assistant\Prompts\KnownChatMessages.cs (4)
44public static ChatMessage CreateInitialMessage(string promptText, string applicationName, List<ResourceViewModel> resources) 90public static ChatMessage CreateResourceRecentActivityMessage(ResourceViewModel resource) 103public static ChatMessage CreateAnalyzeResourceMessage(ResourceViewModel resource) 156public static ChatMessage CreateResourceConsoleLogsMessage(ResourceViewModel resource)
Model\Assistant\Prompts\PromptContextsBuilder.cs (1)
43public static Task AnalyzeResource(InitializePromptContext promptContext, string displayText, ResourceViewModel resource)
Model\BrowserLinkOutgoingPeerResolver.cs (1)
22public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResource)
Model\CommonMenuItems.cs (1)
18IEnumerable<ResourceViewModel> resources,
Model\DashboardCommandExecutor.cs (4)
35public async Task ExecuteAsync(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName) 87public async Task ExecuteAsyncCore(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName)
Model\IOutgoingPeerResolver.cs (1)
8bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResourced);
Model\ResourceDetailRelationshipViewModel.cs (2)
8public required ResourceViewModel Resource { get; init; } 18public static ResourceDetailRelationshipViewModel Create(ResourceViewModel resource, string resourceName, IEnumerable<RelationshipViewModel> matches)
Model\ResourceGraph\ResourceGraphMapper.cs (5)
16public static ResourceDto MapResource(ResourceViewModel r, IDictionary<string, ResourceViewModel> resourcesByName, IStringLocalizer<Columns> columnsLoc, bool showHiddenResources, IconResolver iconResolver) 30foreach (var match in matches) 39var resourceName = ResourceViewModel.GetResourceName(r, resourcesByName); 50DisplayName = ResourceViewModel.GetResourceName(r, resourcesByName),
Model\ResourceGridViewModel.cs (3)
11public required ResourceViewModel Resource { get; init; } 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)
15public static Icon GetIconForResource(IconResolver iconResolver, ResourceViewModel resource, IconSize desiredSize, IconVariant desiredVariant = IconVariant.Filled)
Model\ResourceMenuItems.cs (8)
31ResourceViewModel resource, 35Func<ResourceViewModel, string> getResourceName, 43Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, 96private static void AddUrlMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, IStringLocalizer<Resources.Resources> loc) 153private static void AddTelemetryMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, NavigationManager navigationManager, TelemetryRepository telemetryRepository, Func<ResourceViewModel, string> getResourceName, IStringLocalizer<Resources.Resources> loc) 205private static void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, IStringLocalizer<Resources.Resources> loc, IStringLocalizer<Commands> commandsLoc, EventCallback<CommandViewModel> commandSelected, Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, IconResolver iconResolver)
Model\ResourceOutgoingPeerResolver.cs (13)
21private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 40foreach (var resource in snapshot) 57if (!_resourceByName.TryGetValue(resource.Name, out var existingResource) || 82private static bool ArePeerRelevantPropertiesEquivalent(ResourceViewModel resource1, ResourceViewModel resource2) 127private static bool ArePropertyValuesEquivalent(ResourceViewModel resource1, ResourceViewModel resource2, string propertyName) 151public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResource) 156internal static bool TryResolvePeerCore(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch) 191private static bool TryMatchAgainstResources(string peerAddress, IDictionary<string, ResourceViewModel> resources, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch) 199name = 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) 142private static string GetStateText(ResourceViewModel resource, IStringLocalizer<Columns> loc)
Model\ResourceUrlHelpers.cs (1)
25public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false, bool includeNonEndpointUrls = false)
Model\ResourceViewModel.cs (10)
150public static string GetResourceName(ResourceViewModel resource, IDictionary<string, ResourceViewModel> allResources, bool showHiddenResources = false) 155public static string GetResourceName(ResourceViewModel resource, IEnumerable<ResourceViewModel> allResources, bool showHiddenResources = false) 158foreach (var item in allResources) 180public static bool TryGetResourceByName(string resourceName, IDictionary<string, ResourceViewModel> resourceByName, [NotNullWhen(true)] out ResourceViewModel? resource) 198public sealed class ResourceViewModelNameComparer : IComparer<ResourceViewModel> 202public int Compare(ResourceViewModel? x, ResourceViewModel? y)
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)
Otlp\Storage\TelemetryRepository.cs (4)
1129var peer = ResolveUninstrumentedPeerResource(span, _outgoingPeerResolvers); 1147var uninstrumentedPeer = hasUninstrumentedPeer ? ResolveUninstrumentedPeerResource(span, _outgoingPeerResolvers) : null; 1168private static ResourceViewModel? ResolveUninstrumentedPeerResource(OtlpSpan span, IEnumerable<IOutgoingPeerResolver> outgoingPeerResolvers) 1173if (resolver.TryResolvePeer(span.Attributes, out _, out var matchedResourced))
ServiceClient\DashboardClient.cs (7)
45private readonly Dictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 369var viewModel = resource.ToViewModel(_knownPropertyLookup, _logger); 389var viewModel = change.Upsert.ToViewModel(_knownPropertyLookup, _logger); 396if (_resourceByName.Remove(change.Delete.ResourceName, out var removed)) 553public ResourceViewModel? GetResource(string resourceName) 556if (_resourceByName.TryGetValue(resourceName, out var resource)) 790public IReadOnlyList<ResourceViewModel> GetResources()
ServiceClient\IDashboardClient.cs (4)
47ResourceViewModel? GetResource(string resourceName); 73IReadOnlyList<ResourceViewModel> GetResources(); 77ImmutableArray<ResourceViewModel> InitialState, 82ResourceViewModel Resource);
ServiceClient\Partials.cs (2)
19public ResourceViewModel ToViewModel(IKnownPropertyLookup knownPropertyLookup, ILogger logger) 50throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(ResourceViewModel)}.", ex);
Aspire.Dashboard.Components.Tests (40)
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 (13)
50var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 100var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 101var testResource2 = ModelTestHelpers.CreateResource(resourceName: "test-resource2", state: KnownResourceState.Running); 182var regularResource = ModelTestHelpers.CreateResource(resourceName: "regular-resource", state: KnownResourceState.Running); 183var hiddenResource = ModelTestHelpers.CreateResource(resourceName: "hidden-resource", state: KnownResourceState.Running, hidden: true); 289var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 337var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 386var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 439var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 496var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 550var testResource = ModelTestHelpers.CreateResource( 614var testResource = ModelTestHelpers.CreateResource( 677var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running);
Pages\ResourcesTests.cs (6)
29var initialResources = new List<ResourceViewModel> 118var initialResources = new List<ResourceViewModel> 180var initialResources = new List<ResourceViewModel> 217var initialResources = new List<ResourceViewModel> 314var initialResources = new List<ResourceViewModel> 356private static ResourceViewModel CreateResource(string name, string type, string? state, ImmutableArray<HealthReportViewModel>? healthReports)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
13public static ResourceViewModel CreateResource(
tests\Shared\TestDashboardClient.cs (4)
19private readonly IList<ResourceViewModel>? _initialResources; 33IList<ResourceViewModel>? initialResources = null) 140public ResourceViewModel? GetResource(string resourceName) => null; 142public IReadOnlyList<ResourceViewModel> GetResources() => _initialResources?.ToList() ?? [];
Aspire.Dashboard.Tests (79)
ConsoleLogsTests\CreateResourceSelectModelsTests.cs (7)
19var resources = new List<ResourceViewModel> 24var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 51var resources = new List<ResourceViewModel> 67var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 141var resources = new List<ResourceViewModel> 148var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 181var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>();
Integration\Playwright\Infrastructure\MockDashboardClient.cs (5)
13public static readonly ResourceViewModel TestResource1 = ModelTestHelpers.CreateResource( 32private readonly List<ResourceViewModel>? _resources; 34public MockDashboardClient(List<ResourceViewModel>? resources = null) 71public ResourceViewModel? GetResource(string resourceName) => null; 73public IReadOnlyList<ResourceViewModel> GetResources() => _resources ?? [];
Model\AIAssistant\AssistantChatDataContextTests.cs (1)
180var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running);
Model\ResourceGraphMapperTests.cs (12)
22var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("app2", "Reference")]); 23var resource2 = ModelTestHelpers.CreateResource("app2-123456", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 24var resources = new Dictionary<string, ResourceViewModel> 42var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("app2", "Reference")]); 43var resource21 = ModelTestHelpers.CreateResource("app2-123456", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 44var resource22 = ModelTestHelpers.CreateResource("app2-654321", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 45var resources = new Dictionary<string, ResourceViewModel> 65var resource = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: ImmutableArray<RelationshipViewModel>.Empty); 66var resources = new Dictionary<string, ResourceViewModel> 82var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("hidden-app", "Reference")]); 83var hiddenResource = ModelTestHelpers.CreateResource("hidden-app", displayName: "hidden-app", relationships: ImmutableArray<RelationshipViewModel>.Empty, hidden: true); 84var resources = new Dictionary<string, ResourceViewModel>
Model\ResourceIconHelpersTests.cs (6)
20var resource = ModelTestHelpers.CreateResource(iconName: "Database", iconVariant: IconVariant.Filled); 35var resource = ModelTestHelpers.CreateResource(iconName: "CloudArrowUp", iconVariant: IconVariant.Regular); 48var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Container); 62var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Project, iconName: "NonExistentIcon", iconVariant: IconVariant.Filled); 82var resource = ModelTestHelpers.CreateResource(resourceType: resourceType); 95var resource = ModelTestHelpers.CreateResource(resourceType: "postgres-database");
Model\ResourceMenuItemsTests.cs (3)
27var resource = ModelTestHelpers.CreateResource(); 62var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc"); 120var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc");
Model\ResourceSourceViewModelTests.cs (1)
39var resource = ModelTestHelpers.CreateResource(
Model\ResourceStateViewModelTests.cs (1)
78var resource = ModelTestHelpers.CreateResource(
Model\ResourceUrlHelpersTests.cs (1)
12public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false)
Model\ResourceViewModelTests.cs (7)
30var actualStatus = ResourceViewModel.ComputeHealthStatus(reports, state); 50var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 78var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 128var viewModel = resource.ToViewModel(new MockKnownPropertyLookup(123, kp), NullLogger.Instance); 170var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 192var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 213var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance);
ResourceOutgoingPeerResolverTests.cs (25)
17private static ResourceViewModel CreateResource(string name, string? serviceAddress = null, int? servicePort = null, string? displayName = null, KnownResourceState? state = null) 30var resources = new Dictionary<string, ResourceViewModel> 43var resources = new Dictionary<string, ResourceViewModel> 56var resources = new Dictionary<string, ResourceViewModel> 69var resources = new Dictionary<string, ResourceViewModel> 88var resources = new Dictionary<string, ResourceViewModel> 102var resources = new Dictionary<string, ResourceViewModel> 116var resources = new Dictionary<string, ResourceViewModel> 195var resources = new Dictionary<string, ResourceViewModel> 209var resources = new Dictionary<string, ResourceViewModel> 223private static bool TryResolvePeerName(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, out string? peerName) 233var resources = new Dictionary<string, ResourceViewModel> 248var resources = new Dictionary<string, ResourceViewModel> 262var resources = new Dictionary<string, ResourceViewModel> 277var resources = new Dictionary<string, ResourceViewModel> 290var resources = new Dictionary<string, ResourceViewModel> 304var resources = new Dictionary<string, ResourceViewModel> 319var resources = new Dictionary<string, ResourceViewModel> 329private static ResourceViewModel CreateResourceWithConnectionString(string name, string connectionString) 347private static ResourceViewModel CreateResourceWithParameterValue(string name, string value) 369var resources = new Dictionary<string, ResourceViewModel> 384var resources = new Dictionary<string, ResourceViewModel> 401var resources = new Dictionary<string, ResourceViewModel> 419public ResourceViewModel? GetResource(string resourceName) => null; 420public IReadOnlyList<ResourceViewModel> GetResources() => [];
TelemetryRepositoryTests\TestOutgoingPeerResolver.cs (3)
11private readonly Func<KeyValuePair<string, string>[], (string? Name, ResourceViewModel? Resource)>? _onResolve; 14public TestOutgoingPeerResolver(Func<KeyValuePair<string, string>[], (string? Name, ResourceViewModel? Resource)>? onResolve = null) 38public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResourced)
TelemetryRepositoryTests\TraceTests.cs (2)
2014var matchedResourced = ModelTestHelpers.CreateResource(resourceName: "TestPeer"); 2129var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc-def", displayName: "test");
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
13public static ResourceViewModel CreateResource(
tests\Shared\TestDashboardClient.cs (4)
19private readonly IList<ResourceViewModel>? _initialResources; 33IList<ResourceViewModel>? initialResources = null) 140public ResourceViewModel? GetResource(string resourceName) => null; 142public IReadOnlyList<ResourceViewModel> GetResources() => _initialResources?.ToList() ?? [];