Browse Source

Merge pull request #1131 in DEC/decision-webui-dcm from feature/10.0 to research/10.0

* commit '34ca564981fdd03c8392cdaf28eea7e6f41d1e36':
  KERNEL-6541 修改xtype写法
research/10.0
superman 4 years ago
parent
commit
6feafb2328
  1. 4
      src/index.ts
  2. 7
      src/modules/app.model.ts
  3. 28
      src/modules/app.ts
  4. 5
      src/modules/components/collapse/collapse.model.ts
  5. 9
      src/modules/components/collapse/collapse.ts
  6. 5
      src/modules/components/link_button/link.ts
  7. 5
      src/modules/components/test_status/test_status.model.ts
  8. 35
      src/modules/components/test_status/test_status.ts
  9. 6
      src/modules/components/test_status/tip_icon/tip_fail.model.ts
  10. 23
      src/modules/components/test_status/tip_icon/tip_fail.ts
  11. 5
      src/modules/components/test_status/tip_icon/tip_icon.ts
  12. 6
      src/modules/components/text_checker/text_checker.ts
  13. 42
      src/modules/core/core.ts
  14. 5
      src/modules/pages/connection/components/form_item/form_item.ts
  15. 22
      src/modules/pages/connection/connection.model.ts
  16. 25
      src/modules/pages/connection/connection.ts
  17. 16
      src/modules/pages/connection/connection_jdbc/connection_jdbc.model.ts
  18. 60
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  19. 15
      src/modules/pages/connection/connection_jndi/connection_jndi.model.ts
  20. 51
      src/modules/pages/connection/connection_jndi/connection_jndi.ts
  21. 17
      src/modules/pages/connection/connection_plugin/connection_plugin.model.ts
  22. 9
      src/modules/pages/connection/connection_plugin/connection_plugin.ts
  23. 16
      src/modules/pages/connection/list/list.model.ts
  24. 14
      src/modules/pages/connection/list/list.ts
  25. 26
      src/modules/pages/connection/list/list_item/list_item.model.ts
  26. 9
      src/modules/pages/connection/list/list_item/list_item.ts
  27. 17
      src/modules/pages/connection_pool/connection_pool.model.ts
  28. 17
      src/modules/pages/connection_pool/connection_pool.ts
  29. 13
      src/modules/pages/connection_pool/list_item/list_item.model.ts
  30. 9
      src/modules/pages/connection_pool/list_item/list_item.ts
  31. 14
      src/modules/pages/connection_pool/pool/pool.model.ts
  32. 9
      src/modules/pages/connection_pool/pool/pool.ts
  33. 16
      src/modules/pages/database/database.model.ts
  34. 21
      src/modules/pages/database/database.ts
  35. 12
      src/modules/pages/database/database.typings.d.ts
  36. 15
      src/modules/pages/database/database_type/database_type.model.ts
  37. 9
      src/modules/pages/database/database_type/database_type.ts
  38. 13
      src/modules/pages/database/filter/filter.model.ts
  39. 8
      src/modules/pages/database/filter/filter.ts
  40. 10
      src/modules/pages/index.ts
  41. 6
      src/modules/pages/maintain/components/form_item/form_item.ts
  42. 104
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  43. 54
      src/modules/pages/maintain/forms/components/form.jndi.ts
  44. 4
      src/modules/pages/maintain/forms/components/form.plugin.ts
  45. 38
      src/modules/pages/maintain/forms/form.model.ts
  46. 8
      src/modules/pages/maintain/forms/form.server.ts
  47. 24
      src/modules/pages/maintain/forms/form.ts
  48. 23
      src/modules/pages/maintain/maintain.model.ts
  49. 17
      src/modules/pages/maintain/maintain.ts
  50. 16
      src/modules/title/title.model.ts
  51. 13
      src/modules/title/title.ts
  52. 16
      src/modules/title/title_database/title_datebase.model.ts
  53. 10
      src/modules/title/title_database/title_datebase.ts
  54. 23
      src/modules/title/title_maintain/title_maintain.model.ts
  55. 11
      src/modules/title/title_maintain/title_maintain.ts

4
src/index.ts

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

7
src/modules/app.model.ts

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

28
src/modules/app.ts

