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