Apply suggestions from code review

Co-authored-by: FunkeCoder23 <12570656+FunkeCoder23@users.noreply.github.com>
This commit is contained in:
Matt
2024-04-06 13:04:22 +13:00
committed by GitHub
parent 083cd984ea
commit 4a4444229e
2 changed files with 6 additions and 3 deletions
@@ -924,7 +924,8 @@ class DockerClient {
$c['BaseImage'] = $ct['Labels']['BASEIMAGE'] ?? false;
$c['Icon'] = $info['Config']['Labels']['net.unraid.docker.icon'] ?? false;
$c['Url'] = $info['Config']['Labels']['net.unraid.docker.webui'] ?? false;
$c['Shell'] = $info['Config']['Labels']['net.unraid.docker.shell'] ?? false;
$c['Shell'] = $info['Config']['Labels']['net.unraid.docker.shell'] ?? false;
$c['Manager'] = $info['Config']['Labels']['net.unraid.docker.managed'] ?? false;
$c['Ports'] = [];
$c['Networks'] = [];
if ($id) $c['NetworkMode'] = $net.str_replace('/',':',DockerUtil::ctMap($id)?:'/???');
@@ -950,7 +951,7 @@ class DockerClient {
$ports = (isset($ports) && is_array($ports)) ? $ports : [];
foreach ($ports as $port => $value) {
[$PrivatePort, $Type] = array_pad(explode('/', $port),2,'');
$c['Ports'][$PrivatePort] = ['IP' => $ip, 'PrivatePort' => $PrivatePort, 'PublicPort' => $nat ? $value[0]['HostPort'] : $PrivatePort, 'NAT' => $nat, 'Type' => $Type];
$c['Ports'][$PrivatePort] = ['IP' => $ip, 'PrivatePort' => $PrivatePort, 'PublicPort' => $nat ? $value[0]['HostPort'] : null, 'NAT' => $nat, 'Type' => $Type];
}
ksort($c['Ports']);
$this::$containersCache[] = $c;
@@ -93,7 +93,9 @@ foreach ($containers as $ct) {
}
$ports = [];
foreach ($ct['Ports'] as $port) {
$ports[] = sprintf('%s:%s<i class="fa fa-arrows-h" style="margin:0 6px"></i>%s', _var($port,'PrivatePort'), strtoupper(_var($port,'Type')), _var($port,'PublicPort'));
$arrow_style = _var($port,'PublicPort') ? "\"fa fa-arrows-h\"" : "";
$ports[] = sprintf('%s:%s<i class=%s style="margin:0 6px"></i>%s', _var($port,'PrivatePort'), strtoupper(_var($port,'Type')),$arrow_style , _var($port,'PublicPort'));
}
$paths = [];
$ct['Volumes'] = is_array($ct['Volumes']) ? $ct['Volumes'] : [];