发布节点到市场时增加确认对话框

This commit is contained in:
jingrow 2025-11-03 02:17:43 +08:00
parent 2ae47a041a
commit 9d86d738e5
2 changed files with 40 additions and 17 deletions

View File

@ -960,8 +960,6 @@
"Created": "创建时间", "Created": "创建时间",
"Back to Marketplace": "返回应用市场", "Back to Marketplace": "返回应用市场",
"Not specified": "未指定", "Not specified": "未指定",
"应用创建成功": "应用创建成功",
"应用创建失败": "应用创建失败",
"Create a new application for the marketplace": "为应用市场创建新应用", "Create a new application for the marketplace": "为应用市场创建新应用",
"App Title": "应用标题", "App Title": "应用标题",
"App Description": "应用描述", "App Description": "应用描述",
@ -985,15 +983,24 @@
"Applications": "应用列表", "Applications": "应用列表",
"applications": "个应用", "applications": "个应用",
"是": "是", "Publish to Node Marketplace": "发布到节点市场",
"否": "否", "Publish to Marketplace": "发布到市场",
"暂无可过滤的字段": "暂无可过滤的字段", "Publishing to Node Marketplace": "正在发布到节点市场",
"清除所有过滤条件": "清除所有过滤条件", "Packaging node": "打包节点",
"清除": "清除", "Uploading package": "上传打包文件到服务器",
"保存当前过滤条件": "保存当前过滤条件", "Publishing to marketplace": "发布到市场",
"保存": "保存", "Packaging node folder...": "正在打包节点文件夹...",
"保存筛选条件": "保存筛选条件", "Package created successfully": "打包成功",
"过滤器名称": "过滤器名称", "Uploading to server...": "正在上传到服务器...",
"请输入过滤器名称": "请输入过滤器名称", "Upload successful": "上传成功",
"取消": "取消" "Publishing to marketplace...": "正在发布到市场...",
"Published successfully": "发布成功",
"Retry": "重试",
"Please save the node first": "请先保存节点",
"Upload failed": "上传失败",
"Publish failed": "发布失败",
"Publish failed, please check permission and server logs": "发布失败,请检查权限和服务器日志",
"Node published to marketplace successfully": "节点已成功发布到市场",
"Are you sure you want to publish node \"{0}\" to the marketplace?": "确定要将节点 \"{0}\" 发布到市场吗?",
"Confirm": "确认"
} }

View File

@ -65,7 +65,7 @@
<n-button <n-button
type="default" type="default"
size="medium" size="medium"
@click="handlePublishToMarketplace" @click="showPublishConfirmDialog"
:disabled="loading || isNew || !nodeRecord.node_type" :disabled="loading || isNew || !nodeRecord.node_type"
:loading="publishing" :loading="publishing"
v-if="!isNew" v-if="!isNew"
@ -94,7 +94,7 @@
:title="t('Publishing to Node Marketplace')" :title="t('Publishing to Node Marketplace')"
:steps="publishSteps" :steps="publishSteps"
:status="publishStatus" :status="publishStatus"
@retry="handlePublishToMarketplace" @retry="showPublishConfirmDialog"
/> />
<!-- 返回按钮 --> <!-- 返回按钮 -->
@ -126,7 +126,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue' import { ref, computed, watch, onMounted } from 'vue'
import { NButton, NSpace, NIcon, useMessage } from 'naive-ui' import { NButton, NSpace, NIcon, useMessage, useDialog } from 'naive-ui'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue' import SchemaEditorModal from '@/core/components/SchemaEditorModal.vue'
@ -161,6 +161,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const message = useMessage() const message = useMessage()
const dialog = useDialog()
// //
const isNew = computed(() => { const isNew = computed(() => {
@ -241,12 +242,27 @@ function updateStep(index: number, updates: Partial<Step>) {
} }
} }
async function handlePublishToMarketplace() { function showPublishConfirmDialog() {
if (isNew.value || !nodeRecord.value.node_type) { if (isNew.value || !nodeRecord.value.node_type) {
message.warning(t('Please save the node first')) message.warning(t('Please save the node first'))
return return
} }
const nodeType = nodeRecord.value.node_type
const nodeLabel = nodeRecord.value.node_label || nodeType
dialog.warning({
title: t('Publish to Node Marketplace'),
content: t('Are you sure you want to publish node "{0}" to the marketplace?').replace('{0}', nodeLabel),
positiveText: t('Confirm'),
negativeText: t('Cancel'),
onPositiveClick: () => {
performPublish()
}
})
}
async function performPublish() {
const nodeType = nodeRecord.value.node_type const nodeType = nodeRecord.value.node_type
const nodeLabel = nodeRecord.value.node_label || nodeType const nodeLabel = nodeRecord.value.node_label || nodeType
const nodeDescription = nodeRecord.value.node_description || '' const nodeDescription = nodeRecord.value.node_description || ''