Browse Source

fix: DEC-11815 修改数据连接名称的长度限制

research/10.0
alan 5 years ago
parent
commit
cca3760cca
  1. 2
      i18n/zh_cn.properties
  2. 2
      private/i18n.ts
  3. 4
      src/modules/app.constant.ts
  4. 7
      src/modules/pages/connection/list/list_item/list_item.model.ts
  5. 5
      src/modules/pages/maintain/forms/form.ts

2
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= 月初

2
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': '月初',

4
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;

7
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 => {

5
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;

Loading…
Cancel
Save