@ -1,16 +1,20 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { TitleXtype } from './title/title'; import { Title } from './title/title';
import { PAGE_INDEX } from './constants/constant'; import { PAGE_INDEX } from './constants/constant';
import { ConnectionXtype, DatebaseXtype, MaintainXtype, ConnectionPoolXtype } from './pages'; import { Connection } from './pages/connection/connection';
import { AppModel, AppModelXtype } from './app.model'; import { AppModel } from './app.model';
import { Tab } from '@fui/core';
import { Datebase } from './pages/database/database';
import { Maintain } from './pages/maintain/maintain';
import { ConnectionPool } from './pages/connection_pool/connection_pool';
import './app.provider'; import './app.provider';
import '../less/index.less'; import '../less/index.less';
import { Tab } from '@fui/core';
export const AppXtype = 'dec.dcm.main'; @shortcut()
@store(AppModelXtype) @store(AppModel)
@shortcut(AppXtype)
export class App extends BI.Widget { export class App extends BI.Widget {
static xtype = 'dec.dcm.main';
tab: Tab; tab: Tab;
store: AppModel['store']; store: AppModel['store'];
@ -28,7 +32,7 @@ export class App extends BI.Widget {
items: [ items: [
{ {
el: { el: {
type: TitleXtype, type: Title.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
}, },
height: 40, height: 40,
@ -50,19 +54,19 @@ export class App extends BI.Widget {
switch (index) { switch (index) {
case PAGE_INDEX.CONNECTION: case PAGE_INDEX.CONNECTION:
return { return {
type: ConnectionXtype, type: Connection.xtype,
}; };
case PAGE_INDEX.DATEBASE: case PAGE_INDEX.DATEBASE:
return { return {
type: DatebaseXtype, type: Datebase.xtype,
}; };
case PAGE_INDEX.MAINTAIN: case PAGE_INDEX.MAINTAIN:
return { return {
type: MaintainXtype, type: Maintain.xtype,
}; };
default: default:
return { return {
type: ConnectionPoolXtype, type: ConnectionPool.xtype,
}; };
} }
}, },

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

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

9
src/modules/components/collapse/collapse.ts

@ -1,12 +1,13 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { CollapseModel, CollapseModelXtype } from './collapse.model'; import { CollapseModel } from './collapse.model';
import { IconLabel } from '@fui/core'; import { IconLabel } from '@fui/core';
export const EVENT_CHANGE = 'EVENT_CHANGE'; export const EVENT_CHANGE = 'EVENT_CHANGE';
export const CollapseXtype = 'dec.dcm.components.collapse'; @shortcut()
@shortcut(CollapseXtype) @store(CollapseModel)
@store(CollapseModelXtype)
export class Collapse extends BI.BasicButton { export class Collapse extends BI.BasicButton {
static xtype = 'dec.dcm.components.collapse';
props = { props = {
name: '', name: '',
isCollapse: true, isCollapse: true,

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

@ -1,10 +1,11 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Label } from '@fui/core'; import { Label } from '@fui/core';
export const LinkXtype = 'dec.dcm.components.link.button';
const DEFAULT_LINK = '/'; const DEFAULT_LINK = '/';
@shortcut(LinkXtype) @shortcut()
export class LinkButton extends BI.BasicButton { export class LinkButton extends BI.BasicButton {
static xtype = 'dec.dcm.components.link.button';
props: { props: {
text: string; text: string;
cls: string; cls: string;

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

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

35
src/modules/components/test_status/test_status.ts

@ -1,17 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { TestStatusModelXtype, TestStatusModel } from './test_status.model'; import { TestStatusModel } from './test_status.model';
import { TEST_STATUS } from '@constants/constant'; import { TEST_STATUS } from '@constants/constant';
import { TipIconXtype } from './tip_icon/tip_icon'; import { TipIcon } from './tip_icon/tip_icon';
import { TipFailXtype, EVENT_CLOSE, EVENT_RELOAD, EVENT_DETAIL } from './tip_icon/tip_fail'; import { TipFail } from './tip_icon/tip_fail';
import { FloatLeftLayout, Label, Tab, VerticalLayout } from '@fui/core'; import { FloatLeftLayout, Label, Tab, VerticalLayout } from '@fui/core';
export const TestStatusXtype = 'dec.dcm.components.test_status'; @shortcut()
export { @store(TestStatusModel)
EVENT_CLOSE,
EVENT_RELOAD,
};
@shortcut(TestStatusXtype)
@store(TestStatusModelXtype)
export class TestStatus extends BI.Widget { export class TestStatus extends BI.Widget {
static xtype = 'dec.dcm.components.test_status';
static EVENT_CLOSE = 'EVENT_CLOSE';
static EVENT_RELOAD = 'EVENT_RELOAD';
props = { props = {
loadingCls: '', loadingCls: '',
loadingText: '', loadingText: '',
@ -61,32 +60,32 @@ export class TestStatus extends BI.Widget {
switch (index) { switch (index) {
case TEST_STATUS.SUCCESS: case TEST_STATUS.SUCCESS:
return { return {
type: TipIconXtype, type: TipIcon.xtype,
tipCls: successCls, tipCls: successCls,
tipText: successText, tipText: successText,
}; };
case TEST_STATUS.FAIL: case TEST_STATUS.FAIL:
return { return {
type: TipFailXtype, type: TipFail.xtype,
tipCls: failCls, tipCls: failCls,
tipText: failText, tipText: failText,
retryText, retryText,
listeners: [ listeners: [
{ {
eventName: EVENT_RELOAD, eventName: TipFail.EVENT_RELOAD,
action: () => { action: () => {
this.fireEvent(EVENT_RELOAD); this.fireEvent(TestStatus.EVENT_RELOAD);
this.detail.setVisible(false); this.detail.setVisible(false);
}, },
}, },
{ {
eventName: EVENT_CLOSE, eventName: TipFail.EVENT_CLOSE,
action: () => { action: () => {
this.fireEvent(EVENT_CLOSE); this.fireEvent(TestStatus.EVENT_CLOSE);
}, },
}, },
{ {
eventName: EVENT_DETAIL, eventName: TipFail.EVENT_DETAIL,
action: (isCollapse: boolean) => { action: (isCollapse: boolean) => {
this.tab.setHeight(isCollapse ? 250 : 200); this.tab.setHeight(isCollapse ? 250 : 200);
this.detail.setVisible(!isCollapse); this.detail.setVisible(!isCollapse);
@ -96,7 +95,7 @@ export class TestStatus extends BI.Widget {
}; };
default: default:
return { return {
type: TipIconXtype, type: TipIcon.xtype,
tipCls: loadingCls, tipCls: loadingCls,
tipText: loadingText, tipText: loadingText,
}; };

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

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

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

@ -1,13 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Button } from '@fui/core'; import { Button } from '@fui/core';
import { TipFailModel, TipFailModelXtype } from './tip_fail.model'; import { TipFailModel } from './tip_fail.model';
export const TipFailXtype = 'dec.dcm.components.test_status.tip_fail';
export const EVENT_CLOSE = 'EVENT_CLOSE'; @shortcut()
export const EVENT_RELOAD = 'EVENT_RELOAD'; @store(TipFailModel)
export const EVENT_DETAIL = 'EVENT_DETAIL';
@shortcut(TipFailXtype)
@store(TipFailModelXtype)
export class TipFail extends BI.Widget { export class TipFail extends BI.Widget {
static xtype = 'dec.dcm.components.test_status.tip_fail';
static EVENT_CLOSE = 'EVENT_CLOSE';
static EVENT_RELOAD = 'EVENT_RELOAD';
static EVENT_DETAIL = 'EVENT_DETAIL';
props = { props = {
tipCls: '', tipCls: '',
tipText: '', tipText: '',
@ -64,7 +67,7 @@ export class TipFail extends BI.Widget {
}, },
handler: () => { handler: () => {
this.store.setIsCollapse(!this.model.isCollapse); this.store.setIsCollapse(!this.model.isCollapse);
this.fireEvent(EVENT_DETAIL, !this.model.isCollapse); this.fireEvent(TipFail.EVENT_DETAIL, !this.model.isCollapse);
}, },
}, },
{ {
@ -72,14 +75,14 @@ export class TipFail extends BI.Widget {
text: BI.i18nText('Dec-Dcm_Back'), text: BI.i18nText('Dec-Dcm_Back'),
level: 'ignore', level: 'ignore',
handler: () => { handler: () => {
this.fireEvent(EVENT_CLOSE); this.fireEvent(TipFail.EVENT_CLOSE);
}, },
}, },
{ {
type: BI.Button.xtype, type: BI.Button.xtype,
text: retryText, text: retryText,
handler: () => { handler: () => {
this.fireEvent(EVENT_RELOAD); this.fireEvent(TipFail.EVENT_RELOAD);
}, },
}, },
], ],

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

@ -1,7 +1,8 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
export const TipIconXtype = 'dec.dcm.components.test_status.tip_icon'; @shortcut()
@shortcut(TipIconXtype)
export class TipIcon extends BI.Widget { export class TipIcon extends BI.Widget {
static xtype = 'dec.dcm.components.test_status.tip_icon';
props = { props = {
tipCls: '', tipCls: '',
tipText: '', tipText: '',

6
src/modules/components/text_checker/text_checker.ts

@ -1,8 +1,10 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { Label, TextEditor } from '@fui/core'; import { Label, TextEditor } from '@fui/core';
export const TextCheckerXtype = 'dec.dcm.components.text_checker';
@shortcut(TextCheckerXtype) @shortcut()
export class TextChecker extends BI.Widget { export class TextChecker extends BI.Widget {
static xtype = 'dec.dcm.components.text_checker';
props = { props = {
width: 300, width: 300,
allowBlank: true, allowBlank: true,

42
src/modules/core/core.ts

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

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

@ -1,7 +1,8 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
export const FormItemXtype = 'dec.dcm.connection_form_item';
@shortcut(FormItemXtype) @shortcut()
export class FormItem extends BI.Widget { export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.connection_form_item';
props = { props = {
name: '', name: '',
value: '', value: '',

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

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

25
src/modules/pages/connection/connection.ts

@ -1,19 +1,20 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ConnectionModel, ConnectionModelXtype } from './connection.model'; import { ConnectionModel } from './connection.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { ConnectionListXtype } from './list/list'; import { ConnectionList } from './list/list';
import { ConnectionJdbcXtype } from './connection_jdbc/connection_jdbc'; import { ConnectionJdbc } from './connection_jdbc/connection_jdbc';
import { ConnectionJndiXtype } from './connection_jndi/connection_jndi'; import { ConnectionJndi } from './connection_jndi/connection_jndi';
import { ConnectionPluginXtype } from './connection_plugin/connection_plugin'; import { ConnectionPlugin } from './connection_plugin/connection_plugin';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service'; import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from '../../crud/crud.typings'; import { ConnectionJDBC } from '../../crud/crud.typings';
import { Button, HTapeLayout, Label, ListView } from '@fui/core'; import { Button, HTapeLayout, Label, ListView } from '@fui/core';
export const ConnectionXtype = 'dec.dcm.connection'; @shortcut()
@shortcut(ConnectionXtype) @store(ConnectionModel)
@store(ConnectionModelXtype)
export class Connection extends BI.Widget { export class Connection extends BI.Widget {
static xtype = 'dec.dcm.connection';
store: ConnectionModel['store']; store: ConnectionModel['store'];
model: ConnectionModel['model']; model: ConnectionModel['model'];
@ -72,7 +73,7 @@ export class Connection extends BI.Widget {
height: 40, height: 40,
}, },
{ {
type: ConnectionListXtype, type: ConnectionList.xtype,
tgap: 10, tgap: 10,
}, },
], ],
@ -143,15 +144,15 @@ export class Connection extends BI.Widget {
switch (this.model.connectionSelectedOne.connectionType) { switch (this.model.connectionSelectedOne.connectionType) {
case connectionType.JDBC: case connectionType.JDBC:
return [{ return [{
type: ConnectionJdbcXtype, type: ConnectionJdbc.xtype,
}]; }];
case connectionType.JNDI: case connectionType.JNDI:
return [{ return [{
type: ConnectionJndiXtype, type: ConnectionJndi.xtype,
}]; }];
default: default:
return [{ return [{
type: ConnectionPluginXtype, type: ConnectionPlugin.xtype,
}]; }];
} }
} }

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

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

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

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

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

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

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

@ -1,15 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { FormItemXtype } from '../components/form_item/form_item'; import { FormItem } from '../components/form_item/form_item';
import { ConnectionJndiModelXtype, ConnectionJndiModel } from './connection_jndi.model'; import { ConnectionJndiModel } from './connection_jndi.model';
import { ConnectionJNDI } from 'src/modules/crud/crud.typings'; import { ConnectionJNDI } from 'src/modules/crud/crud.typings';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
import { VerticalLayout } from '@fui/core'; import { VerticalLayout } from '@fui/core';
export const ConnectionJndiXtype = 'dec.dcm.connection_jndi'; @shortcut()
@shortcut(ConnectionJndiXtype) @store(ConnectionJndiModel)
@store(ConnectionJndiModelXtype) export class ConnectionJndi extends BI.Widget {
export class ConnectionJdbc extends BI.Widget { static xtype = 'dec.dcm.connection_jndi';
model: ConnectionJndiModel['model']; model: ConnectionJndiModel['model'];
advancedSet: VerticalLayout; advancedSet: VerticalLayout;
@ -26,7 +27,7 @@ export class ConnectionJdbc extends BI.Widget {
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
value: jndiName, value: jndiName,
@ -55,28 +56,28 @@ export class ConnectionJdbc extends BI.Widget {
height: 115, height: 115,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY', name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.factory.initial'], value: contextHashtable['java.naming.factory.initial'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'PROVIDER_URL', name: 'PROVIDER_URL',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.provider.url'], value: contextHashtable['java.naming.provider.url'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL', name: 'SECURITY_PRINCIPAL',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
value: contextHashtable['java.naming.security.principal'], value: contextHashtable['java.naming.security.principal'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS', name: 'SECURITY_CREDENTIALS',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
@ -88,13 +89,13 @@ export class ConnectionJdbc extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [ listeners: [
@ -116,67 +117,67 @@ export class ConnectionJdbc extends BI.Widget {
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'OBJECT_FACTORIES', name: 'OBJECT_FACTORIES',
value: contextHashtable['java.naming.factory.object'], value: contextHashtable['java.naming.factory.object'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'STATE_FACTORIES', name: 'STATE_FACTORIES',
value: contextHashtable['java.naming.factory.state'], value: contextHashtable['java.naming.factory.state'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'URL_PKG_PREFIXES', name: 'URL_PKG_PREFIXES',
value: contextHashtable['java.naming.factory.url.pkgs'], value: contextHashtable['java.naming.factory.url.pkgs'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'DNS_URL', name: 'DNS_URL',
value: contextHashtable['java.naming.dns.url'], value: contextHashtable['java.naming.dns.url'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'AUTHORITATIVE', name: 'AUTHORITATIVE',
value: contextHashtable['java.naming.authoritative'], value: contextHashtable['java.naming.authoritative'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'BATCHSIZE', name: 'BATCHSIZE',
value: contextHashtable['java.naming.batchsize'], value: contextHashtable['java.naming.batchsize'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'REFERRAL', name: 'REFERRAL',
value: contextHashtable['java.naming.referral'], value: contextHashtable['java.naming.referral'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'SECURITY_PROTOCOL', name: 'SECURITY_PROTOCOL',
value: contextHashtable['java.naming.security.protocol'], value: contextHashtable['java.naming.security.protocol'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'SECURITY_AUTHENTICATION', name: 'SECURITY_AUTHENTICATION',
value: contextHashtable['java.naming.security.authentication'], value: contextHashtable['java.naming.security.authentication'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'LANGUAGE', name: 'LANGUAGE',
value: contextHashtable['java.naming.language'], value: contextHashtable['java.naming.language'],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
nameWidth: 200, nameWidth: 200,
name: 'APPLET', name: 'APPLET',
value: contextHashtable['java.naming.applet'], value: contextHashtable['java.naming.applet'],

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

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

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

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

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

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

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

@ -1,12 +1,14 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ListItemXtype } from './list_item/list_item'; import { ListItem } from './list_item/list_item';
import { ConnectionListModel, ConnectionListModelXtype } from './list.model'; import { ConnectionListModel } from './list.model';
import { getDatabaseType } from './list.service'; import { getDatabaseType } from './list.service';
import { Tab } from '@fui/core'; import { Tab } from '@fui/core';
export const ConnectionListXtype = 'dec.dcm.connection.list';
@shortcut(ConnectionListXtype) @shortcut()
@store(ConnectionListModelXtype) @store(ConnectionListModel)
export class ConnectionList extends BI.LoadingPane { export class ConnectionList extends BI.LoadingPane {
static xtype = 'dec.dcm.connection.list';
store: ConnectionListModel['store']; store: ConnectionListModel['store'];
model: ConnectionListModel['model']; model: ConnectionListModel['model'];
@ -83,7 +85,7 @@ export class ConnectionList extends BI.LoadingPane {
private renderList(start = 0, end = 0) { private renderList(start = 0, end = 0) {
return this.model.connections.slice(start, end).map((item, index) => { return this.model.connections.slice(start, end).map((item, index) => {
return { return {
type: ListItemXtype, type: ListItem.xtype,
name: item.connectionName, name: item.connectionName,
value: item.connectionName, value: item.connectionName,
creator: item.creator, creator: item.creator,

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

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

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

@ -1,16 +1,17 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import './list_item.less'; import './list_item.less';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { ListItemModel } from './list_item.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { hasRegistered } from '../list.service'; import { hasRegistered } from '../list.service';
import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service'; import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service';
import { testConnection } from '../../../maintain/forms/form.server'; import { testConnection } from '../../../maintain/forms/form.server';
import { DownListCombo, Label, SignEditor } from '@fui/core'; import { DownListCombo, Label, SignEditor } from '@fui/core';
export const ListItemXtype = 'dec.dcm.connection.list_item'; @shortcut()
@shortcut(ListItemXtype) @store(ListItemModel)
@store(ListItemModelXtype)
export class ListItem extends BI.BasicButton { export class ListItem extends BI.BasicButton {
static xtype = 'dec.dcm.connection.list_item';
props = { props = {
name: '', name: '',
creator: '', creator: '',

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

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

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

@ -1,13 +1,14 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ConnectionPoolModel, ConnectionPoolModelXtype } from './connection_pool.model'; import { ConnectionPoolModel } from './connection_pool.model';
import { ListItemXtype } from './list_item/list_item'; import { ListItem } from './list_item/list_item';
import { PoolXtype } from './pool/pool'; import { Pool } from './pool/pool';
import { PAGE_SIZE } from '@constants/constant'; import { PAGE_SIZE } from '@constants/constant';
import { Label } from '@fui/core'; import { Label } from '@fui/core';
export const ConnectionPoolXtype = 'dec.dcm.connection_pool'; @shortcut()
@shortcut(ConnectionPoolXtype) @store(ConnectionPoolModel)
@store(ConnectionPoolModelXtype)
export class ConnectionPool extends BI.Widget { export class ConnectionPool extends BI.Widget {
static xtype = 'dec.dcm.connection_pool';
title: Label; title: Label;
model: ConnectionPoolModel['model']; model: ConnectionPoolModel['model'];
@ -80,7 +81,7 @@ export class ConnectionPool extends BI.Widget {
height: 40, 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 this.model.connectionJDBC.slice(start, end).map(item => {
return { return {
type: ListItemXtype, type: ListItem.xtype,
name: item.connectionName, name: item.connectionName,
value: item.connectionName, value: item.connectionName,
selected: item.connectionName === defaultSelected, selected: item.connectionName === defaultSelected,

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

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

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

@ -1,9 +1,10 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { ListItemModel } from './list_item.model';
export const ListItemXtype = 'dec.dcm.connection_pool.list_item'; @shortcut()
@shortcut(ListItemXtype) @store(ListItemModel)
@store(ListItemModelXtype)
export class ListItem extends BI.BasicButton { export class ListItem extends BI.BasicButton {
static xtype = 'dec.dcm.connection_pool.list_item';
props = { props = {
name: '', name: '',
height: 25, height: 25,

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

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

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

@ -1,13 +1,14 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { PoolModel, PoolModelXtype } from './pool.model'; import { PoolModel } from './pool.model';
import './pool.less'; import './pool.less';
import { ConnectionPoolType } from '../../../crud/crud.typings'; import { ConnectionPoolType } from '../../../crud/crud.typings';
import { Label } from '@fui/core'; import { Label } from '@fui/core';
export const PoolXtype = 'dec.dcm.connection_pool.pool'; @shortcut()
@shortcut(PoolXtype) @store(PoolModel)
@store(PoolModelXtype)
export class Pool extends BI.Widget { export class Pool extends BI.Widget {
static xtype = 'dec.dcm.connection_pool.pool';
props = { props = {
baseCls: 'dec-dcm-connection-pool', baseCls: 'dec-dcm-connection-pool',
$testId: 'dec-dcm-connection-pool', $testId: 'dec-dcm-connection-pool',

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

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

21
src/modules/pages/database/database.ts

@ -1,15 +1,16 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { FilterXtype } from './filter/filter'; import { Filter } from './filter/filter';
import { DatebaseModel, DatebaseModelXtype } from './database.model'; import { DatebaseModel } from './database.model';
import { DATEBASE_FILTER_TYPE, OTHER_JDBC } from '@constants/constant'; import { DATEBASE_FILTER_TYPE, OTHER_JDBC } from '@constants/constant';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { DatebaseTypeXtype } from './database_type/database_type'; import { DatebaseType } from './database_type/database_type';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core';
export const DatebaseXtype = 'dec.dcm.datebase'; @shortcut()
@shortcut(DatebaseXtype) @store(DatebaseModel)
@store(DatebaseModelXtype)
export class Datebase extends BI.Widget { export class Datebase extends BI.Widget {
static xtype = 'dec.dcm.datebase';
filter: ButtonGroup; filter: ButtonGroup;
search: SearchEditor; search: SearchEditor;
datebaseType: ButtonGroup; datebaseType: ButtonGroup;
@ -117,18 +118,18 @@ export class Datebase extends BI.Widget {
}, },
items: [ items: [
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Commonly'), text: BI.i18nText('Dec-Dcm_Connection_Commonly'),
value: DATEBASE_FILTER_TYPE.COMMONLY, value: DATEBASE_FILTER_TYPE.COMMONLY,
selected: true, selected: true,
}, },
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_All'), text: BI.i18nText('Dec-Dcm_Connection_All'),
value: DATEBASE_FILTER_TYPE.ALL, value: DATEBASE_FILTER_TYPE.ALL,
}, },
{ {
type: FilterXtype, type: Filter.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Other'), text: BI.i18nText('Dec-Dcm_Connection_Other'),
value: DATEBASE_FILTER_TYPE.OTHER, value: DATEBASE_FILTER_TYPE.OTHER,
}, },
@ -219,7 +220,7 @@ export class Datebase extends BI.Widget {
return this.model.datebaseTypes.map(item => { return this.model.datebaseTypes.map(item => {
return { return {
type: DatebaseTypeXtype, type: DatebaseType.xtype,
text: item.text, text: item.text,
value: item.databaseType, value: item.databaseType,
keyword: this.model.search, keyword: this.model.search,

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

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

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

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

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

@ -1,14 +1,15 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { DatebaseTypeModel, DatebaseTypeModelXtype } from './database_type.model'; import { DatebaseTypeModel } from './database_type.model';
import { ImgPrefix, PluginImgPrefix } from '@constants/env'; import { ImgPrefix, PluginImgPrefix } from '@constants/env';
import './database_type.less'; import './database_type.less';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { Img } from '@fui/core'; import { Img } from '@fui/core';
export const DatebaseTypeXtype = 'dec.dcm.datebase.type'; @shortcut()
@shortcut(DatebaseTypeXtype) @store(DatebaseTypeModel)
@store(DatebaseTypeModelXtype)
export class DatebaseType extends BI.BasicButton { export class DatebaseType extends BI.BasicButton {
static xtype = 'dec.dcm.datebase.type';
props = { props = {
text: '', text: '',
url: '', url: '',

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

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

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

@ -1,10 +1,10 @@
import { shortcut, store } from '@core/core'; 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()
@shortcut(FilterXtype) @store(FilterModel)
@store(FilterModelXtype)
export class Filter extends BI.BasicButton { export class Filter extends BI.BasicButton {
static xtype = 'dec.dcm.datebase.filter';
store: FilterModel['store'] store: FilterModel['store']
props = { props = {
text: '', text: '',

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,
};

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

@ -1,8 +1,10 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
export const FormItemXtype = 'dec.dcm.Maintain_form_item';
@shortcut(FormItemXtype) @shortcut()
export class FormItem extends BI.Widget { export class FormItem extends BI.Widget {
static xtype = 'dec.dcm.Maintain_form_item';
props = { props = {
name: '', name: '',
forms: '', forms: '',

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

@ -1,19 +1,19 @@
import { shortcut } from '@core/core'; import { shortcut } from '@core/core';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { FormItemXtype } from '../../components/form_item/form_item'; import { FormItem } from '../../components/form_item/form_item';
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service';
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; import { TextChecker } from '../../../../components/text_checker/text_checker';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
import { Editor, EditorIconCheckCombo, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core'; 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(); const api = new ApiFactory().create();
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; @shortcut()
@shortcut(FormJdbcXtype)
export class FormJdbc extends BI.Widget { export class FormJdbc extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jdbc';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} }
@ -77,22 +77,22 @@ export class FormJdbc extends BI.Widget {
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'), name: BI.i18nText('Dec-Dcm_Connection_Name'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'connection-name', $value: 'connection-name',
width: 300, width: 300,
value: connectionName, value: connectionName,
allowBlank: true, allowBlank: true,
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.connectionName = _ref; this.form.connectionName = _ref;
}, },
watermark: BI.i18nText('Dec-Dcm_Data_Connections'), watermark: BI.i18nText('Dec-Dcm_Data_Connections'),
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
forms: [{ forms: [{
type: BI.EditorIconCheckCombo.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
forms: [{ forms: [{
type: BI.TextEditor.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Host'),
forms: [{ forms: [{
type: BI.TextEditor.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'database-port', $value: 'database-port',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
@ -177,7 +177,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.port = _ref; this.form.port = _ref;
}, },
listeners: [{ listeners: [{
@ -189,7 +189,7 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'),
invisible: !databaseType.kerberos, invisible: !databaseType.kerberos,
forms: [{ forms: [{
@ -226,7 +226,7 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
invisible: !!authType, invisible: !!authType,
ref: (_ref: FormItem) => { 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
invisible: !!authType, invisible: !!authType,
ref: (_ref: FormItem) => { 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'),
invisible: !authType, invisible: !authType,
ref: (_ref: FormItem) => { 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'),
invisible: !authType, invisible: !authType,
ref: (_ref: FormItem) => { 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
forms: [{ forms: [{
type: BI.TextValueCombo.xtype, type: BI.TextValueCombo.xtype,
@ -332,7 +332,7 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
invisible: !databaseType.hasSchema, invisible: !databaseType.hasSchema,
height: 64, height: 64,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
@ -373,7 +373,7 @@ export class FormJdbc extends BI.Widget {
bgap: 8, bgap: 8,
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
forms: [{ forms: [{
type: BI.TextEditor.xtype, type: BI.TextEditor.xtype,
@ -397,7 +397,7 @@ export class FormJdbc extends BI.Widget {
}], }],
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
bgap: -15, bgap: -15,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
@ -420,11 +420,11 @@ export class FormJdbc extends BI.Widget {
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
tgap: 15, tgap: 15,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'initial-size', $value: 'initial-size',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -435,16 +435,16 @@ export class FormJdbc extends BI.Widget {
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.initialSize = _ref; this.form.initialSize = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-active', $value: 'max-active',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -455,16 +455,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxActive = _ref; this.form.maxActive = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-idle', $value: 'max-idle',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -475,16 +475,16 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxIdle = _ref; this.form.maxIdle = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'min-idle', $value: 'min-idle',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -495,17 +495,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.minIdle = _ref; this.form.minIdle = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'max-wait', $value: 'max-wait',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -516,7 +516,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.maxWait = _ref; 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
forms: [{ forms: [{
type: BI.TextAreaEditor.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
forms: [{ forms: [{
type: BI.TextValueCombo.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
forms: [{ forms: [{
type: BI.TextValueCombo.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
forms: [{ forms: [{
type: BI.TextValueCombo.xtype, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'test-between-evicition-millis', $value: 'test-between-evicition-millis',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -609,7 +609,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkNumber(value), checker: (value: string) => this.checkNumber(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.timeBetweenEvictionRunsMillis = _ref; this.form.timeBetweenEvictionRunsMillis = _ref;
}, },
}, },
@ -622,10 +622,10 @@ export class FormJdbc extends BI.Widget {
], ],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'test-pereviction-run-num', $value: 'test-pereviction-run-num',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -636,17 +636,17 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.numTestsPerEvictionRun = _ref; this.form.numTestsPerEvictionRun = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
forms: [ forms: [
{ {
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'min-evictable-idle-time-millis', $value: 'min-evictable-idle-time-millis',
width: 300, width: 300,
allowBlank: false, allowBlank: false,
@ -657,7 +657,7 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, valueRangeConfig], }, valueRangeConfig],
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.minEvictableIdleTimeMillis = _ref; this.form.minEvictableIdleTimeMillis = _ref;
}, },
}, },

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

@ -1,14 +1,16 @@
import { shortcut } from '@core/core'; 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 { ConnectionJNDI, Connection, ContextHashtable } from 'src/modules/crud/crud.typings';
import { CONNECT_CHARSET, CONNECTION_LAYOUT, JNDI_FACTORYS } from '@constants/constant'; import { CONNECT_CHARSET, CONNECTION_LAYOUT, JNDI_FACTORYS } from '@constants/constant';
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { connectionType } from '@constants/env'; import { connectionType } from '@constants/env';
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; import { TextChecker } from '../../../../components/text_checker/text_checker';
import { EditorIconCheckCombo, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core'; 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 { export class FormJndi extends BI.Widget {
static xtype = 'dec.dcm.maintain.form.jndi';
props = { props = {
formData: {} as Connection, formData: {} as Connection,
} }
@ -45,21 +47,21 @@ export class FormJndi extends BI.Widget {
vgap, vgap,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Name'), name: BI.i18nText('Dec-Dcm_Connection_Name'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
type: TextCheckerXtype, type: TextChecker.xtype,
$value: 'connection-name', $value: 'connection-name',
width: 300, width: 300,
value: connectionName, value: connectionName,
ref: (_ref: any) => { ref: (_ref: TextChecker) => {
this.form.connectionName = _ref; this.form.connectionName = _ref;
}, },
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), name: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -97,7 +99,7 @@ export class FormJndi extends BI.Widget {
height: 175, height: 175,
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'INTIAL_CONTEXT_FACTORY', name: 'INTIAL_CONTEXT_FACTORY',
nameWidth: 200, nameWidth: 200,
isBold: false, isBold: false,
@ -127,7 +129,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'PROVIDER_URL', name: 'PROVIDER_URL',
isBold: false, isBold: false,
nameWidth: 200, nameWidth: 200,
@ -143,7 +145,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PRINCIPAL', name: 'SECURITY_PRINCIPAL',
isBold: false, isBold: false,
nameWidth: 200, nameWidth: 200,
@ -159,7 +161,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_CREDENTIALS', name: 'SECURITY_CREDENTIALS',
isBold: false, isBold: false,
nameWidth: 200, 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'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -201,7 +203,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: CollapseXtype, type: Collapse.xtype,
width: 70, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'),
listeners: [ listeners: [
@ -223,7 +225,7 @@ export class FormJndi extends BI.Widget {
}, },
items: [ items: [
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'OBJECT_FACTORIES', name: 'OBJECT_FACTORIES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -238,7 +240,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'STATE_FACTORIES', name: 'STATE_FACTORIES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -253,7 +255,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'URL_PKG_PREFIXES', name: 'URL_PKG_PREFIXES',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -268,7 +270,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'DNS_URL', name: 'DNS_URL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -283,7 +285,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'AUTHORITATIVE', name: 'AUTHORITATIVE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -298,7 +300,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'BATCHSIZE', name: 'BATCHSIZE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -313,7 +315,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'REFERRAL', name: 'REFERRAL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -328,7 +330,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_PROTOCOL', name: 'SECURITY_PROTOCOL',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -343,7 +345,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'SECURITY_AUTHENTICATION', name: 'SECURITY_AUTHENTICATION',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -358,7 +360,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'LANGUAGE', name: 'LANGUAGE',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{
@ -373,7 +375,7 @@ export class FormJndi extends BI.Widget {
}], }],
}, },
{ {
type: FormItemXtype, type: FormItem.xtype,
name: 'APPLET', name: 'APPLET',
nameWidth: 200, nameWidth: 200,
forms: [{ forms: [{

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

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

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

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

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

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

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

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

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

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

17
src/modules/pages/maintain/maintain.ts

@ -1,7 +1,7 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { MaintainModel, MaintainModelXtype } from './maintain.model'; import { MaintainModel } from './maintain.model';
import { MaintainFormXtype } from './forms/form'; import { MaintainForm } from './forms/form';
import { LinkXtype, LinkButton } from 'src/modules/components/link_button/link'; import { LinkButton } from 'src/modules/components/link_button/link';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@ -11,10 +11,11 @@ import { getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { ListView } from '@fui/core'; import { ListView } from '@fui/core';
export const MaintainXtype = 'dec.dcm.maintain'; @shortcut()
@shortcut(MaintainXtype) @store(MaintainModel)
@store(MaintainModelXtype)
export class Maintain extends BI.Widget { export class Maintain extends BI.Widget {
static xtype = 'dec.dcm.maintain';
model: MaintainModel['model']; model: MaintainModel['model'];
store: MaintainModel['store']; store: MaintainModel['store'];
@ -51,7 +52,7 @@ export class Maintain extends BI.Widget {
height: 15, height: 15,
}, },
{ {
type: LinkXtype, type: LinkButton.xtype,
invisible: true, invisible: true,
lgap: 10, lgap: 10,
text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'), text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'),
@ -86,7 +87,7 @@ export class Maintain extends BI.Widget {
const { type } = this.getEditConnection(); const { type } = this.getEditConnection();
return [{ return [{
type: MaintainFormXtype, type: MaintainForm.xtype,
connectionType: type, connectionType: type,
}]; }];
} }

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

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

13
src/modules/title/title.ts

@ -1,14 +1,15 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { TitleModel, TitleModelXtype } from './title.model'; import { TitleModel } from './title.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { TitleDatabase } from './title_database/title_datebase'; import { TitleDatabase } from './title_database/title_datebase';
import { TitleMaintain } from './title_maintain/title_maintain'; import { TitleMaintain } from './title_maintain/title_maintain';
import { LinearSegment, Tab } from '@fui/core'; import { LinearSegment, Tab } from '@fui/core';
export const TitleXtype = 'dec.dcm.title';
@shortcut(TitleXtype) @shortcut()
@store(TitleModelXtype) @store(TitleModel)
export class Title extends BI.Widget { export class Title extends BI.Widget {
static xtype = 'dec.dcm.title';
props = { props = {
baseCls: 'bi-card', baseCls: 'bi-card',
} }
@ -76,11 +77,11 @@ export class Title extends BI.Widget {
switch (index) { switch (index) {
case PAGE_INDEX.DATEBASE: case PAGE_INDEX.DATEBASE:
return { return {
type: TitleDatabase, type: TitleDatabase.xtype,
}; };
case PAGE_INDEX.MAINTAIN: case PAGE_INDEX.MAINTAIN:
return { return {
type: TitleMaintain, type: TitleMaintain.xtype,
}; };
default: default:
return { return {

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

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

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

@ -1,13 +1,13 @@
import { shortcut, store } from '@core/core'; 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 { PAGE_INDEX } from '@constants/constant';
import { Button } from '@fui/core'; import { Button } from '@fui/core';
export const TitleDatabase = 'dec.dcm.title.datebase'; @shortcut()
@store(TitleDatebaseModel)
export class TitleDatabase extends BI.Widget {
static xtype = 'dec.dcm.title.datebase';
@shortcut(TitleDatabase)
@store(TitleDatebaseModelXtype)
export class TitleDatabaseWidget extends BI.Widget {
store: TitleDatebaseModel['store']; store: TitleDatebaseModel['store'];
model: TitleDatebaseModel['model']; model: TitleDatebaseModel['model'];

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

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

11
src/modules/title/title_maintain/title_maintain.ts

@ -1,11 +1,12 @@
import { shortcut, store } from '@core/core'; 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'; import { PAGE_INDEX } from '@constants/constant';
export const TitleMaintain = 'dec.dcm.title.maintain'; @shortcut()
@shortcut(TitleMaintain) @store(TitleMaintainModel)
@store(TitleMaintainModelXtype) export class TitleMaintain extends BI.Widget {
export class TitleMaintainWidget extends BI.Widget { static xtype = 'dec.dcm.title.maintain';
store: TitleMaintainModel['store']; store: TitleMaintainModel['store'];
model: TitleMaintainModel['model']; model: TitleMaintainModel['model'];
render() { render() {

Loading…
Cancel
Save