Add copyable docker pull commands on the images page.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3fa4ae2b66
commit
f3d8d4c8ea
1 file changed
+51
-2
@@ -54,7 +54,8 @@
|
|||||||
<TableHeader>
|
<TableHeader>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableHead class="pl-6">태그</TableHead>
|
<TableHead class="pl-6">태그</TableHead>
|
||||||
<TableHead class="w-24 pr-6 text-right">작업</TableHead>
|
<TableHead class="hidden md:table-cell">Pull 명령</TableHead>
|
||||||
|
<TableHead class="w-28 pr-6 text-right">작업</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
@@ -65,10 +66,30 @@
|
|||||||
{{ tag }}
|
{{ tag }}
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell class="hidden md:table-cell">
|
||||||
|
<code class="rounded bg-muted px-2 py-1 font-mono text-xs">{{ pullCommand(repo, tag) }}</code>
|
||||||
|
</TableCell>
|
||||||
<TableCell class="pr-6 text-right">
|
<TableCell class="pr-6 text-right">
|
||||||
<Button variant="ghost" size="icon" class="text-destructive hover:text-destructive" @click="removeTag(repo, tag)">
|
<div class="flex justify-end gap-1">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
:title="copiedKey === copyKey(repo, tag) ? '복사됨' : 'Pull 명령 복사'"
|
||||||
|
@click.stop="copyPull(repo, tag)"
|
||||||
|
>
|
||||||
|
<Check v-if="copiedKey === copyKey(repo, tag)" class="size-4 text-green-500" />
|
||||||
|
<Copy v-else class="size-4" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
class="text-destructive hover:text-destructive"
|
||||||
|
title="태그 삭제"
|
||||||
|
@click.stop="removeTag(repo, tag)"
|
||||||
|
>
|
||||||
<Trash2 class="size-4" />
|
<Trash2 class="size-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableBody>
|
</TableBody>
|
||||||
@@ -82,8 +103,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
|
Check,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
CircleAlert,
|
CircleAlert,
|
||||||
|
Copy,
|
||||||
Package,
|
Package,
|
||||||
PackageOpen,
|
PackageOpen,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
@@ -93,10 +116,12 @@ import {
|
|||||||
|
|
||||||
useHead({ title: '이미지' })
|
useHead({ title: '이미지' })
|
||||||
|
|
||||||
|
const config = useRuntimeConfig()
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
const open = ref<string | null>(null)
|
const open = ref<string | null>(null)
|
||||||
const tags = ref<string[]>([])
|
const tags = ref<string[]>([])
|
||||||
const tagsPending = ref(false)
|
const tagsPending = ref(false)
|
||||||
|
const copiedKey = ref('')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@@ -107,6 +132,30 @@ const {
|
|||||||
|
|
||||||
const repositories = computed(() => data.value?.repositories || [])
|
const repositories = computed(() => data.value?.repositories || [])
|
||||||
|
|
||||||
|
const registryHost = computed(() => {
|
||||||
|
const raw = String(config.public.registryPublicUrl || '').trim()
|
||||||
|
if (raw) {
|
||||||
|
return raw.replace(/^https?:\/\//i, '').replace(/\/+$/, '')
|
||||||
|
}
|
||||||
|
return `localhost:${config.public.registryPort || '5050'}`
|
||||||
|
})
|
||||||
|
|
||||||
|
function pullCommand(repo: string, tag: string) {
|
||||||
|
return `docker pull ${registryHost.value}/${repo}:${tag}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyKey(repo: string, tag: string) {
|
||||||
|
return `${repo}:${tag}`
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyPull(repo: string, tag: string) {
|
||||||
|
await navigator.clipboard.writeText(pullCommand(repo, tag))
|
||||||
|
copiedKey.value = copyKey(repo, tag)
|
||||||
|
window.setTimeout(() => {
|
||||||
|
if (copiedKey.value === copyKey(repo, tag)) copiedKey.value = ''
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (fetchError.value) {
|
if (fetchError.value) {
|
||||||
error.value = fetchError.value.statusMessage || '레지스트리를 불러오지 못했습니다'
|
error.value = fetchError.value.statusMessage || '레지스트리를 불러오지 못했습니다'
|
||||||
|
|||||||
Reference in new issue
Block a user