릴리스: v1.4.19 템플릿 아이템 삭제 영향 경고 및 보존 정책 정리
This commit is contained in:
@@ -125,7 +125,7 @@ function setThumbFileElement(el) {
|
||||
<img v-if="props.displayThumbnailUrl" class="selectedThumb selectedThumb--sidebar" :src="props.displayThumbnailUrl" :alt="props.selectedTemplate.game.name" />
|
||||
<div v-else class="selectedThumb selectedThumb--empty selectedThumb--sidebar">대표 썸네일</div>
|
||||
<div class="thumbDropZone__copy">
|
||||
<div class="thumbDropZone__iconWrap">
|
||||
<div v-if="!props.displayThumbnailUrl" class="thumbDropZone__iconWrap">
|
||||
<SvgIcon :src="addPhotoAlternateIcon" alt="" class="thumbDropZone__icon" />
|
||||
</div>
|
||||
<div class="thumbDropZone__title">{{ props.displayThumbnailUrl ? '썸네일 변경' : '클릭 & 드래그' }}</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { Teleport, computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { Teleport, computed, inject, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { api } from '../lib/api'
|
||||
import { editorPath } from '../lib/paths'
|
||||
@@ -1215,7 +1215,25 @@ async function toggleSelectedTemplateVisibility(nextValue) {
|
||||
|
||||
async function removeTemplateItem(itemId) {
|
||||
resetMessages()
|
||||
if (!selectedTemplateId.value) return
|
||||
try {
|
||||
const usageRes = await fetch(
|
||||
toApiUrl(`/api/admin/templates/${encodeURIComponent(selectedTemplateId.value)}/items/${encodeURIComponent(itemId)}/usage`),
|
||||
{
|
||||
credentials: 'include',
|
||||
}
|
||||
)
|
||||
if (!usageRes.ok) throw new Error('usage_failed')
|
||||
|
||||
const usageData = await usageRes.json()
|
||||
const usage = usageData?.usage || { totalCount: 0, publicCount: 0, privateCount: 0 }
|
||||
const impactMessage = usage.totalCount
|
||||
? `이 아이템은 이미 저장된 티어표 ${usage.totalCount}개(공개 ${usage.publicCount}개, 비공개 ${usage.privateCount}개)에서 사용 중이에요.\n기존 티어표에는 영향을 주지 않고, 이후 새로 만드는 티어표에서만 제외됩니다.\n정말 삭제할까요?`
|
||||
: '이 기본 아이템을 삭제할까요?\n기존 저장 티어표에는 영향을 주지 않고, 이후 새로 만드는 티어표에서만 제외됩니다.'
|
||||
const ok = window.confirm(impactMessage)
|
||||
if (!ok) return
|
||||
|
||||
const previousScrollY = window.scrollY
|
||||
const res = await fetch(
|
||||
toApiUrl(`/api/admin/templates/${encodeURIComponent(selectedTemplateId.value)}/items/${encodeURIComponent(itemId)}`),
|
||||
{
|
||||
@@ -1226,6 +1244,8 @@ async function removeTemplateItem(itemId) {
|
||||
if (!res.ok) throw new Error('failed')
|
||||
|
||||
await loadTemplate()
|
||||
await nextTick()
|
||||
window.scrollTo({ top: previousScrollY, behavior: 'auto' })
|
||||
success.value = '템플릿 기본 아이템을 삭제했어요.'
|
||||
} catch (e) {
|
||||
error.value = '템플릿 기본 아이템 삭제에 실패했어요.'
|
||||
|
||||
Reference in New Issue
Block a user