Browse Source

Merge pull request #1322 in DEC/decision-webui-dcm from final/10.0 to persist/10.0

* commit 'a77a0d4c9339cedd1d34aea2020f53c35c311c1a':
  KERNEL-6541 修改xtype写法
  KERNEL-6541 引用类型规范化
  KERNEL-6541 类型引用规范化
  build: KERNEL-6541 引用类型规范化
persist/10.0
superman 4 years ago
parent
commit
e074a99e91
  1. 2
      config/jest.environment.js
  2. 8
      index.html
  3. 7
      package.json
  4. 4
      src/index.ts
  5. 2
      src/less/background.less
  6. 2
      src/less/font.less
  7. 4
      src/less/index.less
  8. 2
      src/less/lib/font.less
  9. 7
      src/modules/app.model.ts
  10. 38
      src/modules/app.ts
  11. 5
      src/modules/components/collapse/collapse.model.ts
  12. 27
      src/modules/components/collapse/collapse.ts
  13. 23
      src/modules/components/link_button/link.ts
  14. 5
      src/modules/components/test_status/test_status.model.ts
  15. 75
      src/modules/components/test_status/test_status.ts
  16. 6
      src/modules/components/test_status/tip_icon/tip_fail.model.ts
  17. 45
      src/modules/components/test_status/tip_icon/tip_fail.ts
  18. 14
      src/modules/components/test_status/tip_icon/tip_icon.ts
  19. 25
      src/modules/components/text_checker/text_checker.ts
  20. 42
      src/modules/core/core.ts
  21. 14
      src/modules/pages/connection/components/form_item/form_item.ts
  22. 22
      src/modules/pages/connection/connection.model.ts
  23. 73
      src/modules/pages/connection/connection.ts
  24. 16
      src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts
  25. 70
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  26. 15
      src/modules/pages/connection/connection_jndi/connection_jndi.model.ts
  27. 69
      src/modules/pages/connection/connection_jndi/connection_jndi.ts
  28. 17
      src/modules/pages/connection/connection_plugin/connection_plugin.model.ts
  29. 9
      src/modules/pages/connection/connection_plugin/connection_plugin.ts
  30. 16
      src/modules/pages/connection/list/list.model.ts
  31. 32
      src/modules/pages/connection/list/list.ts
  32. 26
      src/modules/pages/connection/list/list_item/list_item.model.ts
  33. 40
      src/modules/pages/connection/list/list_item/list_item.ts
  34. 17
      src/modules/pages/connection_pool/connection_pool.model.ts
  35. 43
      src/modules/pages/connection_pool/connection_pool.ts
  36. 13
      src/modules/pages/connection_pool/list_item/list_item.model.ts
  37. 14
      src/modules/pages/connection_pool/list_item/list_item.ts
  38. 14
      src/modules/pages/connection_pool/pool/pool.model.ts
  39. 71
      src/modules/pages/connection_pool/pool/pool.ts
  40. 16
      src/modules/pages/database/database.model.ts
  41. 77
      src/modules/pages/database/database.ts
  42. 12
      src/modules/pages/database/database.typings.d.ts
  43. 15
      src/modules/pages/database/database_type/database_type.model.ts
  44. 23
      src/modules/pages/database/database_type/database_type.ts
  45. 13
      src/modules/pages/database/filter/filter.model.ts
  46. 11
      src/modules/pages/database/filter/filter.ts
  47. 10
      src/modules/pages/index.ts
  48. 11
      src/modules/pages/maintain/components/form_item/form_item.ts
  49. 208
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  50. 143
      src/modules/pages/maintain/forms/components/form.jndi.ts
  51. 4
      src/modules/pages/maintain/forms/components/form.plugin.ts
  52. 38
      src/modules/pages/maintain/forms/form.model.ts
  53. 8
      src/modules/pages/maintain/forms/form.server.ts
  54. 24
      src/modules/pages/maintain/forms/form.ts
  55. 23
      src/modules/pages/maintain/maintain.model.ts
  56. 36
      src/modules/pages/maintain/maintain.ts
  57. 16
      src/modules/title/title.model.ts
  58. 31
      src/modules/title/title.ts
  59. 16
      src/modules/title/title_database/title_datebase.model.ts
  60. 24
      src/modules/title/title_database/title_datebase.ts
  61. 23
      src/modules/title/title_maintain/title_maintain.model.ts
  62. 22
      src/modules/title/title_maintain/title_maintain.ts
  63. 74
      src/ui/fineui.ts
  64. 1
      src/ui/index.ts
  65. 1
      tsconfig.json
  66. 2
      types/globals.d.ts
  67. 2
      webpack/webpack.common.js
  68. 5
      webpack/webpack.dev.js
  69. 2275
      yarn.lock

2
config/jest.environment.js

