Browse Source

fix: 右侧重命名时也加入验证

qufenxi
alan 5 years ago
parent
commit
d61a9d832e
  1. 9
      src/modules/pages/connection/list/list_item/list_item.ts

9
src/modules/pages/connection/list/list_item/list_item.ts

@ -4,7 +4,7 @@ import './list_item.less';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { ListItemModel, ListItemModelXtype } from './list_item.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { hasRegistered } from '../list.service'; import { hasRegistered } from '../list.service';
import { connectionCanEdit, getTextByDatabaseType } from '../../../../app.service'; import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service';
import { testConnection } from '../../../maintain/forms/form.server'; import { testConnection } from '../../../maintain/forms/form.server';
export const ListItemXtype = 'dec.dcm.connection.list_item'; export const ListItemXtype = 'dec.dcm.connection.list_item';
@ -71,6 +71,13 @@ export class ListItem extends BI.BasicButton {
eventName: BI.SignEditor.EVENT_BLUR, eventName: BI.SignEditor.EVENT_BLUR,
action: () => { action: () => {
const newName = this.nameEditor.getValue(); const newName = this.nameEditor.getValue();
if (getChartLength(newName) > 200) {
BI.Msg.toast(BI.i18nText(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')), {
level: 'error',
});
return;
}
this.store.changeName(name, newName).then(re => { this.store.changeName(name, newName).then(re => {
this.store.setIsEdit(false, name); this.store.setIsEdit(false, name);
if (re.errorCode) { if (re.errorCode) {

Loading…
Cancel
Save