Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions src/Aspire.Dashboard/Model/ResourceViewModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,11 @@ public static bool TryGetExitCode(this ResourceViewModel resource, out int exitC
return resource.TryGetCustomDataInt(KnownProperties.Resource.ExitCode, out exitCode);
}

public static bool TryGetContainerId(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? containerId)
{
return resource.TryGetCustomDataString(KnownProperties.Container.Id, out containerId);
}

public static bool TryGetContainerImage(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? containerImage)
{
return resource.TryGetCustomDataString(KnownProperties.Container.Image, out containerImage);
}

public static bool TryGetContainerPorts(this ResourceViewModel resource, out ImmutableArray<int> containerImage)
{
return resource.TryGetCustomDataIntArray(KnownProperties.Container.Ports, out containerImage);
}

public static bool TryGetProcessId(this ResourceViewModel resource, out int processId)
{
return resource.TryGetCustomDataInt(KnownProperties.Executable.Pid, out processId);
}

public static bool TryGetProjectPath(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? projectPath)
{
return resource.TryGetCustomDataString(KnownProperties.Project.Path, out projectPath);
Expand All @@ -74,11 +59,6 @@ public static bool TryGetExecutableArguments(this ResourceViewModel resource, ou
return resource.TryGetCustomDataStringArray(KnownProperties.Executable.Args, out arguments);
}

public static bool TryGetWorkingDirectory(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? workingDirectory)
{
return resource.TryGetCustomDataString(KnownProperties.Executable.WorkDir, out workingDirectory);
}

private static bool TryGetCustomDataString(this ResourceViewModel resource, string key, [NotNullWhen(returnValue: true)] out string? s)
{
if (resource.Properties.TryGetValue(key, out var value) && value.TryConvertToString(out var valueString))
Expand Down Expand Up @@ -126,28 +106,4 @@ private static bool TryGetCustomDataInt(this ResourceViewModel resource, string
i = 0;
return false;
}

private static bool TryGetCustomDataIntArray(this ResourceViewModel resource, string key, out ImmutableArray<int> ints)
{
if (resource.Properties.TryGetValue(key, out var value) && value.ListValue is not null)
{
var builder = ImmutableArray.CreateBuilder<int>(value.ListValue.Values.Count);

foreach (var element in value.ListValue.Values)
{
if (!element.TryConvertToInt(out var i))
{
ints = default;
return false;
}
builder.Add(i);
}

ints = builder.MoveToImmutable();
return true;
}

ints = default;
return false;
}
}