mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-04-20 16:40:29 +00:00
48 lines
2.6 KiB
HTML
48 lines
2.6 KiB
HTML
{{ define "pull-command-switcher" }}
|
|
{{/*
|
|
Pull command with inline OCI client switcher.
|
|
Expects dict with: RegistryURL, OwnerHandle, RepoName, Tag, ArtifactType, OciClient, IsLoggedIn
|
|
|
|
For helm charts, shows helm command only (no switcher).
|
|
For container images, shows a client dropdown that updates the command.
|
|
Logged-in users: saves to profile via HTMX POST.
|
|
Anonymous users: saves to localStorage.
|
|
*/}}
|
|
{{ if eq .ArtifactType "helm-chart" }}
|
|
<div class="space-y-2">
|
|
<p class="text-sm font-medium text-base-content/70">Pull this chart</p>
|
|
{{ if .Tag }}
|
|
{{ template "docker-command" (print "helm pull oci://" .RegistryURL "/" .OwnerHandle "/" .RepoName " --version " .Tag) }}
|
|
{{ else }}
|
|
{{ template "docker-command" (print "helm pull oci://" .RegistryURL "/" .OwnerHandle "/" .RepoName) }}
|
|
{{ end }}
|
|
</div>
|
|
{{ else }}
|
|
<div class="space-y-2" id="pull-cmd-container"
|
|
data-registry-url="{{ .RegistryURL }}"
|
|
data-owner-handle="{{ .OwnerHandle }}"
|
|
data-repo-name="{{ .RepoName }}"
|
|
data-tag="{{ if .Tag }}{{ .Tag }}{{ else }}latest{{ end }}"
|
|
data-is-logged-in="{{ .IsLoggedIn }}">
|
|
<label for="oci-client-switcher" class="text-sm font-medium text-base-content/70">Pull this image</label>
|
|
<div class="flex items-center gap-2">
|
|
<select id="oci-client-switcher" class="select select-xs select-bordered w-auto">
|
|
<option value="docker"{{ if or (eq .OciClient "") (eq .OciClient "docker") }} selected{{ end }}>docker</option>
|
|
<option value="podman"{{ if eq .OciClient "podman" }} selected{{ end }}>podman</option>
|
|
<option value="nerdctl"{{ if eq .OciClient "nerdctl" }} selected{{ end }}>nerdctl</option>
|
|
<option value="buildah"{{ if eq .OciClient "buildah" }} selected{{ end }}>buildah</option>
|
|
<option value="crane"{{ if eq .OciClient "crane" }} selected{{ end }}>crane</option>
|
|
<option value="none"{{ if eq .OciClient "none" }} selected{{ end }}>image ref only</option>
|
|
</select>
|
|
<div id="pull-cmd-display" class="flex-1 min-w-0">
|
|
{{ if .Tag }}
|
|
{{ template "docker-command" (print (pullPrefix .OciClient) .RegistryURL "/" .OwnerHandle "/" .RepoName ":" .Tag) }}
|
|
{{ else }}
|
|
{{ template "docker-command" (print (pullPrefix .OciClient) .RegistryURL "/" .OwnerHandle "/" .RepoName ":latest") }}
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|