This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch kylin5 in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 894a4ef5c9a8879904fd73c679703411b1e76f2e Author: Qian Xia <lauraxiaq...@gmail.com> AuthorDate: Fri Aug 4 11:46:27 2023 +0800 KYLIN-5678 model name 127 issue --- .../common/ModelsImportModal/ModelsImportModal.vue | 4 ++-- .../StudioModel/ModelList/ModelAddModal/addmodel.vue | 4 ++-- .../StudioModel/ModelList/ModelCloneModal/clone.vue | 19 ++++++++++++++++--- .../StudioModel/ModelList/ModelRenameModal/rename.vue | 4 ++-- kystudio/src/locale/en.js | 1 + 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue b/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue index 326b215bb2..e65b67986c 100644 --- a/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue +++ b/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue @@ -568,9 +568,9 @@ export default class ModelsImportModal extends Vue { if (!NamedRegex.test(value)) { row.isNameError = true row.nameErrorMsg = 'kylinLang.common.nameFormatValidTip' - } else if (value.length > 50) { + } else if (value.length > 127) { row.isNameError = true - row.nameErrorMsg = 'kylinLang.common.overLengthTip' + row.nameErrorMsg = 'kylinLang.common.overLength127Tip' } else if (allImportModalName.filter(v => v === value).length > 1) { row.isNameError = true row.nameErrorMsg = 'kylinLang.model.sameModelName' diff --git a/kystudio/src/components/studio/StudioModel/ModelList/ModelAddModal/addmodel.vue b/kystudio/src/components/studio/StudioModel/ModelList/ModelAddModal/addmodel.vue index a6bd3e06d1..4f600f3cc1 100644 --- a/kystudio/src/components/studio/StudioModel/ModelList/ModelAddModal/addmodel.vue +++ b/kystudio/src/components/studio/StudioModel/ModelList/ModelAddModal/addmodel.vue @@ -65,8 +65,8 @@ export default class ModelAddModal extends Vue { checkName (rule, value, callback) { if (!NamedRegex.test(value)) { callback(new Error(this.$t('kylinLang.common.nameFormatValidTip'))) - } else if (value.length > 50) { - callback(new Error(this.$t('kylinLang.common.overLengthTip'))) + } else if (value.length > 127) { + callback(new Error(this.$t('kylinLang.common.overLength127Tip'))) } else { this.modelNameValidate({model_name: value, project: this.currentSelectedProject}).then((response) => { handleSuccess(response, (data) => { diff --git a/kystudio/src/components/studio/StudioModel/ModelList/ModelCloneModal/clone.vue b/kystudio/src/components/studio/StudioModel/ModelList/ModelCloneModal/clone.vue index da35c4f9cd..69695366f9 100644 --- a/kystudio/src/components/studio/StudioModel/ModelList/ModelCloneModal/clone.vue +++ b/kystudio/src/components/studio/StudioModel/ModelList/ModelCloneModal/clone.vue @@ -18,7 +18,7 @@ import { mapState, mapMutations, mapActions, mapGetters } from 'vuex' import vuex from '../../../../../store' import { NamedRegex } from 'config' - import { handleError, kylinMessage } from 'util/business' + import { handleError, kylinMessage, handleSuccess } from 'util/business' import locales from './locales' import store, { types } from './store' @@ -37,7 +37,8 @@ }, methods: { ...mapActions({ - cloneModel: 'CLONE_MODEL' + cloneModel: 'CLONE_MODEL', + modelNameValidate: 'NEW_MODEL_NAME_VALIDATE' }), ...mapMutations('ModelCloneModal', { setModal: types.SET_MODAL, @@ -65,8 +66,20 @@ checkName (rule, value, callback) { if (!NamedRegex.test(value)) { callback(new Error(this.$t('kylinLang.common.nameFormatValidTip'))) + } else if (value.length > 127) { + callback(new Error(this.$t('kylinLang.common.overLength127Tip'))) } else { - callback() + this.modelNameValidate({model_name: value, project: this.currentSelectedProject}).then((response) => { + handleSuccess(response, (data) => { + if (data) { + callback(new Error(this.$t('kylinLang.model.sameModelName'))) + } else { + callback() + } + }) + }, (res) => { + handleError(res) + }) } } closeModal (isSubmit) { diff --git a/kystudio/src/components/studio/StudioModel/ModelList/ModelRenameModal/rename.vue b/kystudio/src/components/studio/StudioModel/ModelList/ModelRenameModal/rename.vue index c837b82dc0..0df2cb3503 100644 --- a/kystudio/src/components/studio/StudioModel/ModelList/ModelRenameModal/rename.vue +++ b/kystudio/src/components/studio/StudioModel/ModelList/ModelRenameModal/rename.vue @@ -70,8 +70,8 @@ checkName (rule, value, callback) { if (!NamedRegex.test(value)) { callback(new Error(this.$t('kylinLang.common.nameFormatValidTip'))) - } else if (value.length > 50) { - callback(new Error(this.$t('kylinLang.common.overLengthTip'))) + } else if (value.length > 127) { + callback(new Error(this.$t('kylinLang.common.overLength127Tip'))) } else { callback() } diff --git a/kystudio/src/locale/en.js b/kystudio/src/locale/en.js index bebacbd1ce..626cb138a9 100644 --- a/kystudio/src/locale/en.js +++ b/kystudio/src/locale/en.js @@ -204,6 +204,7 @@ exports.default = { sqlLimitTip: 'Only the first 100 rows of SQL statements are displayed. Please click the copy button to obtain the complete queries.', sqlPartLimitTip: 'Only parts of SQL statements are displayed. Please click the copy button to obtain the complete queries.', overLengthTip: '50 characters at maximum.', + overLength127Tip: '127 characters at maximum.', dataDirectory: 'Datasource', useOldPasswordTip: 'You are using the password generated by the system to log in, please change the password.', searchDimensionName: 'Search Dimension Name',