Skip to content

Commit 3d8ab69

Browse files
perf: Add a tip before exiting the workflow
1 parent 76e6b6e commit 3d8ab69

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export default {
1919
autoSave: 'Auto Save',
2020
latestRelease: 'Latest Release',
2121
copyParam: 'Copy Parameters',
22-
debug: 'Run'
22+
debug: 'Run',
23+
exit: 'Exit',
24+
exitSave: 'Save & Exit',
2325
},
2426
tip: {
2527
publicSuccess: 'Published successfully',
@@ -33,7 +35,8 @@ export default {
3335
repeatedNodeError: 'A node with this name already exists',
3436
cannotCopy: 'Cannot be copied',
3537
copyError: 'Node already copied',
36-
paramErrorMessage: 'Parameter already exists: '
38+
paramErrorMessage: 'Parameter already exists: ',
39+
saveMessage: 'Current changes have not been saved. Save before exiting?',
3740
},
3841
delete: {
3942
confirmTitle: 'Confirm to delete this node?',

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export default {
1919
autoSave: '自动保存',
2020
latestRelease: '最近发布',
2121
copyParam: '复制参数',
22-
debug: '调试'
22+
debug: '调试',
23+
exit: '直接退出',
24+
exitSave: '保存并退出',
2325
},
2426
tip: {
2527
publicSuccess: '发布成功',
@@ -33,7 +35,8 @@ export default {
3335
repeatedNodeError: '节点名称已存在!',
3436
cannotCopy: '不能被复制',
3537
copyError: '已复制节点',
36-
paramErrorMessage: '参数已存在: '
38+
paramErrorMessage: '参数已存在: ',
39+
saveMessage: '当前的更改尚未保存,是否保存后退出?',
3740
},
3841
delete: {
3942
confirmTitle: '确定删除该节点?',

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export default {
1919
autoSave: '自動保存',
2020
latestRelease: '最近發布',
2121
copyParam: '複製參數',
22-
debug: '調試'
22+
debug: '調試',
23+
exit: '直接退出',
24+
exitSave: '保存並退出',
2325
},
2426
tip: {
2527
publicSuccess: '發布成功',
@@ -33,7 +35,8 @@ export default {
3335
repeatedNodeError: '節點名稱已存在!',
3436
cannotCopy: '不能被複製',
3537
copyError: '已複製節點',
36-
paramErrorMessage: '參數已存在: '
38+
paramErrorMessage: '參數已存在: ',
39+
saveMessage: '當前修改未保存,是否保存後退出?',
3740
},
3841
delete: {
3942
confirmTitle: '確定刪除該節點?',

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<div class="application-workflow" v-loading="loading">
33
<div class="header border-b flex-between p-12-24">
44
<div class="flex align-center">
5-
<back-button
6-
@click="router.push({ path: `/application/${id}/WORK_FLOW/overview` })"
7-
></back-button>
5+
<back-button @click="back"></back-button>
86
<h4>{{ detail?.name }}</h4>
97
<div v-if="showHistory && disablePublic">
108
<el-text type="info" class="ml-16 color-secondary"
@@ -143,7 +141,7 @@ import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vu
143141
import PublishHistory from '@/views/application-workflow/component/PublishHistory.vue'
144142
import applicationApi from '@/api/application'
145143
import { isAppIcon } from '@/utils/application'
146-
import { MsgSuccess, MsgError } from '@/utils/message'
144+
import { MsgSuccess, MsgError, MsgConfirm } from '@/utils/message'
147145
import { datetimeFormat } from '@/utils/time'
148146
import useStore from '@/stores'
149147
import { WorkFlowInstance } from '@/workflow/common/validate'
@@ -175,6 +173,19 @@ const showHistory = ref(false)
175173
const disablePublic = ref(false)
176174
const currentVersion = ref<any>({})
177175
176+
function back() {
177+
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.tip.saveMessage'), {
178+
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
179+
cancelButtonText: t('views.applicationWorkflow.setting.exit'),
180+
type: 'warning'
181+
})
182+
.then(() => {
183+
saveApplication(true, true)
184+
})
185+
.catch(() => {
186+
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
187+
})
188+
}
178189
function clickoutsideHistory() {
179190
if (!disablePublic.value) {
180191
showHistory.value = false
@@ -347,14 +358,18 @@ function getDetail() {
347358
})
348359
}
349360
350-
function saveApplication(bool?: boolean) {
361+
function saveApplication(bool?: boolean, back?: boolean) {
351362
const obj = {
352363
work_flow: getGraphData()
353364
}
365+
loading.value = back || false
354366
application.asyncPutApplication(id, obj).then((res) => {
355367
saveTime.value = new Date()
356368
if (bool) {
357369
MsgSuccess(t('common.saveSuccess'))
370+
if (back) {
371+
router.push({ path: `/application/${id}/WORK_FLOW/overview` })
372+
}
358373
}
359374
})
360375
}

0 commit comments

Comments
 (0)