From 9365a41799258eadda10c8da428bf9b735075628 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 23 Dec 2020 10:31:10 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-6541=20=E4=BF=AE=E6=94=B9xtype=E5=86=99?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 4 +- src/modules/app.model.ts | 7 +- src/modules/app.ts | 28 +++-- .../components/collapse/collapse.model.ts | 5 +- src/modules/components/collapse/collapse.ts | 9 +- src/modules/components/link_button/link.ts | 5 +- .../test_status/test_status.model.ts | 5 +- .../components/test_status/test_status.ts | 35 +++--- .../test_status/tip_icon/tip_fail.model.ts | 6 +- .../test_status/tip_icon/tip_fail.ts | 23 ++-- .../test_status/tip_icon/tip_icon.ts | 5 +- .../components/text_checker/text_checker.ts | 6 +- src/modules/core/core.ts | 42 +------ .../components/form_item/form_item.ts | 5 +- .../pages/connection/connection.model.ts | 22 ++-- src/modules/pages/connection/connection.ts | 25 +++-- .../connection_jdbc/connection_jdbc.model.ts | 16 +-- .../connection_jdbc/connection_jdbc.ts | 60 +++++----- .../connection_jndi/connection_jndi.model.ts | 15 +-- .../connection_jndi/connection_jndi.ts | 51 ++++----- .../connection_plugin.model.ts | 17 +-- .../connection_plugin/connection_plugin.ts | 9 +- .../pages/connection/list/list.model.ts | 16 +-- src/modules/pages/connection/list/list.ts | 14 ++- .../list/list_item/list_item.model.ts | 26 +++-- .../connection/list/list_item/list_item.ts | 9 +- .../connection_pool/connection_pool.model.ts | 17 +-- .../pages/connection_pool/connection_pool.ts | 17 +-- .../list_item/list_item.model.ts | 13 ++- .../connection_pool/list_item/list_item.ts | 9 +- .../pages/connection_pool/pool/pool.model.ts | 14 ++- .../pages/connection_pool/pool/pool.ts | 9 +- src/modules/pages/database/database.model.ts | 16 +-- src/modules/pages/database/database.ts | 21 ++-- .../pages/database/database.typings.d.ts | 12 -- .../database_type/database_type.model.ts | 15 +-- .../database/database_type/database_type.ts | 9 +- .../pages/database/filter/filter.model.ts | 13 ++- src/modules/pages/database/filter/filter.ts | 8 +- src/modules/pages/index.ts | 10 -- .../components/form_item/form_item.ts | 6 +- .../maintain/forms/components/form.jdbc.ts | 104 +++++++++--------- .../maintain/forms/components/form.jndi.ts | 54 ++++----- .../maintain/forms/components/form.plugin.ts | 4 +- .../pages/maintain/forms/form.model.ts | 38 ++++--- .../pages/maintain/forms/form.server.ts | 8 +- src/modules/pages/maintain/forms/form.ts | 24 ++-- src/modules/pages/maintain/maintain.model.ts | 23 ++-- src/modules/pages/maintain/maintain.ts | 17 +-- src/modules/title/title.model.ts | 16 +-- src/modules/title/title.ts | 13 ++- .../title_database/title_datebase.model.ts | 16 +-- .../title/title_database/title_datebase.ts | 10 +- .../title_maintain/title_maintain.model.ts | 23 ++-- .../title/title_maintain/title_maintain.ts | 11 +- 55 files changed, 516 insertions(+), 499 deletions(-) delete mode 100644 src/modules/pages/database/database.typings.d.ts delete mode 100644 src/modules/pages/index.ts diff --git a/src/index.ts b/src/index.ts index 7d44dd0..efa6739 100644 --- a/src/index.ts +++ b/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', }); diff --git a/src/modules/app.model.ts b/src/modules/app.model.ts index a6f5968..8dd78a8 100644 --- a/src/modules/app.model.ts +++ b/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 = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'filter', 'connections', 'connectionSelected', 'connectionSelectedOne', 'saveEvent', 'testEvent', 'isCopy']; state() { return { diff --git a/src/modules/app.ts b/src/modules/app.ts index 759440c..73561fc 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -1,16 +1,20 @@ import { shortcut, store } from '@core/core'; -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'; -import { Tab } from '@fui/core'; -export const AppXtype = 'dec.dcm.main'; -@store(AppModelXtype) -@shortcut(AppXtype) +@shortcut() +@store(AppModel) export class App extends BI.Widget { + static xtype = 'dec.dcm.main'; + tab: Tab; store: AppModel['store']; @@ -28,7 +32,7 @@ export class App extends BI.Widget { items: [ { el: { - type: TitleXtype, + type: Title.xtype, cls: 'bi-border-bottom', }, height: 40, @@ -50,19 +54,19 @@ export class App extends BI.Widget { 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, }; } }, diff --git a/src/modules/components/collapse/collapse.model.ts b/src/modules/components/collapse/collapse.model.ts index 9ae58a6..1b8f3b1 100644 --- a/src/modules/components/collapse/collapse.model.ts +++ b/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, diff --git a/src/modules/components/collapse/collapse.ts b/src/modules/components/collapse/collapse.ts index 45492f3..58e8db1 100644 --- a/src/modules/components/collapse/collapse.ts +++ b/src/modules/components/collapse/collapse.ts @@ -1,12 +1,13 @@ 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, diff --git a/src/modules/components/link_button/link.ts b/src/modules/components/link_button/link.ts index b5171af..dfd0f42 100644 --- a/src/modules/components/link_button/link.ts +++ b/src/modules/components/link_button/link.ts @@ -1,10 +1,11 @@ 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 { + static xtype = 'dec.dcm.components.link.button'; + props: { text: string; cls: string; diff --git a/src/modules/components/test_status/test_status.model.ts b/src/modules/components/test_status/test_status.model.ts index 8a728f4..a4cc9c7 100644 --- a/src/modules/components/test_status/test_status.model.ts +++ b/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, diff --git a/src/modules/components/test_status/test_status.ts b/src/modules/components/test_status/test_status.ts index 4d0d94a..0cfba82 100644 --- a/src/modules/components/test_status/test_status.ts +++ b/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 { 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'; +import { TipIcon } from './tip_icon/tip_icon'; +import { TipFail } from './tip_icon/tip_fail'; import { FloatLeftLayout, Label, Tab, VerticalLayout } from '@fui/core'; -export const TestStatusXtype = 'dec.dcm.components.test_status'; -export { - EVENT_CLOSE, - EVENT_RELOAD, -}; -@shortcut(TestStatusXtype) -@store(TestStatusModelXtype) +@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: '', @@ -61,32 +60,32 @@ export class TestStatus extends BI.Widget { 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, }; diff --git a/src/modules/components/test_status/tip_icon/tip_fail.model.ts b/src/modules/components/test_status/tip_icon/tip_fail.model.ts index ed0b17d..8c16cb0 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.model.ts +++ b/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() { diff --git a/src/modules/components/test_status/tip_icon/tip_fail.ts b/src/modules/components/test_status/tip_icon/tip_fail.ts index 26f5dcd..05ef93f 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.ts +++ b/src/modules/components/test_status/tip_icon/tip_fail.ts @@ -1,13 +1,16 @@ import { shortcut, store } from '@core/core'; import { Button } from '@fui/core'; -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 { 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: '', @@ -64,7 +67,7 @@ export class TipFail extends BI.Widget { }, handler: () => { this.store.setIsCollapse(!this.model.isCollapse); - this.fireEvent(EVENT_DETAIL, !this.model.isCollapse); + this.fireEvent(TipFail.EVENT_DETAIL, !this.model.isCollapse); }, }, { @@ -72,14 +75,14 @@ export class TipFail extends BI.Widget { text: BI.i18nText('Dec-Dcm_Back'), level: 'ignore', handler: () => { - this.fireEvent(EVENT_CLOSE); + this.fireEvent(TipFail.EVENT_CLOSE); }, }, { type: BI.Button.xtype, text: retryText, handler: () => { - this.fireEvent(EVENT_RELOAD); + this.fireEvent(TipFail.EVENT_RELOAD); }, }, ], diff --git a/src/modules/components/test_status/tip_icon/tip_icon.ts b/src/modules/components/test_status/tip_icon/tip_icon.ts index ea23ed3..707a6c7 100644 --- a/src/modules/components/test_status/tip_icon/tip_icon.ts +++ b/src/modules/components/test_status/tip_icon/tip_icon.ts @@ -1,7 +1,8 @@ import { shortcut } from '@core/core'; -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: '', diff --git a/src/modules/components/text_checker/text_checker.ts b/src/modules/components/text_checker/text_checker.ts index 12a2de3..c7984c0 100644 --- a/src/modules/components/text_checker/text_checker.ts +++ b/src/modules/components/text_checker/text_checker.ts @@ -1,8 +1,10 @@ import { shortcut } from '@core/core'; import { Label, TextEditor } from '@fui/core'; -export const TextCheckerXtype = 'dec.dcm.components.text_checker'; -@shortcut(TextCheckerXtype) + +@shortcut() export class TextChecker extends BI.Widget { + static xtype = 'dec.dcm.components.text_checker'; + props = { width: 300, allowBlank: true, diff --git a/src/modules/core/core.ts b/src/modules/core/core.ts index a4c222a..700e40d 100644 --- a/src/modules/core/core.ts +++ b/src/modules/core/core.ts @@ -1,43 +1,3 @@ type Constructor = new(...args: any[]) => T; -export function shortcut(className: string) { - return function decorator(Base: Constructor): void { - BI.shortcut(className, Base); - }; -} - -export function store(modelName: string) { - return function decorator(Base: Constructor): void { - Base.prototype._store = () => BI.Models.getModel(modelName); - }; -} - -export function model(className: string) { - return function decorator(Base: Constructor): void { - BI.model(className, Base); - }; -} - -export class Model extends Fix.Model { - model: {[key in keyof U['context']]: U['context'][key]} & {[key in keyof ReturnType]: ReturnType[key]} & {[key in keyof this['computed']]: ReturnType} & {[key: string]: undefined}; - - store: this['actions']; - - state(): {[key: string]: any} { - return {}; - } - - // context: Partial; - - context: string[]; - - actions:{[key: string]: (...args: any[]) => any}; - - // childContext: (keyof this['$$childContext'])[]; - - childContext: string[]; - - $$childContext: {[key in keyof this['computed']]: ReturnType} & {[key in keyof ReturnType]: ReturnType[key]}; - - computed: {[key: string]: () => any}; -} +export const { shortcut, model, store, Model, provider } = BI.Decorators; diff --git a/src/modules/pages/connection/components/form_item/form_item.ts b/src/modules/pages/connection/components/form_item/form_item.ts index 6effde3..e08f76f 100644 --- a/src/modules/pages/connection/components/form_item/form_item.ts +++ b/src/modules/pages/connection/components/form_item/form_item.ts @@ -1,7 +1,8 @@ import { shortcut } from '@core/core'; -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: '', diff --git a/src/modules/pages/connection/connection.model.ts b/src/modules/pages/connection/connection.model.ts index 1c50111..6fe86dc 100644 --- a/src/modules/pages/connection/connection.model.ts +++ b/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 = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected']; actions = { setPageIndex:(index: string) => { diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index eda7acd..43387d5 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -1,19 +1,20 @@ 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']; @@ -72,7 +73,7 @@ export class Connection extends BI.Widget { height: 40, }, { - type: ConnectionListXtype, + type: ConnectionList.xtype, tgap: 10, }, ], @@ -143,15 +144,15 @@ 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, }]; } } diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts index cb894c0..1661704 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts +++ b/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 = ['connectionSelectedOne']; } diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index c3da8c9..7d7f811 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -1,17 +1,17 @@ import { shortcut, store } from '@core/core'; -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'; import { VerticalLayout } from '@fui/core'; -export const ConnectionJdbcXtype = 'dec.dcm.connection_jdbc'; -@shortcut(ConnectionJdbcXtype) -@store(ConnectionJdbcModelXtype) +@shortcut() +@store(ConnectionJdecModel) export class ConnectionJdbc extends BI.Widget { - advancedSet: any; + static xtype = 'dec.dcm.connection_jdbc'; + advancedSet: any; model: ConnectionJdecModel['model']; allDatabaseTypes = getAllDatabaseTypes(); @@ -28,61 +28,61 @@ export class ConnectionJdbc extends BI.Widget { 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: 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: [ @@ -104,64 +104,64 @@ export class ConnectionJdbc extends BI.Widget { }, 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'), diff --git a/src/modules/pages/connection/connection_jndi/connection_jndi.model.ts b/src/modules/pages/connection/connection_jndi/connection_jndi.model.ts index c4346e8..84440fd 100644 --- a/src/modules/pages/connection/connection_jndi/connection_jndi.model.ts +++ b/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 = ['connectionSelectedOne']; } diff --git a/src/modules/pages/connection/connection_jndi/connection_jndi.ts b/src/modules/pages/connection/connection_jndi/connection_jndi.ts index 327ea77..1db4a3b 100644 --- a/src/modules/pages/connection/connection_jndi/connection_jndi.ts +++ b/src/modules/pages/connection/connection_jndi/connection_jndi.ts @@ -1,15 +1,16 @@ import { shortcut, store } from '@core/core'; -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'; -export const ConnectionJndiXtype = 'dec.dcm.connection_jndi'; -@shortcut(ConnectionJndiXtype) -@store(ConnectionJndiModelXtype) -export class ConnectionJdbc extends BI.Widget { +@shortcut() +@store(ConnectionJndiModel) +export class ConnectionJndi extends BI.Widget { + static xtype = 'dec.dcm.connection_jndi'; + model: ConnectionJndiModel['model']; advancedSet: VerticalLayout; @@ -26,7 +27,7 @@ export class ConnectionJdbc extends BI.Widget { vgap, items: [ { - type: FormItemXtype, + type: FormItem.xtype, nameWidth: 200, name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), value: jndiName, @@ -55,28 +56,28 @@ export class ConnectionJdbc extends BI.Widget { 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: [ @@ -116,67 +117,67 @@ export class ConnectionJdbc extends BI.Widget { }, 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'], diff --git a/src/modules/pages/connection/connection_plugin/connection_plugin.model.ts b/src/modules/pages/connection/connection_plugin/connection_plugin.model.ts index b6fbc60..fb609ad 100644 --- a/src/modules/pages/connection/connection_plugin/connection_plugin.model.ts +++ b/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 = ['connectionSelectedOne']; } diff --git a/src/modules/pages/connection/connection_plugin/connection_plugin.ts b/src/modules/pages/connection/connection_plugin/connection_plugin.ts index 14e6990..ee66226 100644 --- a/src/modules/pages/connection/connection_plugin/connection_plugin.ts +++ b/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 () { diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 4e76792..036f320 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/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 = ['connections', 'connectionSelected']; computed = { shwoType: () => BI.size(this.model.connections) > 0 ? 'list' : 'none', diff --git a/src/modules/pages/connection/list/list.ts b/src/modules/pages/connection/list/list.ts index 2ddfa94..0e4be9b 100644 --- a/src/modules/pages/connection/list/list.ts +++ b/src/modules/pages/connection/list/list.ts @@ -1,12 +1,14 @@ import { shortcut, store } from '@core/core'; -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'; import { Tab } from '@fui/core'; -export const ConnectionListXtype = 'dec.dcm.connection.list'; -@shortcut(ConnectionListXtype) -@store(ConnectionListModelXtype) + +@shortcut() +@store(ConnectionListModel) export class ConnectionList extends BI.LoadingPane { + static xtype = 'dec.dcm.connection.list'; + store: ConnectionListModel['store']; model: ConnectionListModel['model']; @@ -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, diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index efc02ca..a02695d 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/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 = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected', 'isCopy']; state() { return { diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 41b06f0..4f098bc 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -1,16 +1,17 @@ import { shortcut, store } from '@core/core'; 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: '', diff --git a/src/modules/pages/connection_pool/connection_pool.model.ts b/src/modules/pages/connection_pool/connection_pool.model.ts index befc9d5..6a18729 100644 --- a/src/modules/pages/connection_pool/connection_pool.model.ts +++ b/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 = ['selected']; + context = ['connections']; state() { return { diff --git a/src/modules/pages/connection_pool/connection_pool.ts b/src/modules/pages/connection_pool/connection_pool.ts index 0bb76f5..e3547f7 100644 --- a/src/modules/pages/connection_pool/connection_pool.ts +++ b/src/modules/pages/connection_pool/connection_pool.ts @@ -1,13 +1,14 @@ import { shortcut, store } from '@core/core'; -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'; import { Label } from '@fui/core'; -export const ConnectionPoolXtype = 'dec.dcm.connection_pool'; -@shortcut(ConnectionPoolXtype) -@store(ConnectionPoolModelXtype) +@shortcut() +@store(ConnectionPoolModel) export class ConnectionPool extends BI.Widget { + static xtype = 'dec.dcm.connection_pool'; + title: Label; model: ConnectionPoolModel['model']; @@ -80,7 +81,7 @@ export class ConnectionPool extends BI.Widget { height: 40, }, { - type: PoolXtype, + type: Pool.xtype, }, ], }; @@ -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, diff --git a/src/modules/pages/connection_pool/list_item/list_item.model.ts b/src/modules/pages/connection_pool/list_item/list_item.model.ts index 2cfe828..ae0d68e 100644 --- a/src/modules/pages/connection_pool/list_item/list_item.model.ts +++ b/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 = ['selected']; actions = { setSelected: (selected: string) => { this.model.selected = selected; diff --git a/src/modules/pages/connection_pool/list_item/list_item.ts b/src/modules/pages/connection_pool/list_item/list_item.ts index fa9c9e0..1ae8966 100644 --- a/src/modules/pages/connection_pool/list_item/list_item.ts +++ b/src/modules/pages/connection_pool/list_item/list_item.ts @@ -1,9 +1,10 @@ import { shortcut, store } from '@core/core'; -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, diff --git a/src/modules/pages/connection_pool/pool/pool.model.ts b/src/modules/pages/connection_pool/pool/pool.model.ts index 36a7f38..2a3fc33 100644 --- a/src/modules/pages/connection_pool/pool/pool.model.ts +++ b/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 = ['selected']; state () { return { diff --git a/src/modules/pages/connection_pool/pool/pool.ts b/src/modules/pages/connection_pool/pool/pool.ts index 018acef..9185d24 100644 --- a/src/modules/pages/connection_pool/pool/pool.ts +++ b/src/modules/pages/connection_pool/pool/pool.ts @@ -1,13 +1,14 @@ import { shortcut, store } from '@core/core'; -import { PoolModel, PoolModelXtype } from './pool.model'; +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', diff --git a/src/modules/pages/database/database.model.ts b/src/modules/pages/database/database.model.ts index 88b5e21..44109ea 100644 --- a/src/modules/pages/database/database.model.ts +++ b/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 = ['filter', 'datebaseTypeSelected']; state() { return { search: '', diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index 2793e5d..93b32ae 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -1,15 +1,16 @@ 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'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core'; -export const DatebaseXtype = 'dec.dcm.datebase'; -@shortcut(DatebaseXtype) -@store(DatebaseModelXtype) +@shortcut() +@store(DatebaseModel) export class Datebase extends BI.Widget { + static xtype = 'dec.dcm.datebase'; + filter: ButtonGroup; search: SearchEditor; datebaseType: ButtonGroup; @@ -117,18 +118,18 @@ export class Datebase extends BI.Widget { }, 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, }, @@ -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, diff --git a/src/modules/pages/database/database.typings.d.ts b/src/modules/pages/database/database.typings.d.ts deleted file mode 100644 index 2e1513f..0000000 --- a/src/modules/pages/database/database.typings.d.ts +++ /dev/null @@ -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; -} diff --git a/src/modules/pages/database/database_type/database_type.model.ts b/src/modules/pages/database/database_type/database_type.model.ts index 1417d95..cb51507 100644 --- a/src/modules/pages/database/database_type/database_type.model.ts +++ b/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 = ['datebaseTypeSelected', 'pageIndex']; actions = { setDatebaseTypeSelected: (datebaseTypeSelected: string) => { diff --git a/src/modules/pages/database/database_type/database_type.ts b/src/modules/pages/database/database_type/database_type.ts index 7a99798..6778564 100644 --- a/src/modules/pages/database/database_type/database_type.ts +++ b/src/modules/pages/database/database_type/database_type.ts @@ -1,14 +1,15 @@ import { shortcut, store } from '@core/core'; -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: '', diff --git a/src/modules/pages/database/filter/filter.model.ts b/src/modules/pages/database/filter/filter.model.ts index 4ae5eb7..aa98df6 100644 --- a/src/modules/pages/database/filter/filter.model.ts +++ b/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 = ['filter']; actions = { setFilter:(filter: string) => { diff --git a/src/modules/pages/database/filter/filter.ts b/src/modules/pages/database/filter/filter.ts index e5f798b..1f30b58 100644 --- a/src/modules/pages/database/filter/filter.ts +++ b/src/modules/pages/database/filter/filter.ts @@ -1,10 +1,10 @@ import { shortcut, store } from '@core/core'; -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: '', diff --git a/src/modules/pages/index.ts b/src/modules/pages/index.ts deleted file mode 100644 index 5186c84..0000000 --- a/src/modules/pages/index.ts +++ /dev/null @@ -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, -}; diff --git a/src/modules/pages/maintain/components/form_item/form_item.ts b/src/modules/pages/maintain/components/form_item/form_item.ts index d8cedf7..00b6f1a 100644 --- a/src/modules/pages/maintain/components/form_item/form_item.ts +++ b/src/modules/pages/maintain/components/form_item/form_item.ts @@ -1,8 +1,10 @@ import { shortcut } from '@core/core'; 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: '', diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index b9c1f16..700564c 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1,19 +1,19 @@ import { shortcut } from '@core/core'; -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'; -import { FormItem } from '../../../connection/components/form_item/form_item'; 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, } @@ -77,22 +77,22 @@ export class FormJdbc extends BI.Widget { 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: BI.EditorIconCheckCombo.xtype, @@ -121,7 +121,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), forms: [{ type: BI.TextEditor.xtype, @@ -142,7 +142,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), forms: [{ type: BI.TextEditor.xtype, @@ -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,7 +189,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), invisible: !databaseType.kerberos, forms: [{ @@ -226,7 +226,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), invisible: !!authType, ref: (_ref: FormItem) => { @@ -245,7 +245,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Password'), invisible: !!authType, ref: (_ref: FormItem) => { @@ -268,7 +268,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), invisible: !authType, ref: (_ref: FormItem) => { @@ -287,7 +287,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), invisible: !authType, ref: (_ref: FormItem) => { @@ -318,7 +318,7 @@ export class FormJdbc extends BI.Widget { }, }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), forms: [{ type: BI.TextValueCombo.xtype, @@ -332,7 +332,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, invisible: !databaseType.hasSchema, height: 64, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), @@ -373,7 +373,7 @@ export class FormJdbc extends BI.Widget { bgap: 8, }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), forms: [{ type: BI.TextEditor.xtype, @@ -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'), @@ -420,11 +420,11 @@ export class FormJdbc extends BI.Widget { }, 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,7 +516,7 @@ 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; }, }, @@ -529,7 +529,7 @@ export class FormJdbc extends BI.Widget { ], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), forms: [{ type: BI.TextAreaEditor.xtype, @@ -546,7 +546,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), forms: [{ type: BI.TextValueCombo.xtype, @@ -562,7 +562,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), forms: [{ type: BI.TextValueCombo.xtype, @@ -578,7 +578,7 @@ export class FormJdbc extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), forms: [{ type: BI.TextValueCombo.xtype, @@ -594,11 +594,11 @@ export class FormJdbc extends BI.Widget { }], }, { - 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,7 +609,7 @@ 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; }, }, @@ -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,7 +657,7 @@ 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; }, }, diff --git a/src/modules/pages/maintain/forms/components/form.jndi.ts b/src/modules/pages/maintain/forms/components/form.jndi.ts index 80b1ea3..7295a93 100644 --- a/src/modules/pages/maintain/forms/components/form.jndi.ts +++ b/src/modules/pages/maintain/forms/components/form.jndi.ts @@ -1,14 +1,16 @@ import { shortcut } from '@core/core'; -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'; +import { TextChecker } from '../../../../components/text_checker/text_checker'; import { EditorIconCheckCombo, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core'; -export const FormJndiXtype = 'dec.dcm.maintain.form.jndi'; -@shortcut(FormJndiXtype) + +@shortcut() export class FormJndi extends BI.Widget { + static xtype = 'dec.dcm.maintain.form.jndi'; + props = { formData: {} as Connection, } @@ -45,21 +47,21 @@ export class FormJndi extends BI.Widget { 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: [{ @@ -97,7 +99,7 @@ export class FormJndi extends BI.Widget { height: 175, items: [ { - type: FormItemXtype, + type: FormItem.xtype, name: 'INTIAL_CONTEXT_FACTORY', nameWidth: 200, isBold: false, @@ -127,7 +129,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'PROVIDER_URL', isBold: false, nameWidth: 200, @@ -143,7 +145,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'SECURITY_PRINCIPAL', isBold: false, nameWidth: 200, @@ -159,7 +161,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'SECURITY_CREDENTIALS', isBold: false, nameWidth: 200, @@ -186,7 +188,7 @@ export class FormJndi extends BI.Widget { ], }, { - type: FormItemXtype, + type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), nameWidth: 200, forms: [{ @@ -201,7 +203,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: CollapseXtype, + type: Collapse.xtype, width: 70, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), listeners: [ @@ -223,7 +225,7 @@ export class FormJndi extends BI.Widget { }, items: [ { - type: FormItemXtype, + type: FormItem.xtype, name: 'OBJECT_FACTORIES', nameWidth: 200, forms: [{ @@ -238,7 +240,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'STATE_FACTORIES', nameWidth: 200, forms: [{ @@ -253,7 +255,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'URL_PKG_PREFIXES', nameWidth: 200, forms: [{ @@ -268,7 +270,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'DNS_URL', nameWidth: 200, forms: [{ @@ -283,7 +285,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'AUTHORITATIVE', nameWidth: 200, forms: [{ @@ -298,7 +300,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'BATCHSIZE', nameWidth: 200, forms: [{ @@ -313,7 +315,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'REFERRAL', nameWidth: 200, forms: [{ @@ -328,7 +330,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'SECURITY_PROTOCOL', nameWidth: 200, forms: [{ @@ -343,7 +345,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'SECURITY_AUTHENTICATION', nameWidth: 200, forms: [{ @@ -358,7 +360,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'LANGUAGE', nameWidth: 200, forms: [{ @@ -373,7 +375,7 @@ export class FormJndi extends BI.Widget { }], }, { - type: FormItemXtype, + type: FormItem.xtype, name: 'APPLET', nameWidth: 200, forms: [{ diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index 6774bca..ae9646e 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/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, } diff --git a/src/modules/pages/maintain/forms/form.model.ts b/src/modules/pages/maintain/forms/form.model.ts index a7f5ec6..3bbc66e 100644 --- a/src/modules/pages/maintain/forms/form.model.ts +++ b/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 = [ + 'datebaseTypeSelected', + 'datebaseTypeSelectedOne', + 'connectionSelectedOne', + 'saveEvent', + 'pageIndex', + 'testEvent', + 'connections', + 'isCopy', + ]; actions = { addConnection: (data: Connection) => api.addConnection(data), diff --git a/src/modules/pages/maintain/forms/form.server.ts b/src/modules/pages/maintain/forms/form.server.ts index a862e1f..dc52f4c 100644 --- a/src/modules/pages/maintain/forms/form.server.ts +++ b/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 { }; 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 { }, listeners: [ { - eventName: EVENT_RELOAD, + eventName: TestStatus.EVENT_RELOAD, action: () => { testStatus.setLoading(); testConnection(); }, }, { - eventName: EVENT_CLOSE, + eventName: TestStatus.EVENT_CLOSE, action: () => { BI.Maskers.remove(id); }, diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 6eec4d3..fe33db2 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/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; } } diff --git a/src/modules/pages/maintain/maintain.model.ts b/src/modules/pages/maintain/maintain.model.ts index 1eb12e5..3b57597 100644 --- a/src/modules/pages/maintain/maintain.model.ts +++ b/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 = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'isCopy']; actions = { setPageIndex:(index: string) => { diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index 83d25a9..98ff521 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -1,7 +1,7 @@ import { shortcut, store } from '@core/core'; -import { MaintainModel, MaintainModelXtype } from './maintain.model'; -import { MaintainFormXtype } from './forms/form'; -import { LinkXtype, LinkButton } 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(); @@ -11,10 +11,11 @@ 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']; @@ -51,7 +52,7 @@ export class Maintain extends BI.Widget { height: 15, }, { - type: LinkXtype, + type: LinkButton.xtype, invisible: true, lgap: 10, text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'), @@ -86,7 +87,7 @@ export class Maintain extends BI.Widget { const { type } = this.getEditConnection(); return [{ - type: MaintainFormXtype, + type: MaintainForm.xtype, connectionType: type, }]; } diff --git a/src/modules/title/title.model.ts b/src/modules/title/title.model.ts index 56012db..737c324 100644 --- a/src/modules/title/title.model.ts +++ b/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 = ['pageIndex', 'datebaseTypeSelected'] actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index 32ba5b7..dc85b0f 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -1,14 +1,15 @@ 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'; import { LinearSegment, Tab } from '@fui/core'; -export const TitleXtype = 'dec.dcm.title'; -@shortcut(TitleXtype) -@store(TitleModelXtype) +@shortcut() +@store(TitleModel) export class Title extends BI.Widget { + static xtype = 'dec.dcm.title'; + props = { baseCls: 'bi-card', } @@ -76,11 +77,11 @@ export class Title extends BI.Widget { switch (index) { case PAGE_INDEX.DATEBASE: return { - type: TitleDatabase, + type: TitleDatabase.xtype, }; case PAGE_INDEX.MAINTAIN: return { - type: TitleMaintain, + type: TitleMaintain.xtype, }; default: return { diff --git a/src/modules/title/title_database/title_datebase.model.ts b/src/modules/title/title_database/title_datebase.model.ts index 1f45e5d..ba553c3 100644 --- a/src/modules/title/title_database/title_datebase.model.ts +++ b/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 = ['pageIndex', 'datebaseTypeSelected']; actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title_database/title_datebase.ts b/src/modules/title/title_database/title_datebase.ts index c8274c1..1441d75 100644 --- a/src/modules/title/title_database/title_datebase.ts +++ b/src/modules/title/title_database/title_datebase.ts @@ -1,13 +1,13 @@ import { shortcut, store } from '@core/core'; -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']; diff --git a/src/modules/title/title_maintain/title_maintain.model.ts b/src/modules/title/title_maintain/title_maintain.model.ts index ca0a8ed..21fd87a 100644 --- a/src/modules/title/title_maintain/title_maintain.model.ts +++ b/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 = ['pageIndex', 'saveEvent', 'testEvent', 'connectionSelected', 'isCopy']; actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title_maintain/title_maintain.ts b/src/modules/title/title_maintain/title_maintain.ts index c7e9150..18fdc2c 100644 --- a/src/modules/title/title_maintain/title_maintain.ts +++ b/src/modules/title/title_maintain/title_maintain.ts @@ -1,11 +1,12 @@ import { shortcut, store } from '@core/core'; -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() {