Browse Source

Merge pull request #7528 in DEC/decision-webui-dcm from release/11.0 to final/11.0

* commit 'fa9edeaa61dd5676269b221acc332b7419f5a2eb':
  REPORT-94752【视觉验收】数据连接 fix:修复视觉问题
  REPORT-94654 fix:数据连接异常报错问题修复
  REPORT-94752【视觉验收】数据连接 fix: 视觉修复
  REPORT-93097 fix: 修复数据连接多次连接报错问题
  REPORT-91727 对用户输入的参数进行统一校验 DCM仓库也要改下 feat:产品逻辑变更,要求关键字校验不区分大小写
  REPORT-93847 fix: 数据连接样式问题
  REPORT-93628 fix:修改下文件上传的组件样式
  无JIRA任务,顺带处理下数据连接样式
  REPORT-93627【迭代】【平台视觉适配】数据连接管理-模式选择处有滚动条 fix: 并非这次迭代导致,之前就有问题。 调整一下间距的设置大小,防止挤出滚动条
  REPORT-93628【迭代】【平台视觉适配】数据连接管理-修改下密码处的视觉展示 fix: 其实适配6.0的改动不涉及数据连接部分。 但是主风格改为输入框border-bottom风格了,那么这里也需要同步改一下。
  REPORT-93513 fix: 修复长文本显示问题
  REPORT-91727 对用户输入的参数进行统一校验 feat:dcm仓库里面有两个场景,这里引入进来补充
final/11.0
superman 2 years ago
parent
commit
b0d6fe6344
  1. 9
      src/modules/app.ts
  2. 2
      src/modules/components/file_chooser/file_chooser.ts
  3. 8
      src/modules/components/file_upload/file_upload.ts
  4. 10
      src/modules/components/test_status/tip_icon/tip_fail.ts
  5. 6
      src/modules/constants/constant.ts
  6. 52
      src/modules/core/checkIllegalStrings/checkIllegalStrings.ts
  7. 15
      src/modules/core/checkIllegalStrings/constant.ts
  8. 1
      src/modules/core/index.ts
  9. 1
      src/modules/pages/connection/connection.ts
  10. 16
      src/modules/pages/connection/list/list_item/list_item.ts
  11. 5
      src/modules/pages/database/database.ts
  12. 11
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  13. 7
      src/modules/pages/maintain/forms/form.ts
  14. 2
      src/modules/pages/maintain/maintain.ts
  15. 3
      src/modules/pages/setting/setting.ts
  16. 2
      src/modules/title/title.ts
  17. 5
      src/modules/title/title_database/title_datebase.ts
  18. 8
      src/modules/title/title_maintain/title_maintain.ts

9
src/modules/app.ts

@ -38,7 +38,6 @@ export class App extends BI.Widget {
{ {
el: { el: {
type: Title.xtype, type: Title.xtype,
cls: 'bi-border-bottom',
listeners: [{ listeners: [{
eventName: 'EVENT_CLICK_SETTING', eventName: 'EVENT_CLICK_SETTING',
action:() => { action:() => {
@ -82,10 +81,10 @@ export class App extends BI.Widget {
} }
}, },
}, },
left: 10, left: 0,
top: 10, top: 0,
right: 10, right: 0,
bottom: 10, bottom: 0,
}], }],
}, },
], ],

2
src/modules/components/file_chooser/file_chooser.ts

@ -41,7 +41,7 @@ export class FileChooser extends BI.Widget {
items: [ items: [
{ {
type: BI.SignEditor.xtype, type: BI.SignEditor.xtype,
cls: 'bi-border bi-focus-shadow', cls: 'bi-border-bottom bi-focus-shadow',
width, width,
height: 22, height: 22,
watermark, watermark,

8
src/modules/components/file_upload/file_upload.ts

@ -59,7 +59,7 @@ export class FileUpload extends BI.Widget {
items: [ items: [
{ {
type: BI.SignEditor.xtype, type: BI.SignEditor.xtype,
cls: 'bi-border bi-focus-shadow', cls: 'bi-border-bottom bi-focus-shadow',
width: 300, width: 300,
height: 22, height: 22,
watermark, watermark,
@ -144,9 +144,9 @@ export class FileUpload extends BI.Widget {
this.fileModified = _ref; this.fileModified = _ref;
}, },
}] }]
}], }],
}, },
tgap: 14, tgap: 14,
lgap: 4, lgap: 4,
@ -155,7 +155,7 @@ export class FileUpload extends BI.Widget {
type: BI.IconButton.xtype, type: BI.IconButton.xtype,
cls: "default-delete-font", cls: "default-delete-font",
handler: function () { handler: function () {
NProgress.set(0.0); NProgress.set(0.0);
self.xhr.abort(); self.xhr.abort();
self.store.setFileName(''); self.store.setFileName('');
self.clearInfo(); self.clearInfo();

10
src/modules/components/test_status/tip_icon/tip_fail.ts

@ -54,8 +54,7 @@ export class TipFail extends BI.Widget {
}], }],
}, { }, {
type: BI.Label.xtype, type: BI.Label.xtype,
height: 14, _bgap: 10,
bgap: 10,
text: tipText, text: tipText,
ref:(_ref:Label)=>{ ref:(_ref:Label)=>{
this.failText=_ref; this.failText=_ref;
@ -63,12 +62,12 @@ export class TipFail extends BI.Widget {
}, },
{ {
type: BI.VerticalAdaptLayout.xtype, type: BI.VerticalAdaptLayout.xtype,
hgap: 5, hgap: 12,
items: [ items: [
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'),
level: 'ignore', clear: true,
ref: (_ref: Button) => { ref: (_ref: Button) => {
this.detailButton = _ref; this.detailButton = _ref;
}, },
@ -79,8 +78,8 @@ export class TipFail extends BI.Widget {
}, },
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
light: true,
text: BI.i18nText('Dec-Dcm_Back'), text: BI.i18nText('Dec-Dcm_Back'),
level: 'ignore',
handler: () => { handler: () => {
this.fireEvent(TipFail.EVENT_CLOSE); this.fireEvent(TipFail.EVENT_CLOSE);
}, },
@ -89,6 +88,7 @@ export class TipFail extends BI.Widget {
type: BI.Button.xtype, type: BI.Button.xtype,
text: retryText, text: retryText,
handler: () => { handler: () => {
this.store.setIsCollapse(false);
this.fireEvent(TipFail.EVENT_RELOAD); this.fireEvent(TipFail.EVENT_RELOAD);
}, },
}, },

6
src/modules/constants/constant.ts

@ -703,7 +703,7 @@ export const DATA_BASE_TYPES = [
type: 'jdbc', type: 'jdbc',
hasSchema: true, hasSchema: true,
kerberos: false, kerberos: false,
}, },
{ {
text: 'TDSQL', text: 'TDSQL',
databaseType: 'tdsql', databaseType: 'tdsql',
@ -837,7 +837,7 @@ export const DEFAULT_JDBC_POOL = {
}; };
export const CONNECTION_LAYOUT = { export const CONNECTION_LAYOUT = {
hgap: 5, hgap: 10,
vgap: 15, vgap: 15,
labelHeight: 24, labelHeight: 24,
}; };
@ -878,4 +878,4 @@ export const YES_OR_NO = [
text: BI.i18nText('Dec-Basic_No'), text: BI.i18nText('Dec-Basic_No'),
value: 0, value: 0,
} }
] ]

52
src/modules/core/checkIllegalStrings/checkIllegalStrings.ts

@ -0,0 +1,52 @@
/*
https://work.fineres.com/browse/REPORT-91724 用于参数统一校验
*/
import { ILLEGAL_STRINGS } from "./constant";
export type CheckResult = {
legal: boolean,
errorMsg: string,
}
export const CHECK_CORRECT: CheckResult = {
legal: true,
errorMsg: "",
};
/**
*
* @param value
*/
export function checkIllegalStrings(value: string): CheckResult {
// 后端传入的校验开关,如果没传,那也默认开启
const enabled = Dec.system.enableParameterVerify ?? true;
let result = CHECK_CORRECT;
if (enabled) {
// 关键字不区分大小写
ILLEGAL_STRINGS.every(s => {
const sIndex = value.toLowerCase().indexOf(s);
if (sIndex !== -1) {
result = {
legal: false,
errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${value.substr(sIndex, s.length)}`,
};
return false;
}
return true;
});
return result;
}
return result;
}
export function checkIllegalStringsInWidgetAndShowError(widget: any) {
const value = widget.getValue();
const result = checkIllegalStrings(value);
if (!result.legal) {
widget.showError(result.errorMsg);
}
return result.legal;
}

15
src/modules/core/checkIllegalStrings/constant.ts

@ -0,0 +1,15 @@
/**
*
*/
export const ILLEGAL_STRINGS = [
"\"",
"<",
">",
"&",
"/script",
"javascript:",
"onblur",
"getruntime",
"processbuilder",
"java.lang.processimpl",
];

1
src/modules/core/index.ts

@ -0,0 +1 @@
export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings"

1
src/modules/pages/connection/connection.ts

@ -143,7 +143,6 @@ export class Connection extends BI.Widget {
}, },
}], }],
}, },
width: 90,
}, },
], ],
}, },

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

@ -7,6 +7,7 @@ import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../
import { testConnection } from '../../../maintain/forms/form.server'; import { testConnection } from '../../../maintain/forms/form.server';
import { DownListCombo, Label, SignEditor } from '@fui/core'; import { DownListCombo, Label, SignEditor } from '@fui/core';
import { ApiFactory } from '../../../../crud/apiFactory'; import { ApiFactory } from '../../../../crud/apiFactory';
import { checkIllegalStrings } from "@core/index";
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@ -89,6 +90,17 @@ export class ListItem extends BI.BasicButton {
return; return;
} }
const result = checkIllegalStrings(newName);
if (!result.legal) {
BI.Msg.toast(result.errorMsg, {
level: 'error',
});
this.store.setIsEdit(false, name);
this.nameLabel.setText(name);
this.nameEditor.setValue(name);
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) {
@ -210,8 +222,8 @@ export class ListItem extends BI.BasicButton {
private testConnectionAction() { private testConnectionAction() {
// 接口返回的内容是对称加密的,前端要先解密再用新加密传回去 // 接口返回的内容是对称加密的,前端要先解密再用新加密传回去
const connection = this.model.connections const connection = BI.cloneDeep(this.model.connections
.find(item => item.connectionName === this.options.name); .find(item => item.connectionName === this.options.name));
if (BI.isNull(connection)) return; if (BI.isNull(connection)) return;

5
src/modules/pages/database/database.ts

@ -147,20 +147,18 @@ export class Datebase extends BI.Widget {
items: [ items: [
{ {
el: { el: {
type: BI.HTapeLayout.xtype, type: BI.VerticalAdaptLayout.xtype,
hgap: 20, hgap: 20,
invisible: true, invisible: true,
items: [ items: [
{ {
type: BI.Label.xtype, type: BI.Label.xtype,
width: 70,
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
}, },
{ {
type: BI.MultiSelectItem.xtype, type: BI.MultiSelectItem.xtype,
width: 80,
selected: this.model.isInternal, selected: this.model.isInternal,
text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'),
title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'),
@ -173,7 +171,6 @@ export class Datebase extends BI.Widget {
}, },
{ {
type: BI.MultiSelectItem.xtype, type: BI.MultiSelectItem.xtype,
width: 80,
selected: this.model.isPlugin, selected: this.model.isPlugin,
text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'),
title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'),

11
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -423,7 +423,7 @@ export class FormJdbc extends BI.Widget {
{ {
type: BI.Editor.xtype, type: BI.Editor.xtype,
$value: 'password', $value: 'password',
cls: 'bi-border bi-border-radius', cls: 'bi-border-bottom',
width: EDITOR_WIDTH, width: EDITOR_WIDTH,
height: EDITOR_HEIGHT, height: EDITOR_HEIGHT,
allowBlank: true, allowBlank: true,
@ -573,6 +573,7 @@ export class FormJdbc extends BI.Widget {
forms: [ forms: [
{ {
type: BI.VerticalLayout.xtype, type: BI.VerticalLayout.xtype,
height: 55,
items: [ items: [
{ {
type: BI.FloatLeftLayout.xtype, type: BI.FloatLeftLayout.xtype,
@ -595,9 +596,9 @@ export class FormJdbc extends BI.Widget {
}, },
{ {
type: BI.TextValueCombo.xtype, type: BI.TextValueCombo.xtype,
_tgap: 15,
$value: 'schema', $value: 'schema',
width: EDITOR_WIDTH, width: EDITOR_WIDTH,
tgap: 15,
disabled: true, disabled: true,
value: schema, value: schema,
items: schema ? [{ text: schema, value: schema }] : [], items: schema ? [{ text: schema, value: schema }] : [],
@ -715,7 +716,7 @@ export class FormJdbc extends BI.Widget {
{ {
type: BI.Editor.xtype, type: BI.Editor.xtype,
$value: 'temporary-file-pieces-limit', $value: 'temporary-file-pieces-limit',
cls: 'bi-border bi-border-radius', cls: 'bi-border-bottom',
width: EDITOR_WIDTH, width: EDITOR_WIDTH,
height: EDITOR_HEIGHT, height: EDITOR_HEIGHT,
allowBlank: true, allowBlank: true,
@ -735,7 +736,7 @@ export class FormJdbc extends BI.Widget {
{ {
type: BI.Editor.xtype, type: BI.Editor.xtype,
$value: 'temporary-file-size-limit', $value: 'temporary-file-size-limit',
cls: 'bi-border bi-border-radius', cls: 'bi-border-bottom',
width: EDITOR_WIDTH, width: EDITOR_WIDTH,
height: EDITOR_HEIGHT, height: EDITOR_HEIGHT,
allowBlank: true, allowBlank: true,
@ -801,7 +802,7 @@ export class FormJdbc extends BI.Widget {
{ {
type: BI.Editor.xtype, type: BI.Editor.xtype,
$value: 'hdfs-connection-address', $value: 'hdfs-connection-address',
cls: 'bi-border bi-border-radius', cls: 'bi-border-bottom',
width: EDITOR_WIDTH, width: EDITOR_WIDTH,
height: EDITOR_HEIGHT, height: EDITOR_HEIGHT,
allowBlank: true, allowBlank: true,

7
src/modules/pages/maintain/forms/form.ts

@ -8,6 +8,7 @@ import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.ty
import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant';
import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; import { getJdbcDatabaseType, getChartLength } from '../../../app.service';
import { NAME_MAX_LENGTH } from '../../../app.constant'; import { NAME_MAX_LENGTH } from '../../../app.constant';
import { checkIllegalStrings } from "@core/index";
@shortcut() @shortcut()
@store(MaintainFormModel) @store(MaintainFormModel)
@ -209,6 +210,12 @@ export class MaintainForm extends BI.Widget {
if (this.form.validation && !this.form.validation()) { if (this.form.validation && !this.form.validation()) {
return false; return false;
} }
const result = checkIllegalStrings(value.connectionName);
if (!result.legal) {
this.setFromError(result.errorMsg);
return false;
}
return true; return true;
} }

2
src/modules/pages/maintain/maintain.ts

@ -28,7 +28,7 @@ export class Maintain extends BI.Widget {
return { return {
type: BI.VTapeLayout.xtype, type: BI.VTapeLayout.xtype,
hgap: 5, hgap: 16,
items: [ items: [
{ {
type: BI.VerticalAdaptLayout.xtype, type: BI.VerticalAdaptLayout.xtype,

3
src/modules/pages/setting/setting.ts

@ -44,11 +44,11 @@ export class TimeOutSetting extends BI.Widget {
}, { }, {
type: 'bi.vertical', type: 'bi.vertical',
cls: 'bi-card', cls: 'bi-card',
hgap: 10,
vgap: 10, vgap: 10,
items: [ items: [
{ {
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',
hgap: 16,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
height: 32, height: 32,
items: [{ items: [{
@ -61,6 +61,7 @@ export class TimeOutSetting extends BI.Widget {
}, },
{ {
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',
hgap: 16,
items: [{ items: [{
type: 'dec.label.editor.item', type: 'dec.label.editor.item',
text: BI.i18nText('Dec-Over_Time'), text: BI.i18nText('Dec-Over_Time'),

2
src/modules/title/title.ts

@ -11,7 +11,7 @@ export class Title extends BI.Widget {
static xtype = 'dec.dcm.title'; static xtype = 'dec.dcm.title';
props = { props = {
baseCls: 'bi-card', baseCls: '',
} }
tab: Tab; tab: Tab;
linearSegment: LinearSegment; linearSegment: LinearSegment;

5
src/modules/title/title_database/title_datebase.ts

@ -25,13 +25,13 @@ export class TitleDatabase extends BI.Widget {
items: [{ items: [{
type: BI.VerticalAdaptLayout.xtype, type: BI.VerticalAdaptLayout.xtype,
height: 40, height: 40,
rgap: 5, rgap: 16,
items: [ items: [
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
$value: 'title-database-cancel', $value: 'title-database-cancel',
text: BI.i18nText('BI-Basic_Cancel'), text: BI.i18nText('BI-Basic_Cancel'),
level: 'ignore', light: true,
handler: () => { handler: () => {
this.store.setPageIndex(PAGE_INDEX.CONNECTION); this.store.setPageIndex(PAGE_INDEX.CONNECTION);
}, },
@ -49,6 +49,7 @@ export class TitleDatabase extends BI.Widget {
}, },
}, },
], ],
_rgap: -16,
}], }],
}; };
} }

8
src/modules/title/title_maintain/title_maintain.ts

@ -15,13 +15,13 @@ export class TitleMaintain extends BI.Widget {
items: [{ items: [{
type: BI.VerticalAdaptLayout.xtype, type: BI.VerticalAdaptLayout.xtype,
height: 40, height: 40,
rgap: 5,
items: [ items: [
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
$value: 'title-maintain-cancel', $value: 'title-maintain-cancel',
text: BI.i18nText('BI-Basic_Cancel'), text: BI.i18nText('BI-Basic_Cancel'),
level: 'ignore', clear: true,
_rgap: 16,
handler: () => { handler: () => {
this.store.setIsCopy(false); this.store.setIsCopy(false);
this.store.setPageIndex(PAGE_INDEX.CONNECTION); this.store.setPageIndex(PAGE_INDEX.CONNECTION);
@ -30,15 +30,17 @@ export class TitleMaintain extends BI.Widget {
}, },
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
_rgap: 16,
$value: 'title-maintain-connection-test', $value: 'title-maintain-connection-test',
text: BI.i18nText('Dec-Dcm_Connection_Test'), text: BI.i18nText('Dec-Dcm_Connection_Test'),
level: 'ignore', light: true,
handler: () => { handler: () => {
this.store.setTestEvent(); this.store.setTestEvent();
}, },
}, },
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
_rgap: 16,
$value: 'title-maintain-save', $value: 'title-maintain-save',
text: BI.i18nText('BI-Basic_Save'), text: BI.i18nText('BI-Basic_Save'),
handler: () => { handler: () => {

Loading…
Cancel
Save