Content-Length: 277767 | pFad | http://github.com/dotnet/tye/pull/818/commits/ad725ba20516e154b1e46b5456169245cdb45049

57 Refactore tye dashboard api by sirh3e · Pull Request #818 · dotnet/tye · GitHub
Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Refactore tye dashboard api #818

Merged
merged 10 commits into from
Dec 1, 2020
Prev Previous commit
Next Next commit
refactored ifs into switch
  • Loading branch information
sirh3e committed Nov 21, 2020
commit ad725ba20516e154b1e46b5456169245cdb45049
52 changes: 26 additions & 26 deletions src/Microsoft.Tye.Hosting/TyeDashboardApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,33 @@ private static V1Service CreateServiceJson(Service service)
}

var v1RunInfo = new V1RunInfo();
if (description.RunInfo is DockerRunInfo dockerRunInfo)
switch (description.RunInfo)
{
v1RunInfo.Type = V1RunInfoType.Docker;
v1RunInfo.Image = dockerRunInfo.Image;
v1RunInfo.VolumeMappings = dockerRunInfo.VolumeMappings.Select(v => new V1DockerVolume
{
Name = v.Name,
Source = v.Source,
Target = v.Target
}).ToList();

v1RunInfo.WorkingDirectory = dockerRunInfo.WorkingDirectory;
v1RunInfo.Args = dockerRunInfo.Args;
}
else if (description.RunInfo is ExecutableRunInfo executableRunInfo)
{
v1RunInfo.Type = V1RunInfoType.Executable;
v1RunInfo.Args = executableRunInfo.Args;
v1RunInfo.Executable = executableRunInfo.Executable;
v1RunInfo.WorkingDirectory = executableRunInfo.WorkingDirectory;
}
else if (description.RunInfo is ProjectRunInfo projectRunInfo)
{
v1RunInfo.Type = V1RunInfoType.Project;
v1RunInfo.Args = projectRunInfo.Args;
v1RunInfo.Build = projectRunInfo.Build;
v1RunInfo.Project = projectRunInfo.ProjectFile.FullName;
case DockerRunInfo dockerRunInfo:
v1RunInfo.Type = V1RunInfoType.Docker;
v1RunInfo.Image = dockerRunInfo.Image;
v1RunInfo.VolumeMappings = dockerRunInfo.VolumeMappings.Select(v => new V1DockerVolume
{
Name = v.Name,
Source = v.Source,
Target = v.Target
}).ToList();

v1RunInfo.WorkingDirectory = dockerRunInfo.WorkingDirectory;
v1RunInfo.Args = dockerRunInfo.Args;
break;
case ExecutableRunInfo executableRunInfo:
v1RunInfo.Type = V1RunInfoType.Executable;
v1RunInfo.Args = executableRunInfo.Args;
v1RunInfo.Executable = executableRunInfo.Executable;
v1RunInfo.WorkingDirectory = executableRunInfo.WorkingDirectory;
break;
case ProjectRunInfo projectRunInfo:
v1RunInfo.Type = V1RunInfoType.Project;
v1RunInfo.Args = projectRunInfo.Args;
v1RunInfo.Build = projectRunInfo.Build;
v1RunInfo.Project = projectRunInfo.ProjectFile.FullName;
break;
}

var v1ServiceDescription = new V1ServiceDescription()
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/dotnet/tye/pull/818/commits/ad725ba20516e154b1e46b5456169245cdb45049

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy