Files

93 lines
4.5 KiB
HTML

{{ define "helm-digest-content" }}
{{/*
Helm-aware digest content WITH the install/pull command. Used on the
digest detail page (/d/<handle>/<repo>/<digest>) where there's no other
install switcher above. The repo page's chart tab uses helm-chart-info
(without the install card) since repo-tag-section already renders an
install switcher at the top.
Expects dict: Manifest, HelmContent, RegistryURL, OwnerHandle, RepoName,
OciClient, IsLoggedIn.
*/}}
<div class="space-y-6">
{{ if .HelmContent.HoldUnreachable }}
<div class="alert alert-warning" role="status">
{{ icon "wifi-off" "size-4 shrink-0" }}
<div>
<p class="font-medium">We couldn't reach the hold</p>
<p class="text-sm">Chart metadata is stored on the hold. It may be offline right now.</p>
</div>
</div>
{{ end }}
{{/* Install / Pull command — reuses the existing switcher component
(helm branch renders an install/pull toggle). */}}
{{ $tag := "" }}
{{ if .Manifest.Tags }}{{ $tag = index .Manifest.Tags 0 }}{{ end }}
{{ if and (not $tag) .HelmContent.Meta }}{{ $tag = .HelmContent.Meta.Version }}{{ end }}
<div class="card bg-base-200 border border-base-300 p-6">
{{ template "pull-command-switcher" (dict
"RegistryURL" .RegistryURL
"OwnerHandle" .OwnerHandle
"RepoName" .RepoName
"Tag" $tag
"ArtifactType" "helm-chart"
"OciClient" .OciClient
"IsLoggedIn" .IsLoggedIn
) }}
</div>
{{ template "helm-chart-info" . }}
</div>
{{ end }}
{{ define "helm-chart-info" }}
{{/*
Chart metadata + artifact card + scanning note. No install switcher —
callers are expected to render one elsewhere on the page if needed.
Standard tab-content padding (space-y-4 min-w-0 pt-6) matches the
layers/vulns/sbom partials so the chart tab lines up visually.
Expects dict: HelmContent (and the rest is ignored).
*/}}
<div class="space-y-4 min-w-0 pt-6">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
{{/* Metadata (left, ~2/3) */}}
<div class="lg:col-span-2 space-y-4 min-w-0">
{{ if .HelmContent.Meta }}
{{ template "helm-metadata" .HelmContent.Meta }}
{{ else if .HelmContent.MetaFetchFailed }}
<div class="card bg-base-200 shadow-sm border border-base-300 p-6">
<p class="font-medium text-base-content">Couldn't read chart metadata</p>
<p class="text-sm text-base-content/70 mt-1">The hold is reachable but didn't return a valid Chart.yaml for this digest. The chart tarball is still pullable below.</p>
</div>
{{ end }}
</div>
{{/* Artifact + scanning note (right, ~1/3) */}}
<div class="space-y-4 min-w-0">
<div class="card bg-base-200 shadow-sm border border-base-300 p-6 space-y-3">
<h2 class="text-sm font-semibold uppercase tracking-wider text-base-content/70">Chart artifact</h2>
{{ if .HelmContent.Tarball }}
<div class="space-y-2">
<p class="font-mono text-xs break-all text-base-content/70" title="{{ .HelmContent.Tarball.MediaType }}">{{ .HelmContent.Tarball.MediaType }}</p>
<p class="text-lg font-bold">{{ humanizeBytes .HelmContent.Tarball.Size }}</p>
<div class="flex items-center gap-2 text-xs">
<code class="font-mono break-all" title="{{ .HelmContent.Tarball.Digest }}">{{ truncateDigest (trimPrefix "sha256:" .HelmContent.Tarball.Digest) 16 }}</code>
<button class="btn btn-ghost btn-xs" data-action="copy" data-copy="{{ .HelmContent.Tarball.Digest }}" aria-label="Copy digest">{{ icon "copy" "size-3" }}</button>
</div>
</div>
{{ else }}
<p class="text-sm text-base-content/70">No chart tarball recorded for this digest.</p>
{{ end }}
</div>
<div class="card bg-base-200 shadow-sm border border-base-300 p-6 space-y-2">
<h2 class="text-sm font-semibold uppercase tracking-wider text-base-content/70">About scanning</h2>
<p class="text-sm text-base-content/70">ATCR doesn't scan helm charts for vulnerabilities. Run a chart linter such as <a class="link link-primary" href="https://github.com/stackrox/kube-linter" rel="noopener noreferrer">kube-linter</a> in your CI before publishing.</p>
</div>
</div>
</div>
</div>
{{ end }}