@ -11,7 +11,7 @@ class FineUiEnvironment extends JsdomEnvironment {
document.createElement('body'); document.createElement('body');
[ [
'../node_modules/fineui/dist/fineui.js', '../node_modules/@fui/core/dist/fineui.js',
'../node_modules/@fui/materials/docs/materials.js', '../node_modules/@fui/materials/docs/materials.js',
'../config/fineui.prepare.js', '../config/fineui.prepare.js',
'./fineui.setup.js', './fineui.setup.js',

8
index.html

@ -5,15 +5,15 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Fine Report</title> <title>Fine Report</title>
<!--核心css文件--> <!--核心css文件-->
<link rel="preload" href="./node_modules/fineui/dist/font/iconfont.woff" as="font" type="font/woff" crossorigin="" /> <link rel="preload" href="./node_modules/@fui/core/dist/font/iconfont.woff" as="font" type="font/woff" crossorigin="" />
<link rel="stylesheet" type="text/css" href="./node_modules/fineui/dist/fineui.css" /> <link rel="stylesheet" type="text/css" href="./node_modules/@fui/core/dist/fineui.css" />
<link rel="stylesheet" type="text/css" href="./node_modules/@fui/materials/docs/materials.css" /> <link rel="stylesheet" type="text/css" href="./node_modules/@fui/materials/docs/materials.css" />
</head> </head>
<body id="body"> <body id="body">
<div id="wrapper"></div> <div id="wrapper"></div>
<script src="./node_modules/fineui/dist/fineui.js"></script> <script src="./node_modules/@fui/core/dist/fineui.js"></script>
<script src="./node_modules/fineui/dist/utils.js"></script> <script src="./node_modules/@fui/core/dist/utils.js"></script>
<script src="./node_modules/@fui/materials/docs/materials.js"></script> <script src="./node_modules/@fui/materials/docs/materials.js"></script>
<script src="./assets/scripts/dec.js"></script> <script src="./assets/scripts/dec.js"></script>
<script src="./redis.js"></script> <script src="./redis.js"></script>

7
package.json

@ -16,6 +16,7 @@
"nprogress": "0.2.0" "nprogress": "0.2.0"
}, },
"devDependencies": { "devDependencies": {
"@fui/babel-preset-fineui": "^1.0.0",
"@types/jest": "24.0.11", "@types/jest": "24.0.11",
"@typescript-eslint/eslint-plugin": "1.7.0", "@typescript-eslint/eslint-plugin": "1.7.0",
"@typescript-eslint/parser": "1.7.0", "@typescript-eslint/parser": "1.7.0",
@ -28,6 +29,7 @@
"eslint": "5.16.0", "eslint": "5.16.0",
"eslint-plugin-jest": "22.4.1", "eslint-plugin-jest": "22.4.1",
"express": "4.16.4", "express": "4.16.4",
"fork-ts-checker-webpack-plugin": "1.4.3",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"http-proxy": "1.17.0", "http-proxy": "1.17.0",
"husky": "1.3.1", "husky": "1.3.1",
@ -50,11 +52,10 @@
"webpack": "4.35.2", "webpack": "4.35.2",
"webpack-cli": "3.3.5", "webpack-cli": "3.3.5",
"webpack-dev-server": "3.7.2", "webpack-dev-server": "3.7.2",
"webpack-merge": "4.2.1", "webpack-merge": "4.2.1"
"@fui/babel-preset-fineui": "^1.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"fineui": "^2.0.0", "@fui/core": "^2.0.0",
"@fui/materials": "10.0.0-release - 10.0.0-release.99999999999999" "@fui/materials": "10.0.0-release - 10.0.0-release.99999999999999"
}, },
"scripts": { "scripts": {

4
src/index.ts

@ -1,5 +1,5 @@
import { AppXtype } from './modules/app'; import { App } from './modules/app';
BI.createWidget({ BI.createWidget({
type: AppXtype, type: App.xtype,
element: '#wrapper', element: '#wrapper',
}); });

2
src/less/background.less

@ -1,4 +1,4 @@
@import "../../node_modules/fineui/src/less/image.less"; @import "../../node_modules/@fui/core/src/less/image.less";
@import "./lib/background.less"; @import "./lib/background.less";
@import "var"; @import "var";

2
src/less/font.less

@ -1,4 +1,4 @@
@import "../../node_modules/fineui/src/less/image.less"; @import "../../node_modules/@fui/core/src/less/image.less";
@import "./lib/font.less"; @import "./lib/font.less";
.addFontRes(); .addFontRes();
.font(dcm-link-font, @font-link); .font(dcm-link-font, @font-link);

4
src/less/index.less

@ -1,5 +1,5 @@
@import "../../node_modules/fineui/src/less/lib/colors.less"; @import "../../node_modules/@fui/core/src/less/lib/colors.less";
@import '../../node_modules/fineui/src/less/visual.less'; @import '../../node_modules/@fui/core/src/less/visual.less';
@import "background.less"; @import "background.less";
@import "font.less"; @import "font.less";
@import "var.less"; @import "var.less";

2
src/less/lib/font.less

@ -1,4 +1,4 @@
@import '../../../node_modules/fineui/src/less/lib/font.less'; @import '../../../node_modules/@fui/core/src/less/lib/font.less';
@font-link: "e759"; @font-link: "e759";
@font-link-test: "e763"; @font-link-test: "e763";

7
src/modules/app.model.ts

@ -2,11 +2,12 @@ import { PAGE_INDEX, DATEBASE_FILTER_TYPE } from './constants/constant';
import { Model, model } from '@core/core'; import { Model, model } from '@core/core';
import { Connection } from 'src/modules/crud/crud.typings'; import { Connection } from 'src/modules/crud/crud.typings';
import { getAllDatabaseTypes } from './app.service'; import { getAllDatabaseTypes } from './app.service';
export const AppModelXtype = 'dec.dcm.model.main';
@model(AppModelXtype) @model()
export class AppModel extends Model { export class AppModel extends Model {
childContext = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'filter', 'connections', 'connectionSelected', 'connectionSelectedOne', 'saveEvent', 'testEvent', 'isCopy']; static xtype = 'dec.dcm.model.main';
childContext = <const>['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'filter', 'connections', 'connectionSelected', 'connectionSelectedOne', 'saveEvent', 'testEvent', 'isCopy'];
state() { state() {
return { return {

38
src/modules/app.ts

@ -1,17 +1,21 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Tab, Vtape, Absolute } from 'ui'; import { Title } from './title/title';
import { TitleXtype } from './title/title';
import { PAGE_INDEX } from './constants/constant'; import { PAGE_INDEX } from './constants/constant';
import { ConnectionXtype, DatebaseXtype, MaintainXtype, ConnectionPoolXtype } from './pages'; import { Connection } from './pages/connection/connection';
import { AppModel, AppModelXtype } from './app.model'; import { AppModel } from './app.model';
import { Tab } from '@fui/core';
import { Datebase } from './pages/database/database';
import { Maintain } from './pages/maintain/maintain';
import { ConnectionPool } from './pages/connection_pool/connection_pool';
import './app.provider'; import './app.provider';
import '../less/index.less'; import '../less/index.less';
export const AppXtype = 'dec.dcm.main'; @shortcut()
@store(AppModelXtype) @store(AppModel)
@shortcut(AppXtype)
export class App extends BI.Widget { export class App extends BI.Widget {
tab: any; static xtype = 'dec.dcm.main';
tab: Tab;
store: AppModel['store']; store: AppModel['store'];
model: AppModel['model']; model: AppModel['model'];
@ -24,45 +28,45 @@ export class App extends BI.Widget {
render() { render() {
return { return {
type: Vtape, type: BI.VTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: TitleXtype, type: Title.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
}, },
height: 40, height: 40,
}, },
{ {
type: Absolute, type: BI.AbsoluteLayout.xtype,
cls: 'bi-background', cls: 'bi-background',
items: [{ items: [{
el: { el: {
type: Tab, type: BI.Tab.xtype,
cls: 'bi-card', cls: 'bi-card',
single: true, single: true,
tgap: 10, tgap: 10,
showIndex: this.model.pageIndex, showIndex: this.model.pageIndex,
ref: (_ref: any) => { ref: (_ref: Tab) => {
this.tab = _ref; this.tab = _ref;
}, },
cardCreator: (index: string) => { cardCreator: (index: string) => {
switch (index) { switch (index) {
case PAGE_INDEX.CONNECTION: case PAGE_INDEX.CONNECTION:
return { return {
type: ConnectionXtype, type: Connection.xtype,
}; };
case PAGE_INDEX.DATEBASE: case PAGE_INDEX.DATEBASE:
return { return {
type: DatebaseXtype, type: Datebase.xtype,
}; };
case PAGE_INDEX.MAINTAIN: case PAGE_INDEX.MAINTAIN:
return { return {
type: MaintainXtype, type: Maintain.xtype,
}; };
default: default:
return { return {
type: ConnectionPoolXtype, type: ConnectionPool.xtype,
}; };
} }
}, },

5
src/modules/components/collapse/collapse.model.ts

@ -1,8 +1,9 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
export const CollapseModelXtype = 'dec.dcm.model.components.collapse'; @model()
@model(CollapseModelXtype)
export class CollapseModel extends Model { export class CollapseModel extends Model {
static xtype = 'dec.dcm.model.components.collapse';
state() { state() {
return { return {
isCollapse: true, isCollapse: true,

27
src/modules/components/collapse/collapse.ts

@ -1,20 +1,21 @@
import { IconLabel, Left, Label } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { CollapseModel, CollapseModelXtype } from './collapse.model'; import { CollapseModel } from './collapse.model';
import { IconLabel } from '@fui/core';
export const EVENT_CHANGE = 'EVENT_CHANGE'; export const EVENT_CHANGE = 'EVENT_CHANGE';
export const CollapseXtype = 'dec.dcm.components.collapse'; @shortcut()
@shortcut(CollapseXtype) @store(CollapseModel)
@store(CollapseModelXtype)
export class Collapse extends BI.BasicButton { export class Collapse extends BI.BasicButton {
static xtype = 'dec.dcm.components.collapse';
props = { props = {
name: '', name: '',
isCollapse: true, isCollapse: true,
$testId: 'dec-dcm-components-collapse', $testId: 'dec-dcm-components-collapse',
} }
rightFont: any; rightFont: IconLabel;
downFont: any; downFont: IconLabel;
model: CollapseModel['model']; model: CollapseModel['model'];
store: CollapseModel['store']; store: CollapseModel['store'];
@ -31,28 +32,28 @@ export class Collapse extends BI.BasicButton {
this.store.setCollapse(this.options.isCollapse); this.store.setCollapse(this.options.isCollapse);
return { return {
type: Left, type: BI.FloatLeftLayout.xtype,
items: [ items: [
{ {
type: IconLabel, type: BI.IconLabel.xtype,
height: 17, height: 17,
cls: 'dcm-triangle-collapse-font icon-size-16', cls: 'dcm-triangle-collapse-font icon-size-16',
ref: (_ref: any) => { ref: (_ref: IconLabel) => {
this.rightFont = _ref; this.rightFont = _ref;
}, },
invisible: !this.model.isCollapse, invisible: !this.model.isCollapse,
}, },
{ {
type: IconLabel, type: BI.IconLabel.xtype,
height: 17, height: 17,
cls: 'dcm-triangle-expand-font icon-size-16', cls: 'dcm-triangle-expand-font icon-size-16',
ref: (_ref: any) => { ref: (_ref: IconLabel) => {
this.downFont = _ref; this.downFont = _ref;
}, },
invisible: this.model.isCollapse, invisible: this.model.isCollapse,
}, },
{ {
type: Label, type: BI.Label.xtype,
lgap: 2, lgap: 2,
text: this.options.name, text: this.options.name,
}, },

23
src/modules/components/link_button/link.ts

@ -1,25 +1,36 @@
import { CenterAdapt, Label } from 'ui';
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Label } from '@fui/core';
export const LinkXtype = 'dec.dcm.components.link.button';
const DEFAULT_LINK = '/'; const DEFAULT_LINK = '/';
@shortcut(LinkXtype) @shortcut()
export class LinkButton extends BI.BasicButton { export class LinkButton extends BI.BasicButton {
props = { static xtype = 'dec.dcm.components.link.button';
props: {
text: string;
cls: string;
$testId: string;
link?: Function | string;
} = {
text: '', text: '',
cls: 'cursor-pointer', cls: 'cursor-pointer',
$testId: 'dec-dcm-link-button', $testId: 'dec-dcm-link-button',
} }
private text: Label;
render() { render() {
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
cls: 'bi-high-light', cls: 'bi-high-light',
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-high-light-border-bottom', cls: 'bi-high-light-border-bottom',
text: this.options.text, text: this.options.text,
ref: (_ref: Label) => {
this.text = _ref;
},
}, },
], ],
}; };

5
src/modules/components/test_status/test_status.model.ts

@ -1,8 +1,9 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { TEST_STATUS } from '@constants/constant'; import { TEST_STATUS } from '@constants/constant';
export const TestStatusModelXtype = 'dec.dcm.model.components.test_status';
@model(TestStatusModelXtype) @model()
export class TestStatusModel extends Model { export class TestStatusModel extends Model {
static xtype = 'dec.dcm.model.components.test_status';
state() { state() {
return { return {
status: TEST_STATUS.LOADING, status: TEST_STATUS.LOADING,

75
src/modules/components/test_status/test_status.ts

@ -1,17 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { TestStatusModelXtype, TestStatusModel } from './test_status.model'; import { TestStatusModel } from './test_status.model';
import { CenterAdapt, Tab, Vertical, Label, TextButton, Left } from 'ui';
import { TEST_STATUS } from '@constants/constant'; import { TEST_STATUS } from '@constants/constant';
import { TipIconXtype } from './tip_icon/tip_icon'; import { TipIcon } from './tip_icon/tip_icon';
import { TipFailXtype, EVENT_CLOSE, EVENT_RELOAD, EVENT_DETAIL } from './tip_icon/tip_fail'; import { TipFail } from './tip_icon/tip_fail';
export const TestStatusXtype = 'dec.dcm.components.test_status'; import { FloatLeftLayout, Label, Tab, VerticalLayout } from '@fui/core';
export { @shortcut()
EVENT_CLOSE, @store(TestStatusModel)
EVENT_RELOAD,
};
@shortcut(TestStatusXtype)
@store(TestStatusModelXtype)
export class TestStatus extends BI.Widget { export class TestStatus extends BI.Widget {
static xtype = 'dec.dcm.components.test_status';
static EVENT_CLOSE = 'EVENT_CLOSE';
static EVENT_RELOAD = 'EVENT_RELOAD';
props = { props = {
loadingCls: '', loadingCls: '',
loadingText: '', loadingText: '',
@ -25,11 +24,11 @@ export class TestStatus extends BI.Widget {
model: TestStatusModel['model']; model: TestStatusModel['model'];
store: TestStatusModel['store']; store: TestStatusModel['store'];
tab: any; tab: Tab;
failMessage: any; failMessage: Label;
failDriverMessage: any; failDriverMessage: Label;
driverLink: any; driverLink: FloatLeftLayout;
detail: any; detail: VerticalLayout;
watch = { watch = {
status: (status: string) => { status: (status: string) => {
@ -41,52 +40,52 @@ export class TestStatus extends BI.Widget {
const { loadingCls, loadingText, successCls, successText, failCls, failText, retryText } = this.options; const { loadingCls, loadingText, successCls, successText, failCls, failText, retryText } = this.options;
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
cls: 'bi-z-index-mask', cls: 'bi-z-index-mask',
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: Tab, type: BI.Tab.xtype,
cls: 'bi-card', cls: 'bi-card',
width: 450, width: 450,
height: 250, height: 250,
single: true, single: true,
showIndex: this.model.status, showIndex: this.model.status,
ref: (_ref: any) => { ref: (_ref: Tab) => {
this.tab = _ref; this.tab = _ref;
}, },
cardCreator: (index: string) => { cardCreator: (index: string) => {
switch (index) { switch (index) {
case TEST_STATUS.SUCCESS: case TEST_STATUS.SUCCESS:
return { return {
type: TipIconXtype, type: TipIcon.xtype,
tipCls: successCls, tipCls: successCls,
tipText: successText, tipText: successText,
}; };
case TEST_STATUS.FAIL: case TEST_STATUS.FAIL:
return { return {
type: TipFailXtype, type: TipFail.xtype,
tipCls: failCls, tipCls: failCls,
tipText: failText, tipText: failText,
retryText, retryText,
listeners: [ listeners: [
{ {
eventName: EVENT_RELOAD, eventName: TipFail.EVENT_RELOAD,
action: () => { action: () => {
this.fireEvent(EVENT_RELOAD); this.fireEvent(TestStatus.EVENT_RELOAD);
this.detail.setVisible(false); this.detail.setVisible(false);
}, },
}, },
{ {
eventName: EVENT_CLOSE, eventName: TipFail.EVENT_CLOSE,
action: () => { action: () => {
this.fireEvent(EVENT_CLOSE); this.fireEvent(TestStatus.EVENT_CLOSE);
}, },
}, },
{ {
eventName: EVENT_DETAIL, eventName: TipFail.EVENT_DETAIL,
action: (isCollapse: boolean) => { action: (isCollapse: boolean) => {
this.tab.setHeight(isCollapse ? 250 : 200); this.tab.setHeight(isCollapse ? 250 : 200);
this.detail.setVisible(!isCollapse); this.detail.setVisible(!isCollapse);
@ -96,7 +95,7 @@ export class TestStatus extends BI.Widget {
}; };
default: default:
return { return {
type: TipIconXtype, type: TipIcon.xtype,
tipCls: loadingCls, tipCls: loadingCls,
tipText: loadingText, tipText: loadingText,
}; };
@ -104,13 +103,13 @@ export class TestStatus extends BI.Widget {
}, },
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
cls: 'bi-card', cls: 'bi-card',
invisible: true, invisible: true,
bgap: 10, bgap: 10,
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
cls: 'bi-header-background', cls: 'bi-header-background',
vgap: 5, vgap: 5,
hgap: 10, hgap: 10,
@ -118,29 +117,29 @@ export class TestStatus extends BI.Widget {
height: 75, height: 75,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
whiteSpace: 'normal', whiteSpace: 'normal',
width: 400, width: 400,
textAlign: 'left', textAlign: 'left',
text: '', text: '',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.failMessage = _ref; this.failMessage = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
textAlign: 'left', textAlign: 'left',
invisible: true, invisible: true,
ref: (_ref: any) => { ref: (_ref: Label) => {
this.failDriverMessage = _ref; this.failDriverMessage = _ref;
}, },
}, },
{ {
type: Left, type: BI.FloatLeftLayout.xtype,
invisible: true, invisible: true,
items: [ items: [
{ {
type: TextButton, type: BI.TextButton.xtype,
cls: 'bi-high-light bi-high-light-border-bottom', cls: 'bi-high-light bi-high-light-border-bottom',
text: BI.i18nText('Dec-Dcm_Connection_Download_Driver'), text: BI.i18nText('Dec-Dcm_Connection_Download_Driver'),
handler: () => { handler: () => {
@ -148,14 +147,14 @@ export class TestStatus extends BI.Widget {
}, },
}, },
], ],
ref: (_ref: any) => { ref: (_ref: FloatLeftLayout) => {
this.driverLink = _ref; this.driverLink = _ref;
}, },
}, },
], ],
}, },
], ],
ref: (_ref: any) => { ref: (_ref: VerticalLayout) => {
this.detail = _ref; this.detail = _ref;
}, },
}, },

6
src/modules/components/test_status/tip_icon/tip_fail.model.ts

@ -1,7 +1,9 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
export const TipFailModelXtype = 'dec.dcm.model.components.test_status.tip_fail';
@model(TipFailModelXtype) @model()
export class TipFailModel extends Model { export class TipFailModel extends Model {
static xtype = 'dec.dcm.model.components.test_status.tip_fail';
context: ['isCollapse']; context: ['isCollapse'];
state() { state() {

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

@ -1,13 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Vertical, HorizotalAuto, CenterAdapt, Label, VerticalAdapt, Button } from 'ui'; import { Button } from '@fui/core';
import { TipFailModel, TipFailModelXtype } from './tip_fail.model'; import { TipFailModel } from './tip_fail.model';
export const TipFailXtype = 'dec.dcm.components.test_status.tip_fail';
export const EVENT_CLOSE = 'EVENT_CLOSE'; @shortcut()
export const EVENT_RELOAD = 'EVENT_RELOAD'; @store(TipFailModel)
export const EVENT_DETAIL = 'EVENT_DETAIL';
@shortcut(TipFailXtype)
@store(TipFailModelXtype)
export class TipFail extends BI.Widget { export class TipFail extends BI.Widget {
static xtype = 'dec.dcm.components.test_status.tip_fail';
static EVENT_CLOSE = 'EVENT_CLOSE';
static EVENT_RELOAD = 'EVENT_RELOAD';
static EVENT_DETAIL = 'EVENT_DETAIL';
props = { props = {
tipCls: '', tipCls: '',
tipText: '', tipText: '',
@ -17,7 +20,7 @@ export class TipFail extends BI.Widget {
model: TipFailModel['model']; model: TipFailModel['model'];
store: TipFailModel['store']; store: TipFailModel['store'];
detailButton: any; detailButton: Button;
watch = { watch = {
isCollapse: (isCollapse: boolean) => { isCollapse: (isCollapse: boolean) => {
@ -31,13 +34,13 @@ export class TipFail extends BI.Widget {
const { tipCls, tipText, retryText } = this.options; const { tipCls, tipText, retryText } = this.options;
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: HorizotalAuto, type: BI.HorizontalAutoLayout.xtype,
cls: tipCls, cls: tipCls,
bgap: 20, bgap: 20,
items: [{ items: [{
@ -46,40 +49,40 @@ export class TipFail extends BI.Widget {
height: 60, height: 60,
}], }],
}, { }, {
type: Label, type: BI.Label.xtype,
height: 14, height: 14,
bgap: 10, bgap: 10,
text: tipText, text: tipText,
}, },
{ {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
hgap: 5, hgap: 5,
items: [ items: [
{ {
type: Button, type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'),
level: 'ignore', level: 'ignore',
ref: (_ref: any) => { ref: (_ref: Button) => {
this.detailButton = _ref; this.detailButton = _ref;
}, },
handler: () => { handler: () => {
this.store.setIsCollapse(!this.model.isCollapse); this.store.setIsCollapse(!this.model.isCollapse);
this.fireEvent(EVENT_DETAIL, !this.model.isCollapse); this.fireEvent(TipFail.EVENT_DETAIL, !this.model.isCollapse);
}, },
}, },
{ {
type: Button, type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Back'), text: BI.i18nText('Dec-Dcm_Back'),
level: 'ignore', level: 'ignore',
handler: () => { handler: () => {
this.fireEvent(EVENT_CLOSE); this.fireEvent(TipFail.EVENT_CLOSE);
}, },
}, },
{ {
type: Button, type: BI.Button.xtype,
text: retryText, text: retryText,
handler: () => { handler: () => {
this.fireEvent(EVENT_RELOAD); this.fireEvent(TipFail.EVENT_RELOAD);
}, },
}, },
], ],

14
src/modules/components/test_status/tip_icon/tip_icon.ts

@ -1,8 +1,8 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Vertical, HorizotalAuto, CenterAdapt, Label } from 'ui'; @shortcut()
export const TipIconXtype = 'dec.dcm.components.test_status.tip_icon';
@shortcut(TipIconXtype)
export class TipIcon extends BI.Widget { export class TipIcon extends BI.Widget {
static xtype = 'dec.dcm.components.test_status.tip_icon';
props = { props = {
tipCls: '', tipCls: '',
tipText: '', tipText: '',
@ -11,13 +11,13 @@ export class TipIcon extends BI.Widget {
const { tipCls, tipText } = this.options; const { tipCls, tipText } = this.options;
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: HorizotalAuto, type: BI.HorizontalAutoLayout.xtype,
cls: tipCls, cls: tipCls,
bgap: 20, bgap: 20,
items: [{ items: [{
@ -26,7 +26,7 @@ export class TipIcon extends BI.Widget {
height: 60, height: 60,
}], }],
}, { }, {
type: Label, type: BI.Label.xtype,
height: 14, height: 14,
text: tipText, text: tipText,
}, },

25
src/modules/components/text_checker/text_checker.ts

@ -1,8 +1,10 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { TextEditor, Absolute, Label } from 'ui'; import { Label, TextEditor } from '@fui/core';
export const TextCheckerXtype = 'dec.dcm.components.text_checker';
@shortcut(TextCheckerXtype) @shortcut()
export class TextChecker extends BI.Widget { export class TextChecker extends BI.Widget {
static xtype = 'dec.dcm.components.text_checker';
props = { props = {
width: 300, width: 300,
allowBlank: true, allowBlank: true,
@ -13,11 +15,12 @@ export class TextChecker extends BI.Widget {
checker: (value: string) => boolean; checker: (value: string) => boolean;
autoFix?: boolean; autoFix?: boolean;
}[], }[],
$value: '',
} }
textEditor: any; textEditor: TextEditor;
errorLabel: any; errorLabel: Label;
private isError; private isError: boolean;
private value: string; private value: string;
private errorChecker: { private errorChecker: {
errorText: string; errorText: string;
@ -30,18 +33,18 @@ export class TextChecker extends BI.Widget {
this.value = value; this.value = value;
return { return {
type: Absolute, type: BI.AbsoluteLayout.xtype,
width, width,
height: 20, height: 20,
items: [{ items: [{
el: { el: {
type: TextEditor, type: BI.TextEditor.xtype,
$value, $value,
width, width,
allowBlank, allowBlank,
value, value,
watermark, watermark,
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.textEditor = _ref; this.textEditor = _ref;
}, },
listeners: [{ listeners: [{
@ -73,9 +76,9 @@ export class TextChecker extends BI.Widget {
}, },
}, { }, {
el: { el: {
type: Label, type: BI.Label.xtype,
cls: 'bi-error', cls: 'bi-error',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.errorLabel = _ref; this.errorLabel = _ref;
}, },
}, },

42
src/modules/core/core.ts

@ -1,43 +1,3 @@
type Constructor<T> = new(...args: any[]) => T; type Constructor<T> = new(...args: any[]) => T;
export function shortcut(className: string) { export const { shortcut, model, store, Model, provider } = BI.Decorators;
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};
}

14
src/modules/pages/connection/components/form_item/form_item.ts

@ -1,8 +1,8 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Label, Htape, Vertical } from 'ui';
export const FormItemXtype = 'dec.dcm.connection_form_item'; @shortcut()
@shortcut(FormItemXtype)
export class FormItem extends BI.Widget { export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.connection_form_item';
props = { props = {
name: '', name: '',
value: '', value: '',
@ -16,12 +16,12 @@ export class FormItem extends BI.Widget {
const { nameWidth, unit, value } = this.options; const { nameWidth, unit, value } = this.options;
return { return {
type: Htape, type: BI.HTapeLayout.xtype,
height: 17, height: 17,
items: [ items: [
{ {
el: { el: {
type: Label, type: BI.Label.xtype,
cls: this.options.isBold ? 'bi-font-bold' : '', cls: this.options.isBold ? 'bi-font-bold' : '',
textAlign: 'left', textAlign: 'left',
text: this.options.name, text: this.options.name,
@ -29,10 +29,10 @@ export class FormItem extends BI.Widget {
width: nameWidth, width: nameWidth,
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
text: unit ? `${value} ${unit}` : value, text: unit ? `${value} ${unit}` : value,
textAlign: 'left', textAlign: 'left',
title: value, title: value,

22
src/modules/pages/connection/connection.model.ts

@ -2,18 +2,20 @@ import { model, Model } from '@core/core';
import { AppModel } from '../../app.model'; import { AppModel } from '../../app.model';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const ConnectionModelXtype = 'dec.dcm.model.connection'; @model()
@model(ConnectionModelXtype)
export class ConnectionModel extends Model<{ export class ConnectionModel extends Model<{
context : { types : {
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['$$childContext']['connectionSelected']; connectionSelected: AppModel['TYPE']['connectionSelected'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
} },
context: ConnectionModel['context'];
}> { }> {
context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected']; static xtype = 'dec.dcm.model.connection';
context = <const>['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected'];
actions = { actions = {
setPageIndex:(index: string) => { setPageIndex:(index: string) => {

73
src/modules/pages/connection/connection.ts

@ -1,26 +1,27 @@
import { Button, Htape, Vtape, Label, VerticalAdapt, ListView, CenterAdapt, Layout } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ConnectionModel, ConnectionModelXtype } from './connection.model'; import { ConnectionModel } from './connection.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { ConnectionListXtype } from './list/list'; import { ConnectionList } from './list/list';
import { ConnectionJdbcXtype } from './connection_jdbc/connection_jdbc'; import { ConnectionJdbc } from './connection_jdbc/connection_jdbc';
import { ConnectionJndiXtype } from './connection_jndi/connection_jndi'; import { ConnectionJndi } from './connection_jndi/connection_jndi';
import { ConnectionPluginXtype } from './connection_plugin/connection_plugin'; import { ConnectionPlugin } from './connection_plugin/connection_plugin';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service'; import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from '../../crud/crud.typings'; import { ConnectionJDBC } from '../../crud/crud.typings';
import { Button, HTapeLayout, Label, ListView } from '@fui/core';
export const ConnectionXtype = 'dec.dcm.connection'; @shortcut()
@shortcut(ConnectionXtype) @store(ConnectionModel)
@store(ConnectionModelXtype)
export class Connection extends BI.Widget { export class Connection extends BI.Widget {
static xtype = 'dec.dcm.connection';
store: ConnectionModel['store']; store: ConnectionModel['store'];
model: ConnectionModel['model']; model: ConnectionModel['model'];
connectionTitleWidget: any; connectionTitleWidget: Label;
connectionEditWidget: any; connectionEditWidget: Button;
listView: any; listView: ListView;
title: any; title: HTapeLayout;
watch = { watch = {
connectionSelected:(name: string) => { connectionSelected:(name: string) => {
@ -48,21 +49,21 @@ export class Connection extends BI.Widget {
this.store.setConnectionSelected(''); this.store.setConnectionSelected('');
return { return {
type: Htape, type: BI.HTapeLayout.xtype,
hgap: 10, hgap: 10,
items: [ items: [
{ {
el: { el: {
type: Vtape, type: BI.VTapeLayout.xtype,
cls: 'bi-border-right', cls: 'bi-border-right',
rgap: 10, rgap: 10,
items: [ items: [
{ {
el: { el: {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
items: [{ items: [{
type: Button, type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Connection_New'), text: BI.i18nText('Dec-Dcm_Connection_New'),
handler: () => { handler: () => {
this.store.setPageIndex(PAGE_INDEX.DATEBASE); this.store.setPageIndex(PAGE_INDEX.DATEBASE);
@ -72,7 +73,7 @@ export class Connection extends BI.Widget {
height: 40, height: 40,
}, },
{ {
type: ConnectionListXtype, type: ConnectionList.xtype,
tgap: 10, tgap: 10,
}, },
], ],
@ -80,32 +81,32 @@ export class Connection extends BI.Widget {
width: 275, width: 275,
}, },
{ {
type: Vtape, type: BI.VTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: Htape, type: BI.HTapeLayout.xtype,
ref: (_ref: any) => { ref: (_ref: HTapeLayout) => {
this.title = _ref; this.title = _ref;
}, },
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
textAlign: 'left', textAlign: 'left',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.connectionTitleWidget = _ref; this.connectionTitleWidget = _ref;
}, },
}, },
{ {
el: { el: {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
items: [{ items: [{
type: Button, type: BI.Button.xtype,
$value: 'connection-edit', $value: 'connection-edit',
invisible: true, invisible: true,
text: BI.i18nText('Dec-Dcm_Edit'), text: BI.i18nText('Dec-Dcm_Edit'),
ref: (_ref: any) => { ref: (_ref: Button) => {
this.connectionEditWidget = _ref; this.connectionEditWidget = _ref;
}, },
handler: () => { handler: () => {
@ -124,8 +125,8 @@ export class Connection extends BI.Widget {
height: 40, height: 40,
}, },
{ {
type: ListView, type: BI.ListView.xtype,
ref: (_ref: any) => { ref: (_ref: ListView) => {
this.listView = _ref; this.listView = _ref;
}, },
}, },
@ -143,38 +144,38 @@ export class Connection extends BI.Widget {
switch (this.model.connectionSelectedOne.connectionType) { switch (this.model.connectionSelectedOne.connectionType) {
case connectionType.JDBC: case connectionType.JDBC:
return [{ return [{
type: ConnectionJdbcXtype, type: ConnectionJdbc.xtype,
}]; }];
case connectionType.JNDI: case connectionType.JNDI:
return [{ return [{
type: ConnectionJndiXtype, type: ConnectionJndi.xtype,
}]; }];
default: default:
return [{ return [{
type: ConnectionPluginXtype, type: ConnectionPlugin.xtype,
}]; }];
} }
} }
private renderNoRegistered() { private renderNoRegistered() {
return [{ return [{
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
height: 500, height: 500,
items: [ items: [
{ {
type: Vtape, type: BI.VTapeLayout.xtype,
width: 300, width: 300,
height: 150, height: 150,
items: [ items: [
{ {
el: { el: {
type: Layout, type: BI.Layout.xtype,
cls: 'error-page-background', cls: 'error-page-background',
}, },
height: 130, height: 130,
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_Np_Registered'), text: BI.i18nText('Dec-Dcm_Connection_Np_Registered'),
}, },
@ -186,7 +187,7 @@ export class Connection extends BI.Widget {
private renderEmpty() { private renderEmpty() {
return [{ return [{
type: Layout, type: BI.Layout.xtype,
}]; }];
} }

16
src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts

@ -1,11 +1,13 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ConnectionModel } from '../connection.model'; import { AppModel } from '../../../app.model';
export const ConnectionJdbcModelXtype = 'dec.dcm.model.connection_jdbc';
@model(ConnectionJdbcModelXtype) @model()
export class ConnectionJdecModel extends Model<{ export class ConnectionJdecModel extends Model<{
context : { types : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
} },
context: ConnectionJdecModel['context'];
}> { }> {
context = ['connectionSelectedOne']; static xtype = 'dec.dcm.model.connection_jdbc';
context = <const>['connectionSelectedOne'];
} }

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

@ -1,17 +1,17 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Vertical, Layout } from 'ui'; import { FormItem } from '../components/form_item/form_item';
import { FormItemXtype } from '../components/form_item/form_item'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { ConnectionJdecModel } from './connection_jdbc.model';
import { ConnectionJdbcModelXtype, ConnectionJdecModel } from './connection_jdbc.model';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
export const ConnectionJdbcXtype = 'dec.dcm.connection_jdbc'; import { VerticalLayout } from '@fui/core';
@shortcut(ConnectionJdbcXtype) @shortcut()
@store(ConnectionJdbcModelXtype) @store(ConnectionJdecModel)
export class ConnectionJdbc extends BI.Widget { export class ConnectionJdbc extends BI.Widget {
advancedSet: any; static xtype = 'dec.dcm.connection_jdbc';
advancedSet: any;
model: ConnectionJdecModel['model']; model: ConnectionJdecModel['model'];
allDatabaseTypes = getAllDatabaseTypes(); allDatabaseTypes = getAllDatabaseTypes();
@ -23,66 +23,66 @@ export class ConnectionJdbc extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT; const { hgap, vgap } = CONNECTION_LAYOUT;
return { return {
type: Vertical, type: BI.VerticalLayout.xtype,
hgap, hgap,
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
value: driver, value: driver,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
value: databaseName, value: databaseName,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), name: BI.i18nText('Dec-Dcm_Connection_Form_Host'),
value: host, value: host,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
value: port, value: port,
}, },
authType ? authType ?
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'),
value: authType, value: authType,
} : { } : {
type: Layout, type: BI.Layout.xtype,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
value: authType ? principal : user, value: authType ? principal : user,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'),
value: '******', value: '******',
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
value: schema, value: schema,
invisible: !databaseType.hasSchema, invisible: !databaseType.hasSchema,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
value: url, value: url,
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [ listeners: [
@ -95,73 +95,73 @@ export class ConnectionJdbc extends BI.Widget {
], ],
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
tgap: -15, tgap: -15,
vgap, vgap,
invisible: true, invisible: true,
ref: (_ref: any) => { ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref; this.advancedSet = _ref;
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
value: connectionPoolAttr.initialSize, value: connectionPoolAttr.initialSize,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
value: connectionPoolAttr.maxActive, value: connectionPoolAttr.maxActive,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
value: connectionPoolAttr.maxIdle, value: connectionPoolAttr.maxIdle,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
value: connectionPoolAttr.minIdle, value: connectionPoolAttr.minIdle,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
value: connectionPoolAttr.maxWait, value: connectionPoolAttr.maxWait,
unit: BI.i18nText('Dec-Dcm_Millisecond'), unit: BI.i18nText('Dec-Dcm_Millisecond'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'),
value: connectionPoolAttr.validationQuery, value: connectionPoolAttr.validationQuery,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'),
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
value: connectionPoolAttr.timeBetweenEvictionRunsMillis, value: connectionPoolAttr.timeBetweenEvictionRunsMillis,
unit: BI.i18nText('Dec-Dcm_Millisecond'), unit: BI.i18nText('Dec-Dcm_Millisecond'),
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
value: connectionPoolAttr.numTestsPerEvictionRun, value: connectionPoolAttr.numTestsPerEvictionRun,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
value: connectionPoolAttr.minEvictableIdleTimeMillis, value: connectionPoolAttr.minEvictableIdleTimeMillis,
unit: BI.i18nText('BI-Basic_Seconds'), unit: BI.i18nText('BI-Basic_Seconds'),

15
src/modules/pages/connection/connection_jndi/connection_jndi.model.ts

@ -1,11 +1,12 @@
import { AppModel } from 'src/modules/app.model';
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ConnectionModel } from '../connection.model'; @model()
export const ConnectionJndiModelXtype = 'dec.dcm.model.connection_jndi';
@model(ConnectionJndiModelXtype)
export class ConnectionJndiModel extends Model<{ export class ConnectionJndiModel extends Model<{
context : { types : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
} },
context: ConnectionJndiModel['context'];
}> { }> {
context = ['connectionSelectedOne']; static xtype = 'dec.dcm.model.connection_jndi';
context = <const>['connectionSelectedOne'];
} }

69
src/modules/pages/connection/connection_jndi/connection_jndi.ts

@ -1,18 +1,19 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Vertical, Htape, Label, Left } from 'ui'; import { FormItem } from '../components/form_item/form_item';
import { FormItemXtype } from '../components/form_item/form_item'; import { ConnectionJndiModel } from './connection_jndi.model';
import { ConnectionJndiModelXtype, ConnectionJndiModel } from './connection_jndi.model';
import { ConnectionJNDI } from 'src/modules/crud/crud.typings'; import { ConnectionJNDI } from 'src/modules/crud/crud.typings';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
import { VerticalLayout } from '@fui/core';
@shortcut()
@store(ConnectionJndiModel)
export class ConnectionJndi extends BI.Widget {
static xtype = 'dec.dcm.connection_jndi';
export const ConnectionJndiXtype = 'dec.dcm.connection_jndi';
@shortcut(ConnectionJndiXtype)
@store(ConnectionJndiModelXtype)
export class ConnectionJdbc extends BI.Widget {
model: ConnectionJndiModel['model']; model: ConnectionJndiModel['model'];
advancedSet: any; advancedSet: VerticalLayout;
render() { render() {
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJNDI; const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJNDI;
@ -20,27 +21,27 @@ export class ConnectionJdbc extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT; const { hgap, vgap } = CONNECTION_LAYOUT;
return { return {
type: Vertical, type: BI.VerticalLayout.xtype,
$testId: 'dec-dcm-connection-jndi', $testId: 'dec-dcm-connection-jndi',
hgap, hgap,
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
value: jndiName, value: jndiName,
}, },
{ {
type: Htape, type: BI.HTapeLayout.xtype,
height: 115, height: 115,
items: [ items: [
{ {
el: { el: {
type: Left, type: BI.FloatLeftLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-font-bold', cls: 'bi-font-bold',
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'), text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'),
@ -50,33 +51,33 @@ export class ConnectionJdbc extends BI.Widget {
width: 200, width: 200,
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
bgap: 15, bgap: 15,
height: 115, height: 115,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY', name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.factory.initial'], value: contextHashtable['java.naming.factory.initial'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'PROVIDER_URL', name: 'PROVIDER_URL',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.provider.url'], value: contextHashtable['java.naming.provider.url'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL', name: 'SECURITY_PRINCIPAL',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.security.principal'], value: contextHashtable['java.naming.security.principal'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS', name: 'SECURITY_CREDENTIALS',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
@ -88,13 +89,13 @@ export class ConnectionJdbc extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [ listeners: [
@ -107,76 +108,76 @@ export class ConnectionJdbc extends BI.Widget {
], ],
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
vgap, vgap,
tgap: -15, tgap: -15,
invisible: true, invisible: true,
ref: (_ref: any) => { ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref; this.advancedSet = _ref;
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'OBJECT_FACTORIES', name: 'OBJECT_FACTORIES',
value: contextHashtable['java.naming.factory.object'], value: contextHashtable['java.naming.factory.object'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'STATE_FACTORIES', name: 'STATE_FACTORIES',
value: contextHashtable['java.naming.factory.state'], value: contextHashtable['java.naming.factory.state'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'URL_PKG_PREFIXES', name: 'URL_PKG_PREFIXES',
value: contextHashtable['java.naming.factory.url.pkgs'], value: contextHashtable['java.naming.factory.url.pkgs'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'DNS_URL', name: 'DNS_URL',
value: contextHashtable['java.naming.dns.url'], value: contextHashtable['java.naming.dns.url'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'AUTHORITATIVE', name: 'AUTHORITATIVE',
value: contextHashtable['java.naming.authoritative'], value: contextHashtable['java.naming.authoritative'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'BATCHSIZE', name: 'BATCHSIZE',
value: contextHashtable['java.naming.batchsize'], value: contextHashtable['java.naming.batchsize'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'REFERRAL', name: 'REFERRAL',
value: contextHashtable['java.naming.referral'], value: contextHashtable['java.naming.referral'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'SECURITY_PROTOCOL', name: 'SECURITY_PROTOCOL',
value: contextHashtable['java.naming.security.protocol'], value: contextHashtable['java.naming.security.protocol'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'SECURITY_AUTHENTICATION', name: 'SECURITY_AUTHENTICATION',
value: contextHashtable['java.naming.security.authentication'], value: contextHashtable['java.naming.security.authentication'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'LANGUAGE', name: 'LANGUAGE',
value: contextHashtable['java.naming.language'], value: contextHashtable['java.naming.language'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'APPLET', name: 'APPLET',
value: contextHashtable['java.naming.applet'], value: contextHashtable['java.naming.applet'],

17
src/modules/pages/connection/connection_plugin/connection_plugin.model.ts

@ -1,11 +1,14 @@
import { AppModel } from '../../../app.model';
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ConnectionModel } from '../connection.model';
export const ConnectionPluginModelXtype = 'dec.dcm.model.connection_plugin'; @model()
@model(ConnectionPluginModelXtype)
export class ConnectionPluginModel extends Model<{ export class ConnectionPluginModel extends Model<{
context : { types : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
} },
context: ConnectionPluginModel['context'];
}> { }> {
context = ['connectionSelectedOne']; static xtype = 'dec.dcm.model.connection_plugin';
context = <const>['connectionSelectedOne'];
} }

9
src/modules/pages/connection/connection_plugin/connection_plugin.ts

@ -1,10 +1,11 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ConnectionPluginModelXtype, ConnectionPluginModel } from './connection_plugin.model'; import { ConnectionPluginModel } from './connection_plugin.model';
import { getPluginWidgetShow } from 'src/modules/app.service'; import { getPluginWidgetShow } from 'src/modules/app.service';
export const ConnectionPluginXtype = 'dec.dcm.connection_plugin'; @shortcut()
@shortcut(ConnectionPluginXtype) @store(ConnectionPluginModel)
@store(ConnectionPluginModelXtype)
export class ConnectionPlugin extends BI.Widget { export class ConnectionPlugin extends BI.Widget {
static xtype = 'dec.dcm.connection_plugin';
model: ConnectionPluginModel['model']; model: ConnectionPluginModel['model'];
render () { render () {

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

@ -2,15 +2,17 @@ import { model, Model } from '@core/core';
import { ApiFactory } from '../../..//crud/apiFactory'; import { ApiFactory } from '../../..//crud/apiFactory';
import { AppModel } from '../../../app.model'; import { AppModel } from '../../../app.model';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const ConnectionListModelXtype = 'dec.dcm.model.connection.list'; @model()
@model(ConnectionListModelXtype)
export class ConnectionListModel extends Model<{ export class ConnectionListModel extends Model<{
context : { types : {
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['$$childContext']['connectionSelected']; connectionSelected: AppModel['TYPE']['connectionSelected'];
} },
context: ConnectionListModel['context'];
}> { }> {
context = ['connections', 'connectionSelected']; static xtype = 'dec.dcm.model.connection.list';
context = <const>['connections', 'connectionSelected'];
computed = { computed = {
shwoType: () => BI.size(this.model.connections) > 0 ? 'list' : 'none', shwoType: () => BI.size(this.model.connections) > 0 ? 'list' : 'none',

32
src/modules/pages/connection/list/list.ts

@ -1,17 +1,19 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { CenterAdapt, Label, Layout, Vtape, Loader, Tab } from 'ui'; import { ListItem } from './list_item/list_item';
import { ListItemXtype } from './list_item/list_item'; import { ConnectionListModel } from './list.model';
import { ConnectionListModel, ConnectionListModelXtype } from './list.model';
import { getDatabaseType } from './list.service'; import { getDatabaseType } from './list.service';
export const ConnectionListXtype = 'dec.dcm.connection.list'; import { Tab } from '@fui/core';
@shortcut(ConnectionListXtype)
@store(ConnectionListModelXtype) @shortcut()
@store(ConnectionListModel)
export class ConnectionList extends BI.LoadingPane { export class ConnectionList extends BI.LoadingPane {
static xtype = 'dec.dcm.connection.list';
store: ConnectionListModel['store']; store: ConnectionListModel['store'];
model: ConnectionListModel['model']; model: ConnectionListModel['model'];
groupWidget: any; groupWidget: any;
tab: any; tab: Tab;
beforeInit(cb: Function) { beforeInit(cb: Function) {
this.store.setConnections().then(() => { this.store.setConnections().then(() => {
@ -32,31 +34,31 @@ export class ConnectionList extends BI.LoadingPane {
render() { render() {
return { return {
type: Tab, type: BI.Tab.xtype,
single: true, single: true,
showIndex: this.model.shwoType, showIndex: this.model.shwoType,
ref: (_ref: any) => { ref: (_ref: Tab) => {
this.tab = _ref; this.tab = _ref;
}, },
cardCreator: (index: 'list' | 'none') => { cardCreator: (index: 'list' | 'none') => {
if (index === 'none') { if (index === 'none') {
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: Vtape, type: BI.VTapeLayout.xtype,
width: 260, width: 260,
height: 150, height: 150,
items: [ items: [
{ {
el: { el: {
type: Layout, type: BI.Layout.xtype,
cls: 'data-connection-background', cls: 'data-connection-background',
}, },
height: 130, height: 130,
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_None'), text: BI.i18nText('Dec-Dcm_Connection_None'),
}, },
@ -67,7 +69,7 @@ export class ConnectionList extends BI.LoadingPane {
} }
return { return {
type: Loader, type: BI.Loader.xtype,
itemsCreator: (options: {times: number}, populate) => { itemsCreator: (options: {times: number}, populate) => {
populate(this.renderList((options.times - 1) * 50, options.times * 50)); populate(this.renderList((options.times - 1) * 50, options.times * 50));
}, },
@ -83,7 +85,7 @@ export class ConnectionList extends BI.LoadingPane {
private renderList(start = 0, end = 0) { private renderList(start = 0, end = 0) {
return this.model.connections.slice(start, end).map((item, index) => { return this.model.connections.slice(start, end).map((item, index) => {
return { return {
type: ListItemXtype, type: ListItem.xtype,
name: item.connectionName, name: item.connectionName,
value: item.connectionName, value: item.connectionName,
creator: item.creator, creator: item.creator,

26
src/modules/pages/connection/list/list_item/list_item.model.ts

@ -6,20 +6,22 @@ import { getChartLength } from '../../../../app.service';
import { NAME_MAX_LENGTH } from '../../../../app.constant'; import { NAME_MAX_LENGTH } from '../../../../app.constant';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const ListItemModelXtype = 'dec.dcm.model.connection.list_item'; @model()
@model(ListItemModelXtype)
export class ListItemModel extends Model<{ export class ListItemModel extends Model<{
context : { types : {
connectionSelected: AppModel['$$childContext']['connectionSelected']; connectionSelected: AppModel['TYPE']['connectionSelected'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne']; datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
isCopy: AppModel['$$childContext']['isCopy'] isCopy: AppModel['TYPE']['isCopy']
} },
context: ListItemModel['context'];
}> { }> {
context = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected', 'isCopy']; static xtype = 'dec.dcm.model.connection.list_item';
context = <const>['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected', 'isCopy'];
state() { state() {
return { return {

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

@ -1,16 +1,17 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Label, IconLabel, IconButton, DownListCombo, SignEditor, Layout, Htape, Vertical } from 'ui';
import './list_item.less'; import './list_item.less';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { ListItemModel } from './list_item.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { hasRegistered } from '../list.service'; import { hasRegistered } from '../list.service';
import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service'; import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service';
import { testConnection } from '../../../maintain/forms/form.server'; import { testConnection } from '../../../maintain/forms/form.server';
import { DownListCombo, Label, SignEditor } from '@fui/core';
export const ListItemXtype = 'dec.dcm.connection.list_item'; @shortcut()
@shortcut(ListItemXtype) @store(ListItemModel)
@store(ListItemModelXtype)
export class ListItem extends BI.BasicButton { export class ListItem extends BI.BasicButton {
static xtype = 'dec.dcm.connection.list_item';
props = { props = {
name: '', name: '',
creator: '', creator: '',
@ -23,10 +24,9 @@ export class ListItem extends BI.BasicButton {
store: ListItemModel['store']; store: ListItemModel['store'];
model: ListItemModel['model']; model: ListItemModel['model'];
comboWidget: any; nameLabel: Label;
nameLabel: any; nameEditor: SignEditor;
nameEditor: any; downListCombo: DownListCombo;
downListCombo: any;
watch = { watch = {
isEdit: (isEdit: boolean) => { isEdit: (isEdit: boolean) => {
@ -42,34 +42,34 @@ export class ListItem extends BI.BasicButton {
const { name, databaseType } = this.options; const { name, databaseType } = this.options;
return { return {
type: Htape, type: BI.HTapeLayout.xtype,
$scope: name, $scope: name,
items: [{ items: [{
el: { el: {
type: IconLabel, type: BI.IconLabel.xtype,
cls: 'dcm-link-font icon-size-16', cls: 'dcm-link-font icon-size-16',
title: name, title: name,
}, },
width: 25, width: 25,
}, { }, {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
text: name, text: name,
textAlign: 'left', textAlign: 'left',
height: 25, height: 25,
title: name, title: name,
ref: (_ref: any) => { ref: (_ref: Label) => {
this.nameLabel = _ref; this.nameLabel = _ref;
}, },
}, },
{ {
type: SignEditor, type: BI.SignEditor.xtype,
$value: 'connection-name', $value: 'connection-name',
value: name, value: name,
invisible: !this.model.isEdit, invisible: !this.model.isEdit,
ref: (_ref: any) => { ref: (_ref: SignEditor) => {
this.nameEditor = _ref; this.nameEditor = _ref;
}, },
listeners: [{ listeners: [{
@ -104,17 +104,17 @@ export class ListItem extends BI.BasicButton {
], ],
}, { }, {
el: databaseType ? { el: databaseType ? {
type: DownListCombo, type: BI.DownListCombo.xtype,
cls: 'link-item-icon', cls: 'link-item-icon',
stopPropagation: true, stopPropagation: true,
hgap: 8, hgap: 8,
el: { el: {
type: IconButton, type: BI.IconButton.xtype,
$value: 'other-edit', $value: 'other-edit',
cls: 'dcm-link-other-font icon-size-16', cls: 'dcm-link-other-font icon-size-16',
}, },
items: this.renderDownList(), items: this.renderDownList(),
ref: (_ref: any) => { ref: (_ref: DownListCombo) => {
this.downListCombo = _ref; this.downListCombo = _ref;
}, },
listeners: [{ listeners: [{
@ -130,7 +130,7 @@ export class ListItem extends BI.BasicButton {
}], }],
} : { } : {
type: Layout, type: BI.Layout.xtype,
}, },
width: 25, width: 25,
}], }],

17
src/modules/pages/connection_pool/connection_pool.model.ts

@ -1,15 +1,18 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { AppModel } from '../../app.model'; import { AppModel } from '../../app.model';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
export const ConnectionPoolModelXtype = 'dec.dcm.model.connection_pool';
@model(ConnectionPoolModelXtype) @model()
export class ConnectionPoolModel extends Model<{ export class ConnectionPoolModel extends Model<{
context : { types : {
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
} },
context: ConnectionPoolModel['context'];
}> { }> {
childContext = ['selected']; static xtype = 'dec.dcm.model.connection_pool';
context = ['connections'];
childContext = <const>['selected'];
context = <const>['connections'];
state() { state() {
return { return {

43
src/modules/pages/connection_pool/connection_pool.ts

@ -1,14 +1,15 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Htape, Vtape, Label, Layout, CenterAdapt, Loader } from 'ui'; import { ConnectionPoolModel } from './connection_pool.model';
import { ConnectionPoolModel, ConnectionPoolModelXtype } from './connection_pool.model'; import { ListItem } from './list_item/list_item';
import { ListItemXtype } from './list_item/list_item'; import { Pool } from './pool/pool';
import { PoolXtype } from './pool/pool';
import { PAGE_SIZE } from '@constants/constant'; import { PAGE_SIZE } from '@constants/constant';
export const ConnectionPoolXtype = 'dec.dcm.connection_pool'; import { Label } from '@fui/core';
@shortcut(ConnectionPoolXtype) @shortcut()
@store(ConnectionPoolModelXtype) @store(ConnectionPoolModel)
export class ConnectionPool extends BI.Widget { export class ConnectionPool extends BI.Widget {
title: any; static xtype = 'dec.dcm.connection_pool';
title: Label;
model: ConnectionPoolModel['model']; model: ConnectionPoolModel['model'];
store: ConnectionPoolModel['store']; store: ConnectionPoolModel['store'];
@ -30,16 +31,16 @@ export class ConnectionPool extends BI.Widget {
} }
return { return {
type: Htape, type: BI.HTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: Vtape, type: BI.VTapeLayout.xtype,
cls: 'bi-border-right', cls: 'bi-border-right',
items: [ items: [
{ {
el: { el: {
type: Label, type: BI.Label.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Data_Connections'), text: BI.i18nText('Dec-Dcm_Data_Connections'),
@ -48,7 +49,7 @@ export class ConnectionPool extends BI.Widget {
height: 40, height: 40,
}, },
{ {
type: Loader, type: BI.Loader.xtype,
itemsCreator: (options: {times: number}, populate) => { itemsCreator: (options: {times: number}, populate) => {
populate(this.renderList((options.times - 1) * PAGE_SIZE, options.times * PAGE_SIZE)); populate(this.renderList((options.times - 1) * PAGE_SIZE, options.times * PAGE_SIZE));
}, },
@ -65,22 +66,22 @@ export class ConnectionPool extends BI.Widget {
private renderPool() { private renderPool() {
return { return {
type: Vtape, type: BI.VTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: Label, type: BI.Label.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
textAlign: 'left', textAlign: 'left',
lgap: 10, lgap: 10,
ref: (_ref: any) => { ref: (_ref: Label) => {
this.title = _ref; this.title = _ref;
}, },
}, },
height: 40, height: 40,
}, },
{ {
type: PoolXtype, type: Pool.xtype,
}, },
], ],
}; };
@ -88,22 +89,22 @@ export class ConnectionPool extends BI.Widget {
private renderNoConnection() { private renderNoConnection() {
return { return {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: Vtape, type: BI.VTapeLayout.xtype,
width: 260, width: 260,
height: 150, height: 150,
items: [ items: [
{ {
el: { el: {
type: Layout, type: BI.Layout.xtype,
cls: 'data-connection-background', cls: 'data-connection-background',
}, },
height: 130, height: 130,
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_NO_Connection_Pool'), text: BI.i18nText('Dec-Dcm_Connection_NO_Connection_Pool'),
}, },
@ -118,7 +119,7 @@ export class ConnectionPool extends BI.Widget {
return this.model.connectionJDBC.slice(start, end).map(item => { return this.model.connectionJDBC.slice(start, end).map(item => {
return { return {
type: ListItemXtype, type: ListItem.xtype,
name: item.connectionName, name: item.connectionName,
value: item.connectionName, value: item.connectionName,
selected: item.connectionName === defaultSelected, selected: item.connectionName === defaultSelected,

13
src/modules/pages/connection_pool/list_item/list_item.model.ts

@ -1,13 +1,14 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ConnectionPoolModel } from '../connection_pool.model'; import { ConnectionPoolModel } from '../connection_pool.model';
export const ListItemModelXtype = 'dec.dcm.model.connection_pool.list_item'; @model()
@model(ListItemModelXtype)
export class ListItemModel extends Model<{ export class ListItemModel extends Model<{
context : { types : {
selected: ConnectionPoolModel['$$childContext']['selected']; selected: ConnectionPoolModel['TYPE']['selected'];
} },
context: ListItemModel['context'];
}> { }> {
context = ['selected']; static xtype = 'dec.dcm.model.connection_pool.list_item';
context = <const>['selected'];
actions = { actions = {
setSelected: (selected: string) => { setSelected: (selected: string) => {
this.model.selected = selected; this.model.selected = selected;

14
src/modules/pages/connection_pool/list_item/list_item.ts

@ -1,10 +1,10 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { VerticalAdapt, Label } from 'ui'; import { ListItemModel } from './list_item.model';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; @shortcut()
export const ListItemXtype = 'dec.dcm.connection_pool.list_item'; @store(ListItemModel)
@shortcut(ListItemXtype)
@store(ListItemModelXtype)
export class ListItem extends BI.BasicButton { export class ListItem extends BI.BasicButton {
static xtype = 'dec.dcm.connection_pool.list_item';
props = { props = {
name: '', name: '',
height: 25, height: 25,
@ -16,11 +16,11 @@ export class ListItem extends BI.BasicButton {
render() { render() {
return { return {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
lgap: 5, lgap: 5,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
text: this.options.name, text: this.options.name,
title: this.options.name, title: this.options.name,
width: 250, width: 250,

14
src/modules/pages/connection_pool/pool/pool.model.ts

@ -3,14 +3,16 @@ import { ConnectionPoolModel } from '../connection_pool.model';
import { ConnectionPoolType } from '../../../crud/crud.typings'; import { ConnectionPoolType } from '../../../crud/crud.typings';
import { ApiFactory } from '../../../crud/apiFactory'; import { ApiFactory } from '../../../crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const PoolModelXtype = 'dec.dcm.model.connection_pool.pool'; @model()
@model(PoolModelXtype)
export class PoolModel extends Model<{ export class PoolModel extends Model<{
context : { types : {
selected: ConnectionPoolModel['$$childContext']['selected']; selected: ConnectionPoolModel['TYPE']['selected'];
} },
context: PoolModel['context'];
}> { }> {
context = ['selected']; static xtype = 'dec.dcm.model.connection_pool.poo';
context = <const>['selected'];
state () { state () {
return { return {

71
src/modules/pages/connection_pool/pool/pool.ts

@ -1,76 +1,77 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { PoolModel, PoolModelXtype } from './pool.model'; import { PoolModel } from './pool.model';
import { FloatCenter, Vertical, CenterAdapt, Label, VerticalAdapt } from 'ui';
import './pool.less'; import './pool.less';
import { ConnectionPoolType } from '../../../crud/crud.typings'; import { ConnectionPoolType } from '../../../crud/crud.typings';
import { Label } from '@fui/core';
export const PoolXtype = 'dec.dcm.connection_pool.pool'; @shortcut()
@shortcut(PoolXtype) @store(PoolModel)
@store(PoolModelXtype)
export class Pool extends BI.Widget { export class Pool extends BI.Widget {
static xtype = 'dec.dcm.connection_pool.pool';
props = { props = {
baseCls: 'dec-dcm-connection-pool', baseCls: 'dec-dcm-connection-pool',
$testId: 'dec-dcm-connection-pool', $testId: 'dec-dcm-connection-pool',
} }
model: PoolModel['model']; model: PoolModel['model'];
maxActive: any; maxActive: Label;
maxIdle: any; maxIdle: Label;
numActive: any; numActive: Label;
numIdle: any; numIdle: Label;
watch = { watch = {
pool: (pool: ConnectionPoolType) => { pool: (pool: ConnectionPoolType) => {
this.maxActive.setText(pool.maxActive); this.maxActive.setText(`${pool.maxActive}`);
this.maxIdle.setText(pool.maxIdle); this.maxIdle.setText(`${pool.maxIdle}`);
this.numActive.setText(pool.numActive); this.numActive.setText(`${pool.numActive}`);
this.numIdle.setText(pool.numIdle); this.numIdle.setText(`${pool.numIdle}`);
}, },
} }
render() { render() {
return { return {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: FloatCenter, type: BI.FloatCenterLayout.xtype,
hgap: 20, hgap: 20,
vgap: 10, vgap: 10,
height: 200, height: 200,
items: [ items: [
{ {
el: { el: {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
cls: 'bi-background', cls: 'bi-background',
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
cls: 'right-status-board-item', cls: 'right-status-board-item',
items: [ items: [
{ {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
$testId: 'dec-dcm-pool-status-number', $testId: 'dec-dcm-pool-status-number',
$value: 'active', $value: 'active',
cls: 'bi-high-light card-font-heighlight', cls: 'bi-high-light card-font-heighlight',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.numActive = _ref; this.numActive = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
text: '/', text: '/',
}, },
{ {
type: Label, type: BI.Label.xtype,
$testId: 'dec-dcm-pool-status-max', $testId: 'dec-dcm-pool-status-max',
$value: 'active', $value: 'active',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.maxActive = _ref; this.maxActive = _ref;
}, },
}, },
@ -79,7 +80,7 @@ export class Pool extends BI.Widget {
], ],
}, },
{ {
type: Label, type: BI.Label.xtype,
text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), text: BI.i18nText('Dec-Dcm_Active_Connections_Number'),
}, },
], ],
@ -88,37 +89,37 @@ export class Pool extends BI.Widget {
}, },
}, },
{ {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
cls: 'bi-background', cls: 'bi-background',
items: [ items: [
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
cls: 'right-status-board-item', cls: 'right-status-board-item',
items: [ items: [
{ {
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
items: [ items: [
{ {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
$testId: 'dec-dcm-pool-status-number', $testId: 'dec-dcm-pool-status-number',
$value: 'idle', $value: 'idle',
cls: 'bi-high-light card-font-heighlight', cls: 'bi-high-light card-font-heighlight',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.numIdle = _ref; this.numIdle = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
text: '/', text: '/',
}, },
{ {
type: Label, type: BI.Label.xtype,
$testId: 'dec-dcm-pool-status-max', $testId: 'dec-dcm-pool-status-max',
$value: 'idle', $value: 'idle',
ref: (_ref: any) => { ref: (_ref: Label) => {
this.maxIdle = _ref; this.maxIdle = _ref;
}, },
}, },
@ -127,7 +128,7 @@ export class Pool extends BI.Widget {
], ],
}, },
{ {
type: Label, type: BI.Label.xtype,
text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'),
}, },
], ],

16
src/modules/pages/database/database.model.ts

@ -3,15 +3,17 @@ import { AppModel } from 'src/modules/app.model';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
import { DatabaseType } from '../../app.typings'; import { DatabaseType } from '../../app.typings';
export const DatebaseModelXtype = 'dec.dcm.model.datebase'; @model()
@model(DatebaseModelXtype)
export class DatebaseModel extends Model<{ export class DatebaseModel extends Model<{
context : { types : {
filter: AppModel['$$childContext']['filter']; filter: AppModel['TYPE']['filter'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
} },
context: DatebaseModel['context'];
}> { }> {
context = ['filter', 'datebaseTypeSelected']; static xtype = 'dec.dcm.model.datebase';
context = <const>['filter', 'datebaseTypeSelected'];
state() { state() {
return { return {
search: '', search: '',

77
src/modules/pages/database/database.ts

@ -1,21 +1,22 @@
import { SearchEditor, Vtape, Right, Htape, Vertical, ButtonGroup, Left, Label, MultiSelectItem, CenterAdapt } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { FilterXtype } from './filter/filter'; import { Filter } from './filter/filter';
import { DatebaseModel, DatebaseModelXtype } from './database.model'; import { DatebaseModel } from './database.model';
import { DATEBASE_FILTER_TYPE, OTHER_JDBC } from '@constants/constant'; import { DATEBASE_FILTER_TYPE, OTHER_JDBC } from '@constants/constant';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { DatebaseTypeXtype } from './database_type/database_type'; import { DatebaseType } from './database_type/database_type';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
export const DatebaseXtype = 'dec.dcm.datebase'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core';
@shortcut(DatebaseXtype) @shortcut()
@store(DatebaseModelXtype) @store(DatebaseModel)
export class Datebase extends BI.Widget { export class Datebase extends BI.Widget {
filter: any; static xtype = 'dec.dcm.datebase';
search: any;
datebaseType: any; filter: ButtonGroup;
search: SearchEditor;
datebaseType: ButtonGroup;
typeFilterWidget: any; typeFilterWidget: any;
internalWidget: any; internalWidget: MultiSelectItem;
pluginWidget: any; pluginWidget: MultiSelectItem;
allDatabaseTypes = getAllDatabaseTypes(); allDatabaseTypes = getAllDatabaseTypes();
@ -68,23 +69,23 @@ export class Datebase extends BI.Widget {
render() { render() {
return { return {
type: Vtape, type: BI.VTapeLayout.xtype,
vgap: 10, vgap: 10,
hgap: 10, hgap: 10,
items: [ items: [
{ {
el: { el: {
type: Vertical, type: BI.VerticalLayout.xtype,
items: [ items: [
{ {
type: Right, type: BI.FloatRightLayout.xtype,
items: [ items: [
{ {
type: SearchEditor, type: BI.SearchEditor.xtype,
$value: 'database-type', $value: 'database-type',
width: 300, width: 300,
watermark: BI.i18nText('BI-Basic_Search'), watermark: BI.i18nText('BI-Basic_Search'),
ref: (_ref: any) => { ref: (_ref: SearchEditor) => {
this.search = _ref; this.search = _ref;
}, },
listeners: [ listeners: [
@ -103,32 +104,32 @@ export class Datebase extends BI.Widget {
height: 25, height: 25,
}, },
{ {
type: Htape, type: BI.HTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: ButtonGroup, type: BI.ButtonGroup.xtype,
cls: 'bi-border-right', cls: 'bi-border-right',
layouts: [{ layouts: [{
type: Vertical, type: BI.VerticalLayout.xtype,
}], }],
ref: (_ref: any) => { ref: (_ref: ButtonGroup) => {
this.filter = _ref; this.filter = _ref;
}, },
items: [ items: [
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Commonly'), text: BI.i18nText('Dec-Dcm_Connection_Commonly'),
value: DATEBASE_FILTER_TYPE.COMMONLY, value: DATEBASE_FILTER_TYPE.COMMONLY,
selected: true, selected: true,
}, },
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_All'), text: BI.i18nText('Dec-Dcm_Connection_All'),
value: DATEBASE_FILTER_TYPE.ALL, value: DATEBASE_FILTER_TYPE.ALL,
}, },
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Other'), text: BI.i18nText('Dec-Dcm_Connection_Other'),
value: DATEBASE_FILTER_TYPE.OTHER, value: DATEBASE_FILTER_TYPE.OTHER,
}, },
@ -137,28 +138,28 @@ export class Datebase extends BI.Widget {
width: 200, width: 200,
}, },
{ {
type: Vtape, type: BI.VTapeLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: Htape, type: BI.HTapeLayout.xtype,
hgap: 20, hgap: 20,
invisible: true, invisible: true,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
width: 70, width: 70,
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'),
}, },
{ {
type: MultiSelectItem, type: BI.MultiSelectItem.xtype,
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'), title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'),
ref: (_ref: any) => { ref: (_ref: MultiSelectItem) => {
this.internalWidget = _ref; this.internalWidget = _ref;
}, },
handler: () => { handler: () => {
@ -166,12 +167,12 @@ export class Datebase extends BI.Widget {
}, },
}, },
{ {
type: MultiSelectItem, type: BI.MultiSelectItem.xtype,
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'), title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'),
ref: (_ref: any) => { ref: (_ref: MultiSelectItem) => {
this.pluginWidget = _ref; this.pluginWidget = _ref;
}, },
handler: () => { handler: () => {
@ -179,7 +180,7 @@ export class Datebase extends BI.Widget {
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'), text: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'),
@ -193,14 +194,14 @@ export class Datebase extends BI.Widget {
height: 24, height: 24,
}, },
{ {
type: ButtonGroup, type: BI.ButtonGroup.xtype,
hgap: 15, hgap: 15,
layouts: [{ layouts: [{
type: Left, type: BI.FloatLeftLayout.xtype,
scrolly: true, scrolly: true,
}], }],
items: this.renderDatebaseType(), items: this.renderDatebaseType(),
ref: (_ref: any) => { ref: (_ref: ButtonGroup) => {
this.datebaseType = _ref; this.datebaseType = _ref;
}, },
}, },
@ -219,7 +220,7 @@ export class Datebase extends BI.Widget {
return this.model.datebaseTypes.map(item => { return this.model.datebaseTypes.map(item => {
return { return {
type: DatebaseTypeXtype, type: DatebaseType.xtype,
text: item.text, text: item.text,
value: item.databaseType, value: item.databaseType,
keyword: this.model.search, keyword: this.model.search,
@ -232,11 +233,11 @@ export class Datebase extends BI.Widget {
private renderNoResult() { private renderNoResult() {
return [{ return [{
type: CenterAdapt, type: BI.CenterAdaptLayout.xtype,
height: '100%', height: '100%',
width: '100%', width: '100%',
items: [{ items: [{
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_No_Search_Result'), text: BI.i18nText('Dec-Dcm_Connection_No_Search_Result'),
}], }],

12
src/modules/pages/database/database.typings.d.ts vendored

@ -1,12 +0,0 @@
export interface DatabaseType {
text: string;
databaseType: string;
driver?: string;
drivers?: string[];
url?: string;
commonly: boolean;
internal: boolean;
type: string;
hasSchema?: boolean;
kerberos?: boolean;
}

15
src/modules/pages/database/database_type/database_type.model.ts

@ -1,15 +1,16 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { AppModel } from 'src/modules/app.model'; import { AppModel } from 'src/modules/app.model';
export const DatebaseTypeModelXtype = 'dec.dcm.model.datebase.type'; @model()
@model(DatebaseTypeModelXtype)
export class DatebaseTypeModel extends Model< export class DatebaseTypeModel extends Model<
{ {
context: { types: {
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
} },
context: DatebaseTypeModel['context'];
}> { }> {
context = ['datebaseTypeSelected', 'pageIndex']; static xtype = 'dec.dcm.model.datebase.type';
context = <const>['datebaseTypeSelected', 'pageIndex'];
actions = { actions = {
setDatebaseTypeSelected: (datebaseTypeSelected: string) => { setDatebaseTypeSelected: (datebaseTypeSelected: string) => {

23
src/modules/pages/database/database_type/database_type.ts

@ -1,14 +1,15 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Vtape, Label, Absolute, Img } from 'ui'; import { DatebaseTypeModel } from './database_type.model';
import { DatebaseTypeModel, DatebaseTypeModelXtype } from './database_type.model';
import { ImgPrefix, PluginImgPrefix } from '@constants/env'; import { ImgPrefix, PluginImgPrefix } from '@constants/env';
import './database_type.less'; import './database_type.less';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { Img } from '@fui/core';
export const DatebaseTypeXtype = 'dec.dcm.datebase.type'; @shortcut()
@shortcut(DatebaseTypeXtype) @store(DatebaseTypeModel)
@store(DatebaseTypeModelXtype)
export class DatebaseType extends BI.BasicButton { export class DatebaseType extends BI.BasicButton {
static xtype = 'dec.dcm.datebase.type';
props = { props = {
text: '', text: '',
url: '', url: '',
@ -22,7 +23,7 @@ export class DatebaseType extends BI.BasicButton {
$testId: 'dec-dcm-database-type', $testId: 'dec-dcm-database-type',
} }
img: any; img: Img;
store: DatebaseTypeModel['store']; store: DatebaseTypeModel['store'];
@ -30,25 +31,25 @@ export class DatebaseType extends BI.BasicButton {
const { text, keyword, databaseType, iconUrl } = this.options; const { text, keyword, databaseType, iconUrl } = this.options;
return { return {
type: Absolute, type: BI.AbsoluteLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: Vtape, type: BI.VTapeLayout.xtype,
cls: 'bi-list-item-active bi-border', cls: 'bi-list-item-active bi-border',
items: [ items: [
{ {
el: { el: {
type: Img, type: BI.Img.xtype,
src: iconUrl ? this.getIconUrl(iconUrl) : `${ImgPrefix}${databaseType}.jpg`, src: iconUrl ? this.getIconUrl(iconUrl) : `${ImgPrefix}${databaseType}.jpg`,
ref: (_ref: any) => { ref: (_ref: Img) => {
this.img = _ref; this.img = _ref;
}, },
}, },
height: 90, height: 90,
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-header-background', cls: 'bi-header-background',
text, text,
title: text, title: text,

13
src/modules/pages/database/filter/filter.model.ts

@ -1,14 +1,15 @@
import { Model, model } from '@core/core'; import { Model, model } from '@core/core';
import { AppModel } from 'src/modules/app.model'; import { AppModel } from 'src/modules/app.model';
export const FilterModelXtype = 'dec.dcm.model.datebase.filter'; @model()
@model(FilterModelXtype)
export class FilterModel extends Model<{ export class FilterModel extends Model<{
context : { types : {
filter: AppModel['$$childContext']['filter']; filter: AppModel['TYPE']['filter'];
} },
context: FilterModel['context'];
}> { }> {
context = ['filter']; static xtype = 'dec.dcm.model.datebase.filter';
context = <const>['filter'];
actions = { actions = {
setFilter:(filter: string) => { setFilter:(filter: string) => {

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

@ -1,11 +1,10 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Label } from 'ui'; import { FilterModel } from './filter.model';
import { FilterModel, FilterModelXtype } from './filter.model';
export const FilterXtype = 'dec.dcm.datebase.filter'; @shortcut()
@shortcut(FilterXtype) @store(FilterModel)
@store(FilterModelXtype)
export class Filter extends BI.BasicButton { export class Filter extends BI.BasicButton {
static xtype = 'dec.dcm.datebase.filter';
store: FilterModel['store'] store: FilterModel['store']
props = { props = {
text: '', text: '',
@ -18,7 +17,7 @@ export class Filter extends BI.BasicButton {
const { text } = this.options; const { text } = this.options;
return { return {
type: Label, type: BI.Label.xtype,
textAlign: 'left', textAlign: 'left',
height: 25, height: 25,
lgap: 10, lgap: 10,

10
src/modules/pages/index.ts

@ -1,10 +0,0 @@
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,
};

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

@ -1,9 +1,10 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Label, Left } from 'ui';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
export const FormItemXtype = 'dec.dcm.Maintain_form_item';
@shortcut(FormItemXtype) @shortcut()
export class FormItem extends BI.Widget { export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.Maintain_form_item';
props = { props = {
name: '', name: '',
forms: '', forms: '',
@ -14,10 +15,10 @@ export class FormItem extends BI.Widget {
render () { render () {
return { return {
type: Left, type: BI.FloatLeftLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
cls: this.options.isBold ? 'bi-font-bold' : '', cls: this.options.isBold ? 'bi-font-bold' : '',
width: this.options.nameWidth, width: this.options.nameWidth,
textAlign: 'left', textAlign: 'left',

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

@ -1,18 +1,19 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Vertical, TextEditor, TextValueCombo, Label, TextAreaEditor, Editor, EdirotIconCheckCombo, Left, TextButton, Layout } from 'ui'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { FormItem } 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, INT_MAX_VALUE, INT_MIN_VALUE } 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 { TextChecker } from '../../../../components/text_checker/text_checker';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
import { Editor, EditorIconCheckCombo, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; @shortcut()
@shortcut(FormJdbcXtype)
export class FormJdbc extends BI.Widget { export class FormJdbc extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jdbc';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} }
@ -20,13 +21,12 @@ export class FormJdbc extends BI.Widget {
oldPassword = ''; oldPassword = '';
allDatabaseTypes = getAllDatabaseTypes(); allDatabaseTypes = getAllDatabaseTypes();
testStatus: any; advancedSet: VerticalLayout;
advancedSet: any; formUser: FormItem;
formUser: any; formPassword: FormItem;
formPassword: any; formPrincipal: FormItem;
formPrincipal: any; formKeyPath: FormItem;
formKeyPath: any; labelTips: Label;
labelTips: any;
form = { form = {
connectionName: null, connectionName: null,
@ -72,35 +72,35 @@ export class FormJdbc extends BI.Widget {
}; };
return { return {
type: Vertical, type: BI.VerticalLayout.xtype,
hgap, hgap,
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'), name: BI.i18nText('Dec-Dcm_Connection_Name'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'connection-name', $value: 'connection-name',
width: 300, width: 300,
value: connectionName, value: connectionName,
allowBlank: true, allowBlank: true,
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.connectionName = _ref; this.form.connectionName = _ref;
}, },
watermark: BI.i18nText('Dec-Dcm_Data_Connections'), watermark: BI.i18nText('Dec-Dcm_Data_Connections'),
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
forms: [{ forms: [{
type: EdirotIconCheckCombo, type: BI.EditorIconCheckCombo.xtype,
$testId: 'dec-editor-icon-check-combo', $testId: 'dec-editor-icon-check-combo',
$value: 'driver', $value: 'driver',
width: 300, width: 300,
value: driver, value: driver,
ref: (_ref: any) => { ref: (_ref: EditorIconCheckCombo) => {
this.form.driver = _ref; this.form.driver = _ref;
}, },
items: this.getDrivers(), items: this.getDrivers(),
@ -121,10 +121,10 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'database-name', $value: 'database-name',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
@ -142,10 +142,10 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), name: BI.i18nText('Dec-Dcm_Connection_Form_Host'),
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'database-host', $value: 'database-host',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
@ -163,10 +163,10 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'database-port', $value: 'database-port',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
@ -177,7 +177,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.port = _ref; this.form.port = _ref;
}, },
listeners: [{ listeners: [{
@ -189,15 +189,15 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'),
invisible: !databaseType.kerberos, invisible: !databaseType.kerberos,
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'auth-type', $value: 'auth-type',
width: 300, width: 300,
value: authType, value: authType,
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.authType = _ref; this.form.authType = _ref;
}, },
items: [ items: [
@ -226,33 +226,33 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
invisible: !!authType, invisible: !!authType,
ref: (_ref: any) => { ref: (_ref: FormItem) => {
this.formUser = _ref; this.formUser = _ref;
}, },
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'username', $value: 'username',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: user, value: user,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.user = _ref; this.form.user = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Password'), name: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
invisible: !!authType, invisible: !!authType,
ref: (_ref: any) => { ref: (_ref: FormItem) => {
this.formPassword = _ref; this.formPassword = _ref;
}, },
forms: [{ forms: [{
type: Editor, type: BI.Editor.xtype,
$value: 'password', $value: 'password',
cls: 'bi-border bi-border-radius', cls: 'bi-border bi-border-radius',
width: 300, width: 300,
@ -262,39 +262,39 @@ export class FormJdbc extends BI.Widget {
inputType: 'password', inputType: 'password',
autocomplete: 'new-password', autocomplete: 'new-password',
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
ref: (_ref: any) => { ref: (_ref: Editor) => {
this.form.password = _ref; this.form.password = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'),
invisible: !authType, invisible: !authType,
ref: (_ref: any) => { ref: (_ref: FormItem) => {
this.formPrincipal = _ref; this.formPrincipal = _ref;
}, },
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'principal', $value: 'principal',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: principal, value: principal,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'),
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.principal = _ref; this.form.principal = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'),
invisible: !authType, invisible: !authType,
ref: (_ref: any) => { ref: (_ref: FormItem) => {
this.formKeyPath = _ref; this.formKeyPath = _ref;
}, },
forms: [{ forms: [{
type: Editor, type: BI.Editor.xtype,
$value: 'key-path', $value: 'key-path',
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
@ -302,87 +302,87 @@ export class FormJdbc extends BI.Widget {
allowBlank: true, allowBlank: true,
value: keyPath, value: keyPath,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'),
ref: (_ref: any) => { ref: (_ref: Editor) => {
this.form.keyPath = _ref; this.form.keyPath = _ref;
}, },
}], }],
}, },
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
textAlign: 'left', textAlign: 'left',
invisible: true, invisible: true,
text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'), text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'),
ref: (_ref: any) => { ref: (_ref: Label) => {
this.labelTips = _ref; this.labelTips = _ref;
}, },
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'original-charset-name', $value: 'original-charset-name',
width: 300, width: 300,
value: originalCharsetName ? originalCharsetName : '', value: originalCharsetName ? originalCharsetName : '',
items: CONNECT_CHARSET, items: CONNECT_CHARSET,
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.originalCharsetName = _ref; this.form.originalCharsetName = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
invisible: !databaseType.hasSchema, invisible: !databaseType.hasSchema,
height: 64, height: 64,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
forms: [{ forms: [{
type: Vertical, type: BI.VerticalLayout.xtype,
items: [{ items: [{
type: Left, type: BI.FloatLeftLayout.xtype,
items: [{ items: [{
type: TextButton, type: BI.TextButton.xtype,
cls: 'bi-high-light', cls: 'bi-high-light',
text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'), text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'),
handler: () => { handler: () => {
this.fireEvent('EVENT_TEST_CONNECTION'); this.fireEvent('EVENT_TEST_CONNECTION');
}, },
}, { }, {
type: Label, type: BI.Label.xtype,
cls: 'bi-tips', cls: 'bi-tips',
lgap: 3, lgap: 3,
text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'), text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'),
}], }],
}, { }, {
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'schema', $value: 'schema',
width: 300, width: 300,
vgap: 15, vgap: 15,
disabled: true, disabled: true,
value: schema, value: schema,
items: schema ? [{ text: schema, value:schema }] : [], items: schema ? [{ text: schema, value:schema }] : [],
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.schema = _ref; this.form.schema = _ref;
}, },
}], }],
}], }],
}, },
{ {
type: Layout, type: BI.Layout.xtype,
cls: 'bi-border-top', cls: 'bi-border-top',
bgap: 8, bgap: 8,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'database-url', $value: 'database-url',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: url, value: url,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.url = _ref; this.form.url = _ref;
}, },
listeners: [{ listeners: [{
@ -397,7 +397,7 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
bgap: -15, bgap: -15,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
@ -411,20 +411,20 @@ export class FormJdbc extends BI.Widget {
], ],
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
vgap, vgap,
tgap: -15, tgap: -15,
invisible: true, invisible: true,
ref: (_ref: any) => { ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref; this.advancedSet = _ref;
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
tgap: 15, tgap: 15,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'initial-size', $value: 'initial-size',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -435,16 +435,16 @@ export class FormJdbc extends BI.Widget {
autoFix: true, autoFix: true,
}, valueRangeConfig], }, 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: TextChecker) => {
this.form.initialSize = _ref; this.form.initialSize = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-active', $value: 'max-active',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -455,16 +455,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxActive = _ref; this.form.maxActive = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-idle', $value: 'max-idle',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -475,16 +475,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxIdle = _ref; this.form.maxIdle = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'min-idle', $value: 'min-idle',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -495,17 +495,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.minIdle = _ref; this.form.minIdle = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-wait', $value: 'max-wait',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -516,12 +516,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxWait = _ref; this.form.maxWait = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
lgap: 5, lgap: 5,
height: CONNECTION_LAYOUT.labelHeight, height: CONNECTION_LAYOUT.labelHeight,
text: BI.i18nText('Dec-Dcm_Millisecond'), text: BI.i18nText('Dec-Dcm_Millisecond'),
@ -529,10 +529,10 @@ export class FormJdbc extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
forms: [{ forms: [{
type: TextAreaEditor, type: BI.TextAreaEditor.xtype,
$value: 'validation-query', $value: 'validation-query',
cls: 'bi-border', cls: 'bi-border',
allowBlank: true, allowBlank: true,
@ -540,65 +540,65 @@ export class FormJdbc extends BI.Widget {
value: validationQuery, value: validationQuery,
width: 300, width: 300,
height: 100, height: 100,
ref: (_ref: any) => { ref: (_ref: TextAreaEditor) => {
this.form.validationQuery = _ref; this.form.validationQuery = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'check', $value: 'check',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: testOnBorrow, value: testOnBorrow,
items: this.getBooleanItem(), items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.testOnBorrow = _ref; this.form.testOnBorrow = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'test-on-return', $value: 'test-on-return',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: testOnReturn, value: testOnReturn,
items: this.getBooleanItem(), items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.testOnReturn = _ref; this.form.testOnReturn = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'test-while-idle', $value: 'test-while-idle',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: testWhileIdle, value: testWhileIdle,
items: this.getBooleanItem(), items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.testWhileIdle = _ref; this.form.testWhileIdle = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'test-between-evicition-millis', $value: 'test-between-evicition-millis',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -609,12 +609,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkNumber(value), checker: (value: string) => this.checkNumber(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.timeBetweenEvictionRunsMillis = _ref; this.form.timeBetweenEvictionRunsMillis = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
lgap: 5, lgap: 5,
height: CONNECTION_LAYOUT.labelHeight, height: CONNECTION_LAYOUT.labelHeight,
text: BI.i18nText('Dec-Dcm_Millisecond'), text: BI.i18nText('Dec-Dcm_Millisecond'),
@ -622,10 +622,10 @@ export class FormJdbc extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'test-pereviction-run-num', $value: 'test-pereviction-run-num',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -636,17 +636,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.numTestsPerEvictionRun = _ref; this.form.numTestsPerEvictionRun = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'min-evictable-idle-time-millis', $value: 'min-evictable-idle-time-millis',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -657,12 +657,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.minEvictableIdleTimeMillis = _ref; this.form.minEvictableIdleTimeMillis = _ref;
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
lgap: 5, lgap: 5,
height: CONNECTION_LAYOUT.labelHeight, height: CONNECTION_LAYOUT.labelHeight,
text: BI.i18nText('BI-Basic_Seconds'), text: BI.i18nText('BI-Basic_Seconds'),

143
src/modules/pages/maintain/forms/components/form.jndi.ts

@ -1,19 +1,20 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Vertical, TextEditor, Htape, Left, Label, TextValueCombo, EdirotIconCheckCombo } from 'ui'; import { FormItem } from '../../components/form_item/form_item';
import { FormItemXtype } from '../../components/form_item/form_item';
import { ConnectionJNDI, Connection, ContextHashtable } from 'src/modules/crud/crud.typings'; import { ConnectionJNDI, Connection, ContextHashtable } from 'src/modules/crud/crud.typings';
import { CONNECT_CHARSET, CONNECTION_LAYOUT, JNDI_FACTORYS } from '@constants/constant'; import { CONNECT_CHARSET, CONNECTION_LAYOUT, JNDI_FACTORYS } from '@constants/constant';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; import { TextChecker } from '../../../../components/text_checker/text_checker';
export const FormJndiXtype = 'dec.dcm.maintain.form.jndi'; import { EditorIconCheckCombo, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core';
@shortcut(FormJndiXtype)
@shortcut()
export class FormJndi extends BI.Widget { export class FormJndi extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jndi';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} }
advancedSet: any; advancedSet: VerticalLayout;
testStatus: any;
form = { form = {
connectionName: null, connectionName: null,
jndiName: null, jndiName: null,
@ -41,49 +42,49 @@ export class FormJndi extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT; const { hgap, vgap } = CONNECTION_LAYOUT;
return { return {
type: Vertical, type: BI.VerticalLayout.xtype,
hgap, hgap,
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'), name: BI.i18nText('Dec-Dcm_Connection_Name'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'connection-name', $value: 'connection-name',
width: 300, width: 300,
value: connectionName, value: connectionName,
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.connectionName = _ref; this.form.connectionName = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'jdni-name', $value: 'jdni-name',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: jndiName, value: jndiName,
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.jndiName = _ref; this.form.jndiName = _ref;
}, },
}], }],
}, },
{ {
type: Htape, type: BI.HTapeLayout.xtype,
height: 175, height: 175,
items: [ items: [
{ {
el: { el: {
type: Left, type: BI.FloatLeftLayout.xtype,
items: [ items: [
{ {
type: Label, type: BI.Label.xtype,
cls: 'bi-font-bold', cls: 'bi-font-bold',
textAlign: 'left', textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'), text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'),
@ -93,22 +94,22 @@ export class FormJndi extends BI.Widget {
width: 200, width: 200,
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
bgap: 15, bgap: 15,
height: 175, height: 175,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY', name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
forms: [{ forms: [{
type: EdirotIconCheckCombo, type: BI.EditorIconCheckCombo.xtype,
$testId: 'dec-editor-icon-check-combo', $testId: 'dec-editor-icon-check-combo',
$value: 'initial', $value: 'initial',
width: 300, width: 300,
value: contextHashtable['java.naming.factory.initial'], value: contextHashtable['java.naming.factory.initial'],
ref: (_ref: any) => { ref: (_ref: EditorIconCheckCombo) => {
this.form.initial = _ref; this.form.initial = _ref;
}, },
items: JNDI_FACTORYS.map(item => { items: JNDI_FACTORYS.map(item => {
@ -128,55 +129,55 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'PROVIDER_URL', name: 'PROVIDER_URL',
isBold: false, isBold: false,
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'provider-url', $value: 'provider-url',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.provider.url'], value: contextHashtable['java.naming.provider.url'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.providerUrl = _ref; this.form.providerUrl = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL', name: 'SECURITY_PRINCIPAL',
isBold: false, isBold: false,
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'security-principal', $value: 'security-principal',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.security.principal'], value: contextHashtable['java.naming.security.principal'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.securityPrincipal = _ref; this.form.securityPrincipal = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS', name: 'SECURITY_CREDENTIALS',
isBold: false, isBold: false,
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'security-credentials', $value: 'security-credentials',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.security.credentials'], value: contextHashtable['java.naming.security.credentials'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.securityCredentials = _ref; this.form.securityCredentials = _ref;
}, },
}], }],
}, },
{ {
type: Label, type: BI.Label.xtype,
bgap: -15, bgap: -15,
cls: 'bi-tips', cls: 'bi-tips',
textAlign: 'left', textAlign: 'left',
@ -187,22 +188,22 @@ export class FormJndi extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextValueCombo, type: BI.TextValueCombo.xtype,
$value: 'new-charset-name', $value: 'new-charset-name',
width: 300, width: 300,
value: newCharsetName ? newCharsetName : '', value: newCharsetName ? newCharsetName : '',
items: CONNECT_CHARSET, items: CONNECT_CHARSET,
ref: (_ref: any) => { ref: (_ref: TextValueCombo) => {
this.form.newCharsetName = _ref; this.form.newCharsetName = _ref;
}, },
}], }],
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [ listeners: [
@ -215,175 +216,175 @@ export class FormJndi extends BI.Widget {
], ],
}, },
{ {
type: Vertical, type: BI.VerticalLayout.xtype,
vgap, vgap,
tgap: -15, tgap: -15,
invisible: true, invisible: true,
ref: (_ref: any) => { ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref; this.advancedSet = _ref;
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'OBJECT_FACTORIES', name: 'OBJECT_FACTORIES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'factory-object', $value: 'factory-object',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.factory.object'], value: contextHashtable['java.naming.factory.object'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.factoryObject = _ref; this.form.factoryObject = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'STATE_FACTORIES', name: 'STATE_FACTORIES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'factory-state', $value: 'factory-state',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.factory.state'], value: contextHashtable['java.naming.factory.state'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.factoryState = _ref; this.form.factoryState = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'URL_PKG_PREFIXES', name: 'URL_PKG_PREFIXES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'factory-url-pkgs', $value: 'factory-url-pkgs',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.factory.url.pkgs'], value: contextHashtable['java.naming.factory.url.pkgs'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.factoryUrlPkgs = _ref; this.form.factoryUrlPkgs = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'DNS_URL', name: 'DNS_URL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'dns-url', $value: 'dns-url',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.dns.url'], value: contextHashtable['java.naming.dns.url'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.dnsUrl = _ref; this.form.dnsUrl = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'AUTHORITATIVE', name: 'AUTHORITATIVE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'authoritative', $value: 'authoritative',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.authoritative'], value: contextHashtable['java.naming.authoritative'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.authoritative = _ref; this.form.authoritative = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'BATCHSIZE', name: 'BATCHSIZE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'batchsize', $value: 'batchsize',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.batchsize'], value: contextHashtable['java.naming.batchsize'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.batchsize = _ref; this.form.batchsize = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'REFERRAL', name: 'REFERRAL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'referral', $value: 'referral',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.referral'], value: contextHashtable['java.naming.referral'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.referral = _ref; this.form.referral = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PROTOCOL', name: 'SECURITY_PROTOCOL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'security-protocol', $value: 'security-protocol',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.security.protocol'], value: contextHashtable['java.naming.security.protocol'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.securityProtocol = _ref; this.form.securityProtocol = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_AUTHENTICATION', name: 'SECURITY_AUTHENTICATION',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'security-authentication', $value: 'security-authentication',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.security.authentication'], value: contextHashtable['java.naming.security.authentication'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.authentication = _ref; this.form.authentication = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'LANGUAGE', name: 'LANGUAGE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'language', $value: 'language',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.language'], value: contextHashtable['java.naming.language'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.language = _ref; this.form.language = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'APPLET', name: 'APPLET',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextEditor, type: BI.TextEditor.xtype,
$value: 'applet', $value: 'applet',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: contextHashtable['java.naming.applet'], value: contextHashtable['java.naming.applet'],
ref: (_ref: any) => { ref: (_ref: TextEditor) => {
this.form.applet = _ref; this.form.applet = _ref;
}, },
}], }],

4
src/modules/pages/maintain/forms/components/form.plugin.ts

@ -1,9 +1,9 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Connection } from 'src/modules/crud/crud.typings'; import { Connection } from 'src/modules/crud/crud.typings';
import { getPluginWidgetEdit } from '../../../../app.service'; import { getPluginWidgetEdit } from '../../../../app.service';
export const FormPluginXtype = 'dec.dcm.maintain_plugin'; @shortcut()
@shortcut(FormPluginXtype)
export class FormPlugin extends BI.Widget { export class FormPlugin extends BI.Widget {
static xtype = 'dec.dcm.maintain_plugin';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} }

38
src/modules/pages/maintain/forms/form.model.ts

@ -5,21 +5,33 @@ import { ApiFactory } from 'src/modules/crud/apiFactory';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { testConnection } from './form.server'; import { testConnection } from './form.server';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const MaintainFormModelXtype = 'dec.dcm.model.maintain_form';
@model(MaintainFormModelXtype) @model()
export class MaintainFormModel extends Model<{ export class MaintainFormModel extends Model<{
context : { types : {
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne']; datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
saveEvent: AppModel['$$childContext']['saveEvent']; saveEvent: AppModel['TYPE']['saveEvent'];
testEvent: AppModel['$$childContext']['testEvent']; testEvent: AppModel['TYPE']['testEvent'];
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
isCopy: AppModel['$$childContext']['isCopy']; isCopy: AppModel['TYPE']['isCopy'];
} },
context: MaintainFormModel['context'];
}> { }> {
context = ['datebaseTypeSelected', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'saveEvent', 'pageIndex', 'testEvent', 'connections', 'isCopy']; static xtype = 'dec.dcm.model.maintain_form';
context = <const>[
'datebaseTypeSelected',
'datebaseTypeSelectedOne',
'connectionSelectedOne',
'saveEvent',
'pageIndex',
'testEvent',
'connections',
'isCopy',
];
actions = { actions = {
addConnection: (data: Connection) => api.addConnection(data), addConnection: (data: Connection) => api.addConnection(data),

8
src/modules/pages/maintain/forms/form.server.ts

@ -1,7 +1,7 @@
import { Connection, ConnectionJDBC } from '../../../crud/crud.typings'; import { Connection, ConnectionJDBC } from '../../../crud/crud.typings';
import { connectionType, errorCode } from '@constants/env'; import { connectionType, errorCode } from '@constants/env';
import { DATA_BASE_DRIVER_LINK, JDBC_ODBC_DRIVER, JDBC_ODBC_DRIVER_HELP_LINK, DEFAULT_HELP_LINK } from '@constants/constant'; import { DATA_BASE_DRIVER_LINK, JDBC_ODBC_DRIVER, JDBC_ODBC_DRIVER_HELP_LINK, DEFAULT_HELP_LINK } from '@constants/constant';
import { TestStatusXtype, EVENT_RELOAD, EVENT_CLOSE } from '../../../components/test_status/test_status'; import { TestStatus } from '../../../components/test_status/test_status';
import { getJdbcDatabaseType } from '../../../app.service'; import { getJdbcDatabaseType } from '../../../app.service';
import { ApiFactory } from '../../../crud/apiFactory'; import { ApiFactory } from '../../../crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@ -58,7 +58,7 @@ export function testConnection(value: Connection): Promise<string[]> {
}; };
BI.Maskers.create(id, null, { BI.Maskers.create(id, null, {
render: { render: {
type: TestStatusXtype, type: TestStatus.xtype,
loadingText: BI.i18nText('Dec-Dcm_Connection_Testing'), loadingText: BI.i18nText('Dec-Dcm_Connection_Testing'),
loadingCls: 'upload-loading-icon', loadingCls: 'upload-loading-icon',
successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'), successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'),
@ -71,14 +71,14 @@ export function testConnection(value: Connection): Promise<string[]> {
}, },
listeners: [ listeners: [
{ {
eventName: EVENT_RELOAD, eventName: TestStatus.EVENT_RELOAD,
action: () => { action: () => {
testStatus.setLoading(); testStatus.setLoading();
testConnection(); testConnection();
}, },
}, },
{ {
eventName: EVENT_CLOSE, eventName: TestStatus.EVENT_CLOSE,
action: () => { action: () => {
BI.Maskers.remove(id); BI.Maskers.remove(id);
}, },

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

@ -1,17 +1,19 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { MaintainFormModelXtype, MaintainFormModel } from './form.model'; import { MaintainFormModel } from './form.model';
import { FormJdbc, FormJdbcXtype } from './components/form.jdbc'; import { FormJdbc } from './components/form.jdbc';
import { FormJndiXtype } from './components/form.jndi'; import { FormJndi } from './components/form.jndi';
import { FormPluginXtype } from './components/form.plugin'; import { FormPlugin } from './components/form.plugin';
import { connectionType, errorCode } from '@constants/env'; import { connectionType, errorCode } from '@constants/env';
import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings';
import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant';
import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; import { getJdbcDatabaseType, getChartLength } from '../../../app.service';
import { NAME_MAX_LENGTH } from '../../../app.constant'; import { NAME_MAX_LENGTH } from '../../../app.constant';
export const MaintainFormXtype = 'dec.dcm.maintain.form';
@shortcut(MaintainFormXtype) @shortcut()
@store(MaintainFormModelXtype) @store(MaintainFormModel)
export class MaintainForm extends BI.Widget { export class MaintainForm extends BI.Widget {
static xtype = 'dec.dcm.maintain.form';
props = { props = {
connectionType: '', connectionType: '',
} }
@ -86,13 +88,13 @@ export class MaintainForm extends BI.Widget {
private getFormType() { private getFormType() {
switch (this.options.connectionType) { switch (this.options.connectionType) {
case connectionType.JDBC: case connectionType.JDBC:
return FormJdbcXtype; return FormJdbc.xtype;
case connectionType.JNDI: case connectionType.JNDI:
return FormJndiXtype; return FormJndi.xtype;
case DATEBASE_FILTER_TYPE.OTHER: case DATEBASE_FILTER_TYPE.OTHER:
return FormJdbcXtype; return FormJdbc.xtype;
default: default:
return FormPluginXtype; return FormPlugin.xtype;
} }
} }

23
src/modules/pages/maintain/maintain.model.ts

@ -1,18 +1,19 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { AppModel } from '../../app.model'; import { AppModel } from '../../app.model';
export const MaintainModelXtype = 'dec.dcm.model.maintain'; @model()
@model(MaintainModelXtype)
export class MaintainModel extends Model<{ export class MaintainModel extends Model<{
context : { types : {
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['$$childContext']['connections']; connections: AppModel['TYPE']['connections'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne']; datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
isCopy: AppModel['$$childContext']['isCopy']; isCopy: AppModel['TYPE']['isCopy'];
} },
context: MaintainModel['context'];
}> { }> {
context = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'isCopy']; static xtype = 'dec.dcm.model.maintain';
context = <const>['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'isCopy'];
actions = { actions = {
setPageIndex:(index: string) => { setPageIndex:(index: string) => {

36
src/modules/pages/maintain/maintain.ts

@ -1,8 +1,7 @@
import { Vtape, Label, VerticalAdapt, ListView, IconButton } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { MaintainModel, MaintainModelXtype } from './maintain.model'; import { MaintainModel } from './maintain.model';
import { MaintainFormXtype } from './forms/form'; import { MaintainForm } from './forms/form';
import { LinkXtype } from 'src/modules/components/link_button/link'; import { LinkButton } from 'src/modules/components/link_button/link';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@ -10,32 +9,35 @@ import './maintain.less';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service'; import { getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { ListView } from '@fui/core';
export const MaintainXtype = 'dec.dcm.maintain'; @shortcut()
@shortcut(MaintainXtype) @store(MaintainModel)
@store(MaintainModelXtype)
export class Maintain extends BI.Widget { export class Maintain extends BI.Widget {
static xtype = 'dec.dcm.maintain';
model: MaintainModel['model']; model: MaintainModel['model'];
store: MaintainModel['store']; store: MaintainModel['store'];
listView: any; listView: ListView;
socketTip: LinkButton;
render() { render() {
const { isEdit, databaseType } = this.getEditConnection(); const { isEdit, databaseType } = this.getEditConnection();
const titleText = getTextByDatabaseType(databaseType); const titleText = getTextByDatabaseType(databaseType);
return { return {
type: Vtape, type: BI.VTapeLayout.xtype,
hgap: 5, hgap: 5,
items: [ items: [
{ {
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
height: 40, height: 40,
hgap: 5, hgap: 5,
items: [ items: [
{ {
type: IconButton, type: BI.IconButton.xtype,
$value: 'back-databases', $value: 'back-databases',
cls: 'dcm-back-font', cls: 'dcm-back-font',
height: 15, height: 15,
@ -45,25 +47,25 @@ export class Maintain extends BI.Widget {
}, },
}, },
{ {
type: Label, type: BI.Label.xtype,
text: titleText, text: titleText,
height: 15, height: 15,
}, },
{ {
type: LinkXtype, type: LinkButton.xtype,
invisible: true, invisible: true,
lgap: 10, lgap: 10,
text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'), text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'),
link: api.getHyperlink(DecCst.Hyperlink.WEBSOCKET_CONNECT), link: api.getHyperlink(DecCst.Hyperlink.WEBSOCKET_CONNECT),
ref: (_ref: any) => { ref: (_ref: LinkButton) => {
this.socketTip = _ref; this.socketTip = _ref;
}, },
}, },
], ],
}, },
{ {
type: ListView, type: BI.ListView.xtype,
ref: (_ref: any) => { ref: (_ref: ListView) => {
this.listView = _ref; this.listView = _ref;
}, },
items: this.renderItems(), items: this.renderItems(),
@ -85,7 +87,7 @@ export class Maintain extends BI.Widget {
const { type } = this.getEditConnection(); const { type } = this.getEditConnection();
return [{ return [{
type: MaintainFormXtype, type: MaintainForm.xtype,
connectionType: type, connectionType: type,
}]; }];
} }

16
src/modules/title/title.model.ts

@ -1,15 +1,17 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { AppModel } from '../app.model'; import { AppModel } from '../app.model';
export const TitleModelXtype = 'dec.dcm.model.title'; @model()
@model(TitleModelXtype)
export class TitleModel extends Model<{ export class TitleModel extends Model<{
context : { types: {
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
} },
context: TitleModel['context'];
}> { }> {
context = ['pageIndex', 'datebaseTypeSelected'] static xtype = 'dec.dcm.model.title';
context = <const>['pageIndex', 'datebaseTypeSelected']
actions = { actions = {
setPageIndex: (index: string) => { setPageIndex: (index: string) => {

31
src/modules/title/title.ts

@ -1,19 +1,20 @@
import { LeftRightVerticalAdapt, VerticalAdapt, LinearSegment, Tab } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { TitleModel, TitleModelXtype } from './title.model'; import { TitleModel } from './title.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { TitleDatabase } from './title_database/title_datebase'; import { TitleDatabase } from './title_database/title_datebase';
import { TitleMaintain } from './title_maintain/title_maintain'; import { TitleMaintain } from './title_maintain/title_maintain';
export const TitleXtype = 'dec.dcm.title'; import { LinearSegment, Tab } from '@fui/core';
@shortcut(TitleXtype) @shortcut()
@store(TitleModelXtype) @store(TitleModel)
export class Title extends BI.Widget { export class Title extends BI.Widget {
static xtype = 'dec.dcm.title';
props = { props = {
baseCls: 'bi-card', baseCls: 'bi-card',
} }
tab: any; tab: Tab;
linearSegment: any; linearSegment: LinearSegment;
model: TitleModel['model']; model: TitleModel['model'];
store: TitleModel['store']; store: TitleModel['store'];
@ -27,18 +28,18 @@ export class Title extends BI.Widget {
render() { render() {
return { return {
type: LeftRightVerticalAdapt, type: BI.LeftRightVerticalAdaptLayout.xtype,
items: { items: {
left: [ left: [
{ {
type: LinearSegment, type: BI.LinearSegment.xtype,
cls: 'bi-font-bold', cls: 'bi-font-bold',
height: 40, height: 40,
hgap: 10, hgap: 10,
layouts: [{ layouts: [{
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
}], }],
ref: (_ref: any) => { ref: (_ref: LinearSegment) => {
this.linearSegment = _ref; this.linearSegment = _ref;
}, },
items: [ items: [
@ -66,21 +67,21 @@ export class Title extends BI.Widget {
], ],
right: [ right: [
{ {
type: Tab, type: BI.Tab.xtype,
height: 40, height: 40,
showIndex: this.model.pageIndex, showIndex: this.model.pageIndex,
ref: (_ref: any) => { ref: (_ref: Tab) => {
this.tab = _ref; this.tab = _ref;
}, },
cardCreator: (index: string) => { cardCreator: (index: string) => {
switch (index) { switch (index) {
case PAGE_INDEX.DATEBASE: case PAGE_INDEX.DATEBASE:
return { return {
type: TitleDatabase, type: TitleDatabase.xtype,
}; };
case PAGE_INDEX.MAINTAIN: case PAGE_INDEX.MAINTAIN:
return { return {
type: TitleMaintain, type: TitleMaintain.xtype,
}; };
default: default:
return { return {

16
src/modules/title/title_database/title_datebase.model.ts

@ -1,15 +1,17 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { AppModel } from 'src/modules/app.model'; import { AppModel } from 'src/modules/app.model';
export const TitleDatebaseModelXtype = 'dec.dcm.model.title_datebase'; @model()
@model(TitleDatebaseModelXtype)
export class TitleDatebaseModel extends Model<{ export class TitleDatebaseModel extends Model<{
context: { types: {
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
} },
context: TitleDatebaseModel['context'];
}> { }> {
context = ['pageIndex', 'datebaseTypeSelected']; static xtype = 'dec.dcm.model.title_datebase';
context = <const>['pageIndex', 'datebaseTypeSelected'];
actions = { actions = {
setPageIndex: (index: string) => { setPageIndex: (index: string) => {

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

@ -1,17 +1,17 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Right, Button, VerticalAdapt } from 'ui'; import { TitleDatebaseModel } from './title_datebase.model';
import { TitleDatebaseModel, TitleDatebaseModelXtype } from './title_datebase.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { Button } from '@fui/core';
export const TitleDatabase = 'dec.dcm.title.datebase'; @shortcut()
@store(TitleDatebaseModel)
export class TitleDatabase extends BI.Widget {
static xtype = 'dec.dcm.title.datebase';
@shortcut(TitleDatabase)
@store(TitleDatebaseModelXtype)
export class TitleDatabaseWidget extends BI.Widget {
store: TitleDatebaseModel['store']; store: TitleDatebaseModel['store'];
model: TitleDatebaseModel['model']; model: TitleDatebaseModel['model'];
submitButton: any; submitButton: Button;
watch = { watch = {
datebaseTypeSelected: (datebaseTypeSelected: string) => { datebaseTypeSelected: (datebaseTypeSelected: string) => {
@ -21,14 +21,14 @@ export class TitleDatabaseWidget extends BI.Widget {
render() { render() {
return { return {
type: Right, type: BI.FloatRightLayout.xtype,
items: [{ items: [{
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
height: 40, height: 40,
rgap: 5, rgap: 5,
items: [ items: [
{ {
type: Button, type: BI.Button.xtype,
$value: 'title-database-cancel', $value: 'title-database-cancel',
text: BI.i18nText('BI-Basic_Cancel'), text: BI.i18nText('BI-Basic_Cancel'),
level: 'ignore', level: 'ignore',
@ -37,11 +37,11 @@ export class TitleDatabaseWidget extends BI.Widget {
}, },
}, },
{ {
type: Button, type: BI.Button.xtype,
$value: 'title-database-save', $value: 'title-database-save',
text: BI.i18nText('BI-Basic_Save'), text: BI.i18nText('BI-Basic_Save'),
disabled: !this.model.datebaseTypeSelected, disabled: !this.model.datebaseTypeSelected,
ref: (_ref: any) => { ref: (_ref: Button) => {
this.submitButton = _ref; this.submitButton = _ref;
}, },
handler: () => { handler: () => {

23
src/modules/title/title_maintain/title_maintain.model.ts

@ -2,18 +2,21 @@ import { model, Model } from '@core/core';
import { AppModel } from 'src/modules/app.model'; import { AppModel } from 'src/modules/app.model';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
export const TitleMaintainModelXtype = 'dec.dcm.model.title_maintain';
@model(TitleMaintainModelXtype) @model()
export class TitleMaintainModel extends Model<{ export class TitleMaintainModel extends Model<{
context : { types : {
pageIndex: AppModel['$$childContext']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
saveEvent: AppModel['$$childContext']['saveEvent']; saveEvent: AppModel['TYPE']['saveEvent'];
connectionSelected: AppModel['$$childContext']['connectionSelected']; connectionSelected: AppModel['TYPE']['connectionSelected'];
testEvent: AppModel['$$childContext']['testEvent']; testEvent: AppModel['TYPE']['testEvent'];
isCopy: AppModel['$$childContext']['isCopy']; isCopy: AppModel['TYPE']['isCopy'];
} },
context: TitleMaintainModel['context'];
}> { }> {
context = ['pageIndex', 'saveEvent', 'testEvent', 'connectionSelected', 'isCopy']; static xtype = 'dec.dcm.model.title_maintain';
context = <const>['pageIndex', 'saveEvent', 'testEvent', 'connectionSelected', 'isCopy'];
actions = { actions = {
setPageIndex: (index: string) => { setPageIndex: (index: string) => {

22
src/modules/title/title_maintain/title_maintain.ts

@ -1,24 +1,24 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Right, Button, VerticalAdapt } from 'ui'; import { TitleMaintainModel } from './title_maintain.model';
import { TitleMaintainModel, TitleMaintainModelXtype } from './title_maintain.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
export const TitleMaintain = 'dec.dcm.title.maintain'; @shortcut()
@shortcut(TitleMaintain) @store(TitleMaintainModel)
@store(TitleMaintainModelXtype) export class TitleMaintain extends BI.Widget {
export class TitleMaintainWidget extends BI.Widget { static xtype = 'dec.dcm.title.maintain';
store: TitleMaintainModel['store']; store: TitleMaintainModel['store'];
model: TitleMaintainModel['model']; model: TitleMaintainModel['model'];
render() { render() {
return { return {
type: Right, type: BI.FloatRightLayout.xtype,
items: [{ items: [{
type: VerticalAdapt, type: BI.VerticalAdaptLayout.xtype,
height: 40, height: 40,
rgap: 5, rgap: 5,
items: [ items: [
{ {
type: Button, type: BI.Button.xtype,
$value: 'title-maintain-cancel', $value: 'title-maintain-cancel',
text: BI.i18nText('BI-Basic_Cancel'), text: BI.i18nText('BI-Basic_Cancel'),
level: 'ignore', level: 'ignore',
@ -29,7 +29,7 @@ export class TitleMaintainWidget extends BI.Widget {
}, },
}, },
{ {
type: Button, type: BI.Button.xtype,
$value: 'title-maintain-connection-test', $value: 'title-maintain-connection-test',
text: BI.i18nText('Dec-Dcm_Connection_Test'), text: BI.i18nText('Dec-Dcm_Connection_Test'),
level: 'ignore', level: 'ignore',
@ -38,7 +38,7 @@ export class TitleMaintainWidget extends BI.Widget {
}, },
}, },
{ {
type: Button, type: BI.Button.xtype,
$value: 'title-maintain-save', $value: 'title-maintain-save',
text: BI.i18nText('BI-Basic_Save'), text: BI.i18nText('BI-Basic_Save'),
handler: () => { handler: () => {

74
src/ui/fineui.ts

@ -1,74 +0,0 @@
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
src/ui/index.ts

@ -1 +0,0 @@
export * from './fineui';

1
tsconfig.json

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

2
types/globals.d.ts vendored

@ -2,7 +2,7 @@ interface Obj {
[key: string]: any; [key: string]: any;
} }
declare let BI: Obj & import('fineui')._BI; declare let BI: Obj & import('@fui/core').BI & import('@fui/materials').BI;
declare const Fix: Obj; declare const Fix: Obj;
declare const DecCst: Obj; declare const DecCst: Obj;
declare const Dec: { declare const Dec: {

2
webpack/webpack.common.js

@ -49,7 +49,7 @@ module.exports = {
options: { options: {
plugins: [vars({ plugins: [vars({
variables: { variables: {
fontUrl: '../node_modules/fineui/dist/font/', fontUrl: '../node_modules/@fui/core/dist/font/',
imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x',
image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x',
} }

5
webpack/webpack.dev.js

@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const chokidar = require('chokidar'); const chokidar = require('chokidar');
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const dirs = require('./dirs'); const dirs = require('./dirs');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
@ -65,6 +65,9 @@ module.exports = merge(common, {
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../index.html'), template: path.resolve(__dirname, '../index.html'),
}), }),
new ForkTsCheckerWebpackPlugin({
watch: ['./src'],
}),
new OptimizeCssAssetsPlugin({ new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g, assetNameRegExp: /\.css$/g,
cssProcessor: require('cssnano'), cssProcessor: require('cssnano'),

2275
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save