Browse Source

Merge pull request #1241 in DEC/decision-webui-dcm from release/10.0 to final/10.0

* commit '7aeec47c4df6a3c630b61b1d754ebac42edc016c':
  KERNEL-6541 修改xtype写法
  KERNEL-6541 引用类型规范化
  KERNEL-6541 类型引用规范化
  build: KERNEL-6541 引用类型规范化
final/10.0 10.0.13.2021.01.13.final
superman 4 years ago
parent
commit
a77a0d4c93
  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');
[
'../node_modules/fineui/dist/fineui.js',
'../node_modules/@fui/core/dist/fineui.js',
'../node_modules/@fui/materials/docs/materials.js',
'../config/fineui.prepare.js',
'./fineui.setup.js',

8
index.html

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

7
package.json

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

4
src/index.ts

@ -1,5 +1,5 @@
import { AppXtype } from './modules/app';
import { App } from './modules/app';
BI.createWidget({
type: AppXtype,
type: App.xtype,
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 "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";
.addFontRes();
.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/fineui/src/less/visual.less';
@import "../../node_modules/@fui/core/src/less/lib/colors.less";
@import '../../node_modules/@fui/core/src/less/visual.less';
@import "background.less";
@import "font.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-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 { Connection } from 'src/modules/crud/crud.typings';
import { getAllDatabaseTypes } from './app.service';
export const AppModelXtype = 'dec.dcm.model.main';
@model(AppModelXtype)
@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() {
return {

38
src/modules/app.ts

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

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

@ -1,8 +1,9 @@
import { model, Model } from '@core/core';
export const CollapseModelXtype = 'dec.dcm.model.components.collapse';
@model(CollapseModelXtype)
@model()
export class CollapseModel extends Model {
static xtype = 'dec.dcm.model.components.collapse';
state() {
return {
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 { CollapseModel, CollapseModelXtype } from './collapse.model';
import { CollapseModel } from './collapse.model';
import { IconLabel } from '@fui/core';
export const EVENT_CHANGE = 'EVENT_CHANGE';
export const CollapseXtype = 'dec.dcm.components.collapse';
@shortcut(CollapseXtype)
@store(CollapseModelXtype)
@shortcut()
@store(CollapseModel)
export class Collapse extends BI.BasicButton {
static xtype = 'dec.dcm.components.collapse';
props = {
name: '',
isCollapse: true,
$testId: 'dec-dcm-components-collapse',
}
rightFont: any;
downFont: any;
rightFont: IconLabel;
downFont: IconLabel;
model: CollapseModel['model'];
store: CollapseModel['store'];
@ -31,28 +32,28 @@ export class Collapse extends BI.BasicButton {
this.store.setCollapse(this.options.isCollapse);
return {
type: Left,
type: BI.FloatLeftLayout.xtype,
items: [
{
type: IconLabel,
type: BI.IconLabel.xtype,
height: 17,
cls: 'dcm-triangle-collapse-font icon-size-16',
ref: (_ref: any) => {
ref: (_ref: IconLabel) => {
this.rightFont = _ref;
},
invisible: !this.model.isCollapse,
},
{
type: IconLabel,
type: BI.IconLabel.xtype,
height: 17,
cls: 'dcm-triangle-expand-font icon-size-16',
ref: (_ref: any) => {
ref: (_ref: IconLabel) => {
this.downFont = _ref;
},
invisible: this.model.isCollapse,
},
{
type: Label,
type: BI.Label.xtype,
lgap: 2,
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 { Label } from '@fui/core';
export const LinkXtype = 'dec.dcm.components.link.button';
const DEFAULT_LINK = '/';
@shortcut(LinkXtype)
@shortcut()
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: '',
cls: 'cursor-pointer',
$testId: 'dec-dcm-link-button',
}
private text: Label;
render() {
return {
type: CenterAdapt,
type: BI.CenterAdaptLayout.xtype,
cls: 'bi-high-light',
items: [
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-high-light-border-bottom',
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 { TEST_STATUS } from '@constants/constant';
export const TestStatusModelXtype = 'dec.dcm.model.components.test_status';
@model(TestStatusModelXtype)
@model()
export class TestStatusModel extends Model {
static xtype = 'dec.dcm.model.components.test_status';
state() {
return {
status: TEST_STATUS.LOADING,

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

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

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

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

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

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

42
src/modules/core/core.ts

@ -1,43 +1,3 @@
type Constructor<T> = new(...args: any[]) => T;
export function shortcut(className: string) {
return function decorator<U>(Base: Constructor<U>): void {
BI.shortcut(className, Base);
};
}
export function store(modelName: string) {
return function decorator<U>(Base: Constructor<U>): void {
Base.prototype._store = () => BI.Models.getModel(modelName);
};
}
export function model(className: string) {
return function decorator<U>(Base: Constructor<U>): void {
BI.model(className, Base);
};
}
export class Model<U extends {context?: {[key: string]: any}} = {}> extends Fix.Model {
model: {[key in keyof U['context']]: U['context'][key]} & {[key in keyof ReturnType<this['state']>]: ReturnType<this['state']>[key]} & {[key in keyof this['computed']]: ReturnType<this['computed'][key]>} & {[key: string]: undefined};
store: this['actions'];
state(): {[key: string]: any} {
return {};
}
// context: Partial<keyof U['context']>;
context: string[];
actions:{[key: string]: (...args: any[]) => any};
// childContext: (keyof this['$$childContext'])[];
childContext: string[];
$$childContext: {[key in keyof this['computed']]: ReturnType<this['computed'][key]>} & {[key in keyof ReturnType<this['state']>]: ReturnType<this['state']>[key]};
computed: {[key: string]: () => any};
}
export const { shortcut, model, store, Model, provider } = BI.Decorators;

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

@ -1,8 +1,8 @@
import { shortcut } from '@core/core';
import { Label, Htape, Vertical } from 'ui';
export const FormItemXtype = 'dec.dcm.connection_form_item';
@shortcut(FormItemXtype)
@shortcut()
export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.connection_form_item';
props = {
name: '',
value: '',
@ -16,12 +16,12 @@ export class FormItem extends BI.Widget {
const { nameWidth, unit, value } = this.options;
return {
type: Htape,
type: BI.HTapeLayout.xtype,
height: 17,
items: [
{
el: {
type: Label,
type: BI.Label.xtype,
cls: this.options.isBold ? 'bi-font-bold' : '',
textAlign: 'left',
text: this.options.name,
@ -29,10 +29,10 @@ export class FormItem extends BI.Widget {
width: nameWidth,
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
items: [
{
type: Label,
type: BI.Label.xtype,
text: unit ? `${value} ${unit}` : value,
textAlign: 'left',
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 { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
export const ConnectionModelXtype = 'dec.dcm.model.connection';
@model(ConnectionModelXtype)
@model()
export class ConnectionModel extends Model<{
context : {
pageIndex: AppModel['$$childContext']['pageIndex'];
connections: AppModel['$$childContext']['connections'];
connectionSelected: AppModel['$$childContext']['connectionSelected'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected'];
}
types : {
pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['TYPE']['connectionSelected'];
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
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 = {
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 { ConnectionModel, ConnectionModelXtype } from './connection.model';
import { ConnectionModel } from './connection.model';
import { PAGE_INDEX } from '@constants/constant';
import { ConnectionListXtype } from './list/list';
import { ConnectionJdbcXtype } from './connection_jdbc/connection_jdbc';
import { ConnectionJndiXtype } from './connection_jndi/connection_jndi';
import { ConnectionPluginXtype } from './connection_plugin/connection_plugin';
import { ConnectionList } from './list/list';
import { ConnectionJdbc } from './connection_jdbc/connection_jdbc';
import { ConnectionJndi } from './connection_jndi/connection_jndi';
import { ConnectionPlugin } from './connection_plugin/connection_plugin';
import { connectionType } from '@constants/env';
import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from '../../crud/crud.typings';
import { Button, HTapeLayout, Label, ListView } from '@fui/core';
export const ConnectionXtype = 'dec.dcm.connection';
@shortcut(ConnectionXtype)
@store(ConnectionModelXtype)
@shortcut()
@store(ConnectionModel)
export class Connection extends BI.Widget {
static xtype = 'dec.dcm.connection';
store: ConnectionModel['store'];
model: ConnectionModel['model'];
connectionTitleWidget: any;
connectionEditWidget: any;
listView: any;
title: any;
connectionTitleWidget: Label;
connectionEditWidget: Button;
listView: ListView;
title: HTapeLayout;
watch = {
connectionSelected:(name: string) => {
@ -48,21 +49,21 @@ export class Connection extends BI.Widget {
this.store.setConnectionSelected('');
return {
type: Htape,
type: BI.HTapeLayout.xtype,
hgap: 10,
items: [
{
el: {
type: Vtape,
type: BI.VTapeLayout.xtype,
cls: 'bi-border-right',
rgap: 10,
items: [
{
el: {
type: VerticalAdapt,
type: BI.VerticalAdaptLayout.xtype,
cls: 'bi-border-bottom',
items: [{
type: Button,
type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Connection_New'),
handler: () => {
this.store.setPageIndex(PAGE_INDEX.DATEBASE);
@ -72,7 +73,7 @@ export class Connection extends BI.Widget {
height: 40,
},
{
type: ConnectionListXtype,
type: ConnectionList.xtype,
tgap: 10,
},
],
@ -80,32 +81,32 @@ export class Connection extends BI.Widget {
width: 275,
},
{
type: Vtape,
type: BI.VTapeLayout.xtype,
items: [
{
el: {
type: Htape,
ref: (_ref: any) => {
type: BI.HTapeLayout.xtype,
ref: (_ref: HTapeLayout) => {
this.title = _ref;
},
cls: 'bi-border-bottom',
items: [
{
type: Label,
type: BI.Label.xtype,
textAlign: 'left',
ref: (_ref: any) => {
ref: (_ref: Label) => {
this.connectionTitleWidget = _ref;
},
},
{
el: {
type: VerticalAdapt,
type: BI.VerticalAdaptLayout.xtype,
items: [{
type: Button,
type: BI.Button.xtype,
$value: 'connection-edit',
invisible: true,
text: BI.i18nText('Dec-Dcm_Edit'),
ref: (_ref: any) => {
ref: (_ref: Button) => {
this.connectionEditWidget = _ref;
},
handler: () => {
@ -124,8 +125,8 @@ export class Connection extends BI.Widget {
height: 40,
},
{
type: ListView,
ref: (_ref: any) => {
type: BI.ListView.xtype,
ref: (_ref: ListView) => {
this.listView = _ref;
},
},
@ -143,38 +144,38 @@ export class Connection extends BI.Widget {
switch (this.model.connectionSelectedOne.connectionType) {
case connectionType.JDBC:
return [{
type: ConnectionJdbcXtype,
type: ConnectionJdbc.xtype,
}];
case connectionType.JNDI:
return [{
type: ConnectionJndiXtype,
type: ConnectionJndi.xtype,
}];
default:
return [{
type: ConnectionPluginXtype,
type: ConnectionPlugin.xtype,
}];
}
}
private renderNoRegistered() {
return [{
type: CenterAdapt,
type: BI.CenterAdaptLayout.xtype,
height: 500,
items: [
{
type: Vtape,
type: BI.VTapeLayout.xtype,
width: 300,
height: 150,
items: [
{
el: {
type: Layout,
type: BI.Layout.xtype,
cls: 'error-page-background',
},
height: 130,
},
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_Np_Registered'),
},
@ -186,7 +187,7 @@ export class Connection extends BI.Widget {
private renderEmpty() {
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 { ConnectionModel } from '../connection.model';
export const ConnectionJdbcModelXtype = 'dec.dcm.model.connection_jdbc';
@model(ConnectionJdbcModelXtype)
import { AppModel } from '../../../app.model';
@model()
export class ConnectionJdecModel extends Model<{
context : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne'];
}
types : {
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 { Vertical, Layout } from 'ui';
import { FormItemXtype } from '../components/form_item/form_item';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { ConnectionJdbcModelXtype, ConnectionJdecModel } from './connection_jdbc.model';
import { FormItem } from '../components/form_item/form_item';
import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { ConnectionJdecModel } from './connection_jdbc.model';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service';
import { CONNECTION_LAYOUT } from '@constants/constant';
export const ConnectionJdbcXtype = 'dec.dcm.connection_jdbc';
@shortcut(ConnectionJdbcXtype)
@store(ConnectionJdbcModelXtype)
import { VerticalLayout } from '@fui/core';
@shortcut()
@store(ConnectionJdecModel)
export class ConnectionJdbc extends BI.Widget {
advancedSet: any;
static xtype = 'dec.dcm.connection_jdbc';
advancedSet: any;
model: ConnectionJdecModel['model'];
allDatabaseTypes = getAllDatabaseTypes();
@ -23,66 +23,66 @@ export class ConnectionJdbc extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT;
return {
type: Vertical,
type: BI.VerticalLayout.xtype,
hgap,
vgap,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
value: driver,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
value: databaseName,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'),
value: host,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
value: port,
},
authType ?
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_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'),
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'),
value: '******',
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
value: schema,
invisible: !databaseType.hasSchema,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
value: url,
},
{
type: CollapseXtype,
type: Collapse.xtype,
width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [
@ -95,73 +95,73 @@ export class ConnectionJdbc extends BI.Widget {
],
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
tgap: -15,
vgap,
invisible: true,
ref: (_ref: any) => {
ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref;
},
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
value: connectionPoolAttr.initialSize,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
value: connectionPoolAttr.maxActive,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
value: connectionPoolAttr.maxIdle,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
value: connectionPoolAttr.minIdle,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
value: connectionPoolAttr.maxWait,
unit: BI.i18nText('Dec-Dcm_Millisecond'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'),
value: connectionPoolAttr.validationQuery,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'),
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
value: connectionPoolAttr.timeBetweenEvictionRunsMillis,
unit: BI.i18nText('Dec-Dcm_Millisecond'),
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
value: connectionPoolAttr.numTestsPerEvictionRun,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
value: connectionPoolAttr.minEvictableIdleTimeMillis,
unit: BI.i18nText('BI-Basic_Seconds'),

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 { ConnectionModel } from '../connection.model';
export const ConnectionJndiModelXtype = 'dec.dcm.model.connection_jndi';
@model(ConnectionJndiModelXtype)
@model()
export class ConnectionJndiModel extends Model<{
context : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne'];
}
types : {
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 { Vertical, Htape, Label, Left } from 'ui';
import { FormItemXtype } from '../components/form_item/form_item';
import { ConnectionJndiModelXtype, ConnectionJndiModel } from './connection_jndi.model';
import { FormItem } from '../components/form_item/form_item';
import { ConnectionJndiModel } from './connection_jndi.model';
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 { 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'];
advancedSet: any;
advancedSet: VerticalLayout;
render() {
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJNDI;
@ -20,27 +21,27 @@ export class ConnectionJdbc extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT;
return {
type: Vertical,
type: BI.VerticalLayout.xtype,
$testId: 'dec-dcm-connection-jndi',
hgap,
vgap,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
value: jndiName,
},
{
type: Htape,
type: BI.HTapeLayout.xtype,
height: 115,
items: [
{
el: {
type: Left,
type: BI.FloatLeftLayout.xtype,
items: [
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-font-bold',
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'),
@ -50,33 +51,33 @@ export class ConnectionJdbc extends BI.Widget {
width: 200,
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
bgap: 15,
height: 115,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200,
isBold: false,
value: contextHashtable['java.naming.factory.initial'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'PROVIDER_URL',
nameWidth: 200,
isBold: false,
value: contextHashtable['java.naming.provider.url'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL',
nameWidth: 200,
isBold: false,
value: contextHashtable['java.naming.security.principal'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS',
nameWidth: 200,
isBold: false,
@ -88,13 +89,13 @@ export class ConnectionJdbc extends BI.Widget {
],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
},
{
type: CollapseXtype,
type: Collapse.xtype,
width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [
@ -107,76 +108,76 @@ export class ConnectionJdbc extends BI.Widget {
],
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
vgap,
tgap: -15,
invisible: true,
ref: (_ref: any) => {
ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref;
},
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'OBJECT_FACTORIES',
value: contextHashtable['java.naming.factory.object'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'STATE_FACTORIES',
value: contextHashtable['java.naming.factory.state'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'URL_PKG_PREFIXES',
value: contextHashtable['java.naming.factory.url.pkgs'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'DNS_URL',
value: contextHashtable['java.naming.dns.url'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'AUTHORITATIVE',
value: contextHashtable['java.naming.authoritative'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'BATCHSIZE',
value: contextHashtable['java.naming.batchsize'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'REFERRAL',
value: contextHashtable['java.naming.referral'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'SECURITY_PROTOCOL',
value: contextHashtable['java.naming.security.protocol'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'SECURITY_AUTHENTICATION',
value: contextHashtable['java.naming.security.authentication'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: 'LANGUAGE',
value: contextHashtable['java.naming.language'],
},
{
type: FormItemXtype,
type: FormItem.xtype,
nameWidth: 200,
name: '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 { ConnectionModel } from '../connection.model';
export const ConnectionPluginModelXtype = 'dec.dcm.model.connection_plugin';
@model(ConnectionPluginModelXtype)
@model()
export class ConnectionPluginModel extends Model<{
context : {
connectionSelectedOne: ConnectionModel['$$childContext']['connectionSelectedOne'];
}
types : {
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 { ConnectionPluginModelXtype, ConnectionPluginModel } from './connection_plugin.model';
import { ConnectionPluginModel } from './connection_plugin.model';
import { getPluginWidgetShow } from 'src/modules/app.service';
export const ConnectionPluginXtype = 'dec.dcm.connection_plugin';
@shortcut(ConnectionPluginXtype)
@store(ConnectionPluginModelXtype)
@shortcut()
@store(ConnectionPluginModel)
export class ConnectionPlugin extends BI.Widget {
static xtype = 'dec.dcm.connection_plugin';
model: ConnectionPluginModel['model'];
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 { AppModel } from '../../../app.model';
const api = new ApiFactory().create();
export const ConnectionListModelXtype = 'dec.dcm.model.connection.list';
@model(ConnectionListModelXtype)
@model()
export class ConnectionListModel extends Model<{
context : {
connections: AppModel['$$childContext']['connections'];
connectionSelected: AppModel['$$childContext']['connectionSelected'];
}
types : {
connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['TYPE']['connectionSelected'];
},
context: ConnectionListModel['context'];
}> {
context = ['connections', 'connectionSelected'];
static xtype = 'dec.dcm.model.connection.list';
context = <const>['connections', 'connectionSelected'];
computed = {
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 { CenterAdapt, Label, Layout, Vtape, Loader, Tab } from 'ui';
import { ListItemXtype } from './list_item/list_item';
import { ConnectionListModel, ConnectionListModelXtype } from './list.model';
import { ListItem } from './list_item/list_item';
import { ConnectionListModel } from './list.model';
import { getDatabaseType } from './list.service';
export const ConnectionListXtype = 'dec.dcm.connection.list';
@shortcut(ConnectionListXtype)
@store(ConnectionListModelXtype)
import { Tab } from '@fui/core';
@shortcut()
@store(ConnectionListModel)
export class ConnectionList extends BI.LoadingPane {
static xtype = 'dec.dcm.connection.list';
store: ConnectionListModel['store'];
model: ConnectionListModel['model'];
groupWidget: any;
tab: any;
tab: Tab;
beforeInit(cb: Function) {
this.store.setConnections().then(() => {
@ -32,31 +34,31 @@ export class ConnectionList extends BI.LoadingPane {
render() {
return {
type: Tab,
type: BI.Tab.xtype,
single: true,
showIndex: this.model.shwoType,
ref: (_ref: any) => {
ref: (_ref: Tab) => {
this.tab = _ref;
},
cardCreator: (index: 'list' | 'none') => {
if (index === 'none') {
return {
type: CenterAdapt,
type: BI.CenterAdaptLayout.xtype,
items: [
{
type: Vtape,
type: BI.VTapeLayout.xtype,
width: 260,
height: 150,
items: [
{
el: {
type: Layout,
type: BI.Layout.xtype,
cls: 'data-connection-background',
},
height: 130,
},
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-tips',
text: BI.i18nText('Dec-Dcm_Connection_None'),
},
@ -67,7 +69,7 @@ export class ConnectionList extends BI.LoadingPane {
}
return {
type: Loader,
type: BI.Loader.xtype,
itemsCreator: (options: {times: number}, populate) => {
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) {
return this.model.connections.slice(start, end).map((item, index) => {
return {
type: ListItemXtype,
type: ListItem.xtype,
name: item.connectionName,
value: item.connectionName,
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';
const api = new ApiFactory().create();
export const ListItemModelXtype = 'dec.dcm.model.connection.list_item';
@model(ListItemModelXtype)
@model()
export class ListItemModel extends Model<{
context : {
connectionSelected: AppModel['$$childContext']['connectionSelected'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne'];
connections: AppModel['$$childContext']['connections'];
pageIndex: AppModel['$$childContext']['pageIndex'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected'];
isCopy: AppModel['$$childContext']['isCopy']
}
types : {
connectionSelected: AppModel['TYPE']['connectionSelected'];
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connections: AppModel['TYPE']['connections'];
pageIndex: AppModel['TYPE']['pageIndex'];
datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
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() {
return {

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

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

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

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

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

@ -1,14 +1,15 @@
import { shortcut, store } from '@core/core';
import { Htape, Vtape, Label, Layout, CenterAdapt, Loader } from 'ui';
import { ConnectionPoolModel, ConnectionPoolModelXtype } from './connection_pool.model';
import { ListItemXtype } from './list_item/list_item';
import { PoolXtype } from './pool/pool';
import { ConnectionPoolModel } from './connection_pool.model';
import { ListItem } from './list_item/list_item';
import { Pool } from './pool/pool';
import { PAGE_SIZE } from '@constants/constant';
export const ConnectionPoolXtype = 'dec.dcm.connection_pool';
@shortcut(ConnectionPoolXtype)
@store(ConnectionPoolModelXtype)
import { Label } from '@fui/core';
@shortcut()
@store(ConnectionPoolModel)
export class ConnectionPool extends BI.Widget {
title: any;
static xtype = 'dec.dcm.connection_pool';
title: Label;
model: ConnectionPoolModel['model'];
store: ConnectionPoolModel['store'];
@ -30,16 +31,16 @@ export class ConnectionPool extends BI.Widget {
}
return {
type: Htape,
type: BI.HTapeLayout.xtype,
items: [
{
el: {
type: Vtape,
type: BI.VTapeLayout.xtype,
cls: 'bi-border-right',
items: [
{
el: {
type: Label,
type: BI.Label.xtype,
cls: 'bi-border-bottom',
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Data_Connections'),
@ -48,7 +49,7 @@ export class ConnectionPool extends BI.Widget {
height: 40,
},
{
type: Loader,
type: BI.Loader.xtype,
itemsCreator: (options: {times: number}, populate) => {
populate(this.renderList((options.times - 1) * PAGE_SIZE, options.times * PAGE_SIZE));
},
@ -65,22 +66,22 @@ export class ConnectionPool extends BI.Widget {
private renderPool() {
return {
type: Vtape,
type: BI.VTapeLayout.xtype,
items: [
{
el: {
type: Label,
type: BI.Label.xtype,
cls: 'bi-border-bottom',
textAlign: 'left',
lgap: 10,
ref: (_ref: any) => {
ref: (_ref: Label) => {
this.title = _ref;
},
},
height: 40,
},
{
type: PoolXtype,
type: Pool.xtype,
},
],
};
@ -88,22 +89,22 @@ export class ConnectionPool extends BI.Widget {
private renderNoConnection() {
return {
type: CenterAdapt,
type: BI.CenterAdaptLayout.xtype,
items: [
{
type: Vtape,
type: BI.VTapeLayout.xtype,
width: 260,
height: 150,
items: [
{
el: {
type: Layout,
type: BI.Layout.xtype,
cls: 'data-connection-background',
},
height: 130,
},
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-tips',
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 {
type: ListItemXtype,
type: ListItem.xtype,
name: item.connectionName,
value: item.connectionName,
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 { ConnectionPoolModel } from '../connection_pool.model';
export const ListItemModelXtype = 'dec.dcm.model.connection_pool.list_item';
@model(ListItemModelXtype)
@model()
export class ListItemModel extends Model<{
context : {
selected: ConnectionPoolModel['$$childContext']['selected'];
}
types : {
selected: ConnectionPoolModel['TYPE']['selected'];
},
context: ListItemModel['context'];
}> {
context = ['selected'];
static xtype = 'dec.dcm.model.connection_pool.list_item';
context = <const>['selected'];
actions = {
setSelected: (selected: string) => {
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 { VerticalAdapt, Label } from 'ui';
import { ListItemModel, ListItemModelXtype } from './list_item.model';
export const ListItemXtype = 'dec.dcm.connection_pool.list_item';
@shortcut(ListItemXtype)
@store(ListItemModelXtype)
import { ListItemModel } from './list_item.model';
@shortcut()
@store(ListItemModel)
export class ListItem extends BI.BasicButton {
static xtype = 'dec.dcm.connection_pool.list_item';
props = {
name: '',
height: 25,
@ -16,11 +16,11 @@ export class ListItem extends BI.BasicButton {
render() {
return {
type: VerticalAdapt,
type: BI.VerticalAdaptLayout.xtype,
lgap: 5,
items: [
{
type: Label,
type: BI.Label.xtype,
text: this.options.name,
title: this.options.name,
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 { ApiFactory } from '../../../crud/apiFactory';
const api = new ApiFactory().create();
export const PoolModelXtype = 'dec.dcm.model.connection_pool.pool';
@model(PoolModelXtype)
@model()
export class PoolModel extends Model<{
context : {
selected: ConnectionPoolModel['$$childContext']['selected'];
}
types : {
selected: ConnectionPoolModel['TYPE']['selected'];
},
context: PoolModel['context'];
}> {
context = ['selected'];
static xtype = 'dec.dcm.model.connection_pool.poo';
context = <const>['selected'];
state () {
return {

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

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

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

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

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

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

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

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

@ -1,11 +1,10 @@
import { shortcut, store } from '@core/core';
import { Label } from 'ui';
import { FilterModel, FilterModelXtype } from './filter.model';
import { FilterModel } from './filter.model';
export const FilterXtype = 'dec.dcm.datebase.filter';
@shortcut(FilterXtype)
@store(FilterModelXtype)
@shortcut()
@store(FilterModel)
export class Filter extends BI.BasicButton {
static xtype = 'dec.dcm.datebase.filter';
store: FilterModel['store']
props = {
text: '',
@ -18,7 +17,7 @@ export class Filter extends BI.BasicButton {
const { text } = this.options;
return {
type: Label,
type: BI.Label.xtype,
textAlign: 'left',
height: 25,
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 { Label, Left } from 'ui';
import { CONNECTION_LAYOUT } from '@constants/constant';
export const FormItemXtype = 'dec.dcm.Maintain_form_item';
@shortcut(FormItemXtype)
@shortcut()
export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.Maintain_form_item';
props = {
name: '',
forms: '',
@ -14,10 +15,10 @@ export class FormItem extends BI.Widget {
render () {
return {
type: Left,
type: BI.FloatLeftLayout.xtype,
items: [
{
type: Label,
type: BI.Label.xtype,
cls: this.options.isBold ? 'bi-font-bold' : '',
width: this.options.nameWidth,
textAlign: 'left',

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

@ -1,18 +1,19 @@
import { shortcut } from '@core/core';
import { Vertical, TextEditor, TextValueCombo, Label, TextAreaEditor, Editor, EdirotIconCheckCombo, Left, TextButton, Layout } from 'ui';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { FormItemXtype } from '../../components/form_item/form_item';
import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { FormItem } from '../../components/form_item/form_item';
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings';
import { connectionType } from '@constants/env';
import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant';
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 { Editor, EditorIconCheckCombo, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core';
const api = new ApiFactory().create();
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc';
@shortcut(FormJdbcXtype)
@shortcut()
export class FormJdbc extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jdbc';
props = {
formData: {} as Connection,
}
@ -20,13 +21,12 @@ export class FormJdbc extends BI.Widget {
oldPassword = '';
allDatabaseTypes = getAllDatabaseTypes();
testStatus: any;
advancedSet: any;
formUser: any;
formPassword: any;
formPrincipal: any;
formKeyPath: any;
labelTips: any;
advancedSet: VerticalLayout;
formUser: FormItem;
formPassword: FormItem;
formPrincipal: FormItem;
formKeyPath: FormItem;
labelTips: Label;
form = {
connectionName: null,
@ -72,35 +72,35 @@ export class FormJdbc extends BI.Widget {
};
return {
type: Vertical,
type: BI.VerticalLayout.xtype,
hgap,
vgap,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'connection-name',
width: 300,
value: connectionName,
allowBlank: true,
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.connectionName = _ref;
},
watermark: BI.i18nText('Dec-Dcm_Data_Connections'),
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
forms: [{
type: EdirotIconCheckCombo,
type: BI.EditorIconCheckCombo.xtype,
$testId: 'dec-editor-icon-check-combo',
$value: 'driver',
width: 300,
value: driver,
ref: (_ref: any) => {
ref: (_ref: EditorIconCheckCombo) => {
this.form.driver = _ref;
},
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'),
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'database-name',
width: 300,
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'),
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'database-host',
width: 300,
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'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'database-port',
width: 300,
allowBlank: true,
@ -177,7 +177,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.port = _ref;
},
listeners: [{
@ -189,15 +189,15 @@ export class FormJdbc extends BI.Widget {
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'),
invisible: !databaseType.kerberos,
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'auth-type',
width: 300,
value: authType,
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.authType = _ref;
},
items: [
@ -226,33 +226,33 @@ export class FormJdbc extends BI.Widget {
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
invisible: !!authType,
ref: (_ref: any) => {
ref: (_ref: FormItem) => {
this.formUser = _ref;
},
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'username',
width: 300,
allowBlank: true,
value: user,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.user = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
invisible: !!authType,
ref: (_ref: any) => {
ref: (_ref: FormItem) => {
this.formPassword = _ref;
},
forms: [{
type: Editor,
type: BI.Editor.xtype,
$value: 'password',
cls: 'bi-border bi-border-radius',
width: 300,
@ -262,39 +262,39 @@ export class FormJdbc extends BI.Widget {
inputType: 'password',
autocomplete: 'new-password',
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
ref: (_ref: any) => {
ref: (_ref: Editor) => {
this.form.password = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'),
invisible: !authType,
ref: (_ref: any) => {
ref: (_ref: FormItem) => {
this.formPrincipal = _ref;
},
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'principal',
width: 300,
allowBlank: true,
value: principal,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'),
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.principal = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'),
invisible: !authType,
ref: (_ref: any) => {
ref: (_ref: FormItem) => {
this.formKeyPath = _ref;
},
forms: [{
type: Editor,
type: BI.Editor.xtype,
$value: 'key-path',
cls: 'bi-border',
width: 300,
@ -302,87 +302,87 @@ export class FormJdbc extends BI.Widget {
allowBlank: true,
value: keyPath,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'),
ref: (_ref: any) => {
ref: (_ref: Editor) => {
this.form.keyPath = _ref;
},
}],
},
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-tips',
textAlign: 'left',
invisible: true,
text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'),
ref: (_ref: any) => {
ref: (_ref: Label) => {
this.labelTips = _ref;
},
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'original-charset-name',
width: 300,
value: originalCharsetName ? originalCharsetName : '',
items: CONNECT_CHARSET,
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.originalCharsetName = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
invisible: !databaseType.hasSchema,
height: 64,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
forms: [{
type: Vertical,
type: BI.VerticalLayout.xtype,
items: [{
type: Left,
type: BI.FloatLeftLayout.xtype,
items: [{
type: TextButton,
type: BI.TextButton.xtype,
cls: 'bi-high-light',
text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'),
handler: () => {
this.fireEvent('EVENT_TEST_CONNECTION');
},
}, {
type: Label,
type: BI.Label.xtype,
cls: 'bi-tips',
lgap: 3,
text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'),
}],
}, {
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'schema',
width: 300,
vgap: 15,
disabled: true,
value: schema,
items: schema ? [{ text: schema, value:schema }] : [],
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.schema = _ref;
},
}],
}],
},
{
type: Layout,
type: BI.Layout.xtype,
cls: 'bi-border-top',
bgap: 8,
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'database-url',
width: 300,
allowBlank: true,
value: url,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.url = _ref;
},
listeners: [{
@ -397,7 +397,7 @@ export class FormJdbc extends BI.Widget {
}],
},
{
type: CollapseXtype,
type: Collapse.xtype,
bgap: -15,
width: 70,
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,
tgap: -15,
invisible: true,
ref: (_ref: any) => {
ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref;
},
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
tgap: 15,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'initial-size',
width: 300,
allowBlank: false,
@ -435,16 +435,16 @@ export class FormJdbc extends BI.Widget {
autoFix: true,
}, valueRangeConfig],
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.initialSize = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'max-active',
width: 300,
allowBlank: false,
@ -455,16 +455,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.maxActive = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'max-idle',
width: 300,
allowBlank: false,
@ -475,16 +475,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.maxIdle = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'min-idle',
width: 300,
allowBlank: false,
@ -495,17 +495,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.minIdle = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
forms: [
{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'max-wait',
width: 300,
allowBlank: false,
@ -516,12 +516,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.maxWait = _ref;
},
},
{
type: Label,
type: BI.Label.xtype,
lgap: 5,
height: CONNECTION_LAYOUT.labelHeight,
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'),
forms: [{
type: TextAreaEditor,
type: BI.TextAreaEditor.xtype,
$value: 'validation-query',
cls: 'bi-border',
allowBlank: true,
@ -540,65 +540,65 @@ export class FormJdbc extends BI.Widget {
value: validationQuery,
width: 300,
height: 100,
ref: (_ref: any) => {
ref: (_ref: TextAreaEditor) => {
this.form.validationQuery = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'check',
width: 300,
allowBlank: true,
value: testOnBorrow,
items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.testOnBorrow = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'test-on-return',
width: 300,
allowBlank: true,
value: testOnReturn,
items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.testOnReturn = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'test-while-idle',
width: 300,
allowBlank: true,
value: testWhileIdle,
items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.testWhileIdle = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
forms: [
{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'test-between-evicition-millis',
width: 300,
allowBlank: false,
@ -609,12 +609,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkNumber(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.timeBetweenEvictionRunsMillis = _ref;
},
},
{
type: Label,
type: BI.Label.xtype,
lgap: 5,
height: CONNECTION_LAYOUT.labelHeight,
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'),
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'test-pereviction-run-num',
width: 300,
allowBlank: false,
@ -636,17 +636,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.numTestsPerEvictionRun = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
forms: [
{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'min-evictable-idle-time-millis',
width: 300,
allowBlank: false,
@ -657,12 +657,12 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value),
autoFix: true,
}, valueRangeConfig],
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.minEvictableIdleTimeMillis = _ref;
},
},
{
type: Label,
type: BI.Label.xtype,
lgap: 5,
height: CONNECTION_LAYOUT.labelHeight,
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 { Vertical, TextEditor, Htape, Left, Label, TextValueCombo, EdirotIconCheckCombo } from 'ui';
import { FormItemXtype } from '../../components/form_item/form_item';
import { FormItem } from '../../components/form_item/form_item';
import { ConnectionJNDI, Connection, ContextHashtable } from 'src/modules/crud/crud.typings';
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 { TextCheckerXtype } from '../../../../components/text_checker/text_checker';
export const FormJndiXtype = 'dec.dcm.maintain.form.jndi';
@shortcut(FormJndiXtype)
import { TextChecker } from '../../../../components/text_checker/text_checker';
import { EditorIconCheckCombo, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core';
@shortcut()
export class FormJndi extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jndi';
props = {
formData: {} as Connection,
}
advancedSet: any;
testStatus: any;
advancedSet: VerticalLayout;
form = {
connectionName: null,
jndiName: null,
@ -41,49 +42,49 @@ export class FormJndi extends BI.Widget {
const { hgap, vgap } = CONNECTION_LAYOUT;
return {
type: Vertical,
type: BI.VerticalLayout.xtype,
hgap,
vgap,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'),
nameWidth: 200,
forms: [{
type: TextCheckerXtype,
type: TextChecker.xtype,
$value: 'connection-name',
width: 300,
value: connectionName,
ref: (_ref: any) => {
ref: (_ref: TextChecker) => {
this.form.connectionName = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'jdni-name',
width: 300,
allowBlank: true,
value: jndiName,
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.jndiName = _ref;
},
}],
},
{
type: Htape,
type: BI.HTapeLayout.xtype,
height: 175,
items: [
{
el: {
type: Left,
type: BI.FloatLeftLayout.xtype,
items: [
{
type: Label,
type: BI.Label.xtype,
cls: 'bi-font-bold',
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_Connection'),
@ -93,22 +94,22 @@ export class FormJndi extends BI.Widget {
width: 200,
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
bgap: 15,
height: 175,
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200,
isBold: false,
forms: [{
type: EdirotIconCheckCombo,
type: BI.EditorIconCheckCombo.xtype,
$testId: 'dec-editor-icon-check-combo',
$value: 'initial',
width: 300,
value: contextHashtable['java.naming.factory.initial'],
ref: (_ref: any) => {
ref: (_ref: EditorIconCheckCombo) => {
this.form.initial = _ref;
},
items: JNDI_FACTORYS.map(item => {
@ -128,55 +129,55 @@ export class FormJndi extends BI.Widget {
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'PROVIDER_URL',
isBold: false,
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'provider-url',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.provider.url'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.providerUrl = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL',
isBold: false,
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'security-principal',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.security.principal'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.securityPrincipal = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS',
isBold: false,
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'security-credentials',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.security.credentials'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.securityCredentials = _ref;
},
}],
},
{
type: Label,
type: BI.Label.xtype,
bgap: -15,
cls: 'bi-tips',
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'),
nameWidth: 200,
forms: [{
type: TextValueCombo,
type: BI.TextValueCombo.xtype,
$value: 'new-charset-name',
width: 300,
value: newCharsetName ? newCharsetName : '',
items: CONNECT_CHARSET,
ref: (_ref: any) => {
ref: (_ref: TextValueCombo) => {
this.form.newCharsetName = _ref;
},
}],
},
{
type: CollapseXtype,
type: Collapse.xtype,
width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [
@ -215,175 +216,175 @@ export class FormJndi extends BI.Widget {
],
},
{
type: Vertical,
type: BI.VerticalLayout.xtype,
vgap,
tgap: -15,
invisible: true,
ref: (_ref: any) => {
ref: (_ref: VerticalLayout) => {
this.advancedSet = _ref;
},
items: [
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'OBJECT_FACTORIES',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'factory-object',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.factory.object'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.factoryObject = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'STATE_FACTORIES',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'factory-state',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.factory.state'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.factoryState = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'URL_PKG_PREFIXES',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'factory-url-pkgs',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.factory.url.pkgs'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.factoryUrlPkgs = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'DNS_URL',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'dns-url',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.dns.url'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.dnsUrl = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'AUTHORITATIVE',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'authoritative',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.authoritative'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.authoritative = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'BATCHSIZE',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'batchsize',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.batchsize'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.batchsize = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'REFERRAL',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'referral',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.referral'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.referral = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_PROTOCOL',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'security-protocol',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.security.protocol'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.securityProtocol = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'SECURITY_AUTHENTICATION',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'security-authentication',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.security.authentication'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.authentication = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'LANGUAGE',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'language',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.language'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.language = _ref;
},
}],
},
{
type: FormItemXtype,
type: FormItem.xtype,
name: 'APPLET',
nameWidth: 200,
forms: [{
type: TextEditor,
type: BI.TextEditor.xtype,
$value: 'applet',
width: 300,
allowBlank: true,
value: contextHashtable['java.naming.applet'],
ref: (_ref: any) => {
ref: (_ref: TextEditor) => {
this.form.applet = _ref;
},
}],

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

@ -1,9 +1,9 @@
import { shortcut } from '@core/core';
import { Connection } from 'src/modules/crud/crud.typings';
import { getPluginWidgetEdit } from '../../../../app.service';
export const FormPluginXtype = 'dec.dcm.maintain_plugin';
@shortcut(FormPluginXtype)
@shortcut()
export class FormPlugin extends BI.Widget {
static xtype = 'dec.dcm.maintain_plugin';
props = {
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 { testConnection } from './form.server';
const api = new ApiFactory().create();
export const MaintainFormModelXtype = 'dec.dcm.model.maintain_form';
@model(MaintainFormModelXtype)
@model()
export class MaintainFormModel extends Model<{
context : {
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne'];
saveEvent: AppModel['$$childContext']['saveEvent'];
testEvent: AppModel['$$childContext']['testEvent'];
pageIndex: AppModel['$$childContext']['pageIndex'];
connections: AppModel['$$childContext']['connections'];
isCopy: AppModel['$$childContext']['isCopy'];
}
types : {
datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
saveEvent: AppModel['TYPE']['saveEvent'];
testEvent: AppModel['TYPE']['testEvent'];
pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['TYPE']['connections'];
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 = {
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 { 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 { 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 { ApiFactory } from '../../../crud/apiFactory';
const api = new ApiFactory().create();
@ -58,7 +58,7 @@ export function testConnection(value: Connection): Promise<string[]> {
};
BI.Maskers.create(id, null, {
render: {
type: TestStatusXtype,
type: TestStatus.xtype,
loadingText: BI.i18nText('Dec-Dcm_Connection_Testing'),
loadingCls: 'upload-loading-icon',
successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'),
@ -71,14 +71,14 @@ export function testConnection(value: Connection): Promise<string[]> {
},
listeners: [
{
eventName: EVENT_RELOAD,
eventName: TestStatus.EVENT_RELOAD,
action: () => {
testStatus.setLoading();
testConnection();
},
},
{
eventName: EVENT_CLOSE,
eventName: TestStatus.EVENT_CLOSE,
action: () => {
BI.Maskers.remove(id);
},

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

@ -1,17 +1,19 @@
import { shortcut, store } from '@core/core';
import { MaintainFormModelXtype, MaintainFormModel } from './form.model';
import { FormJdbc, FormJdbcXtype } from './components/form.jdbc';
import { FormJndiXtype } from './components/form.jndi';
import { FormPluginXtype } from './components/form.plugin';
import { MaintainFormModel } from './form.model';
import { FormJdbc } from './components/form.jdbc';
import { FormJndi } from './components/form.jndi';
import { FormPlugin } from './components/form.plugin';
import { connectionType, errorCode } from '@constants/env';
import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings';
import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant';
import { getJdbcDatabaseType, getChartLength } from '../../../app.service';
import { NAME_MAX_LENGTH } from '../../../app.constant';
export const MaintainFormXtype = 'dec.dcm.maintain.form';
@shortcut(MaintainFormXtype)
@store(MaintainFormModelXtype)
@shortcut()
@store(MaintainFormModel)
export class MaintainForm extends BI.Widget {
static xtype = 'dec.dcm.maintain.form';
props = {
connectionType: '',
}
@ -86,13 +88,13 @@ export class MaintainForm extends BI.Widget {
private getFormType() {
switch (this.options.connectionType) {
case connectionType.JDBC:
return FormJdbcXtype;
return FormJdbc.xtype;
case connectionType.JNDI:
return FormJndiXtype;
return FormJndi.xtype;
case DATEBASE_FILTER_TYPE.OTHER:
return FormJdbcXtype;
return FormJdbc.xtype;
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 { AppModel } from '../../app.model';
export const MaintainModelXtype = 'dec.dcm.model.maintain';
@model(MaintainModelXtype)
@model()
export class MaintainModel extends Model<{
context : {
pageIndex: AppModel['$$childContext']['pageIndex'];
connections: AppModel['$$childContext']['connections'];
datebaseTypeSelected: AppModel['$$childContext']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['$$childContext']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['$$childContext']['connectionSelectedOne'];
isCopy: AppModel['$$childContext']['isCopy'];
}
types : {
pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['TYPE']['connections'];
datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected'];
datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne'];
connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne'];
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 = {
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 { MaintainModel, MaintainModelXtype } from './maintain.model';
import { MaintainFormXtype } from './forms/form';
import { LinkXtype } from 'src/modules/components/link_button/link';
import { MaintainModel } from './maintain.model';
import { MaintainForm } from './forms/form';
import { LinkButton } from 'src/modules/components/link_button/link';
import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
@ -10,32 +9,35 @@ import './maintain.less';
import { connectionType } from '@constants/env';
import { getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { ListView } from '@fui/core';
export const MaintainXtype = 'dec.dcm.maintain';
@shortcut(MaintainXtype)
@store(MaintainModelXtype)
@shortcut()
@store(MaintainModel)
export class Maintain extends BI.Widget {
static xtype = 'dec.dcm.maintain';
model: MaintainModel['model'];
store: MaintainModel['store'];
listView: any;
listView: ListView;
socketTip: LinkButton;
render() {
const { isEdit, databaseType } = this.getEditConnection();
const titleText = getTextByDatabaseType(databaseType);
return {
type: Vtape,
type: BI.VTapeLayout.xtype,
hgap: 5,
items: [
{
type: VerticalAdapt,
type: BI.VerticalAdaptLayout.xtype,
cls: 'bi-border-bottom',
height: 40,
hgap: 5,
items: [
{
type: IconButton,
type: BI.IconButton.xtype,
$value: 'back-databases',
cls: 'dcm-back-font',
height: 15,
@ -45,25 +47,25 @@ export class Maintain extends BI.Widget {
},
},
{
type: Label,
type: BI.Label.xtype,
text: titleText,
height: 15,
},
{
type: LinkXtype,
type: LinkButton.xtype,
invisible: true,
lgap: 10,
text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'),
link: api.getHyperlink(DecCst.Hyperlink.WEBSOCKET_CONNECT),
ref: (_ref: any) => {
ref: (_ref: LinkButton) => {
this.socketTip = _ref;
},
},
],
},
{
type: ListView,
ref: (_ref: any) => {
type: BI.ListView.xtype,
ref: (_ref: ListView) => {
this.listView = _ref;
},
items: this.renderItems(),
@ -85,7 +87,7 @@ export class Maintain extends BI.Widget {
const { type } = this.getEditConnection();
return [{
type: MaintainFormXtype,
type: MaintainForm.xtype,
connectionType: type,
}];
}

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

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

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

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

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

@ -1,17 +1,17 @@
import { shortcut, store } from '@core/core';
import { Right, Button, VerticalAdapt } from 'ui';
import { TitleDatebaseModel, TitleDatebaseModelXtype } from './title_datebase.model';
import { TitleDatebaseModel } from './title_datebase.model';
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'];
model: TitleDatebaseModel['model'];
submitButton: any;
submitButton: Button;
watch = {
datebaseTypeSelected: (datebaseTypeSelected: string) => {
@ -21,14 +21,14 @@ export class TitleDatabaseWidget extends BI.Widget {
render() {
return {
type: Right,
type: BI.FloatRightLayout.xtype,
items: [{
type: VerticalAdapt,
type: BI.VerticalAdaptLayout.xtype,
height: 40,
rgap: 5,
items: [
{
type: Button,
type: BI.Button.xtype,
$value: 'title-database-cancel',
text: BI.i18nText('BI-Basic_Cancel'),
level: 'ignore',
@ -37,11 +37,11 @@ export class TitleDatabaseWidget extends BI.Widget {
},
},
{
type: Button,
type: BI.Button.xtype,
$value: 'title-database-save',
text: BI.i18nText('BI-Basic_Save'),
disabled: !this.model.datebaseTypeSelected,
ref: (_ref: any) => {
ref: (_ref: Button) => {
this.submitButton = _ref;
},
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 { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
export const TitleMaintainModelXtype = 'dec.dcm.model.title_maintain';
@model(TitleMaintainModelXtype)
@model()
export class TitleMaintainModel extends Model<{
context : {
pageIndex: AppModel['$$childContext']['pageIndex'];
saveEvent: AppModel['$$childContext']['saveEvent'];
connectionSelected: AppModel['$$childContext']['connectionSelected'];
testEvent: AppModel['$$childContext']['testEvent'];
isCopy: AppModel['$$childContext']['isCopy'];
}
types : {
pageIndex: AppModel['TYPE']['pageIndex'];
saveEvent: AppModel['TYPE']['saveEvent'];
connectionSelected: AppModel['TYPE']['connectionSelected'];
testEvent: AppModel['TYPE']['testEvent'];
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 = {
setPageIndex: (index: string) => {

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

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

2
types/globals.d.ts vendored

@ -2,7 +2,7 @@ interface Obj {
[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 DecCst: Obj;
declare const Dec: {

2
webpack/webpack.common.js

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

2275
yarn.lock

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