Browse Source

Merge pull request #4701 in DEC/decision-webui-dcm from feature/x to release/11.0

* commit 'dc50a6a9284de99e8a45f6424ed137c17afdbd93':
  REPORT-67986 fix:【迭代】【数据连接支持SSH及SSL】优化显示
  DEC-22540 fix:【迭代】【数据连接支持SSH及SSL】调整目录树节点名称
  DEC-22408 feat:【迭代】【数据连接支持SSH及SSL】调整gap
  DEC-22408 feat:【迭代】【数据连接支持SSH及SSL】
bugfix/11.0
superman 3 years ago
parent
commit
68de0e899c
  1. 5
      .eslintrc
  2. 4
      package.json
  3. 68
      src/modules/components/file_chooser/file_chooser.model.ts
  4. 183
      src/modules/components/file_chooser/file_chooser.ts
  5. 120
      src/modules/components/text_checker/text_checker.ts
  6. 22
      src/modules/constants/constant.ts
  7. 214
      src/modules/crud/crud.typings.d.ts
  8. 241
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  9. 18
      src/modules/pages/maintain/components/form_item/form_item.ts
  10. 1379
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  11. 2
      tsconfig.json
  12. 22
      types/globals.d.ts

5
.eslintrc

@ -30,7 +30,8 @@
"no-use-before-define": [
"error",
{
"functions": false
"functions": false,
"classes ": false
}
],
"new-cap": [
@ -179,7 +180,7 @@
"array-bracket-spacing": ["error", "never"], // 数组紧贴括号部分不允许包含空格
"object-curly-spacing": ["error", "always"], // 对象紧贴花括号部分不允许包含空格
"no-regex-spaces": "error", // 禁止正则表达式字面量中出现多个空格
"no-multi-spaces": "error", // 禁止出现多个空格而且不是用来作缩进的
// "no-multi-spaces": "error", // 禁止出现多个空格而且不是用来作缩进的
"block-spacing": ["error", "never"], // 单行代码块中紧贴括号部分不允许包含空格
"computed-property-spacing": ["error", "never"], // 禁止括号和其内部值之间的空格
"no-trailing-spaces": [

4
package.json

@ -18,8 +18,8 @@
"devDependencies": {
"@fui/babel-preset-fineui": "^1.0.0",
"@types/jest": "24.0.11",
"@typescript-eslint/eslint-plugin": "1.7.0",
"@typescript-eslint/parser": "1.7.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"axios": "0.18.0",
"babel-loader": "8.0.6",
"body-parser": "1.18.3",

68
src/modules/components/file_chooser/file_chooser.model.ts

@ -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();
},
};
}

183
src/modules/components/file_chooser/file_chooser.ts

@ -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 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);
}
}

120
src/modules/components/text_checker/text_checker.ts

