Browse Source
* commit 'e89681f83c91994716f26f1849d4447405cc9b77': (115 commits) BI-144496 fix: 数据连接增加埋点 getJdyDataLinkAppList REPORT-112276 公共数据取数简道云数据连接部分适配 设计优先级,优先使用平台内置的 FDL-9101 fix: 修复hana数据连接url联动输入框异常问题 REPORT-112768 fix: 修复数据连接更新视图不同步问题 REPORT-112768 fix: 修复数据连接更新视图不同步问题 REPORT-111534 fix:数据连接脏数据容错 无JIRA任务,修复打包问题 REPORT-109671 feat:druid校验语句问题 REPORT-110986 feat: 数据连接支持跳转至详情&联动 REPORT-110986 feat: 数据连接支持跳转至详情&联动 FDL-9101 fix: 修复saphana数据连接失败问题 FDL-9101 fix: 修复saphana数据连接失败问题 REPORT-107734 fix:【数据连接增加fetchsize配置项】tdsql数据连接特殊处理下 REPORT-107734【平台前端适配】数据连接增加fetchsize配置项 REPORT-102763 fix:数据连接支持对接业务系统-接口补充 REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错 REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错 REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错 REPORT-99289 删除代码中的debugger ...research/mss-2.0
superman
7 months ago
61 changed files with 4502 additions and 1425 deletions
@ -1,3 +1,13 @@
|
||||
module.exports = function (api) { |
||||
return require("@fui/babel-preset-fineui").configs.base(api) |
||||
module.exports = api => { |
||||
const { plugins, presets, sourceType } = require("@fui/babel-preset-fineui").configs.base(api); |
||||
|
||||
return { |
||||
compact: false, |
||||
presets, |
||||
sourceType, |
||||
plugins: [ |
||||
...plugins, |
||||
"@babel/plugin-proposal-logical-assignment-operators", |
||||
], |
||||
}; |
||||
}; |
||||
|
@ -0,0 +1,68 @@
|
||||
import { model, Model } from '@core/core'; |
||||
|
||||
type RootInfo = { |
||||
url: string; // api url
|
||||
prefix: string; // 路径前缀
|
||||
root: string; // 根文件夹名称
|
||||
}; |
||||
|
||||
export const ROOT_INFO_MAP: Record<string, RootInfo> = { |
||||
// 证书 resources/certificates/
|
||||
certificates: { |
||||
url: '/v10/certificates/all', |
||||
prefix: 'resources/', |
||||
root: 'certificates', |
||||
}, |
||||
}; |
||||
|
||||
@model() |
||||
export class FileChooserModel extends Model { |
||||
static xtype = 'dec.dcm.model.components.file_chooser'; |
||||
|
||||
private options: { |
||||
root: string; |
||||
}; |
||||
|
||||
state() { |
||||
return { |
||||
keyword: '', // 搜索关键字
|
||||
items: [], // 文件项
|
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
/** |
||||
* 请求获取items |
||||
* @param callback 回调 |
||||
*/ |
||||
requestGetItems: (callback?: Function) => { |
||||
const { keyword } = this.model; |
||||
const { url, prefix, root } = ROOT_INFO_MAP[this.options.root]; |
||||
const requestUrl = `${url}?keyword=${encodeURIComponent(keyword)}`; |
||||
Dec.reqGetHandle(requestUrl, '', (data) => { |
||||
this.model.items = data |
||||
.concat({ |
||||
id: root, |
||||
text: prefix + root, |
||||
value: prefix + root, |
||||
isParent: true, |
||||
}) |
||||
.map((item) => ({ |
||||
...item, |
||||
value: prefix + item.path, |
||||
open: item.id === root || BI.isKey(keyword), |
||||
})); |
||||
BI.isFunction(callback) && callback(); |
||||
}); |
||||
}, |
||||
|
||||
/** |
||||
* 设置keyword |
||||
* @param value |
||||
*/ |
||||
setKeyword: (value: string) => { |
||||
this.model.keyword = value; |
||||
this.requestGetItems(); |
||||
}, |
||||
}; |
||||
} |
@ -0,0 +1,183 @@
|
||||
import { EVENT_CHANGE } from './../collapse/collapse'; |
||||
import { shortcut, store } from '@core/core'; |
||||
import { SignEditor, MultiLayerSingleLevelTree, SearchEditor, Button, Editor } from '@fui/core'; |
||||
import { FileChooserModel } from './file_chooser.model'; |
||||
|
||||
@shortcut() |
||||
@store(FileChooserModel, { |
||||
props(this: FileChooser) { |
||||
return this.options; |
||||
}, |
||||
}) |
||||
export class FileChooser extends BI.Widget { |
||||
static xtype = 'dec.dcm.components.file_chooser'; |
||||
|
||||
props = { |
||||
width: 300, |
||||
root: '', // 含义见model中的RootInfo
|
||||
watermark: '', |
||||
value: '', |
||||
}; |
||||
|
||||
model: FileChooserModel['model']; |
||||
store: FileChooserModel['store']; |
||||
watch = { |
||||
items: (value) => { |
||||
this.fileTree.populate(value); |
||||
}, |
||||
}; |
||||
|
||||
textEditor: SignEditor; |
||||
keywordEditor: SearchEditor; |
||||
fileTree: MultiLayerSingleLevelTree; |
||||
sureButton: Button; |
||||
|
||||
render() { |
||||
const { width, watermark, value } = this.options; |
||||
|
||||
return { |
||||
type: BI.VerticalAdaptLayout.xtype, |
||||
height: 24, |
||||
items: [ |
||||
{ |
||||
type: BI.SignEditor.xtype, |
||||
cls: 'bi-border-bottom bi-focus-shadow', |
||||
width, |
||||
height: 22, |
||||
watermark, |
||||
title: value, |
||||
value, |
||||
ref: (_ref: SignEditor) => { |
||||
this.textEditor = _ref; |
||||
}, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.SignEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.textEditor.getValue(); |
||||
this.setValue(value); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.Button.xtype, |
||||
|
||||
text: BI.i18nText('Dec-Basic_Choose_File'), |
||||
clear: true, |
||||
handler: () => { |
||||
this.openFileChoosePopover(); |
||||
}, |
||||
}, |
||||
lgap: 10, |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
|
||||
getValue(): string { |
||||
return this.textEditor.getValue(); |
||||
} |
||||
|
||||
setValue(value: string) { |
||||
this.options.value = value; |
||||
this.textEditor.text.setTitle(value); |
||||
this.textEditor.setValue(value); |
||||
} |
||||
|
||||
/** |
||||
* 打开文件选择弹窗 |
||||
*/ |
||||
private openFileChoosePopover() { |
||||
// 重置搜索关键词
|
||||
this.store.setKeyword(''); |
||||
// 创建并显示窗口
|
||||
const popoverName = BI.UUID(); |
||||
BI.Popovers.create( |
||||
popoverName, |
||||
{ |
||||
header: BI.i18nText('Dec-Data_Set_File_Select_Server_File'), |
||||
body: { |
||||
type: BI.VTapeLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: BI.SearchEditor.xtype, |
||||
ref: (ref: SearchEditor) => { |
||||
this.keywordEditor = ref; |
||||
}, |
||||
height: 24, |
||||
value: this.model.keyword, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.SearchEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.keywordEditor.getValue(); |
||||
this.store.setKeyword(value); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: BI.SearchEditor.EVENT_CLEAR, |
||||
action: () => { |
||||
this.store.setKeyword(''); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.MultiLayerSingleLevelTree.xtype, |
||||
ref: (ref: MultiLayerSingleLevelTree) => { |
||||
this.fileTree = ref; |
||||
}, |
||||
keywordGetter: () => this.model.keyword, |
||||
items: this.model.items, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.MultiLayerSingleLevelTree.EVENT_CHANGE, |
||||
action: () => { |
||||
this.sureButton.setEnable(true); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
tgap: 15, |
||||
}, |
||||
{ |
||||
type: BI.RightVerticalAdaptLayout.xtype, |
||||
height: 24, |
||||
vgap: 10, |
||||
items: [ |
||||
{ |
||||
type: BI.Button.xtype, |
||||
text: BI.i18nText('BI-Basic_Cancel'), |
||||
level: 'ignore', |
||||
handler: () => { |
||||
BI.Popovers.remove(popoverName); |
||||
}, |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.Button.xtype, |
||||
ref: (ref: Button) => { |
||||
this.sureButton = ref; |
||||
}, |
||||
text: BI.i18nText('BI-Basic_OK'), |
||||
disabled: true, |
||||
handler: () => { |
||||
const value = this.fileTree.getValue()[0]; |
||||
this.setValue(value); |
||||
BI.Popovers.remove(popoverName); |
||||
}, |
||||
}, |
||||
lgap: 10, |
||||
}, |
||||
], |
||||
}, |
||||
], |
||||
}, |
||||
}, |
||||
this |
||||
).show(popoverName); |
||||
} |
||||
} |
@ -0,0 +1,13 @@
|
||||
.data-conf-file { |
||||
.x-icon{ |
||||
width: 48px; |
||||
height: 48px; |
||||
} |
||||
} |
||||
|
||||
.data-keytab-file { |
||||
.x-icon{ |
||||
width: 48px; |
||||
height: 48px; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
import { model, Model } from '@core/core'; |
||||
|
||||
type UploadParam = { |
||||
keytabPath: string; |
||||
krb5ConfPath: string; |
||||
principal: string; |
||||
} |
||||
|
||||
@model() |
||||
export class FileUploadModel extends Model { |
||||
static xtype = 'dec.dcm.model.components.file_upload'; |
||||
|
||||
private options: { |
||||
inter: string; |
||||
} |
||||
|
||||
state() { |
||||
return { |
||||
uploadUrl: '', |
||||
fileName: '', |
||||
}; |
||||
} |
||||
|
||||
actions = { |
||||
setFileInfo: (params: UploadParam) => { |
||||
const inter = this.options.inter; |
||||
|
||||
this.model.uploadUrl = Dec.Utils.getEncodeURL(Dec.fineServletURL + inter, "", params); |
||||
}, |
||||
|
||||
setFileName:(v: string) => { |
||||
this.model.fileName = v; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,327 @@
|
||||
import { shortcut, store } from '@core/core'; |
||||
import { SignEditor, MultiLayerSingleLevelTree, SearchEditor, Button, Editor, Label } from '@fui/core'; |
||||
import { FileUploadModel } from './file_upload.model'; |
||||
import { ApiFactory } from 'src/modules/crud/apiFactory'; |
||||
import './file_upload.less'; |
||||
|
||||
const api = new ApiFactory().create(); |
||||
|
||||
@shortcut() |
||||
@store(FileUploadModel, { |
||||
props(this: FileUpload) { |
||||
return this.options; |
||||
}, |
||||
}) |
||||
export class FileUpload extends BI.Widget { |
||||
public static xtype = "dec.dcm.components.file_upload"; |
||||
public static EVENT_CHECK_SUCCESS = 'EVENT_CHECK_SUCCESS'; |
||||
public static EVENT_CLEAR_FILE = 'EVENT_CLEAR_FILE'; |
||||
|
||||
public props = { |
||||
watermark: '', |
||||
value: '', |
||||
processId: '', |
||||
disabled: false, |
||||
inter: '', |
||||
access: '', |
||||
iconCls: '' |
||||
}; |
||||
|
||||
model: FileUploadModel['model']; |
||||
store: FileUploadModel['store']; |
||||
watch = { |
||||
uploadUrl: function () { |
||||
this.uploader.setUrl(this.model.uploadUrl); |
||||
}, |
||||
}; |
||||
|
||||
public textEditor: SignEditor; |
||||
public keywordEditor: SearchEditor; |
||||
public fileTree: MultiLayerSingleLevelTree; |
||||
public sureButton: Button; |
||||
public infoLabel: Label; |
||||
|
||||
public render() { |
||||
const { width, watermark, value, processId, inter } = this.options; |
||||
let self = this; |
||||
const processName = BI.concat("process-", processId); |
||||
const processClass = BI.concat(".process-", processId); |
||||
this.setFileInfo({ |
||||
keytabPath: '', |
||||
principal:'', |
||||
krb5ConfPath: '', |
||||
}); |
||||
|
||||
return { |
||||
type: BI.VerticalLayout.xtype, |
||||
items:[{ |
||||
type: BI.FloatLeftLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: BI.SignEditor.xtype, |
||||
cls: 'bi-border-bottom bi-focus-shadow', |
||||
width: 300, |
||||
height: 22, |
||||
watermark, |
||||
disabled: true, |
||||
value, |
||||
ref: (_ref: SignEditor) => { |
||||
this.textEditor = _ref; |
||||
}, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.SignEditor.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.textEditor.getValue(); |
||||
this.setValue(value); |
||||
}, |
||||
}, |
||||
], |
||||
}, { |
||||
type: BI.Button.xtype, |
||||
width: 100, |
||||
_lgap: 10, |
||||
iconCls: "upload-font", |
||||
level: "ignore", |
||||
ghost: true, |
||||
ref: (_ref: Button) => { |
||||
this.uploadButton = _ref; |
||||
}, |
||||
text: BI.i18nText('Dec-Basic_Choose_File'), |
||||
handler: () => { |
||||
this.uploader.select(); |
||||
}, |
||||
}, |
||||
], |
||||
}, { |
||||
type: BI.FloatLeftLayout.xtype, |
||||
tgap: 8, |
||||
invisible: true, |
||||
ref: (_ref) => { |
||||
this.fileInfo = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: BI.VerticalLayout.xtype, |
||||
cls: "bi-border", |
||||
items: [{ |
||||
type: BI.HTapeLayout.xtype, |
||||
height: 68, |
||||
width: 300, |
||||
items: [{ |
||||
el: { |
||||
type: BI.IconLabel.xtype, |
||||
cls: this.options.iconCls, |
||||
}, |
||||
width: 48, |
||||
lgap: 8, |
||||
}, { |
||||
el: { |
||||
type: BI.VerticalLayout.xtype, |
||||
items : [{ |
||||
type: BI.Label.xtype, |
||||
width: 200, |
||||
height: 20, |
||||
textAlign: "left", |
||||
ref: (_ref: Label) => { |
||||
this.fileName = _ref; |
||||
}, |
||||
},{ |
||||
type: BI.VerticalAdaptLayout.xtype, |
||||
items: [{ |
||||
type: BI.Label.xtype, |
||||
cls: "bi-tips", |
||||
height: 20, |
||||
rgap: 3, |
||||
ref: (_ref: Label) => { |
||||
this.fileSize = _ref; |
||||
}, |
||||
}, { |
||||
type: BI.Label.xtype, |
||||
cls: "bi-tips", |
||||
height: 20, |
||||
ref: (_ref: Label) => { |
||||
this.fileModified = _ref; |
||||
}, |
||||
}] |
||||
|
||||
}], |
||||
|
||||
}, |
||||
tgap: 14, |
||||
lgap: 4, |
||||
}, { |
||||
el: { |
||||
type: BI.IconButton.xtype, |
||||
cls: "default-delete-font", |
||||
handler: function () { |
||||
NProgress.set(0.0); |
||||
self.xhr.abort(); |
||||
self.store.setFileName(''); |
||||
self.clearInfo(); |
||||
self.fireEvent(FileUpload.EVENT_CLEAR_FILE); |
||||
|
||||
}, |
||||
}, |
||||
rgap: 10, |
||||
}] |
||||
}, { |
||||
type: BI.VerticalLayout.xtype, |
||||
cls: processName, |
||||
width: 300, |
||||
height: 1, |
||||
}] |
||||
|
||||
}, { |
||||
el :{ |
||||
type: BI.VerticalLayout.xtype, |
||||
cls: "bi-error", |
||||
ref: (_ref: any) => { |
||||
this.errorInfo = _ref; |
||||
}, |
||||
invisible: true, |
||||
items : [{ |
||||
type: BI.Label.xtype, |
||||
height: 20, |
||||
textAlign: "left", |
||||
ref: (_ref: Label) => { |
||||
this.errorCode = _ref; |
||||
}, |
||||
},{ |
||||
type: BI.Label.xtype, |
||||
height: 20, |
||||
textAlign: "left", |
||||
ref: (_ref: Label) => { |
||||
this.errorMsg = _ref; |
||||
}, |
||||
}, { |
||||
type: BI.VerticalAdaptLayout.xtype, |
||||
rgap: 5, |
||||
items: [ |
||||
{ |
||||
type: BI.Label.xtype, |
||||
text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip1'), |
||||
},{ |
||||
type: BI.TextButton.xtype, |
||||
cls: "bi-high-light bi-high-light-border-bottom", |
||||
text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip2'), |
||||
handler: function () { |
||||
window.open(Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.KERBEROS_CONF_HELP]); |
||||
}, |
||||
},{ |
||||
type: BI.Label.xtype, |
||||
text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip3'), |
||||
} |
||||
], |
||||
},], |
||||
}, |
||||
vgap: 4, |
||||
lgap: 8, |
||||
} |
||||
], |
||||
}, { |
||||
type: BI.MultifileEditor.xtype, |
||||
ref: (ref:any) => { |
||||
self.uploader = ref; |
||||
}, |
||||
url: this.model.uploadUrl, |
||||
accept: this.options.accept, |
||||
listeners: [ |
||||
{ |
||||
// 选择文件
|
||||
eventName: BI.MultifileEditor.EVENT_CHANGE, |
||||
action: function (files) { |
||||
self.options.attachId = ''; |
||||
const fileInfo = files.files[0]; |
||||
self.setInfo(fileInfo); |
||||
self.store.setFileName(fileInfo.fileName); |
||||
this.upload(); |
||||
NProgress.configure({ parent: processClass, minimum: 0.0 }); |
||||
}, |
||||
}, |
||||
{ |
||||
// 上传进度刷新
|
||||
eventName: BI.MultifileEditor.EVENT_PROGRESS, |
||||
action: function (progress) { |
||||
let rate = progress.loaded/progress.total; |
||||
NProgress.set(rate); |
||||
}, |
||||
}, |
||||
{ |
||||
// 开始上传文件
|
||||
eventName: BI.MultifileEditor.EVENT_UPLOADSTART, |
||||
action: function (progressEvent, xhr) { |
||||
self.xhr = xhr; |
||||
}, |
||||
}, |
||||
{ |
||||
// 上传文件完毕
|
||||
eventName: BI.MultifileEditor.EVENT_UPLOADED, |
||||
action: function () { |
||||
const uploadedInfo = this.getValue(); |
||||
const failed = BI.some(uploadedInfo, function (index, file) { |
||||
if (file.data.errorCode) { |
||||
BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Error'), { |
||||
level: "error", |
||||
}); |
||||
self.setErrorInfo(file.data) |
||||
return true; |
||||
} |
||||
}); |
||||
const key = self.options.processId +'Path'; |
||||
!failed && self.setValue(uploadedInfo[0].data.kerberosInfo[key]); |
||||
!failed && self.fireEvent(FileUpload.EVENT_CHECK_SUCCESS, uploadedInfo[0].data); |
||||
!failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ |
||||
level: "success" |
||||
}); |
||||
NProgress.configure({ parent: 'body'}); |
||||
|
||||
}, |
||||
}, |
||||
], |
||||
}] |
||||
|
||||
}; |
||||
} |
||||
|
||||
public getValue(): string { |
||||
return this.options.value; |
||||
} |
||||
|
||||
public setValue(value: string) { |
||||
this.options.value = value; |
||||
this.textEditor.text.setTitle(value); |
||||
this.textEditor.setValue(value); |
||||
} |
||||
|
||||
public setInfo(info: any) { |
||||
this.uploadButton.setEnable(false); |
||||
this.fileInfo.setVisible(true); |
||||
this.textEditor.setValue(info.fileName); |
||||
this.fileName.setText(info.fileName); |
||||
this.fileSize.setText(Dec.Utils.getByteWidthUnit(info.size)); |
||||
this.fileModified.setText(BI.getDate().print("%Y-%X-%d %H:%M:%S")) |
||||
} |
||||
|
||||
public clearInfo() { |
||||
this.uploadButton.setEnable(true); |
||||
this.fileInfo.setVisible(false); |
||||
this.errorInfo.setVisible(false); |
||||
this.textEditor.setValue(''); |
||||
this.options.attachId = ''; |
||||
} |
||||
|
||||
public setErrorInfo(errorInfo: any) { |
||||
this.errorInfo.setVisible(true); |
||||
this.errorCode.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorCode") + ":"+ errorInfo.errorCode); |
||||
this.errorMsg.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorMsg") + ":" + errorInfo.errorMessage); |
||||
} |
||||
|
||||
public setEnable(v) { |
||||
this.uploadButton._setEnable(v); |
||||
} |
||||
|
||||
public setFileInfo(params) { |
||||
this.store.setFileInfo(params); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
import { shortcut } from '@core/core'; |
||||
import { BubbleCombo, BubblePopupView, IconButton } from '@fui/core'; |
||||
|
||||
@shortcut() |
||||
export class TipsCombo extends BI.Widget { |
||||
public static xtype = 'dec.dcm.tips.combo'; |
||||
|
||||
public props: BubblePopupView['props'] & IconButton['props'] = { |
||||
trigger: 'hover', |
||||
direction: 'top' |
||||
}; |
||||
|
||||
private bubbleCombo: BubbleCombo; |
||||
|
||||
private bubbleComboPopup: BubblePopupView; |
||||
|
||||
public render() { |
||||
const { direction, trigger, el } = this.options; |
||||
|
||||
return { |
||||
type: BI.BubbleCombo.xtype, |
||||
trigger, |
||||
direction, |
||||
el: { |
||||
type: BI.IconButton.xtype, |
||||
cls: "detail-font", |
||||
}, |
||||
popup: { |
||||
type: BI.BubblePopupView.xtype, |
||||
ref: (_ref: BubblePopupView) => { |
||||
this.bubbleComboPopup = _ref; |
||||
}, |
||||
el, |
||||
}, |
||||
listeners: [], |
||||
ref: (_ref: BubbleCombo) => { |
||||
this.bubbleCombo = _ref; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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; |
||||
} |
@ -0,0 +1,15 @@
|
||||
/** |
||||
* 参数检验的非法字符数组,由于不区分大小写,统一用小写 |
||||
*/ |
||||
export const ILLEGAL_STRINGS = [ |
||||
"\"", |
||||
"<", |
||||
">", |
||||
"&", |
||||
"/script", |
||||
"javascript:", |
||||
"onblur", |
||||
"getruntime", |
||||
"processbuilder", |
||||
"java.lang.processimpl", |
||||
]; |
@ -0,0 +1 @@
|
||||
export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings" |
@ -0,0 +1,24 @@
|
||||
BI.point("dec.dcm.model.connection", "createNewConnection", () => { |
||||
Dec.Utils.saveFocusPoint({ |
||||
id: "E73325", |
||||
title: "新建数据连接", |
||||
}); |
||||
}); |
||||
|
||||
BI.point("dec.dcm.model.title_maintain", "setTestEvent", () => { |
||||
Dec.Utils.saveFocusPoint({ |
||||
id: "E73328", |
||||
title: "测试数据连接", |
||||
}); |
||||
}); |
||||
|
||||
BI.point("dec.dcm.model.maintain_form", "addConnection", function () { |
||||
Dec.Utils.saveFocusPoint({ |
||||
id: "E8827", |
||||
title: "保存数据连接", |
||||
body: { |
||||
datebaseType: this.model.datebaseTypeSelected, |
||||
databaseName: this.model.connectionSelected, |
||||
}, |
||||
}); |
||||
}); |
@ -0,0 +1 @@
|
||||
BI.constant('dec.constant.connection.list', []); |
@ -0,0 +1,17 @@
|
||||
import { DATEBASE_FILTER_TYPE } from "@constants/constant"; |
||||
|
||||
BI.constant('dec.constant.database.filter.type', [ |
||||
{ |
||||
text: BI.i18nText('Dec-Dcm_Connection_Commonly'), |
||||
value: DATEBASE_FILTER_TYPE.COMMONLY, |
||||
selected: true, |
||||
}, |
||||
{ |
||||
text: BI.i18nText('Dec-Dcm_Connection_All'), |
||||
value: DATEBASE_FILTER_TYPE.ALL, |
||||
}, |
||||
{ |
||||
text: BI.i18nText('Dec-Dcm_Connection_Other'), |
||||
value: DATEBASE_FILTER_TYPE.OTHER, |
||||
}, |
||||
]); |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,96 @@
|
||||
import { shortcut } from '@core/core'; |
||||
import { ApiFactory } from 'src/modules/crud/apiFactory'; |
||||
|
||||
const api = new ApiFactory().create(); |
||||
|
||||
@shortcut() |
||||
export class TimeOutSetting extends BI.Widget { |
||||
public static xtype = 'dec.dcm.page.timeout.setting'; |
||||
|
||||
public props = { |
||||
value: 0, |
||||
}; |
||||
|
||||
beforeRender(cb: Function) { |
||||
const self = this; |
||||
api.getTimeOut().then(res => { |
||||
self.props.value = res.data.count; |
||||
cb(); |
||||
}); |
||||
} |
||||
|
||||
public render() { |
||||
const { value } = this.props; |
||||
const self = this; |
||||
|
||||
return { |
||||
type: 'bi.vtape', |
||||
cls: 'bi-background', |
||||
items: [{ |
||||
type: 'dec.setting.header', |
||||
height: 40, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CANCEL', |
||||
action: function () { |
||||
self.fireEvent('EVENT_CHANGE'); |
||||
}, |
||||
}, { |
||||
eventName: 'EVENT_SAVE', |
||||
action: function () { |
||||
api.putTimeOut(Number(self.editor.getValue())); |
||||
self.fireEvent('EVENT_CHANGE'); |
||||
}, |
||||
}], |
||||
}, { |
||||
type: 'bi.vertical', |
||||
cls: 'bi-card', |
||||
vgap: 10, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
cls: 'bi-border-bottom', |
||||
height: 40, |
||||
items: [{ |
||||
type: 'bi.label', |
||||
textAlign: 'left', |
||||
width: 120, |
||||
cls: 'dec-font-weight-bold', |
||||
text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), |
||||
}] |
||||
}, tgap: -10, hgap: 16, |
||||
}, |
||||
{ |
||||
type: 'bi.vertical_adapt', |
||||
hgap: 16, |
||||
items: [{ |
||||
type: 'dec.label.editor.item', |
||||
text: BI.i18nText('Dec-Over_Time'), |
||||
textWidth: 100, |
||||
editorWidth: 80, |
||||
allowBlank: false, |
||||
value: value, |
||||
validationChecker: function(v) { |
||||
return BI.isPositiveInteger(v); |
||||
}, |
||||
errorText: BI.i18nText('BI-Please_Input_Positive_Integer'), |
||||
ref: function (_ref) { |
||||
self.editor = _ref; |
||||
}, |
||||
}, { |
||||
el: { |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-Dcm_Connection_Timeout_Millisecond'), |
||||
}, |
||||
lgap: 10, |
||||
}] |
||||
|
||||
}, |
||||
] |
||||
}], |
||||
ref: function (_ref) { |
||||
self.setting = _ref; |
||||
}, |
||||
}; |
||||
} |
||||
} |
Loading…
Reference in new issue