Browse Source

feat: 加入jdni连接

qufenxi
alan 6 years ago
parent
commit
16263ffd98
  1. 7
      i18n/zh_cn.properties
  2. 6
      private/i18n.ts
  3. 6
      src/app/app.component.ts
  4. 3
      src/plugins/jndi/jdni.scss
  5. 25
      src/plugins/jndi/jdni.typing.d.ts
  6. 187
      src/plugins/jndi/jndi.edit.ts
  7. 54
      src/plugins/jndi/jndi.pool.ts
  8. 139
      src/plugins/jndi/jndi.preview.ts
  9. 87
      src/plugins/jndi/jndi.service.ts
  10. 6
      src/shared/components/form.item.component.ts

7
i18n/zh_cn.properties

@ -52,4 +52,9 @@ Dec-Dcm_Connection_Form_Pattern= 模式
Dec-Dcm_Connection_Form_Database_Addr= 数据库地址
Dec-Dcm_Connection_Form_Database_Port= 端口号
Dec-Dcm_Connection_Make_Sure_Delete= 确定删除该数据连接?
Dec-Dcm_Connection_ReConnect= 重新连接
Dec-Dcm_Connection_ReConnect= 重新连接
Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字
Dec-Dcm_Connection_Form_JNDI_Context= 上下文
Dec-Dcm_Connection_Form_JNDI_Advanced= 高级
Dec-Dcm_Connection_Form_JNDI_Other_Attributes= 其他属性
Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes= 收起

6
private/i18n.ts

@ -54,4 +54,10 @@ export default {
'Dec-Dcm_Connection_Form_Database_Port': '端口号',
'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?',
'Dec-Dcm_Connection_ReConnect': '重新连接',
'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字',
'Dec-Dcm_Connection_Form_JNDI_Context': '上下文',
'Dec-Dcm_Connection_Form_JNDI_Advanced': '高级',
'Dec-Dcm_Connection_Form_JNDI_Other_Attributes': '其他属性',
'Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes': '收起',
'Dec-Dcm_Connection_Form_JNDI_Notice': '注意:需要把包含INITIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下.',
};

6
src/app/app.component.ts

@ -4,9 +4,9 @@ import appModel from './app.model';
import title from './title/title.component';
import linkSet from './link_set/link-set.component';
import linkStatus from './link_status/link_status.component';
import '../demo/plugin.redis.edit';
import '../demo/plugin.redis.preview';
import '../demo/plugin.tedis.pool';
import '../plugins/jndi/jndi.edit';
import '../plugins/jndi/jndi.pool';
import '../plugins/jndi/jndi.preview';
import {fetchLinkList} from '../shared/crud/crud.request';
import './app.component.scss';

3
src/plugins/jndi/jdni.scss

@ -0,0 +1,3 @@
.jndi-notice{
color: red;
}

25
src/plugins/jndi/jdni.typing.d.ts vendored

@ -0,0 +1,25 @@
export interface AttributeType {
text: string;
name: string;
}
export interface FormType {
connectionName?: string;
factory?: string;
url?: string;
principal?: string;
credentials?: string;
originalCharsetName?: string;
objectFactories?: string;
stateFactories?: string;
urlPkgPrefixes?: string;
dnsUrl?: string;
authoritative?: string;
batchSize?: string;
referral?: string;
securityProtocol?: string;
securityAuthentication?: string;
language?: string;
applet?: string;
}

187
src/plugins/jndi/jndi.edit.ts