@ -3,87 +3,97 @@ import { Label, TextEditor } from '@fui/core';
@shortcut()
export class TextChecker extends BI.Widget {
static xtype = 'dec.dcm.components.text_checker';
public static xtype = 'dec.dcm.components.text_checker';
props = {
public props = {
width: 300,
allowBlank: true,
value: '',
watermark: '',
inputType: 'text',
autocomplete: '',
validationChecker: [] as {
errorText: string;
checker: (value: string) => boolean;
autoFix?: boolean;
}[],
$value: '',
}
};
textEditor: TextEditor;
errorLabel: Label;
public textEditor: TextEditor;
public errorLabel: Label;
private isError: boolean;
private value: string;
private errorChecker: {
errorText: string;
checker: (value: string) => boolean;
autoFix?: boolean;
}
};
render() {
const { width, allowBlank, value, watermark, validationChecker, $value } = this.options;
public render() {
const { width, allowBlank, value, watermark, inputType, autocomplete, validationChecker, $value } = this.options;
this.value = value;
return {
type: BI.AbsoluteLayout.xtype,
width,
height: 20,
items: [{
el: {
type: BI.TextEditor.xtype,
$value,
width,
allowBlank,
value,
watermark,
ref: (_ref: TextEditor) => {
this.textEditor = _ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action: () => {
const value = this.getValue();
if (value) {
this.errorChecker = validationChecker.find(item => item.checker && !item.checker(value));
this.errorLabel.setText(BI.get(this.errorChecker, 'errorText'));
this.isError = !!BI.get(this.errorChecker, 'errorText');
} else {
this.errorLabel.setText('');
this.isError = false;
}
if (!this.isError) {
this.value = value;
}
this.fireEvent(BI.Editor.EVENT_CHANGE);
},
}, {
eventName: BI.TextEditor.EVENT_BLUR,
action: () => {
if (BI.get(this.errorChecker, 'autoFix')) {
this.setValue(this.value);
this.errorLabel.setText('');
}
items: [
{
el: {
type: BI.TextEditor.xtype,
$value,
width,
allowBlank,
value,
watermark,
inputType,
autocomplete,
ref: (_ref: TextEditor) => {
this.textEditor = _ref;
},
}],
listeners: [
{
eventName: BI.Editor.EVENT_CHANGE,
action: () => {
const value = this.getValue();
if (value) {
this.errorChecker = validationChecker.find((item) => item.checker && !item.checker(value));
this.errorLabel.setText(BI.get(this.errorChecker, 'errorText'));
this.isError = !!BI.get(this.errorChecker, 'errorText');
} else {
this.errorLabel.setText('');
this.isError = false;
}
if (!this.isError) {
this.value = value;
}
this.fireEvent(BI.Editor.EVENT_CHANGE);
},
},
{
eventName: BI.TextEditor.EVENT_BLUR,
action: () => {
if (BI.get(this.errorChecker, 'autoFix')) {
this.setValue(this.value);
this.errorLabel.setText('');
}
},
},
],
},
},
}, {
el: {
type: BI.Label.xtype,
cls: 'bi-error',
ref: (_ref: Label) => {
this.errorLabel = _ref;
{
el: {
type: BI.Label.xtype,
cls: 'bi-error',
ref: (_ref: Label) => {
this.errorLabel = _ref;
},
},
top: -15,
},
top: -15,
}],
],
};
}
@ -98,4 +108,8 @@ export class TextChecker extends BI.Widget {
public setError(value: string) {
this.errorLabel.setText(value);
}
public setWatermark(value: string) {
this.textEditor.setWaterMark(value);
}
}

22
src/modules/constants/constant.ts

@ -734,6 +734,28 @@ export const CONNECT_CHARSET = [
},
];
export const CONNECT_SSH_TYPE = [
{
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
value: 'NORMAL',
privateKeyPathFormVisible: false,
secretFormName: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
},
{
text: BI.i18nText('Dec-Dcm_Connection_Form_PublicKey'),
value: 'KEY',
privateKeyPathFormVisible: true,
secretFormName: BI.i18nText('Dec-Dcm_Connection_Form_Passphrase'),
},
];
export const CONNECT_SSL_TYPE = [
{
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
value: 'NORMAL',
},
];
export const TEST_STATUS = {
LOADING: 'loading',
SUCCESS: 'success',

214
src/modules/crud/crud.typings.d.ts vendored

@ -1,3 +1,7 @@
export interface CrudParams {
[key: string]: string | number | { [key: string]: any };
}
export interface CrudReqOpts {
url?: string;
type?: 'GET' | 'POST' | 'DELETE' | 'PUT';
@ -9,28 +13,104 @@ export interface CrudReqOpts {
params?: CrudParams;
}
export interface CrudParams {
[key: string]: string | number | { [key: string]: any };
export interface ConnectionLicInfo {
currentConnectionNum: number;
maxConnectionNum: number;
}
export interface Connection {
connectionId: string;
connectionType: string;
connectionName: string;
creator?: string;
connectionData: ConnectionJDBC | ConnectionJNDI | ConnectionPlugin | string;
privilegeDetailBeanList?: {
privilegeType: number;
privilegeValue: number;
}[];
export interface ConnectionPoolType {
maxActive: number;
maxIdle: number;
numActive: number;
numIdle: number;
}
export interface ConnectionLicInfo {
currentConnectionNum: number;
maxConnectionNum: number;
type ConnectionDataOfSSH = {
usingSsh: boolean; // 使用SSH通道
sshIp: string; // 主机
sshPort: number; // 端口
sshUser: string; // 用户名
redirectPort: number;
redirectIp: string;
sshTimeOut: number;
sshKeepAlive: number;
} & (
| {
sshType: 'NORMAL'; // 验证方法:密码
sshPrivateKeyPath: ''; // 没啥意义,该验证方法下为空字符串
sshSecret: string; // 密码
}
| {
sshType: 'KEY'; // 验证方法:公钥
sshPrivateKeyPath: string; // 私钥
sshSecret: string; // 密码短语
}
);
type ConnectionDataOfSSL = {
usingSsl: boolean; // 使用SSL通道
sslType: 'NORMAL'; // SSL类型,只有NORMAL一种
caCertificate: string; // CA证书
verifyCa: boolean; // 验证针对CA的服务器证书
sslClientPrivateKey: string; // 客户端密钥
sslClientCertificate: string; // 客户端证书
};
export interface ConnectionPoolJDBC {
/**
*
*/
initialSize?: number;
/**
*
*/
maxActive?: number;
/**
*
*/
maxIdle?: number;
/**
*
*/
minIdle?: number;
/**
*
*/
maxWait?: number;
/**
* sql查询
*/
validationQuery?: string;
/**
*
*/
testOnBorrow?: boolean;
/**
*
*/
testOnReturn?: boolean;
/**
*
*/
testWhileIdle?: boolean;
/**
* 线
*/
timeBetweenEvictionRunsMillis?: number;
/**
*
*/
numTestsPerEvictionRun?: number;
/**
*
*/
minEvictableIdleTimeMillis?: number;
}
export interface ConnectionJDBC {
export type ConnectionJDBC ={
/**
*
*/
@ -44,6 +124,10 @@ export interface ConnectionJDBC {
*
*/
driver: string;
/**
*
*/
driverSource: 'default' | 'custom';
/**
* url
*/
@ -118,72 +202,8 @@ export interface ConnectionJDBC {
identity?: string;
connectionPoolAttr: ConnectionPoolJDBC;
}
export interface ConnectionPoolJDBC {
/**
*
*/
initialSize?: number;
/**
*
*/
maxActive?: number;
/**
*
*/
maxIdle?: number;
/**
*
*/
minIdle?: number;
/**
*
*/
maxWait?: number;
/**
* sql查询
*/
validationQuery?: string;
/**
*
*/
testOnBorrow?: boolean;
/**
*
*/
testOnReturn?: boolean;
/**
*
*/
testWhileIdle?: boolean;
/**
* 线
*/
timeBetweenEvictionRunsMillis?: number;
/**
*
*/
numTestsPerEvictionRun?: number;
/**
*
*/
minEvictableIdleTimeMillis?: number;
}
export interface ConnectionJNDI {
jndiName: string;
/**
*
*/
originalCharsetName: string;
newCharsetName: string;
creator?: string;
contextHashtable: ContextHashtable;
}
}& ConnectionDataOfSSH &
ConnectionDataOfSSL
export interface ContextHashtable {
'java.naming.factory.initial': string;
@ -203,25 +223,41 @@ export interface ContextHashtable {
'java.naming.applet': string;
}
export interface ConnectionJNDI {
jndiName: string;
/**
*
*/
originalCharsetName: string;
newCharsetName: string;
creator?: string;
contextHashtable: ContextHashtable;
}
export interface ConnectionPlugin {
pluginType: 'json';
creator: '';
pluginData: any;
}
export interface Connection {
connectionId: string;
connectionType: string;
connectionName: string;
creator?: string;
connectionData: ConnectionJDBC | ConnectionJNDI | ConnectionPlugin | string;
privilegeDetailBeanList?: {
privilegeType: number;
privilegeValue: number;
}[];
}
export interface TestRequest {
data?: string[];
errorCode?: string;
errorMsg?: string;
}
export interface ConnectionPoolType {
maxActive: number;
maxIdle: number;
numActive: number;
numIdle: number;
}
export interface SocketResult {
data?: string;
errorCode?: string;

241
src/modules/pages/connection/connection_jdbc/connection_jdbc.ts

@ -4,7 +4,7 @@ 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 } from '@constants/constant';
import { CONNECTION_LAYOUT, CONNECT_SSH_TYPE } from '@constants/constant';
import { VerticalLayout } from '@fui/core';
import { ApiFactory } from '../../../crud/apiFactory';
@ -15,10 +15,13 @@ const api = new ApiFactory().create();
export class ConnectionJdbc extends BI.Widget {
static xtype = 'dec.dcm.connection_jdbc';
advancedSet: any;
model: ConnectionJdecModel['model'];
allDatabaseTypes = getAllDatabaseTypes();
sshSet: VerticalLayout;
sslSet: VerticalLayout;
advancedSet: VerticalLayout;
render() {
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
const {
@ -33,6 +36,20 @@ export class ConnectionJdbc extends BI.Widget {
principal,
url,
fetchSize,
// ssh
usingSsh,
sshIp,
sshPort,
sshUser,
sshType,
sshSecret,
sshPrivateKeyPath,
// ssl
usingSsl,
caCertificate,
verifyCa,
sslClientPrivateKey,
sslClientCertificate,
} = connectionData;
const databaseType = getJdbcDatabaseType(database, driver);
const { host, port, databaseName } = resolveUrlInfo(url, database);
@ -63,14 +80,15 @@ export class ConnectionJdbc extends BI.Widget {
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,
},
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'),
@ -118,72 +136,181 @@ export class ConnectionJdbc extends BI.Widget {
value: connectionPoolAttr.maxWait,
unit: BI.i18nText('Dec-Dcm_Millisecond'),
},
// ssh设置
{
type: Collapse.xtype,
width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'),
width: 100,
invisible: !usingSsh,
name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSH'),
listeners: [
{
eventName: EVENT_CHANGE,
action: (isCollapse: boolean) => {
this.advancedSet.setVisible(!isCollapse);
this.sshSet.setVisible(!isCollapse);
},
},
],
},
{
type: BI.VerticalLayout.xtype,
tgap: -15,
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'),
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: [
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
value: connectionPoolAttr.timeBetweenEvictionRunsMillis,
unit: BI.i18nText('Dec-Dcm_Millisecond'),
eventName: EVENT_CHANGE,
action: (isCollapse: boolean) => {
this.sslSet.setVisible(!isCollapse);
},
},
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
value: connectionPoolAttr.numTestsPerEvictionRun,
],
},
{
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: [
{
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,
invisible: fetchSize < 0 && fetchSize !== -2,
name: 'Fetchsize',
value: fetchSize === -2 ? '' : fetchSize,
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,
invisible: fetchSize < 0 && fetchSize !== -2,
name: 'Fetchsize',
value: fetchSize === -2 ? '' : fetchSize,
},
],
},
},
],
};
}

18
src/modules/pages/maintain/components/form_item/form_item.ts

@ -1,4 +1,5 @@
import { shortcut } from '@core/core';
import { Label } from '@fui/core';
import { CONNECTION_LAYOUT } from '@constants/constant';
@shortcut()
@ -11,14 +12,19 @@ export class FormItem extends BI.Widget {
nameWidth: 140,
isBold: true,
$testId: 'dec-dcm-maintain-form-item',
}
};
nameLabel: Label;
render () {
render() {
return {
type: BI.FloatLeftLayout.xtype,
items: [
{
type: BI.Label.xtype,
ref: (ref: Label) => {
this.nameLabel = ref;
},
cls: this.options.isBold ? 'bi-font-bold' : '',
width: this.options.nameWidth,
textAlign: 'left',
@ -29,4 +35,12 @@ export class FormItem extends BI.Widget {
],
};
}
/**
*
* @param name
*/
setName(name: string) {
this.nameLabel.setText(name);
}
}

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

File diff suppressed because it is too large Load Diff

2
tsconfig.json

@ -19,7 +19,7 @@
// "noUnusedParameters": true,
// "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"skipLibCheck": false,
"paths": {
"ui": ["./src/ui"],
"ReportCst": ["./private/constants"],

22
types/globals.d.ts vendored

@ -2,6 +2,8 @@ interface Obj {
[key: string]: any;
}
type RequestFunction = (url: string, data: any, callback: (re: any) => void) => void;
declare let BI: Obj & import('@fui/core').BI & import('@fui/materials').BI;
declare const Fix: Obj;
declare const DecCst: Obj;
@ -10,15 +12,19 @@ declare const Dec: {
socket: {
connected: boolean;
};
system: {
};
system: {};
personal: {
username: string;
};
socketEmit: (type: string, name: string, callback: (re: any) => void) => void;
reqGet: (url: string, data: any, callback: (re: any) => void) => void;
reqPost: (url: string, data: any, callback: (re: any) => void) => void;
reqPut: (url: string, data: any, callback: (re: any) => void) => void;
reqDelete: (url: string, data: any, callback: (re: any) => void) => void;
};
// req
reqGet: RequestFunction;
reqPost: RequestFunction;
reqPut: RequestFunction;
reqDelete: RequestFunction;
// reqHandle
reqGetHandle: RequestFunction;
reqPostHandle: RequestFunction;
reqPutHandle: RequestFunction;
reqDeleteHandle: RequestFunction;
};

Loading…
Cancel
Save