From 8c4dbb32debc4a0061e23b745a7728b62d329182 Mon Sep 17 00:00:00 2001 From: Joseph Date: Sat, 4 Mar 2023 16:33:28 +0000 Subject: [PATCH] [DockerHubBridge] Display compressed image size in items (#3279) * [DockerHubBridge] Display compressed image size in items * [DockerHubBridge] lint * [DockerHubBridge] Use format_bytes() --- bridges/DockerHubBridge.php | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/bridges/DockerHubBridge.php b/bridges/DockerHubBridge.php index f0baa37f..574e3964 100644 --- a/bridges/DockerHubBridge.php +++ b/bridges/DockerHubBridge.php @@ -93,7 +93,7 @@ class DockerHubBridge extends BridgeAbstract Last pushed

{$lastPushed}

Images
-{$this->getImages($result)} +{$this->getImagesTable($result)} EOD; $this->items[] = $item; @@ -187,25 +187,37 @@ EOD; return $url . '/tags/?&name=' . $name; } - private function getImages($result) + private function getImagesTable($result) { - $html = <<DigestOS/architecture -EOD; + $data = ''; foreach ($result->images as $image) { $layersUrl = $this->getLayerUrl($result->name, $image->digest); $id = $this->getShortDigestId($image->digest); - - $html .= << - {$id} - {$image->os}/{$image->architecture} - + $size = format_bytes($image->size); + $data .= << + {$id} + {$image->os}/{$image->architecture} + {$size} + EOD; } - return $html . ''; + return << + + + Digest + OS/architecture + Compressed Size + + + + {$data} + + +EOD; } private function getShortDigestId($digest)