perf: Add a tip before exiting the workflow

This commit is contained in:
wangdan-fit2cloud 2025-02-24 17:53:06 +08:00 committed by GitHub
parent 5eec0f7975
commit 261915db29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 11 deletions

View File

@ -19,7 +19,9 @@ export default {
autoSave: 'Auto Save', autoSave: 'Auto Save',
latestRelease: 'Latest Release', latestRelease: 'Latest Release',
copyParam: 'Copy Parameters', copyParam: 'Copy Parameters',
debug: 'Run' debug: 'Run',
exit: 'Exit',
exitSave: 'Save & Exit',
}, },
tip: { tip: {
publicSuccess: 'Published successfully', publicSuccess: 'Published successfully',
@ -33,7 +35,8 @@ export default {
repeatedNodeError: 'A node with this name already exists', repeatedNodeError: 'A node with this name already exists',
cannotCopy: 'Cannot be copied', cannotCopy: 'Cannot be copied',
copyError: 'Node already copied', copyError: 'Node already copied',
paramErrorMessage: 'Parameter already exists: ' paramErrorMessage: 'Parameter already exists: ',
saveMessage: 'Current changes have not been saved. Save before exiting?',
}, },
delete: { delete: {
confirmTitle: 'Confirm to delete this node?', confirmTitle: 'Confirm to delete this node?',

View File

@ -19,7 +19,9 @@ export default {
autoSave: '自动保存', autoSave: '自动保存',
latestRelease: '最近发布', latestRelease: '最近发布',
copyParam: '复制参数', copyParam: '复制参数',
debug: '调试' debug: '调试',
exit: '直接退出',
exitSave: '保存并退出',
}, },
tip: { tip: {
publicSuccess: '发布成功', publicSuccess: '发布成功',
@ -33,7 +35,8 @@ export default {
repeatedNodeError: '节点名称已存在!', repeatedNodeError: '节点名称已存在!',
cannotCopy: '不能被复制', cannotCopy: '不能被复制',
copyError: '已复制节点', copyError: '已复制节点',
paramErrorMessage: '参数已存在: ' paramErrorMessage: '参数已存在: ',
saveMessage: '当前的更改尚未保存,是否保存后退出?',
}, },
delete: { delete: {
confirmTitle: '确定删除该节点?', confirmTitle: '确定删除该节点?',

View File

@ -19,7 +19,9 @@ export default {
autoSave: '自動保存', autoSave: '自動保存',
latestRelease: '最近發布', latestRelease: '最近發布',
copyParam: '複製參數', copyParam: '複製參數',
debug: '調試' debug: '調試',
exit: '直接退出',
exitSave: '保存並退出',
}, },
tip: { tip: {
publicSuccess: '發布成功', publicSuccess: '發布成功',
@ -33,7 +35,8 @@ export default {
repeatedNodeError: '節點名稱已存在!', repeatedNodeError: '節點名稱已存在!',
cannotCopy: '不能被複製', cannotCopy: '不能被複製',
copyError: '已複製節點', copyError: '已複製節點',
paramErrorMessage: '參數已存在: ' paramErrorMessage: '參數已存在: ',
saveMessage: '當前修改未保存,是否保存後退出?',
}, },
delete: { delete: {
confirmTitle: '確定刪除該節點?', confirmTitle: '確定刪除該節點?',

View File

@ -2,9 +2,7 @@
<div class="application-workflow" v-loading="loading"> <div class="application-workflow" v-loading="loading">
<div class="header border-b flex-between p-12-24"> <div class="header border-b flex-between p-12-24">
<div class="flex align-center"> <div class="flex align-center">
<back-button <back-button @click="back"></back-button>
@click="router.push({ path: `/application/${id}/WORK_FLOW/overview` })"
></back-button>
<h4>{{ detail?.name }}</h4> <h4>{{ detail?.name }}</h4>
<div v-if="showHistory && disablePublic"> <div v-if="showHistory && disablePublic">
<el-text type="info" class="ml-16 color-secondary" <el-text type="info" class="ml-16 color-secondary"
@ -143,7 +141,7 @@ import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vu
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue' import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
import applicationApi from '@/api/application' import applicationApi from '@/api/application'
import { isAppIcon } from '@/utils/application' import { isAppIcon } from '@/utils/application'
import { MsgSuccess, MsgError } from '@/utils/message' import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
import useStore from '@/stores' import useStore from '@/stores'
import { WorkFlowInstance } from '@/workflow/common/validate' import { WorkFlowInstance } from '@/workflow/common/validate'
@ -175,6 +173,19 @@ const showHistory = ref(false)
const disablePublic = ref(false) const disablePublic = ref(false)
const currentVersion = ref<any>({}) const currentVersion = ref<any>({})
function back() {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), {
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
cancelButtonText: t('views.applicationWorkflow.setting.exit'),
type: 'warning'
})
.then(() => {
saveApplication(true, true)
})
.catch(() => {
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
})
}
function clickoutsideHistory() { function clickoutsideHistory() {
if (!disablePublic.value) { if (!disablePublic.value) {
showHistory.value = false showHistory.value = false
@ -347,14 +358,18 @@ function getDetail() {
}) })
} }
function saveApplication(bool?: boolean) { function saveApplication(bool?: boolean, back?: boolean) {
const obj = { const obj = {
work_flow: getGraphData() work_flow: getGraphData()
} }
loading.value = back || false
application.asyncPutApplication(id, obj).then((res) => { application.asyncPutApplication(id, obj).then((res) => {
saveTime.value = new Date() saveTime.value = new Date()
if (bool) { if (bool) {
MsgSuccess(t('common.saveSuccess')) MsgSuccess(t('common.saveSuccess'))
if (back) {
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
}
} }
}) })
} }