Files

116 lines
5.6 KiB
HTML

{{ define "helm-metadata" }}
{{/*
Renders parsed Chart.yaml metadata as a description list. Expects a
HelmChartMeta value. Rows are skipped silently when fields are empty so
sparse charts don't render with a wall of "—" cells.
*/}}
<div class="card bg-base-200 shadow-sm border border-base-300 p-6 space-y-4 min-w-0">
{{ if .Description }}
<div>
<h2 class="text-sm font-semibold uppercase tracking-wider text-base-content/70 mb-2">Description</h2>
<p class="text-sm leading-relaxed">{{ .Description }}</p>
</div>
{{ end }}
<dl class="grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm">
{{ if .Type }}
<dt class="font-medium text-base-content/70">Type</dt>
<dd>{{ .Type }}</dd>
{{ end }}
{{ if .AppVersion }}
<dt class="font-medium text-base-content/70">App version</dt>
<dd class="font-mono text-xs">{{ .AppVersion }}</dd>
{{ end }}
{{ if .KubeVersion }}
<dt class="font-medium text-base-content/70">Kube version</dt>
<dd class="font-mono text-xs">{{ .KubeVersion }}</dd>
{{ end }}
{{ if .Home }}
<dt class="font-medium text-base-content/70">Home</dt>
<dd class="min-w-0 truncate">
{{ if or (hasPrefix .Home "http://") (hasPrefix .Home "https://") }}
<a href="{{ .Home }}" class="link link-primary" rel="noopener noreferrer" title="{{ .Home }}">{{ .Home }}</a>
{{ else }}
{{/* Non-http schemes (oci://, etc.) get sanitized to #ZgotmplZ
in href context. Render as plain text so the user can
still see and copy the value. */}}
<code class="font-mono text-xs break-all" title="{{ .Home }}">{{ .Home }}</code>
{{ end }}
</dd>
{{ end }}
{{ if .Sources }}
<dt class="font-medium text-base-content/70">Sources</dt>
<dd class="space-y-1 min-w-0">
{{ range .Sources }}
<div class="truncate">
{{ if or (hasPrefix . "http://") (hasPrefix . "https://") }}
<a href="{{ . }}" class="link link-primary" rel="noopener noreferrer" title="{{ . }}">{{ . }}</a>
{{ else }}
<code class="font-mono text-xs break-all" title="{{ . }}">{{ . }}</code>
{{ end }}
</div>
{{ end }}
</dd>
{{ end }}
{{ if .Keywords }}
<dt class="font-medium text-base-content/70">Keywords</dt>
<dd class="flex flex-wrap gap-1">
{{ range .Keywords }}<span class="badge badge-ghost badge-sm">{{ . }}</span>{{ end }}
</dd>
{{ end }}
{{ if .Maintainers }}
<dt class="font-medium text-base-content/70">Maintainers</dt>
<dd class="space-y-1">
{{ range .Maintainers }}
<div class="text-sm">
{{ if and .URL (or (hasPrefix .URL "http://") (hasPrefix .URL "https://")) }}
<a href="{{ .URL }}" class="link link-primary" rel="noopener noreferrer">{{ if .Name }}{{ .Name }}{{ else }}{{ .URL }}{{ end }}</a>
{{ else if .Name }}
{{ .Name }}
{{ else if .URL }}
<code class="font-mono text-xs">{{ .URL }}</code>
{{ end }}
{{ if .Email }}<span class="text-base-content/60">&lt;{{ .Email }}&gt;</span>{{ end }}
</div>
{{ end }}
</dd>
{{ end }}
</dl>
{{ if .Dependencies }}
<div class="pt-2 border-t border-base-300">
<h2 class="text-sm font-semibold uppercase tracking-wider text-base-content/70 mb-2">Dependencies</h2>
<div class="overflow-x-auto">
<table class="table table-xs">
<thead>
<tr>
<th>Name</th>
<th>Version</th>
<th>Repository</th>
</tr>
</thead>
<tbody>
{{ range .Dependencies }}
<tr>
<td class="font-medium">{{ .Name }}{{ if .Alias }} <span class="text-base-content/60">({{ .Alias }})</span>{{ end }}</td>
<td class="font-mono text-xs">{{ .Version }}</td>
<td class="text-xs">
{{ if .Repository }}
{{ if or (hasPrefix .Repository "http://") (hasPrefix .Repository "https://") }}
<a href="{{ .Repository }}" class="link link-primary" rel="noopener noreferrer">{{ .Repository }}</a>
{{ else }}
{{/* oci://, file://, etc. — render as code so it's copyable. */}}
<code class="font-mono break-all">{{ .Repository }}</code>
{{ end }}
{{ end }}
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
</div>
{{ end }}
</div>
{{ end }}