Skip to content

Commit dd66f1b

Browse files
committed
feat: Add confirm when import workflow template
1 parent 54e16ac commit dd66f1b

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

ui/src/locales/lang/en-US/views/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export default {
2727
saveErrorMessage: 'Saving failed, please check your input or try again later',
2828
loadingErrorMessage: 'Failed to load configuration, please check your input or try again later',
2929
noDocPermission: 'No permission to create documents',
30+
confirmUse: 'Are you sure you want to use',
31+
overwrite: 'overwrite the current workflow',
3032
},
3133

3234
form: {

ui/src/locales/lang/zh-CN/views/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export default {
2727
saveErrorMessage: '保存失败,请检查输入或稍后再试',
2828
loadingErrorMessage: '加载配置失败,请检查输入或稍后再试',
2929
noDocPermission: '无文档创建权限',
30+
confirmUse: '确定使用',
31+
overwrite: '覆盖当前工作流',
3032
},
3133
form: {
3234
appName: {

ui/src/locales/lang/zh-Hant/views/application.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default {
2424
saveErrorMessage: '儲存失敗,請檢查輸入或稍後再試',
2525
loadingErrorMessage: '載入配置失敗,請檢查輸入或稍後再試',
2626
noDocPermission: '無文檔創建權限',
27+
confirmUse: '確定使用',
28+
overwrite: '覆蓋當前工作流',
2729
},
2830
form: {
2931
appName: {

ui/src/views/knowledge-workflow/index.vue

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -394,22 +394,35 @@ const elUploadRef = ref()
394394
const importKnowledgeWorkflow = (file: any) => {
395395
const formData = new FormData()
396396
formData.append('file', file.raw)
397+
const name = file.name.replace('.kbwf', '')
397398
elUploadRef.value.clearFiles()
398-
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
399-
.importKnowledgeWorkflow(id, formData, loading)
399+
debugger
400+
MsgConfirm(
401+
t('common.tip'),
402+
`${t('views.application.tip.confirmUse')} ${name} ${t('views.application.tip.overwrite')}?`,
403+
{
404+
confirmButtonText: t('common.confirm'),
405+
cancelButtonText: t('common.cancel'),
406+
},
407+
)
400408
.then(() => {
401-
getDetail()
402-
})
403-
.catch((error: any) => {
404-
if (error.code === 400) {
405-
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
406-
cancelButtonText: t('common.confirm'),
407-
confirmButtonText: t('common.professional'),
408-
}).then(() => {
409-
window.open('https://maxkb.cn/pricing.html', '_blank')
409+
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
410+
.importKnowledgeWorkflow(id, formData, loading)
411+
.then(() => {
412+
getDetail()
413+
})
414+
.catch((error: any) => {
415+
if (error.code === 400) {
416+
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
417+
cancelButtonText: t('common.confirm'),
418+
confirmButtonText: t('common.professional'),
419+
}).then(() => {
420+
window.open('https://maxkb.cn/pricing.html', '_blank')
421+
})
422+
}
410423
})
411-
}
412424
})
425+
.catch(() => {})
413426
}
414427
415428
function exportKnowledgeWorkflow(name: string, id: string) {

0 commit comments

Comments
 (0)