From cca3760ccac7844bfab2bfa070684729dbe0c925 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 8 Jan 2020 13:49:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-11815=20=E4=BF=AE=E6=94=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=90=8D=E7=A7=B0=E7=9A=84=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 2 +- private/i18n.ts | 2 +- src/modules/app.constant.ts | 4 ++++ .../pages/connection/list/list_item/list_item.model.ts | 7 +++++++ src/modules/pages/maintain/forms/form.ts | 5 +++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 7c92a95..64b350f 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -110,7 +110,7 @@ Dec-Dcm_Connection_Deleted=该数据连接已被删除,无法进行操作 Dec-Dcm_Connection_Click_Connect_Database=点击连接数据库 Dec-Dcm_Connection_Read_Mode_List=以读取模式列表 Dec-Dcm_Connection_NO_Connection_Pool=无数据连接,可在数据连接管理页面添加 -Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于200个字符 +Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于150个字符 Dec-Dcm_Login_Error=登录信息已失效,请重新登录 BI-Multi_Date_Quarter_End= 季度末 BI-Multi_Date_Month_Begin= 月初 diff --git a/private/i18n.ts b/private/i18n.ts index 20f08e7..8c93ffa 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -109,7 +109,7 @@ export default { 'Dec-Dcm_Connection_Click_Connect_Database': '点击连接数据库', 'Dec-Dcm_Connection_Read_Mode_List': '以读取模式列表', 'Dec-Dcm_Connection_NO_Connection_Pool': '无数据连接,可在数据连接管理页面添加', - 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于200个字符', + 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于150个字符', 'Dec-Dcm_Login_Error': '登录信息已失效,请重新登录', 'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Month_Begin': '月初', diff --git a/src/modules/app.constant.ts b/src/modules/app.constant.ts index ebb5253..618bdc3 100644 --- a/src/modules/app.constant.ts +++ b/src/modules/app.constant.ts @@ -1,2 +1,6 @@ export const CONSTANT_PLUGIN_TYPES = 'dec.constant.database.conf.connect.types'; BI.constant(CONSTANT_PLUGIN_TYPES, []); +/** + * 数据连接名称的最大长度 + */ +export const NAME_MAX_LENGTH = 150; diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index 1e5ab05..608a428 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/src/modules/pages/connection/list/list_item/list_item.model.ts @@ -2,6 +2,8 @@ import { model, Model } from '@core/core'; import { AppModel } from '../../../../app.model'; import { ApiFactory } from '../../../../crud/apiFactory'; import { ResultType } from '../../../../crud/crud.typings'; +import { getChartLength } from '../../../../app.service'; +import { NAME_MAX_LENGTH } from '../../../../app.constant'; const api = new ApiFactory().create(); export const ListItemModelXtype = 'dec.dcm.model.connection.list_item'; @@ -63,6 +65,11 @@ export class ListItemModel extends Model<{ resolve({ errorCode: '1', errorMsg: 'Dec-Dcm_Connection_ConnectionName_Cannt_Null' }); }); } + if (getChartLength(newName) > NAME_MAX_LENGTH) { + return new Promise(resolve => { + resolve({ errorCode: '1', errorMsg: 'Dec-Dcm_Connection_Cannot_Too_Lang' }); + }); + } const hasNamed = this.model.connections.some(item => item.connectionName === newName); if (hasNamed && oldName !== newName) { return new Promise(resolve => { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 34fa0f2..72159a0 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -7,6 +7,7 @@ import { connectionType, errorCode } from '@constants/env'; import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; +import { NAME_MAX_LENGTH } from '../../../app.constant'; export const MaintainFormXtype = 'dec.dcm.maintain.form'; @shortcut(MaintainFormXtype) @store(MaintainFormModelXtype) @@ -186,7 +187,7 @@ export class MaintainForm extends BI.Widget { return false; } } - if (getChartLength(value.connectionName) > 200) { + if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); return false; @@ -220,7 +221,7 @@ export class MaintainForm extends BI.Widget { return; } - if (getChartLength(formValue.connectionName) > 200) { + if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); return false;