diff --git a/pkg/handlers/apidocs/docs.go b/pkg/handlers/apidocs/docs.go index de33e80f..15b74bc3 100644 --- a/pkg/handlers/apidocs/docs.go +++ b/pkg/handlers/apidocs/docs.go @@ -4414,6 +4414,10 @@ const docTemplate = `{ "type": "string", "example": "latest" }, + "pull_times": { + "type": "integer", + "example": 10 + }, "pushed_at": { "type": "string", "example": "2006-01-02 15:04:05" diff --git a/pkg/handlers/apidocs/swagger.json b/pkg/handlers/apidocs/swagger.json index aa497447..1354395a 100644 --- a/pkg/handlers/apidocs/swagger.json +++ b/pkg/handlers/apidocs/swagger.json @@ -4405,6 +4405,10 @@ "type": "string", "example": "latest" }, + "pull_times": { + "type": "integer", + "example": 10 + }, "pushed_at": { "type": "string", "example": "2006-01-02 15:04:05" diff --git a/pkg/handlers/apidocs/swagger.yaml b/pkg/handlers/apidocs/swagger.yaml index b548125c..e0ef798c 100644 --- a/pkg/handlers/apidocs/swagger.yaml +++ b/pkg/handlers/apidocs/swagger.yaml @@ -1037,6 +1037,9 @@ definitions: name: example: latest type: string + pull_times: + example: 10 + type: integer pushed_at: example: "2006-01-02 15:04:05" type: string diff --git a/pkg/handlers/tags/tags_list.go b/pkg/handlers/tags/tags_list.go index de237925..61b3fba2 100644 --- a/pkg/handlers/tags/tags_list.go +++ b/pkg/handlers/tags/tags_list.go @@ -139,6 +139,7 @@ func (h *handlers) ListTag(c echo.Context) error { UpdatedAt: tag.Artifact.UpdatedAt.Format(consts.DefaultTimePattern), }, Artifacts: artifacts, + PullTimes: tag.PullTimes, PushedAt: tag.PushedAt.Format(consts.DefaultTimePattern), CreatedAt: tag.CreatedAt.Format(consts.DefaultTimePattern), UpdatedAt: tag.UpdatedAt.Format(consts.DefaultTimePattern), diff --git a/pkg/types/tag.go b/pkg/types/tag.go index 8b0c6fe0..20ec3720 100644 --- a/pkg/types/tag.go +++ b/pkg/types/tag.go @@ -41,6 +41,7 @@ type TagItem struct { ID int64 `json:"id" example:"1"` Name string `json:"name" example:"latest"` PushedAt string `json:"pushed_at" example:"2006-01-02 15:04:05"` + PullTimes int64 `json:"pull_times" example:"10"` Artifact TagItemArtifact `json:"artifact"` Artifacts []TagItemArtifact `json:"artifacts"` CreatedAt string `json:"created_at" example:"2006-01-02 15:04:05"` diff --git a/web/src/interfaces/index.ts b/web/src/interfaces/index.ts index b82c85b9..3f22cd12 100644 --- a/web/src/interfaces/index.ts +++ b/web/src/interfaces/index.ts @@ -134,6 +134,7 @@ export interface ITag { name: string; artifact: IArtifact; artifacts: IArtifact[]; + pull_times: number; pushed_at: string; created_at: string; updated_at: string; diff --git a/web/src/pages/Tag/TableItem.tsx b/web/src/pages/Tag/TableItem.tsx index c293f1ba..6181162a 100644 --- a/web/src/pages/Tag/TableItem.tsx +++ b/web/src/pages/Tag/TableItem.tsx @@ -72,12 +72,25 @@ function DetailItem({ artifact }: { artifact: IArtifact }) { let imageConfigObj = JSON.parse(artifact.config_raw) as IImageConfig; return ( - + {cutDigest(artifact.digest)} - + + Image + + +
+ {distros(sbomObj.distro?.name) === "" ? "" : ( + {sbomObj.distro.name} + )} +
+ {distroName(sbomObj.distro?.name) === "" ? "-" : distroName(sbomObj.distro.name) + " " + sbomObj.distro.version} +
+
+ + { imageConfigObj.os === undefined || imageConfigObj.architecture === undefined || @@ -87,30 +100,23 @@ function DetailItem({ artifact }: { artifact: IArtifact }) { ) } - -
-
- {distroName(sbomObj.distro?.name) === "" ? "-" : distroName(sbomObj.distro.name) + " " + sbomObj.distro.version} -
- {distros(sbomObj.distro?.name) === "" ? "" : ( - {sbomObj.distro.name} - )} -
+ + Verified - - {humanFormat(artifact.blob_size || 0)} - - + {(artifact.pull_times || 0) > 0 ? dayjs().to(dayjs(artifact.last_pull)) : "Never pulled"} - + {/* {artifact.pull_times} - - + */} + {vulnerabilityObj.critical || 0} C {vulnerabilityObj.high || 0} H {vulnerabilityObj.medium || 0} M - {vulnerabilityObj.low || 0} L + {vulnerabilityObj.low || 0} L + + + {humanFormat(artifact.blob_size || 0)} ); diff --git a/web/src/pages/Tag/index.tsx b/web/src/pages/Tag/index.tsx index a9d52877..fd1a786c 100644 --- a/web/src/pages/Tag/index.tsx +++ b/web/src/pages/Tag/index.tsx @@ -254,36 +254,45 @@ export default function Tag({ localServer }: { localServer: string }) { {/* first row end */} {/* second row begin */} -
+
Last pushed {dayjs().to(dayjs(tag.pushed_at))}
+
+ Pull times {tag.pull_times === undefined ? 0 : tag.pull_times} +
{/* second row end */} {/* third row begin */} - +
- - - - - + - - */} + +
+ Digest - Os/Arch + + Type + Distro - Size + + Os/Arch + + Signing + Last pull + {/* Pull Times - + Vulnerabilities + Size +