Browse Source

Merge pull request #2 in ~ABBY/decision-webui-dcm from release/10.0 to final/10.0

* commit 'e4cfc10910c30826de66ab138482827a732e48e3':
  DEC-12158 fix: 国际化测试,遇到的一些界面问题
  fix: 由于容错率的关系,Number方法改成parseInt
  fix: DEC-11221 加入对可输入数值的区间验证
  DEC-11995 feat:密码传输自定义接口
  fix: 修改eslint
  fix: 修改eslint
  fix: DEC-12046 修复本地运行时报错的问题
  DEC-11996 feat: 【华为安全】内存等敏感信息需要鉴权才能获得,前台websocket事件携带token参数
final/10.0
Abby 5 years ago
parent
commit
fd2e90b6ef
  1. 1
      i18n/zh_cn.properties
  2. 5
      package.json
  3. 1
      private/i18n.ts
  4. 4
      src/modules/constants/constant.ts
  5. 2
      src/modules/crud/decision.api.ts
  6. 11
      src/modules/pages/database/database.ts
  7. 32
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  8. 2
      webpack/webpack.dev.js
  9. 15
      yarn.lock

1
i18n/zh_cn.properties

@ -302,3 +302,4 @@ BI-Basic_Quarter= 季度
BI-Basic_No_Select= 不选 BI-Basic_No_Select= 不选
BI-Basic_Now= 此刻 BI-Basic_Now= 此刻
Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB
Dec-Dcm_Connection_Value_Out_Range=数值超出范围

5
package.json

@ -19,6 +19,7 @@
"@babel/core": "7.4.5", "@babel/core": "7.4.5",
"@babel/plugin-proposal-class-properties": "^7.5.0", "@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/plugin-proposal-decorators": "7.4.4", "@babel/plugin-proposal-decorators": "7.4.4",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "7.4.5", "@babel/preset-env": "7.4.5",
"@babel/preset-typescript": "7.3.3", "@babel/preset-typescript": "7.3.3",
"@types/jest": "24.0.11", "@types/jest": "24.0.11",
@ -66,8 +67,8 @@
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=mock webpack-dev-server -p --progress --config=webpack/webpack.dev.js --mode development --open", "dev": "cross-env NODE_ENV=mock webpack-dev-server -p --progress --config=webpack/webpack.dev.js --mode development --open",
"build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", "build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production",
"eslint": "eslint './*.js' './**/*.js' './**/*.ts'", "eslint": "eslint . --ext .ts",
"eslint-fix": "eslint './*.js' './**/*.js' './**/*.ts' --fix", "eslint-fix": "eslint . --ext .ts --fix",
"const": "javac -encoding UTF-8 -d constants/classes constants/*.java && java -cp constants/classes FRConstantsWriter", "const": "javac -encoding UTF-8 -d constants/classes constants/*.java && java -cp constants/classes FRConstantsWriter",
"i18n": "node ./lib/transform-i18n/transform-i18n.js", "i18n": "node ./lib/transform-i18n/transform-i18n.js",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests",

1
private/i18n.ts

@ -301,4 +301,5 @@ export default {
'BI-Basic_No_Select': '不选', 'BI-Basic_No_Select': '不选',
'BI-Basic_Now': '此刻', 'BI-Basic_Now': '此刻',
'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB', 'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB',
'Dec-Dcm_Connection_Value_Out_Range': '数值超出范围',
}; };

4
src/modules/constants/constant.ts

@ -597,7 +597,7 @@ export const DATA_BASE_TYPES = [
export const CONNECT_CHARSET = [ export const CONNECT_CHARSET = [
{ {
text: '自动', text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: '', value: '',
}, },
{ {
@ -707,3 +707,5 @@ export const JNDI_FACTORYS = [
]; ];
export const PAGE_SIZE = 50; export const PAGE_SIZE = 50;
export const INT_MAX_VALUE = 2147483647;
export const INT_MIN_VALUE = -2147483648;

2
src/modules/crud/decision.api.ts

@ -96,7 +96,7 @@ export class DecisionApi implements Api {
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> { private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => { return new Promise(resolve => {
if (Dec && Dec.socket.connected) { if (Dec && Dec.socket.connected) {
Dec.socket.emit(type, BI.encode(name), (re: any) => { Dec.socketEmit(type, BI.encode(name), (re: any) => {
resolve(re); resolve(re);
}); });
} else { } else {

11
src/modules/pages/database/database.ts

@ -140,19 +140,23 @@ export class Datebase extends BI.Widget {
items: [ items: [
{ {
el: { el: {
type: VerticalAdapt, type: Htape,
hgap: 20, hgap: 20,
invisible: true, invisible: true,
items: [ items: [
{ {
type: Label, type: Label,
width: 70,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
}, },
{ {
type: MultiSelectItem, type: MultiSelectItem,
width: 80, width: 80,
selected: this.model.isInternal, selected: this.model.isInternal,
text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'),
title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'),
ref: (_ref: any) => { ref: (_ref: any) => {
this.internalWidget = _ref; this.internalWidget = _ref;
}, },
@ -165,6 +169,7 @@ export class Datebase extends BI.Widget {
width: 80, width: 80,
selected: this.model.isPlugin, selected: this.model.isPlugin,
text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'),
title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'),
ref: (_ref: any) => { ref: (_ref: any) => {
this.pluginWidget = _ref; this.pluginWidget = _ref;
}, },
@ -175,14 +180,16 @@ export class Datebase extends BI.Widget {
{ {
type: Label, type: Label,
cls: 'bi-tips', cls: 'bi-tips',
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'), text: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'),
title: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'),
}, },
], ],
ref: (_ref: any) => { ref: (_ref: any) => {
this.typeFilterWidget = _ref; this.typeFilterWidget = _ref;
}, },
}, },
height: 20, height: 24,
}, },
{ {
type: ButtonGroup, type: ButtonGroup,

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

@ -4,7 +4,7 @@ import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/col
import { FormItemXtype } from '../../components/form_item/form_item'; import { FormItemXtype } from '../../components/form_item/form_item';
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { CONNECT_CHARSET, CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service';
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; import { TextCheckerXtype } from '../../../../components/text_checker/text_checker';
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc';
@ -62,6 +62,12 @@ export class FormJdbc extends BI.Widget {
const { host, port, databaseName } = resolveUrlInfo(url); const { host, port, databaseName } = resolveUrlInfo(url);
const { hgap, vgap } = CONNECTION_LAYOUT; const { hgap, vgap } = CONNECTION_LAYOUT;
const valueRangeConfig = {
errorText: BI.i18nText('Dec-Dcm_Connection_Value_Out_Range'),
checker: (value: string) => this.checkValueRange(value),
autoFix: true,
};
return { return {
type: Vertical, type: Vertical,
hgap, hgap,
@ -161,7 +167,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.port = _ref; this.form.port = _ref;
}, },
@ -408,7 +414,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.initialSize = _ref; this.form.initialSize = _ref;
@ -428,7 +434,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.maxActive = _ref; this.form.maxActive = _ref;
}, },
@ -447,7 +453,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.maxIdle = _ref; this.form.maxIdle = _ref;
}, },
@ -466,7 +472,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.minIdle = _ref; this.form.minIdle = _ref;
}, },
@ -486,7 +492,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.maxWait = _ref; this.form.maxWait = _ref;
}, },
@ -574,7 +580,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'),
checker: (value: string) => this.checkNumber(value), checker: (value: string) => this.checkNumber(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.timeBetweenEvictionRunsMillis = _ref; this.form.timeBetweenEvictionRunsMillis = _ref;
}, },
@ -600,7 +606,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.numTestsPerEvictionRun = _ref; this.form.numTestsPerEvictionRun = _ref;
}, },
@ -620,7 +626,7 @@ export class FormJdbc extends BI.Widget {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.minEvictableIdleTimeMillis = _ref; this.form.minEvictableIdleTimeMillis = _ref;
}, },
@ -651,6 +657,10 @@ export class FormJdbc extends BI.Widget {
return /^[(\-|\+)?\d]+$/.test(value); return /^[(\-|\+)?\d]+$/.test(value);
} }
private checkValueRange(value: string) {
return parseInt(value, 0) <= INT_MAX_VALUE && parseInt(value, 0) >= INT_MIN_VALUE;
}
private getDrivers() { private getDrivers() {
const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionData = this.options.formData.connectionData as ConnectionJDBC;
const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver);
@ -732,7 +742,7 @@ export class FormJdbc extends BI.Widget {
driver: this.form.driver.getValue(), driver: this.form.driver.getValue(),
url: this.form.url.getValue(), url: this.form.url.getValue(),
user: this.form.user.getValue(), user: this.form.user.getValue(),
password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()), password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.Providers.getProvider('dec.provider.cipher').getCipher(this.form.password.getValue()),
queryType: '', queryType: '',
newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk
originalCharsetName, originalCharsetName,

2
webpack/webpack.dev.js

@ -36,7 +36,7 @@ chokidar
module.exports = merge(common, { module.exports = merge(common, {
devtool: 'eval-source-map', devtool: 'eval-source-map',
entry: { entry: {
show: ['./src/i18n.ts', './src/request.ts', './src/index.ts'], show: ['babel-polyfill', './src/i18n.ts', './src/request.ts', './src/index.ts'],
}, },
output: { output: {
path: dirs.DEST, path: dirs.DEST,

15
yarn.lock

@ -606,10 +606,10 @@
"@babel/helper-regex" "^7.4.4" "@babel/helper-regex" "^7.4.4"
regexpu-core "^4.5.4" regexpu-core "^4.5.4"
"@babel/polyfill@7.4.4": "@babel/polyfill@^7.8.3":
version "7.4.4" version "7.8.3"
resolved "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz#78801cf3dbe657844eeabf31c1cae3828051e893" resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.8.3.tgz#2333fc2144a542a7c07da39502ceeeb3abe4debd"
integrity sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg== integrity sha512-0QEgn2zkCzqGIkSWWAEmvxD7e00Nm9asTtQvi7HdlYvMhjy/J38V/1Y9ode0zEJeIuxAI0uftiAzqc7nVeWUGg==
dependencies: dependencies:
core-js "^2.6.5" core-js "^2.6.5"
regenerator-runtime "^0.13.2" regenerator-runtime "^0.13.2"
@ -3054,11 +3054,16 @@ core-js-compat@^3.1.1:
browserslist "^4.6.6" browserslist "^4.6.6"
semver "^6.3.0" semver "^6.3.0"
core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: core-js@^2.4.0, core-js@^2.5.0:
version "2.6.9" version "2.6.9"
resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2"
integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==
core-js@^2.6.5:
version "2.6.11"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c"
integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==
core-util-is@1.0.2, core-util-is@~1.0.0: core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

Loading…
Cancel
Save