Components\Controls\ResourceDetails.razor.cs (11)
26public required ResourceViewModel Resource { get; set; }
29public required ConcurrentDictionary<string, ResourceViewModel> ResourceByName { get; set; }
41public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; }
76private ResourceViewModel? _resource;
192Parameters = { ["Resource"] = _resource, ["FormatName"] = new Func<ResourceViewModel, string>(FormatName) }
296foreach (var match in matches)
298items.Add(ResourceDetailRelationshipViewModel.Create(match, ResourceViewModel.GetResourceName(match, ResourceByName), resourceRelationships));
318foreach (var otherResource in otherResources)
324items.Add(ResourceDetailRelationshipViewModel.Create(otherResource, ResourceViewModel.GetResourceName(otherResource, ResourceByName), resourceRelationships));
383private string FormatName(ResourceViewModel resource)
385return ResourceViewModel.GetResourceName(resource, ResourceByName);
Components\Pages\ConsoleLogs.razor.cs (23)
40public ResourceViewModel Resource { get; }
47public ConsoleLogsSubscription(ResourceViewModel resource, ILogger logger)
146private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName);
246foreach (var resource in snapshot)
257if (ResourceViewModel.TryGetResourceByName(ResourceName, _resourceByName, out var selectedResource))
299void SetSelectedResourceOption(ResourceViewModel resource)
416else if (selectedResourceName is not null && _resourceByName.TryGetValue(selectedResourceName, out var resource))
452var selectedResource = GetSelectedResource();
522private ResourceViewModel? GetSelectedResource()
529_resourceByName.TryGetValue(name, out var resource);
556var selectedResource = GetSelectedResource();
613foreach (var resource in availableResources)
621private Task SubscribeToSingleResourceAsync(ResourceViewModel resource)
648private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName);
651ConcurrentDictionary<string, ResourceViewModel> resourcesByName,
681foreach (var resource in grouping.Select(g => g.Value).OrderBy(r => r, ResourceViewModelNameComparer.Instance))
702SelectViewModel<ResourceTypeDetails> ToOption(ResourceViewModel resource, bool isReplica, string resourceName)
716var resourceName = ResourceViewModel.GetResourceName(resource, resourcesByName);
781var resourcePrefix = ResourceViewModel.GetResourceName(subscription.Resource, _resourceByName);
843private async Task OnResourceChanged(ResourceViewModelChangeType changeType, ResourceViewModel resource)
1008ResourceViewModel? TryGetSingleResource()
Components\Pages\Resources.razor.cs (24)
114private ResourceViewModel? SelectedResource { get; set; }
117private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName);
146private bool Filter(ResourceViewModel resource)
298foreach (var resource in snapshot)
358private bool UpdateFromResource(ResourceViewModel resource)
371private bool UpdateFromResource(ResourceViewModel resource, Func<string, bool> resourceTypeVisible, Func<string, bool> stateVisible, Func<string, bool> healthStatusVisible)
435if (resources._resourceByName.TryGetValue(id, out var resource))
448if (resources._resourceByName.TryGetValue(id, out var resource))
458internal IEnumerable<ResourceViewModel> GetFilteredResources()
563foreach (var resource in GetFilteredResources())
601if (_resourceByName.TryGetValue(ResourceName, out var selectedResource))
635private async Task ShowContextMenuAsync(ResourceViewModel resource, int screenWidth, int screenHeight, int clientX, int clientY)
667private async Task ShowResourceDetailsAsync(ResourceViewModel resource, string? buttonId)
682var current = resource;
737private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName);
739private bool HasMultipleReplicas(ResourceViewModel resource)
762private string GetRowClass(ResourceViewModel resource)
765private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command)
770private static (string? Value, bool IsSensitive, bool IsUnresolved) GetParameterValue(ResourceViewModel resource)
783private static string GetUrlsTooltip(ResourceViewModel resource)
837foreach (var resource in resourcesWithChildren)
844foreach (var resource in resourcesWithChildren)
863private static List<DisplayedUrl> GetDisplayedUrls(ResourceViewModel resource)
Components_Pages_Resources_razor.g.cs (11)
1882), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
1916), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)(
1996), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
2092), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
2586), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
2696), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::Aspire.Dashboard.Model.CommandViewModel, global::System.Boolean>)(
2730), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
2764), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>(
3271), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
3288), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>(
3356), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::Aspire.Dashboard.Model.CommandViewModel, global::System.Boolean>)(
Model\Assistant\AIHelpers.cs (11)
159internal static string GetResponseGraphJson(List<ResourceViewModel> resources, DashboardOptions options, bool includeDashboardUrl = false, Func<ResourceViewModel, string>? getResourceName = null, bool includeEnvironmentVariables = false)
212static List<object> GetResourceRelationships(List<ResourceViewModel> allResources, ResourceViewModel resourceViewModel, Func<ResourceViewModel, string>? getResourceName)
223foreach (var match in matches)
236static string? GetResourceHealthStatus(ResourceViewModel resource)
251static string? GetReportHealthStatus(ResourceViewModel resource, HealthReportViewModel report)
393public static bool TryGetResource(IReadOnlyList<ResourceViewModel> resources, string resourceName, [NotNullWhen(true)] out ResourceViewModel? resource)
523public static bool IsResourceAIOptOut(ResourceViewModel r)
Model\ResourceMenuBuilder.cs (12)
75ResourceViewModel resource,
76IDictionary<string, ResourceViewModel> resourceByName,
79Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting,
102_navigationManager.NavigateTo(DashboardUrls.ConsoleLogsUrl(resource: ResourceViewModel.GetResourceName(resource, resourceByName)));
176private void AddUrlMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource)
233private void AddTelemetryMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, IDictionary<string, ResourceViewModel> resourceByName)
250_navigationManager.NavigateTo(DashboardUrls.StructuredLogsUrl(resource: ResourceViewModel.GetResourceName(resource, resourceByName)));
263_navigationManager.NavigateTo(DashboardUrls.TracesUrl(resource: ResourceViewModel.GetResourceName(resource, resourceByName)));
277_navigationManager.NavigateTo(DashboardUrls.MetricsUrl(resource: ResourceViewModel.GetResourceName(resource, resourceByName)));
285private void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, EventCallback<CommandViewModel> commandSelected, Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting)
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\ResourceViewModelExtensions.cs (17)
17public static IReadOnlyDictionary<string, string?> GetPropertiesAsDictionary(this ResourceViewModel resource)
32public static bool IsContainer(this ResourceViewModel resource)
37public static bool IsProject(this ResourceViewModel resource)
42public static bool IsTool(this ResourceViewModel resource)
47public static bool IsExecutable(this ResourceViewModel resource, bool allowSubtypes)
62public static bool TryGetExitCode(this ResourceViewModel resource, out int exitCode)
67public static bool TryGetContainerImage(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? containerImage)
72public static bool TryGetProjectPath(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? projectPath)
77public static bool TryGetToolPackage(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? projectPath)
82public static bool TryGetExecutablePath(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? executablePath)
87public static bool TryGetExecutableArguments(this ResourceViewModel resource, out ImmutableArray<string> arguments)
92public static bool TryGetAppArgs(this ResourceViewModel resource, out ImmutableArray<string> arguments)
97public static bool TryGetAppArgsSensitivity(this ResourceViewModel resource, out ImmutableArray<bool> argParams)
102private static bool TryGetCustomDataString(this ResourceViewModel resource, string key, [NotNullWhen(returnValue: true)] out string? s)
114private static bool TryGetCustomDataStringArray(this ResourceViewModel resource, string key, out ImmutableArray<string> strings)
139private static bool TryGetCustomDataBoolArray(this ResourceViewModel resource, string key, out ImmutableArray<bool> bools)
164private static bool TryGetCustomDataInt(this ResourceViewModel resource, string key, out int i)