Compare commits
No commits in common. 'persist/11.0' and 'qufenxi' have entirely different histories.
persist/11
...
qufenxi
101 changed files with 13093 additions and 6255 deletions
@ -1,13 +1,3 @@
|
||||
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", |
||||
], |
||||
}; |
||||
module.exports = function (api) { |
||||
return require("@fui/babel-preset-fineui").configs.base(api) |
||||
}; |
||||
|
@ -1,5 +1,5 @@
|
||||
import { App } from './modules/app'; |
||||
import { AppXtype } from './modules/app'; |
||||
BI.createWidget({ |
||||
type: App.xtype, |
||||
type: AppXtype, |
||||
element: '#wrapper', |
||||
}); |
||||
|
@ -1,5 +1,5 @@
|
||||
@import "../../node_modules/@fui/core/src/less/lib/colors.less"; |
||||
@import '../../node_modules/@fui/core/src/less/visual.less'; |
||||
@import "../../node_modules/fineui/src/less/lib/colors.less"; |
||||
@import '../../node_modules/fineui/src/less/visual.less'; |
||||
@import "background.less"; |
||||
@import "font.less"; |
||||
@import "var.less"; |
@ -1,177 +1,9 @@
|
||||
import { CONSTANT_PLUGIN_TYPES } from './app.constant'; |
||||
import { DATA_BASE_TYPES } from '@constants/constant'; |
||||
|
||||
BI.provider('dec.connection.provider.datebase', function () { |
||||
this.resolves = {}; |
||||
|
||||
function starRocksResolve(url: string) { |
||||
// 处理starRocks数据连接常规模式
|
||||
let result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i); |
||||
if (result) { |
||||
return { |
||||
host: result[1], |
||||
port: result[2] === 'port' ? '' : result[2], |
||||
catalog: result[3], |
||||
databaseName: result[4], |
||||
urlInfo: result[0], |
||||
}; |
||||
} else { |
||||
// 兼容老数据库里面没有catalog的情况
|
||||
result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([^]+)(.*)/i); |
||||
if (result) { |
||||
return { |
||||
host: result[1], |
||||
port: result[2] === 'port' ? '' : result[2], |
||||
catalog: '', |
||||
databaseName: result[3], |
||||
urlInfo: result[0], |
||||
}; |
||||
} |
||||
} |
||||
// 处理starRocks数据连接负载均衡模式
|
||||
let loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); |
||||
if (loadBalance) { |
||||
return { |
||||
host: '', |
||||
port: '', |
||||
catalog: loadBalance[1], |
||||
databaseName: loadBalance[2], |
||||
urlInfo: loadBalance[0], |
||||
} |
||||
} else { |
||||
// 兼容老数据库里面没有catalog的情况
|
||||
loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)([^/]+)/i); |
||||
if (loadBalance) { |
||||
return { |
||||
host: '', |
||||
port: '', |
||||
catalog: '', |
||||
databaseName: loadBalance[1], |
||||
urlInfo: loadBalance[0], |
||||
} |
||||
} |
||||
} |
||||
return { |
||||
host: '', |
||||
port: '', |
||||
databaseName: '', |
||||
urlInfo: '', |
||||
}; |
||||
} |
||||
// 原service中resolveUrlInfo方法
|
||||
function jdbcResolve(url: string) { |
||||
if (BI.isNull(url)) return {}; |
||||
|
||||
const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/)([^]+)(.*)/i); |
||||
if (oracleUlr) { |
||||
return { |
||||
host: oracleUlr[5], |
||||
port: oracleUlr[7] === 'port' ? '' : oracleUlr[7], |
||||
databaseName: oracleUlr[9], |
||||
urlInfo: oracleUlr[10], |
||||
}; |
||||
} |
||||
|
||||
const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)(.*)/i); |
||||
if (greenplumUrl) { |
||||
return { |
||||
host: greenplumUrl[4], |
||||
port: greenplumUrl[6] === 'port' ? '' : greenplumUrl[6], |
||||
databaseName: greenplumUrl[8], |
||||
urlInfo: greenplumUrl[9], |
||||
}; |
||||
} |
||||
const result = url.match(/^jdbc:(mysql|sqlserver|db2|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse|trino|sybase:Tds):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)?(.*)/i); |
||||
if (result) { |
||||
return { |
||||
host: result[5], |
||||
port: result[7] === 'port' ? '' : result[7], |
||||
databaseName: result[9] || '', |
||||
urlInfo: result[10], |
||||
}; |
||||
} |
||||
|
||||
// 处理SAP HANA数据连接url
|
||||
const sapHanaUrl = url.match(/^jdbc:(sap):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\?databaseName=)?([^&]+)([^]+)?(.*)/i); |
||||
if (sapHanaUrl) { |
||||
return { |
||||
host: sapHanaUrl[5], |
||||
port: sapHanaUrl[7] === 'port' ? '' : sapHanaUrl[7], |
||||
databaseName: sapHanaUrl[9] || '', |
||||
urlInfo: sapHanaUrl[10], |
||||
}; |
||||
} |
||||
|
||||
// 处理oracle的RAC方式
|
||||
if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) { |
||||
const host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i); |
||||
const port = url.match(/\(PORT\s*=\s*([0-9]+)\)/i); |
||||
const databaseName = url.match(/\(SERVICE_NAME\s*=\s*([\s0-9a-zA-Z_\\.]+)\)/i); |
||||
|
||||
return { |
||||
host: host ? host[1] : '', |
||||
port: port && port[1] !== 'port' ? port[1] : '', |
||||
databaseName: databaseName ? databaseName[1] : '', |
||||
urlInfo: '', |
||||
}; |
||||
} |
||||
return { |
||||
host: '', |
||||
port: '', |
||||
databaseName: '', |
||||
urlInfo: '', |
||||
}; |
||||
} |
||||
|
||||
function coverBaseDatabase(config) { |
||||
const baseDataBase = DATA_BASE_TYPES.find(item => item.text === config.text); |
||||
if (BI.isNotNull(baseDataBase)) { |
||||
// 覆盖基础配置
|
||||
Object.assign(baseDataBase, config); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
function filterPluginDataTypeByPriority() { |
||||
const originTypes = [...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES)]; |
||||
const sortDataTypes = BI.sortBy(originTypes, (index, value: any) => { |
||||
return value.priority || 0; |
||||
}) |
||||
return BI.uniqWith(sortDataTypes, (current, other) => { |
||||
return current.text == other.text; |
||||
}); |
||||
} |
||||
|
||||
BI.provider('dec.connection.provider.datebase', function() { |
||||
this.registerDatabaseType = (config: any) => { |
||||
if (coverBaseDatabase(config)) return; |
||||
|
||||
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); |
||||
}; |
||||
|
||||
this.registerJdbcDatabase = (config: any, resolve?: Function) => { |
||||
config = { |
||||
...config, |
||||
type: 'jdbc', |
||||
}; |
||||
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); |
||||
|
||||
if (coverBaseDatabase(config)) return; |
||||
|
||||
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); |
||||
}; |
||||
|
||||
this.$get = () => BI.inherit(BI.OB, { |
||||
getJdbcResolveByType: (type: string) => { |
||||
// starRocks特殊处理
|
||||
// todo: 后面有专门的迭代系统处理,这里先临时解决下bug
|
||||
if (type === "starrocks"){ |
||||
return starRocksResolve |
||||
} |
||||
return this.resolves[type] || jdbcResolve |
||||
}, |
||||
customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), |
||||
}); |
||||
}); |
||||
|
@ -1,68 +0,0 @@
|
||||
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(); |
||||
}, |
||||
}; |
||||
} |
@ -1,183 +0,0 @@
|
||||
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); |
||||
} |
||||
} |
@ -1,13 +0,0 @@
|
||||
.data-conf-file { |
||||
.x-icon{ |
||||
width: 48px; |
||||
height: 48px; |
||||
} |
||||
} |
||||
|
||||
.data-keytab-file { |
||||
.x-icon{ |
||||
width: 48px; |
||||
height: 48px; |
||||
} |
||||
} |
@ -1,35 +0,0 @@
|
||||
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; |
||||
} |
||||
} |
||||
} |
@ -1,327 +0,0 @@
|
||||
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); |
||||
} |
||||
} |
@ -1,52 +0,0 @@
|
||||
import { shortcut } from '@core/core'; |
||||
import { Label } from '@fui/core'; |
||||
|
||||
const DEFAULT_LINK = '/'; |
||||
@shortcut() |
||||
export class LinkButton extends BI.BasicButton { |
||||
static xtype = 'dec.dcm.components.link.button'; |
||||
|
||||
props: { |
||||
text: string; |
||||
cls: string; |
||||
$testId: string; |
||||
link?: Function | string; |
||||
} = { |
||||
text: '', |
||||
cls: 'cursor-pointer', |
||||
$testId: 'dec-dcm-link-button', |
||||
} |
||||
|
||||
private text: Label; |
||||
|
||||
render() { |
||||
return { |
||||
type: BI.CenterAdaptLayout.xtype, |
||||
cls: 'bi-high-light', |
||||
items: [ |
||||
{ |
||||
type: BI.Label.xtype, |
||||
cls: 'bi-high-light-border-bottom', |
||||
text: this.options.text, |
||||
ref: (_ref: Label) => { |
||||
this.text = _ref; |
||||
}, |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
|
||||
getLink() { |
||||
const link = this.options.link; |
||||
|
||||
return (BI.isFunction(link) ? link() : link) || DEFAULT_LINK; |
||||
} |
||||
|
||||
setText(v: string) { |
||||
this.text.setText(v); |
||||
} |
||||
|
||||
doClick() { |
||||
window.open(this.getLink()); |
||||
} |
||||
} |
@ -1,41 +0,0 @@
|
||||
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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,52 +0,0 @@
|
||||
/* |
||||
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; |
||||
} |
@ -1,15 +0,0 @@
|
||||
/** |
||||
* 参数检验的非法字符数组,由于不区分大小写,统一用小写 |
||||
*/ |
||||
export const ILLEGAL_STRINGS = [ |
||||
"\"", |
||||
"<", |
||||
">", |
||||
"&", |
||||
"/script", |
||||
"javascript:", |
||||
"onblur", |
||||
"getruntime", |
||||
"processbuilder", |
||||
"java.lang.processimpl", |
||||
]; |
@ -1,3 +1,43 @@
|
||||
type Constructor<T> = new(...args: any[]) => T; |
||||
|
||||
export const { shortcut, model, store, Model, provider } = BI.Decorators; |
||||
export function shortcut(className: string) { |
||||
return function decorator<U>(Base: Constructor<U>): void { |
||||
BI.shortcut(className, Base); |
||||
}; |
||||
} |
||||
|
||||
export function store(modelName: string) { |
||||
return function decorator<U>(Base: Constructor<U>): void { |
||||
Base.prototype._store = () => BI.Models.getModel(modelName); |
||||
}; |
||||
} |
||||
|
||||
export function model(className: string) { |
||||
return function decorator<U>(Base: Constructor<U>): void { |
||||
BI.model(className, Base); |
||||
}; |
||||
} |
||||
|
||||
export class Model<U extends {context?: {[key: string]: any}} = {}> extends Fix.Model { |
||||
model: {[key in keyof U['context']]: U['context'][key]} & {[key in keyof ReturnType<this['state']>]: ReturnType<this['state']>[key]} & {[key in keyof this['computed']]: ReturnType<this['computed'][key]>} & {[key: string]: undefined}; |
||||
|
||||
store: this['actions']; |
||||
|
||||
state(): {[key: string]: any} { |
||||
return {}; |
||||
} |
||||
|
||||
// context: Partial<keyof U['context']>;
|
||||
|
||||
context: string[]; |
||||
|
||||
actions:{[key: string]: (...args: any[]) => any}; |
||||
|
||||
// childContext: (keyof this['$$childContext'])[];
|
||||
|
||||
childContext: string[]; |
||||
|
||||
$$childContext: {[key in keyof this['computed']]: ReturnType<this['computed'][key]>} & {[key in keyof ReturnType<this['state']>]: ReturnType<this['state']>[key]}; |
||||
|
||||
computed: {[key: string]: () => any}; |
||||
} |
||||
|
@ -1 +0,0 @@
|
||||
export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings" |
@ -1,24 +0,0 @@
|
||||
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, |
||||
}, |
||||
}); |
||||
}); |
@ -1,13 +1,11 @@
|
||||
import { model, Model } from '@core/core'; |
||||
import { AppModel } from '../../../app.model'; |
||||
|
||||
@model() |
||||
import { ConnectionModel } from '../connection.model'; |
||||
export const ConnectionJdbcModelXtype = 'dec.dcm.model.connection_jdbc'; |
||||
@model(ConnectionJdbcModelXtype) |
||||
export class ConnectionJdecModel extends Model<{ |
||||
types : { |
||||
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; |
||||
}, |
||||
context: ConnectionJdecModel['context']; |
||||
context : { |
||||
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; |
||||
} |
||||
}> { |
||||
static xtype = 'dec.dcm.model.connection_jdbc'; |
||||
context = <const>['connectionSelectedOne']; |
||||
context = ['connectionSelectedOne']; |
||||
} |
||||
|
@ -1,405 +1,174 @@
|
||||
import { shortcut, store } from '@core/core'; |
||||
import { FormItem } from '../components/form_item/form_item'; |
||||
import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
||||
import { ConnectionJdecModel } from './connection_jdbc.model'; |
||||
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; |
||||
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; |
||||
import { CONNECTION_LAYOUT, CONNECT_SSH_TYPE } from '@constants/constant'; |
||||
import { VerticalLayout } from '@fui/core'; |
||||
import { ApiFactory } from '../../../crud/apiFactory'; |
||||
|
||||
const api = new ApiFactory().create(); |
||||
|
||||
@shortcut() |
||||
@store(ConnectionJdecModel) |
||||
export class ConnectionJdbc extends BI.Widget { |
||||
static xtype = 'dec.dcm.connection_jdbc'; |
||||
|
||||
model: ConnectionJdecModel['model']; |
||||
allDatabaseTypes = getAllDatabaseTypes(); |
||||
|
||||
sshSet: VerticalLayout; |
||||
sslSet: VerticalLayout; |
||||
advancedSet: VerticalLayout; |
||||
parallelLoadSet: VerticalLayout; |
||||
|
||||
render() { |
||||
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; |
||||
const { |
||||
driver, |
||||
driverSource, |
||||
database, |
||||
user, |
||||
originalCharsetName, |
||||
schema, |
||||
connectionPoolAttr, |
||||
authType, |
||||
principal, |
||||
url, |
||||
fetchSize, |
||||
// ssh
|
||||
usingSsh, |
||||
sshIp, |
||||
sshPort, |
||||
sshUser, |
||||
sshType, |
||||
sshSecret, |
||||
sshPrivateKeyPath, |
||||
// ssl
|
||||
usingSsl, |
||||
caCertificate, |
||||
verifyCa, |
||||
sslClientPrivateKey, |
||||
sslClientCertificate, |
||||
// 并行装载
|
||||
parallelLoad, |
||||
// HDFS
|
||||
hdfs, |
||||
} = connectionData; |
||||
const databaseType = getJdbcDatabaseType(database, driver); |
||||
const { host, port, catalog, databaseName, version } = resolveUrlInfo(url, database); |
||||
this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; |
||||
const { hgap, vgap } = CONNECTION_LAYOUT; |
||||
|
||||
return { |
||||
type: BI.VerticalLayout.xtype, |
||||
hgap, |
||||
vgap, |
||||
items: [ |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Basic_Version'), |
||||
invisible: BI.isUndefined(this.version), |
||||
value: BI.i18nText('Dec-Migration_Database_Version', this.version), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
_tgap: BI.isUndefined(this.version) ? vgap : 0, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
||||
value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: 'catalog', |
||||
invisible: database !== 'starrocks', |
||||
value: catalog, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), |
||||
value: databaseName, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), |
||||
value: host, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), |
||||
value: port, |
||||
}, |
||||
authType |
||||
? { |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), |
||||
value: authType, |
||||
} |
||||
: { |
||||
type: BI.Layout.xtype, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), |
||||
value: authType ? principal : user, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), |
||||
value: '******', |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), |
||||
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'), |
||||
}, |
||||
// HDFS设置
|
||||
{ |
||||
type: FormItem.xtype, |
||||
invisible: BI.isNull(hdfs), |
||||
name: BI.i18nText('Dec-Dcm_Connection_Address', 'HDFS'), |
||||
value: hdfs?.hdfsAddress, |
||||
}, |
||||
// 并行装载设置
|
||||
{ |
||||
type: Collapse.xtype, |
||||
invisible: BI.isNull(parallelLoad), |
||||
name: BI.i18nText('Dec-Dcm_Connection_Setting', BI.i18nText('Dec-Dcm_Connection_Parallel_Load')), |
||||
listeners: [ |
||||
{ |
||||
eventName: EVENT_CHANGE, |
||||
action: (isCollapse: boolean) => { |
||||
this.parallelLoadSet.setVisible(!isCollapse); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
type: BI.VerticalLayout.xtype, |
||||
invisible: true, |
||||
ref: (_ref: VerticalLayout) => { |
||||
this.parallelLoadSet = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: FormItem.xtype, |
||||
_bgap: vgap, |
||||
name: `${BI.i18nText('Dec-Dcm_Connection_Server_Address')}-${BI.i18nText('Dec-Memory_Detection_Server_Cluster_Node', '1')}`, |
||||
value: parallelLoad?.serverAddress, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
_bgap: vgap, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Reuse_Temporary_Table'), |
||||
value: parallelLoad?.reuseTemporaryTable, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
_bgap: vgap, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Pieces_Limit'), |
||||
value: parallelLoad?.filePiecesLimit, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Size_Limit'), |
||||
value: parallelLoad?.fileSizeLimit, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), |
||||
value: schema, |
||||
invisible: !databaseType.hasSchema, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), |
||||
value: url, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
||||
value: connectionPoolAttr.maxActive, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
||||
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'), |
||||
value: connectionPoolAttr.keepAlive ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), |
||||
value: api.getPlain(connectionPoolAttr.validationQuery || ''), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
||||
value: connectionPoolAttr.maxWait, |
||||
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
||||
}, |
||||
// ssh设置
|
||||
{ |
||||
type: Collapse.xtype, |
||||
width: 100, |
||||
invisible: !usingSsh, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSH'), |
||||
listeners: [ |
||||
{ |
||||
eventName: EVENT_CHANGE, |
||||
action: (isCollapse: boolean) => { |
||||
this.sshSet.setVisible(!isCollapse); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.VerticalLayout.xtype, |
||||
bgap: vgap, |
||||
invisible: true, |
||||
ref: (_ref: VerticalLayout) => { |
||||
this.sshSet = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), |
||||
value: sshIp, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), |
||||
value: sshPort, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), |
||||
value: sshUser, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), |
||||
value: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).text, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
invisible: sshType !== 'KEY', |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), |
||||
value: sshPrivateKeyPath, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).secretFormName, |
||||
value: sshSecret, |
||||
}, |
||||
], |
||||
}, |
||||
}, |
||||
// ssl设置
|
||||
{ |
||||
type: Collapse.xtype, |
||||
width: 100, |
||||
invisible: !usingSsl, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), |
||||
listeners: [ |
||||
{ |
||||
eventName: EVENT_CHANGE, |
||||
action: (isCollapse: boolean) => { |
||||
this.sslSet.setVisible(!isCollapse); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.VerticalLayout.xtype, |
||||
bgap: vgap, |
||||
invisible: true, |
||||
ref: (_ref: VerticalLayout) => { |
||||
this.sslSet = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), |
||||
value: caCertificate, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
invisible: !caCertificate, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), |
||||
value: verifyCa ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), |
||||
value: sslClientPrivateKey, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), |
||||
value: sslClientCertificate, |
||||
}, |
||||
], |
||||
}, |
||||
}, |
||||
// 更多设置
|
||||
{ |
||||
type: Collapse.xtype, |
||||
width: 100, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), |
||||
listeners: [ |
||||
{ |
||||
eventName: EVENT_CHANGE, |
||||
action: (isCollapse: boolean) => { |
||||
this.advancedSet.setVisible(!isCollapse); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
el: { |
||||
type: BI.VerticalLayout.xtype, |
||||
bgap: vgap, |
||||
invisible: true, |
||||
ref: (_ref: VerticalLayout) => { |
||||
this.advancedSet = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
||||
value: connectionPoolAttr.initialSize, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), |
||||
value: connectionPoolAttr.minIdle, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), |
||||
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), |
||||
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
||||
value: connectionPoolAttr.timeBetweenEvictionRunsMillis, |
||||
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
||||
value: connectionPoolAttr.numTestsPerEvictionRun, |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), |
||||
value: connectionPoolAttr.minEvictableIdleTimeMillis, |
||||
unit: BI.i18nText('BI-Basic_Seconds'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), |
||||
value: connectionPoolAttr.maxEvictableIdleTimeMillis, |
||||
unit: BI.i18nText('BI-Basic_Seconds'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), |
||||
value: connectionPoolAttr.keepAliveBetweenTimeMillis, |
||||
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
||||
}, |
||||
{ |
||||
type: FormItem.xtype, |
||||
name: 'Fetchsize', |
||||
value: fetchSize, |
||||
}, |
||||
], |
||||
}, |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
} |
||||
import { shortcut, store } from '@core/core'; |
||||
import { Vertical, Layout } from 'ui'; |
||||
import { FormItemXtype } from '../components/form_item/form_item'; |
||||
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
||||
import { ConnectionJdbcModelXtype, ConnectionJdecModel } from './connection_jdbc.model'; |
||||
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; |
||||
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; |
||||
import { CONNECTION_LAYOUT } from '@constants/constant'; |
||||
export const ConnectionJdbcXtype = 'dec.dcm.connection_jdbc'; |
||||
@shortcut(ConnectionJdbcXtype) |
||||
@store(ConnectionJdbcModelXtype) |
||||
export class ConnectionJdbc extends BI.Widget { |
||||
advancedSet: any; |
||||
|
||||
model: ConnectionJdecModel['model']; |
||||
allDatabaseTypes = getAllDatabaseTypes(); |
||||
|
||||
render () { |
||||
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; |
||||
const { driver, database, user, originalCharsetName, schema, connectionPoolAttr, authType, principal, url } = connectionData; |
||||
const databaseType = getJdbcDatabaseType(database, driver); |
||||
const { host, port, databaseName } = resolveUrlInfo(url); |
||||
const { hgap, vgap } = CONNECTION_LAYOUT; |
||||
|
||||
return { |
||||
type: Vertical, |
||||
hgap, |
||||
vgap, |
||||
items: [ |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
||||
value: driver, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), |
||||
value: databaseName, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), |
||||
value: host, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), |
||||
value: port, |
||||
}, |
||||
authType ? |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), |
||||
value: authType, |
||||
} : { |
||||
type: Layout, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), |
||||
value: authType ? principal : user, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), |
||||
value: '******', |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), |
||||
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), |
||||
value: schema, |
||||
invisible: !databaseType.hasSchema, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), |
||||
value: url, |
||||
}, |
||||
{ |
||||
type: CollapseXtype, |
||||
width: 70, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), |
||||
listeners: [ |
||||
{ |
||||
eventName: EVENT_CHANGE, |
||||
action: (isCollapse: boolean) => { |
||||
this.advancedSet.setVisible(!isCollapse); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
type: Vertical, |
||||
tgap: -15, |
||||
vgap, |
||||
invisible: true, |
||||
ref: (_ref: any) => { |
||||
this.advancedSet = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
||||
value: connectionPoolAttr.initialSize, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
||||
value: connectionPoolAttr.maxActive, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), |
||||
value: connectionPoolAttr.maxIdle, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), |
||||
value: connectionPoolAttr.minIdle, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
||||
value: connectionPoolAttr.maxWait, |
||||
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), |
||||
value: connectionPoolAttr.validationQuery, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
||||
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), |
||||
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), |
||||
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
||||
value: connectionPoolAttr.timeBetweenEvictionRunsMillis, |
||||
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
||||
value: connectionPoolAttr.numTestsPerEvictionRun, |
||||
}, |
||||
{ |
||||
type: FormItemXtype, |
||||
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), |
||||
value: connectionPoolAttr.minEvictableIdleTimeMillis, |
||||
unit: BI.i18nText('BI-Basic_Seconds'), |
||||
}, |
||||
], |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
} |
||||
|
@ -1,12 +1,11 @@
|
||||
import { AppModel } from 'src/modules/app.model'; |
||||
import { model, Model } from '@core/core'; |
||||
@model() |
||||
import { ConnectionModel } from '../connection.model'; |
||||
export const ConnectionJndiModelXtype = 'dec.dcm.model.connection_jndi'; |
||||
@model(ConnectionJndiModelXtype) |
||||
export class ConnectionJndiModel extends Model<{ |
||||
types : { |
||||
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; |
||||
}, |
||||
context: ConnectionJndiModel['context']; |
||||
context : { |
||||
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; |
||||
} |
||||
}> { |
||||
static xtype = 'dec.dcm.model.connection_jndi'; |
||||
context = <const>['connectionSelectedOne']; |
||||
context = ['connectionSelectedOne']; |
||||
} |
||||
|
@ -1,14 +1,11 @@
|
||||
import { AppModel } from '../../../app.model'; |
||||
import { model, Model } from '@core/core'; |
||||
|
||||
@model() |
||||
import { ConnectionModel } from '../connection.model'; |
||||
export const ConnectionPluginModelXtype = 'dec.dcm.model.connection_plugin'; |
||||
@model(ConnectionPluginModelXtype) |
||||
export class ConnectionPluginModel extends Model<{ |
||||
types : { |
||||
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; |
||||
}, |
||||
context: ConnectionPluginModel['context']; |
||||
context : { |
||||
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; |
||||
} |
||||
}> { |
||||
static xtype = 'dec.dcm.model.connection_plugin'; |
||||
|
||||
context = <const>['connectionSelectedOne']; |
||||
context = ['connectionSelectedOne']; |
||||
} |
||||
|
@ -1 +0,0 @@
|
||||
BI.constant('dec.constant.connection.list', []); |
@ -1,59 +1,37 @@
|
||||
import { model, Model } from '@core/core'; |
||||
import { ApiFactory } from '../../..//crud/apiFactory'; |
||||
import { AppModel } from '../../../app.model'; |
||||
import type { ConnectionJDBC } from '../../../crud/crud.typings'; |
||||
const api = new ApiFactory().create(); |
||||
@model() |
||||
export const ConnectionListModelXtype = 'dec.dcm.model.connection.list'; |
||||
@model(ConnectionListModelXtype) |
||||
export class ConnectionListModel extends Model<{ |
||||
types: { |
||||
connections: AppModel['TYPE']['connections']; |
||||
connectionSelected: AppModel['TYPE']['connectionSelected']; |
||||
}, |
||||
context: ConnectionListModel['context']; |
||||
context : { |
||||
connections: AppModel['$$childContext']['connections']; |
||||
connectionSelected: AppModel['$$childContext']['connectionSelected']; |
||||
} |
||||
}> { |
||||
static xtype = 'dec.dcm.model.connection.list'; |
||||
|
||||
context = <const>['connections', 'connectionSelected']; |
||||
context = ['connections', 'connectionSelected']; |
||||
|
||||
computed = { |
||||
shwoType: () => BI.size(this.model.connections) > 0 ? 'list' : 'none', |
||||
} |
||||
|
||||
actions = { |
||||
setConnections: (): Promise<void> => api.getConnectionList().then(data => { |
||||
data.data.push(...BI.Constants.getConstant('dec.constant.connection.list')); |
||||
setConnections: ():Promise<void> => api.getConnectionlist().then(data => { |
||||
if (BI.size(data.data) > 0) { |
||||
this.model.connections = data.data; |
||||
let defaultDatabaseName, |
||||
defaultDatabaseId = BI.Services.getService("dec.service.global") |
||||
.getHashSearchParams("databaseId"); |
||||
|
||||
this.model.connections.forEach(item => { |
||||
// REPORT-111534 有些环境存在脏数据,补下容错
|
||||
if (BI.isNull(item.connectionData)) return; |
||||
|
||||
// 后端传过来的是字符串,转为对象
|
||||
BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string)); |
||||
|
||||
// 目前只有jdbc存在identity,后期拓展
|
||||
if ((item.connectionData as ConnectionJDBC).identity === defaultDatabaseId) { |
||||
defaultDatabaseName = item.connectionName; |
||||
} |
||||
// 后端传过来的是字符串,转为对象
|
||||
item.connectionData = JSON.parse(item.connectionData as string); |
||||
}); |
||||
|
||||
// 仅首次进入时从url中读取参数,其他情况保留选中状态
|
||||
defaultDatabaseName ||= data.data[0].connectionName; |
||||
|
||||
this.setSelectedConnection(defaultDatabaseName); |
||||
this.model.connectionSelected = data.data[0].connectionName; |
||||
} else { |
||||
this.model.connectionSelected = ''; |
||||
} |
||||
|
||||
|
||||
return new Promise(resolve => { |
||||
resolve(); |
||||
}); |
||||
}), |
||||
|
||||
setSelectedConnection(name: string) { |
||||
this.model.connectionSelected = name; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,17 +0,0 @@
|
||||
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, |
||||
}, |
||||
]); |
@ -0,0 +1,12 @@
|
||||
export interface DatabaseType { |
||||
text: string; |
||||
databaseType: string; |
||||
driver?: string; |
||||
drivers?: string[]; |
||||
url?: string; |
||||
commonly: boolean; |
||||
internal: boolean; |
||||
type: string; |
||||
hasSchema?: boolean; |
||||
kerberos?: boolean; |
||||
} |
@ -0,0 +1,10 @@
|
||||
import { ConnectionXtype } from './connection/connection'; |
||||
import { DatebaseXtype } from './database/database'; |
||||
import { MaintainXtype } from './maintain/maintain'; |
||||
import { ConnectionPoolXtype } from './connection_pool/connection_pool'; |
||||
export { |
||||
ConnectionXtype, |
||||
DatebaseXtype, |
||||
MaintainXtype, |
||||
ConnectionPoolXtype, |
||||
}; |
@ -1,133 +0,0 @@
|
||||
import { model, Model } from '@core/core'; |
||||
import { ConnectionJDBC } from '../../../../crud/crud.typings'; |
||||
import { getJdbcDatabaseType } from '../../../../app.service'; |
||||
import { ApiFactory } from '../../../../crud/apiFactory'; |
||||
|
||||
const api = new ApiFactory().create(); |
||||
|
||||
@model() |
||||
export class DriverSelectorModel extends Model { |
||||
static xtype = 'dec.dcm.model.maintain.form.jdbc.driver_selector'; |
||||
|
||||
state = () => { |
||||
const defaultDrivers = this.getDrivers(); |
||||
const [driverSource, selectedDriver] = this.resolveSelectedDriverType(); |
||||
|
||||
return { |
||||
defaultDrivers, |
||||
driverSource, |
||||
selectedDriverType: driverSource === '' ? 'default' : 'custom', |
||||
customDrivers: [], |
||||
defaultDriver: { |
||||
driver: driverSource === '' ? selectedDriver : '', |
||||
}, |
||||
customDriver: { |
||||
driver: driverSource !== '' ? selectedDriver : '', |
||||
value: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', |
||||
}, |
||||
}; |
||||
}; |
||||
|
||||
computed = { |
||||
driverClassItems: () => this.model.customDrivers.map(driver => { |
||||
return { |
||||
text: `${driver.driverClass} (${driver.name})`, |
||||
value: `${driver.driverClass} (${driver.name})`, |
||||
driverClass: driver.driverClass, |
||||
}; |
||||
}), |
||||
|
||||
driverTypeComboValue: () => this.model.driverSource === '' ? 'default' : 'custom', |
||||
|
||||
driverManageEntryVisible: () => this.model.selectedDriverType === 'custom' && BI.Services.getService('dec.service.global').isAdmin(), |
||||
}; |
||||
|
||||
actions = { |
||||
initDriverClassList: cb => { |
||||
|
||||
api.getSimpleDriverList().then(res => { |
||||
this.model.customDrivers = res.data.filter(driver => { |
||||
return BI.isKey(driver.driverClass); |
||||
}); |
||||
cb(); |
||||
}); |
||||
}, |
||||
|
||||
changeDefaultDriver: driver => { |
||||
this.model.defaultDriver.driver = driver; |
||||
this.model.driverSource = ''; |
||||
}, |
||||
|
||||
changeCustomDriver: value => { |
||||
|
||||
const item = this.model.driverClassItems.find(item => { |
||||
return item.value === value; |
||||
}); |
||||
const driver = item.driverClass; |
||||
this.model.customDriver.driver = driver; |
||||
|
||||
this.model.customDrivers.some(customDriver => { |
||||
// DEC-21469 存在driver值相同但driver名不同的场景,因此要用拼接名判断
|
||||
if (`${customDriver.driverClass} (${customDriver.name})` === value) { |
||||
this.model.driverSource = customDriver.name; |
||||
this.model.customDriver.value = `${driver} (${customDriver.name})`; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
}); |
||||
}, |
||||
|
||||
changeSelectedDriverType: driverTypeComboValue => { |
||||
this.model.selectedDriverType = driverTypeComboValue; |
||||
this.model.driverSource = driverTypeComboValue === 'default' ? '' : this.model.driverSource; |
||||
}, |
||||
|
||||
changeDriverSource: driverTypeComboValue => { |
||||
this.model.driverSource = driverTypeComboValue === 'default' ? '' : this.model.driverSource; |
||||
}, |
||||
|
||||
setDefaultDrivers: version => { |
||||
const defaultDrivers = this.getDrivers(version); |
||||
this.model.defaultDrivers = defaultDrivers; |
||||
this.changeDefaultDriver(defaultDrivers[0]?.value); |
||||
} |
||||
}; |
||||
|
||||
private resolveSelectedDriverType = () => { |
||||
if (BI.isNotEmptyString(this.options.driverSource)) { |
||||
return [this.options.driverSource, this.options.driver]; |
||||
} |
||||
|
||||
return [this.options.driverSource, this.options.driver]; |
||||
}; |
||||
|
||||
private getDrivers = (version?: string) => { |
||||
const connectionData = this.options.connectionData as ConnectionJDBC; |
||||
const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); |
||||
const selectedVersion = version ?? this.options.version; |
||||
const drivers = connectionType.drivers ? |
||||
(BI.isUndefined(connectionType.versions) ? connectionType.drivers : connectionType.drivers[selectedVersion]).map(item => { |
||||
return { |
||||
text: item, |
||||
value: item, |
||||
}; |
||||
}) : |
||||
[{ |
||||
text: connectionType.driver, |
||||
value: connectionType.driver, |
||||
}]; |
||||
if (BI.isUndefined(connectionType.versions) && !drivers.some(item => item.text === connectionData.driver)) { |
||||
return [ |
||||
{ |
||||
text: connectionData.driver, |
||||
value: connectionData.driver, |
||||
}, |
||||
...drivers, |
||||
]; |
||||
} |
||||
|
||||
return drivers; |
||||
}; |
||||
} |
@ -1,196 +0,0 @@
|
||||
import { shortcut, store } from '@core/core'; |
||||
|
||||
import { |
||||
Button, |
||||
EditorIconCheckCombo, |
||||
SearchTextValueCombo, |
||||
TextValueCombo, |
||||
} from '@fui/core'; |
||||
import { ConnectionJDBC } from '../../../../crud/crud.typings'; |
||||
import { getJdbcDatabaseType } from '../../../../app.service'; |
||||
import { DriverSelectorModel } from './driverselector.model'; |
||||
|
||||
|
||||
@shortcut() |
||||
@store(DriverSelectorModel, { |
||||
props(this: DriverSelector) { |
||||
return this.options; |
||||
}, |
||||
}) |
||||
export class DriverSelector extends BI.Widget { |
||||
static xtype = 'dec.dcm.maintain.form.jdbc.driver_selector'; |
||||
|
||||
props = { |
||||
driver: '', |
||||
driverSource: '', |
||||
connectionData: {} as ConnectionJDBC, |
||||
version: '', |
||||
}; |
||||
|
||||
defaultDrivers: EditorIconCheckCombo = null; |
||||
|
||||
customDrivers: SearchTextValueCombo = null; |
||||
|
||||
beforeRender(cb: Function) { |
||||
this.store.initDriverClassList(cb); |
||||
} |
||||
|
||||
watch = { |
||||
driverClassItems: items => { |
||||
this.customDrivers.populate(items); |
||||
this.customDrivers.setValue(this.model.customDriver.value); |
||||
}, |
||||
|
||||
driverManageEntryVisible: b => { |
||||
this.driverManageEntry.setVisible(b); |
||||
}, |
||||
|
||||
defaultDrivers: items => { |
||||
this.defaultDrivers.populate(items); |
||||
this.defaultDrivers.setValue(this.model.defaultDriver.driver); |
||||
this.fireEvent('EVENT_CHANGE'); |
||||
} |
||||
}; |
||||
|
||||
private driverManageEntry = null; |
||||
|
||||
render() { |
||||
const { driver } = this.options.connectionData; |
||||
|
||||
return { |
||||
type: BI.VerticalAdaptLayout.xtype, |
||||
rgap: 10, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: BI.TextValueCombo.xtype, |
||||
width: 86, |
||||
value: this.model.selectedDriverType, |
||||
items: [ |
||||
{ |
||||
text: BI.i18nText('Dec-Basic_Default'), |
||||
value: 'default', |
||||
}, { |
||||
text: BI.i18nText('Dec-Basic_Custom'), |
||||
value: 'custom', |
||||
}, |
||||
], |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||
action: value => { |
||||
this.store.changeSelectedDriverType(value); |
||||
if (value === 'default') { |
||||
this.defaultDrivers.setVisible(true); |
||||
this.customDrivers.setVisible(false); |
||||
this.fireEvent('EVENT_CHANGE'); |
||||
return; |
||||
} |
||||
|
||||
this.defaultDrivers.setVisible(false); |
||||
this.customDrivers.setVisible(true); |
||||
if (BI.isKey(this.customDrivers.getValue()[0])) { |
||||
this.fireEvent('EVENT_CHANGE'); |
||||
} |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
}, { |
||||
el: { |
||||
type: BI.EditorIconCheckCombo.xtype, |
||||
$testId: 'dec-editor-icon-check-combo', |
||||
$value: 'driver', |
||||
ref: _ref => { |
||||
this.defaultDrivers = _ref; |
||||
}, |
||||
invisible: this.model.driverSource !== '', |
||||
width: 204, |
||||
items: this.model.defaultDrivers, |
||||
value: this.model.defaultDriver.driver, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.EditorIconCheckCombo.EVENT_CHANGE, |
||||
action: () => { |
||||
this.store.changeDefaultDriver(this.defaultDrivers.getValue()); |
||||
this.fireEvent('EVENT_CHANGE'); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
}, { |
||||
el: { |
||||
type: BI.SearchTextValueCombo.xtype, |
||||
$testId: 'dec-editor-icon-check-combo', |
||||
$value: 'driver', |
||||
ref: _ref => { |
||||
this.customDrivers = _ref; |
||||
}, |
||||
invisible: this.model.driverSource === '', |
||||
width: 204, |
||||
watermark: BI.i18nText('Dec-Please_Input'), |
||||
items: this.model.driverClassItems, |
||||
value: this.model.customDriver.value, |
||||
text: () => this.model.customDriver.value || '', |
||||
defaultText: BI.i18nText('Dec-Please_Select_One'), |
||||
warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.SearchTextValueCombo.EVENT_CHANGE, |
||||
action: () => { |
||||
this.store.changeCustomDriver(this.customDrivers.getValue()[0]); |
||||
this.fireEvent('EVENT_CHANGE'); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
}, { |
||||
el: { |
||||
type: 'dec.connection.driver.entry', |
||||
ref: (_ref: Button) => { |
||||
this.driverManageEntry = _ref; |
||||
}, |
||||
el: { |
||||
type: BI.Button.xtype, |
||||
level: 'ignore', |
||||
text: BI.i18nText('Dec-Dcm_Create_New_Driver'), |
||||
}, |
||||
from: '.dec-dcm', |
||||
invisible: !this.model.driverManageEntryVisible, |
||||
listeners: [ |
||||
{ |
||||
eventName: 'EVENT_CLOSE', |
||||
action: () => { |
||||
this.store.initDriverClassList(BI.emptyFn); |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
|
||||
validation(): boolean { |
||||
if (this.model.selectedDriverType === 'default' && BI.isKey(this.model.defaultDriver.driver)) { |
||||
return true; |
||||
} |
||||
if (this.model.selectedDriverType === 'custom' && BI.isKey(this.model.customDriver.driver)) { |
||||
return true; |
||||
} |
||||
BI.Msg.toast(BI.i18nText('Dec-Dcm_Driver_Class_Not_Allow_Empty'), { level: 'error' }); |
||||
|
||||
return false; |
||||
} |
||||
|
||||
getValue() { |
||||
return { |
||||
driverSource: this.model.driverSource, |
||||
driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver, |
||||
}; |
||||
} |
||||
|
||||
setDefaultDrivers(version: string) { |
||||
this.store.setDefaultDrivers(version); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,44 +1,35 @@
|
||||
import { shortcut } from '@core/core'; |
||||
import { Connection, ConnectionPlugin } from 'src/modules/crud/crud.typings'; |
||||
import { Connection } from 'src/modules/crud/crud.typings'; |
||||
import { getPluginWidgetEdit } from '../../../../app.service'; |
||||
|
||||
@shortcut() |
||||
export const FormPluginXtype = 'dec.dcm.maintain_plugin'; |
||||
@shortcut(FormPluginXtype) |
||||
export class FormPlugin extends BI.Widget { |
||||
static xtype = 'dec.dcm.maintain_plugin'; |
||||
props = { |
||||
formData: {} as Connection, |
||||
}; |
||||
} |
||||
|
||||
plugin: any; |
||||
|
||||
render() { |
||||
const { connectionType, connectionId, connectionName, connectionData } = this.options.formData; |
||||
|
||||
const { connectionType } = this.options.formData; |
||||
|
||||
return { |
||||
type: getPluginWidgetEdit(connectionType), |
||||
ref: (_ref: any) => { |
||||
this.plugin = _ref; |
||||
}, |
||||
value: connectionData, // 兼容
|
||||
connectionData, |
||||
connectionId, |
||||
connectionType, |
||||
connectionName, |
||||
value: this.options.formData.connectionData, |
||||
}; |
||||
} |
||||
|
||||
public getSubmitValue(): Connection { |
||||
const { connectionType, connectionId, connectionName, connectionData } = this.options.formData; |
||||
|
||||
const { connectionType, connectionId, connectionName } = this.options.formData; |
||||
|
||||
return { |
||||
connectionId, |
||||
connectionType, |
||||
connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName, |
||||
connectionData: <ConnectionPlugin>BI.extend({}, connectionData, this.plugin.getValue()), |
||||
connectionName, |
||||
connectionData: this.plugin.getValue(), |
||||
}; |
||||
} |
||||
|
||||
public getSaveFn() { |
||||
return this.plugin.save; |
||||
} |
||||
} |
||||
|
@ -1,96 +0,0 @@
|
||||
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; |
||||
}, |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,74 @@
|
||||
export const Icon = 'bi.icon'; |
||||
export const IconTextItem = 'bi.icon_text_item'; |
||||
export const IconTextIconItem = 'bi.icon_text_icon_item'; |
||||
export const IconButton = 'bi.icon_button'; |
||||
export const IconChangeButton = 'bi.icon_change_button'; |
||||
export const TextButton = 'bi.text_button'; |
||||
export const DownListCombo = 'bi.down_list_combo'; |
||||
export const Label = 'bi.label'; |
||||
export const SmallTextEditor = 'bi.small_text_editor'; |
||||
export const MultiFileEditor = 'bi.multifile_editor'; |
||||
export const SignEditor = 'bi.sign_editor'; |
||||
export const Button = 'bi.button'; |
||||
export const TextEditor = 'bi.text_editor'; |
||||
export const MultiSelectInsertCombo = 'bi.multi_select_insert_combo'; |
||||
export const MultiSelectCombo = 'bi.multi_select_combo'; |
||||
export const ButtonGroup = 'bi.button_group'; |
||||
export const AllValueChooserCombo = 'bi.all_value_chooser_combo'; |
||||
export const TextAreaEditor = 'bi.textarea_editor'; |
||||
export const MultiSelectItem = 'bi.multi_select_item'; |
||||
export const BarPopOver = 'bi.bar_popover'; |
||||
export const DynamicDateCombo = 'bi.dynamic_date_combo'; |
||||
export const DynamicDateTimeCombo = 'bi.dynamic_date_time_combo'; |
||||
export const MultiTreeCombo = 'bi.multi_tree_combo'; |
||||
export const RichEditor = 'bi.rich_editor'; |
||||
export const NicEditor = 'bi.nic_editor'; |
||||
export const Editor = 'bi.editor'; |
||||
export const MultiTreePopupView = 'bi.multi_tree_popup_view'; |
||||
export const SingleSelectRadioItem = 'bi.single_select_radio_item'; |
||||
export const SingleSelectInsertCombo = 'bi.single_select_insert_combo'; |
||||
export const SingleSelectCombo = 'bi.single_select_combo'; |
||||
export const Tab = 'bi.tab'; |
||||
export const DynamicYearMonthCombo = 'bi.dynamic_year_month_combo'; |
||||
export const Text = 'bi.text'; |
||||
export const Combo = 'bi.combo'; |
||||
export const TimeCombo = 'bi.time_combo'; |
||||
export const IFrame = 'bi.iframe'; |
||||
export const MultiTreeInsertCombo = 'bi.multi_tree_insert_combo'; |
||||
export const MultiTreeListCombo = 'bi.multi_tree_list_combo'; |
||||
export const MultilayerSingleTreeCombo = 'bi.multilayer_single_tree_combo'; |
||||
export const MultilayerSelectTreeCombo = 'bi.multilayer_select_tree_combo'; |
||||
export const AsyncTree = 'bi.async_tree'; |
||||
export const ListAsyncTree = 'bi.list_async_tree'; |
||||
export const MultilayerSingleTreePopup = 'bi.multilayer_single_tree_popup'; |
||||
export const MultilayerSelectTreePopup = 'bi.multilayer_select_tree_popup'; |
||||
export const IconLabel = 'bi.icon_label'; |
||||
export const Radio = 'bi.radio'; |
||||
export const LinearSegment = 'bi.linear_segment'; |
||||
export const SearchEditor = 'bi.search_editor'; |
||||
export const Img = 'bi.img'; |
||||
export const BubbleCombo = 'bi.bubble_combo'; |
||||
export const TextBubblePopupBarView = 'bi.text_bubble_bar_popup_view'; |
||||
export const TextValueCombo = 'bi.text_value_combo'; |
||||
export const Loader = 'bi.loader'; |
||||
export const EdirotIconCheckCombo = 'bi.editor_icon_check_combo'; |
||||
// 布局
|
||||
export const VerticalAdapt = 'bi.vertical_adapt'; |
||||
export const Vtape = 'bi.vtape'; |
||||
export const CenterAdapt = 'bi.center_adapt'; |
||||
export const Htape = 'bi.htape'; |
||||
export const Layout = 'bi.layout'; |
||||
export const Absolute = 'bi.absolute'; |
||||
export const Vertical = 'bi.vertical'; |
||||
export const Left = 'bi.left'; |
||||
export const Right = 'bi.right'; |
||||
export const HorizontalAdapt = 'bi.horizontal_adapt'; |
||||
export const AbsoluteCenterAdapt = 'bi.absolute_center_adapt'; |
||||
export const TableAdapt = 'bi.table_adapt'; |
||||
export const RightVerticalAdapt = 'bi.right_vertical_adapt'; |
||||
export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; |
||||
export const ListView = 'bi.list_view'; |
||||
export const VirtualGroup = 'bi.virtual_group'; |
||||
export const HorizotalAuto = 'bi.horizontal_auto'; |
||||
export const Horizotal = 'bi.horizontal'; |
||||
export const FloatCenter = 'bi.float_center'; |
@ -1,9 +0,0 @@
|
||||
import { Method, AxiosRequestConfig } from 'axios'; |
||||
|
||||
declare namespace AxiosType { |
||||
type X_Method = Method |
||||
interface X_AxiosRequestConfig extends AxiosRequestConfig { } |
||||
} |
||||
|
||||
export = AxiosType; |
||||
export as namespace AxiosType; |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue