帆软决策平台数据连接界面库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

187 lines
5.9 KiB

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);