@ -0,0 +1,187 @@
import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui';
import {factorys, otherAttributes, originalCharsetNames} from './jndi.service';
import FormItem from '@shared/components/form.item.component';
import {AttributeType, FormType} from './jdni.typing';
import './jdni.scss';
const RedisConstantName = 'dec.constant.database.conf.connect.form.jndi.value';
const form: FormType = {
url: '192.168.1.22',
};
const classNameEdit = 'dec.plugin.jndi.edit';
const Widget = BI.inherit(BI.Widget, {
render() {
return {
type: Vertical,
cls: 'right-show',
items: [
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
form: {
type: Editor,
cls: 'bi-border',
width: 300,
allowBlank: true,
value: form.connectionName,
},
},
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'),
height: 160,
ref: _ref => {
this.JndiForm = _ref;
},
form: {
type: Vertical,
cls: 'right-form',
items: [
{
type: FormItem,
text: 'INTIAL_CONTEXT_FACTORY',
width: 180,
form: {
type: TextValueCombo,
cls: 'bi-border',
width: 300,
value: form.factory,
items: BI.map(factorys, (index: number, item: string) => {
return {
text: item,
value: item,
};
}),
},
},
{
type: FormItem,
text: 'PROVIDER_URL',
width: 180,
form: {
type: Editor,
cls: 'bi-border',
width: 300,
allowBlank: true,
value: form.url,
},
},
{
type: FormItem,
text: 'SECURITY_PRINCIPAL',
width: 180,
form: {
type: Editor,
cls: 'bi-border',
width: 300,
allowBlank: true,
value: form.principal,
},
},
{
type: FormItem,
text: 'SECURITY_CREDENTIALS',
width: 180,
form: {
type: Editor,
cls: 'bi-border',
width: 300,
allowBlank: true,
value: form.credentials,
},
},
{
type: FormItem,
width: 180,
form: {
type: TextButton,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'),
width: 300,
textAlign: 'right',
value: true,
ref: _ref => {
this.Collapse = _ref;
},
handler: () => {
const isCollapse = this.Collapse.getValue();
const height = isCollapse ? 550 : 160;
const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes');
this.JndiForm.setHeight(height);
this.Collapse.setValue(!isCollapse);
this.Collapse.setText(text);
this.OtherAttributes.setVisible(isCollapse);
},
},
},
{
type: Vertical,
cls: 'right-form',
invisible: false,
ref: _ref => {
this.OtherAttributes = _ref;
},
items: BI.map(otherAttributes, (index: number, item: AttributeType) => {
return {
type: FormItem,
text: item.text,
width: 180,
form: {
type: Editor,
cls: 'bi-border',
width: 300,
allowBlank: true,
value: form[item.name],
},
};
}),
},
],
},
},
{
type: FormItem,
text: '',
height: 25,
form: {
type: Label,
cls: 'jndi-notice',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'),
},
},
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'),
height: 25,
form: {
type: Vertical,
cls: 'right-form',
items: [
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
width: 180,
form: {
type: TextValueCombo,
cls: 'bi-border',
width: 300,
items: [{
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: form.originalCharsetName,
},
...originalCharsetNames,
],
},
},
],
},
},
],
};
},
});
BI.shortcut(classNameEdit, Widget);
export default classNameEdit;
export const ConstantName = 'dec.constant.database.conf.connect.list';
BI.config(ConstantName, (datas: string[]) => [...datas, 'JNDI']);
BI.constant(RedisConstantName, form);
BI.constant('dec.constant.database.conf.connect.form.jndi.edit', classNameEdit);

54
src/plugins/jndi/jndi.pool.ts

@ -0,0 +1,54 @@
const JndiPool = 'fr.plugin.jndi.pool';
const JndiWidget = BI.inherit(BI.Widget, {
render() {
const {maxActive, numActive} = this.options;
return {
type: 'bi.left',
items: [
{
type: 'bi.left',
cls: 'right-status-item',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board-item',
items: [
{
type: 'bi.label',
cls: 'right-status-text',
extraCls: 'card-font1',
text: numActive,
},
{
type: 'bi.label',
cls: 'right-status-text',
text: '/',
},
{
type: 'bi.label',
cls: 'right-status-text',
text: maxActive,
},
],
},
{
type: 'bi.label',
height: 20,
text: BI.i18nText('Dec-Dcm_Active_Connections_Number'),
},
],
},
],
},
],
};
},
});
BI.shortcut(JndiPool, JndiWidget);
BI.constant('dec.constant.database.conf.connect.form.jndi.pool', JndiPool);

139
src/plugins/jndi/jndi.preview.ts

