4 instantiations of ResourceViewModel
Aspire.Dashboard (1)
ResourceService\Partials.cs (1)
20
return
new
()
Aspire.Dashboard.Components.Tests (2)
Pages\ResourcesTests.cs (1)
99
return new
ResourceViewModel
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
return new
ResourceViewModel
Aspire.Dashboard.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
return new
ResourceViewModel
100 references to ResourceViewModel
Aspire.Dashboard (64)
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 (8)
80
private readonly ConcurrentDictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
192
void SetSelectedResourceOption(
ResourceViewModel
resource)
331
private string GetResourceName(
ResourceViewModel
resource) =>
ResourceViewModel
.GetResourceName(resource, _resourceByName);
334
ConcurrentDictionary<string,
ResourceViewModel
> resourcesByName,
371
SelectViewModel<ResourceTypeDetails> ToOption(
ResourceViewModel
resource, bool isReplica, string applicationName)
385
var resourceName =
ResourceViewModel
.GetResourceName(resource, resourcesByName);
466
private async Task OnResourceChanged(ResourceViewModelChangeType changeType,
ResourceViewModel
resource)
Components\Pages\Resources.razor.cs (13)
65
private
ResourceViewModel
? SelectedResource { get; set; }
68
private readonly ConcurrentDictionary<string,
ResourceViewModel
> _resourceByName = new(StringComparers.ResourceName);
89
private bool Filter(
ResourceViewModel
resource)
225
internal IEnumerable<
ResourceViewModel
> GetFilteredResources()
309
private async Task ShowResourceDetailsAsync(
ResourceViewModel
resource, string? buttonId)
322
var
current = resource;
355
private string GetResourceName(
ResourceViewModel
resource) =>
ResourceViewModel
.GetResourceName(resource, _resourceByName);
357
private bool HasMultipleReplicas(
ResourceViewModel
resource)
380
private string GetRowClass(
ResourceViewModel
resource)
383
private async Task ExecuteResourceCommandAsync(
ResourceViewModel
resource, CommandViewModel command)
388
private static string GetEndpointsTooltip(
ResourceViewModel
resource)
431
private static List<DisplayedEndpoint> GetDisplayedEndpoints(
ResourceViewModel
resource)
Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor.cs (1)
29
private (string? applicationName, int unviewedErrorCount) GetUnviewedErrorCount(
ResourceViewModel
resource)
Extensions\ResourceViewModelExtensions.cs (8)
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 IsStopped(this
ResourceViewModel
resource)
30
public static bool IsUnusableTransitoryState(this
ResourceViewModel
resource)
35
public static bool IsRuntimeUnhealthy(this
ResourceViewModel
resource)
40
public static bool IsUnknownState(this
ResourceViewModel
resource) => resource.KnownState is KnownResourceState.Unknown;
42
public static bool HasNoState(this
ResourceViewModel
resource) => string.IsNullOrEmpty(resource.State);
Model\DashboardCommandExecutor.cs (2)
20
public async Task ExecuteAsync(
ResourceViewModel
resource, CommandViewModel command, Func<
ResourceViewModel
, string> getResourceName)
Model\ResourceEndpointHelpers.cs (1)
14
public static List<DisplayedEndpoint> GetEndpoints(
ResourceViewModel
resource, bool includeInternalUrls = false)
Model\ResourceGridViewModel.cs (2)
37
public static List<ResourceGridViewModel> OrderNestedResources(List<ResourceGridViewModel> initialGridVMs, Func<
ResourceViewModel
, bool> isCollapsed)
59
void AddChildViewModel(
ResourceViewModel
resource, ResourceGridViewModel parent, int depth, bool hidden)
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 (1)
13
internal static ResourceSourceViewModel? GetSourceViewModel(
ResourceViewModel
resource)
Model\ResourceStateViewModel.cs (3)
23
internal static ResourceStateViewModel GetStateViewModel(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
99
internal static string GetResourceStateTooltip(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
129
private static string GetStateText(
ResourceViewModel
resource, IStringLocalizer<Columns> loc)
Model\ResourceViewModel.cs (2)
98
public static string GetResourceName(
ResourceViewModel
resource, IDictionary<string,
ResourceViewModel
> allResources)
Model\ResourceViewModelExtensions.cs (11)
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
private static bool TryGetCustomDataString(this
ResourceViewModel
resource, string key, [NotNullWhen(returnValue: true)] out string? s)
74
private static bool TryGetCustomDataStringArray(this
ResourceViewModel
resource, string key, out ImmutableArray<string> strings)
99
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)
49
ImmutableArray<
ResourceViewModel
> InitialState,
54
ResourceViewModel
Resource);
ResourceService\Partials.cs (2)
16
public
ResourceViewModel
ToViewModel(BrowserTimeProvider timeProvider, IKnownPropertyLookup knownPropertyLookup)
57
throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(
ResourceViewModel
)}.", ex);
Aspire.Dashboard.Components.Tests (15)
Controls\ResourceDetailsTests.cs (8)
24
var
resource1 = ModelTestHelpers.CreateResource(
69
var
resource2 = ModelTestHelpers.CreateResource(
107
var
resource1 = ModelTestHelpers.CreateResource(
152
var
resource2 = ModelTestHelpers.CreateResource(
190
var
resource1 = ModelTestHelpers.CreateResource(
235
var
resource2 = ModelTestHelpers.CreateResource(
273
var
resource1 = ModelTestHelpers.CreateResource(
318
var
resource2 = ModelTestHelpers.CreateResource(
Pages\ConsoleLogsTests.cs (2)
68
var
testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running);
94
var
testResource = ModelTestHelpers.CreateResource(appName: "test-resource", state: KnownResourceState.Running);
Pages\ResourcesTests.cs (1)
97
private static
ResourceViewModel
CreateResource(string name, string type, string? state, ImmutableArray<HealthReportViewModel>? healthReports)
Shared\ResourceSetupHelpers.cs (1)
53
public static void SetupResourcesPage(TestContext context, ViewportInformation viewport, IList<
ResourceViewModel
> initialResources)
Shared\TestDashboardClient.cs (2)
15
private readonly IList<
ResourceViewModel
>? _initialResources;
25
IList<
ResourceViewModel
>? initialResources = null)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
12
public static
ResourceViewModel
CreateResource(
Aspire.Dashboard.Tests (21)
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\ResourceEndpointHelpersTests.cs (1)
12
public static List<DisplayedEndpoint> GetEndpoints(
ResourceViewModel
resource, bool includeInternalUrls = false)
Model\ResourceSourceViewModelTests.cs (1)
29
var
resource = ModelTestHelpers.CreateResource(
Model\ResourceStateViewModelTests.cs (1)
71
var
resource = ModelTestHelpers.CreateResource(
Model\ResourceViewModelTests.cs (3)
31
var actualStatus =
ResourceViewModel
.ComputeHealthStatus(reports, state);
51
var
vm = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup());
98
var
viewModel = resource.ToViewModel(s_timeProvider, new MockKnownPropertyLookup(123, kp));
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(