From d22c809421715748532e374144f8a4faf21f7355 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Tue, 3 Aug 2021 12:21:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=81=E8=AE=B8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 4 ++- frontend/src/lang/tw.js | 4 ++- frontend/src/lang/zh.js | 7 ++-- frontend/src/utils/message.js | 4 +-- frontend/src/views/system/datasource/form.vue | 34 +++++++++++++------ 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index d69856e896..a5d01bb93a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -334,7 +334,9 @@ export default { input_pwd: 'Please input password', message_box: { alert: 'Alert', - confirm: 'Confirm' + confirm: 'Confirm', + ok: 'Confirm', + cancel: 'Cancel' } }, documentation: { diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 21a06c5527..a13981d643 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -334,7 +334,9 @@ export default { input_pwd: '請輸入密碼', message_box: { alert: '警告', - confirm: '確認' + confirm: '確認', + ok: '確認', + cancel: '取消' } }, documentation: { diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index b542905147..f16b9216b7 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -334,7 +334,9 @@ export default { input_pwd: '请输入密码', message_box: { alert: '警告', - confirm: '确认' + confirm: '确认', + ok: '确认', + cancel: '取消' } }, documentation: { @@ -1025,7 +1027,8 @@ export default { oracle_service_name: '服务名', get_schema: '获取 Schema', schema: '数据库 Schema', - please_choose_schema: '请选择数据库 Schema' + please_choose_schema: '请选择数据库 Schema', + edit_datasource_msg: '修改数据源信息,可能会导致改数据源下的数据集不可用,确认修改?' }, pblink: { key_pwd: '请输入密码打开链接', diff --git a/frontend/src/utils/message.js b/frontend/src/utils/message.js index fd72e88a30..74f3daa4de 100644 --- a/frontend/src/utils/message.js +++ b/frontend/src/utils/message.js @@ -9,8 +9,8 @@ export const $alert = (message, callback, options) => { export const $confirm = (message, callback, options = {}) => { const defaultOptions = { - confirmButtonText: i18n.t('common.button.ok'), - cancelButtonText: i18n.t('common.button.cancel'), + confirmButtonText: i18n.t('commons.message_box.ok'), + cancelButtonText: i18n.t('commons.message_box.cancel'), type: 'warning', ...options } diff --git a/frontend/src/views/system/datasource/form.vue b/frontend/src/views/system/datasource/form.vue index 452e725755..9fab06d9e5 100644 --- a/frontend/src/views/system/datasource/form.vue +++ b/frontend/src/views/system/datasource/form.vue @@ -26,10 +26,10 @@ - + - + @@ -38,7 +38,7 @@ - + @@ -53,7 +53,7 @@ - + import LayoutContent from '@/components/business/LayoutContent' import { addDs, editDs, getSchema, validateDs } from '@/api/system/datasource' +import { $confirm } from '@/utils/message' + export default { name: 'DsForm', components: { LayoutContent }, @@ -105,7 +107,8 @@ export default { }, allTypes: [{ name: 'mysql', label: 'MySQL', type: 'jdbc' }, { name: 'oracle', label: 'Oracle', type: 'jdbc' }], schemas: [], - canEdit: false + canEdit: false, + originConfiguration: {} } }, @@ -140,6 +143,7 @@ export default { edit(row) { this.formType = 'modify' this.form = Object.assign({}, row) + this.originConfiguration = this.form.configuration this.form.configuration = JSON.parse(this.form.configuration) }, @@ -156,11 +160,21 @@ export default { const method = this.formType === 'add' ? addDs : editDs const form = JSON.parse(JSON.stringify(this.form)) form.configuration = JSON.stringify(form.configuration) - method(form).then(res => { - this.$success(this.$t('commons.save_success')) - this.refreshTree() - this.backToList() - }) + if(this.formType !== 'add' && this.originConfiguration !== form.configuration) { + $confirm(this.$t('datasource.edit_datasource_msg'), () => { + method(form).then(res => { + this.$success(this.$t('commons.save_success')) + this.refreshTree() + this.backToList() + }) + }) + }else { + method(form).then(res => { + this.$success(this.$t('commons.save_success')) + this.refreshTree() + this.backToList() + }) + } } else { return false }