@ -0,0 +1,139 @@
import {Vertical, Label, TextButton} from '@ui';
import FormItem from '@shared/components/form.item.component';
import {FormType, AttributeType} from './jdni.typing';
import {otherAttributes} from './jndi.service';
const JndiPreview = 'fr.plugin.jndi.preview';
const JndiConstantName = 'dec.constant.database.conf.connect.form.jndi.value';
const jndiForm: FormType = BI.Constants.getConstant(JndiConstantName);
const jndiWidget = BI.inherit(BI.Widget, {
render() {
return {
type: Vertical,
cls: 'right-show',
items: [
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
form: {
type: Label,
text: jndiForm.connectionName,
},
},
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'),
height: 160,
ref: _ref => {
this.JndiForm = _ref;
},
form: {
type: Vertical,
cls: 'right-form',
items: [
{
type: FormItem,
text: 'INTIAL_CONTEXT_FACTORY',
width: 180,
form: {
type: Label,
text: jndiForm.factory,
},
},
{
type: FormItem,
text: 'PROVIDER_URL',
width: 180,
form: {
type: Label,
text: jndiForm.url,
},
},
{
type: FormItem,
text: 'SECURITY_PRINCIPAL',
width: 180,
form: {
type: Label,
text: jndiForm.principal,
},
},
{
type: FormItem,
text: 'SECURITY_CREDENTIALS',
width: 180,
form: {
type: Label,
text: jndiForm.credentials,
},
},
{
type: FormItem,
width: 180,
form: {
type: TextButton,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'),
width: 300,
textAlign: 'right',
value: true,
ref: _ref => {
this.Collapse = _ref;
},
handler: () => {
const isCollapse = this.Collapse.getValue();
const height = isCollapse ? 550 : 160;
const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes');
this.JndiForm.setHeight(height);
this.Collapse.setValue(!isCollapse);
this.Collapse.setText(text);
this.OtherAttributes.setVisible(isCollapse);
},
},
},
{
type: Vertical,
cls: 'right-form',
invisible: false,
ref: _ref => {
this.OtherAttributes = _ref;
},
items: BI.map(otherAttributes, (index: number, item: AttributeType) => {
return {
type: FormItem,
text: item.text,
width: 180,
form: {
type: Label,
text: jndiForm[item.name],
},
};
}),
},
],
},
},
{
type: FormItem,
text: '',
height: 25,
form: {
type: Label,
cls: 'jndi-notice',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'),
},
},
{
type: FormItem,
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
form: {
type: Label,
text: jndiForm.originalCharsetName ? jndiForm.originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
},
},
],
};
},
});
BI.shortcut(JndiPreview, jndiWidget);
BI.constant('dec.constant.database.conf.connect.form.jndi.preview', JndiPreview);

87
src/plugins/jndi/jndi.service.ts

@ -0,0 +1,87 @@
import {AttributeType} from './jdni.typing';
export const factorys = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory'];
export const otherAttributes: AttributeType[] = [
{
text: 'OBJECT_FACTORIES',
name: 'objectFactories',
},
{
text: 'STATE_FACTORIES',
name: 'stateFactories',
},
{
text: 'URL_PKG_PREFIXES',
name: 'urlPkgPrefixes',
},
{
text: 'DNS_URL',
name: 'dnsUrl',
},
{
text: 'AUTHORITATIVE',
name: 'authoritative',
},
{
text: 'BATCHSIZE',
name: 'batchSize',
},
{
text: 'REFERRAL',
name: 'referral',
},
{
text: 'SECURITY_PROTOCOL',
name: 'securityProtocol',
},
{
text: 'SECURITY_AUTHENTICATION',
name: 'securityAuthentication',
},
{
text: 'LANGUAGE',
name: 'language',
},
{
text: 'APPLET',
name: 'applet',
},
];
export const originalCharsetNames = [
{
text: 'GBK',
value: 'GBK',
},
{
text: 'BIG5',
value: 'BIG5',
},
{
text: 'ISO-8859-1',
value: 'ISO-8859-1',
},
{
text: 'UTF-8',
value: 'UTF-8',
},
{
text: 'UTF-16',
value: 'UTF-16',
},
{
text: 'EUC_JP',
value: 'EUC_JP',
},
{
text: 'EUC_KR',
value: 'EUC_KR',
},
{
text: 'CP850',
value: 'CP850',
},
]
;

6
src/shared/components/form.item.component.ts

@ -2,12 +2,12 @@ import {WidgetType, Htape, Label} from '@ui/index';
const className = 'fr.shared.component.form.item';
const Widget: WidgetType = {
render() {
const {text, form, hint, height} = this.options;
const {text, form, hint, height, width = 115} = this.options;
return {
type: Htape,
cls: 'both-side',
height:height ? height : 24,
height: height ? height : 24,
items: [{
el: {
type: Label,
@ -15,7 +15,7 @@ const Widget: WidgetType = {
textAlign: 'left',
text,
},
width: 115,
width,
}, form, {
type: Label,
cls: 'hint',

Loading…
Cancel
Save