diff --git a/private/constants.ts b/private/constants.ts index 69ddc79..7c1a515 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -1,4 +1,6 @@ export const OTHER_CONNECT = 'other'; +export const JNDI_CONNECT = 'JNDI'; +export const MYSQL_CONNECT = 'mysql'; export const DEFAULT_INFO = 'DESIGNER'; export const ACTION_DELETE = 'ACTION_DELETE'; export const ACTION_COPY = 'ACTION_COPY'; @@ -6,3 +8,352 @@ export const ACTION_TEST = 'ACTION_TEST'; export const TAB_LINK_SET = 'TAB_LINK_SET'; export const TAB_LINK_POOL = 'TAB_LINK_POOL'; + + +export const DATA_LINKS = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', 'JNDI']; + +export const DATA_BASE_TYPE = [ + { + text: 'APACHE KYLIN', + databaseType: 'apache-kylin', + driver: 'org.apache.kylin.jdbc.Driver', + url: 'jdbc:kylin://:/', + }, + { + text: 'DERBY', + databaseType: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + url: 'jdbc:derby://localhost:1527/', + }, + { + text: 'HP Vertica', + databaseType: 'hp-vertica', + driver: 'com.vertica.jdbc.Driver', + url: 'jdbc:vertica://ip:port/databaseName', + }, + { + text: 'IBM DB2', + databaseType: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + url: 'jdbc:db2://hostname:port/dbname', + }, + { + text: 'INFORMIX', + databaseType: 'informix', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, + { + text: 'Microsoft SQL Server', + databaseType: 'sql-server', + driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + url: 'jdbc:sqlserver://localhost:1433;databaseName=', + }, + { + text: 'Oracle', + databaseType: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + url: 'jdbc:oracle:thin:@localhost:1521:databaseName', + }, + { + text: 'Privotal Greenplum Database', + databaseType: 'pivotal-greenplum-database', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'Postgresql', + databaseType: 'postgresql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'GaussDB 200', + databaseType: 'hw-libr-a', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'MySQL', + databaseType: 'mysql', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], + url: 'jdbc:mysql://localhost/dbname', + }, + { + text: OTHER_CONNECT, + databaseType: 'other', + driver: 'org.h2.Driver', + drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], + url: 'jdbc:h2://${ENV_HOME}/../databaseName', + }, + { + text: 'ADS', + databaseType: 'ads', + driver: 'com.mysql.jdbc.Driver', + url: 'jdbc:mysql://hostname:port/my_ads_db', + }, + { + text: 'Amazon Redshift', + databaseType: 'amazon-redshift', + driver: 'com.amazon.redshift.jdbc4.Driver', + drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], + url: 'jdbc:redshift://endpoint:port/database', + }, + { + text: 'APACHE IMPALA', + databaseType: 'apache-impala', + driver: 'com.cloudera.impala.jdbc41.Driver', + url: 'jdbc:impala://hostname:port/_impala_builtins', + }, + { + text: 'APACHE KYLIN', + databaseType: 'apache-kylin', + driver: 'org.apache.kylin.jdbc.Driver', + url: 'jdbc:kylin://:/', + }, + { + text: 'APACHE Phoenix', + databaseType: 'apache-phoenix', + driver: 'org.apache.phoenix.jdbc.PhoenixDriver', + url: 'jdbc:phoenix:hostname:port/dbname', + }, + { + text: 'DERBY', + databaseType: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + url: 'jdbc:derby://localhost:1527/', + }, + { + text: 'Gbase 8A', + databaseType: 'gbase-8a', + driver: 'com.gbase.jdbc.Driver', + url: 'jdbc:gbase://hostname:port/dbname', + }, + { + text: 'Gbase 8S', + databaseType: 'gbase-8s', + driver: 'com.gbasedbt.jdbc.IfxDriver', + url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}', + }, + { + text: 'Gbase 8T', + databaseType: 'gbase-8t', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, + { + text: 'H2', + databaseType: 'h2', + driver: 'org.h2.Driver', + url: 'jdbc:h2://${ENV_HOME}/../databaseName', + }, + { + text: '华为云DWS', + databaseType: 'hw-dws', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'FusionInsight elk', + databaseType: 'hw-elk', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'FusionInsight HD', + databaseType: 'hw-fusioninsight-hd', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;', + }, + { + text: 'GaussDB 200', + databaseType: 'hw-libr-a', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Hadoop Hive', + databaseType: 'hadoop-hive', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: 'Hbase', + databaseType: 'hbase', + driver: 'org.apache.phoenix.jdbc.PhoenixDriver', + url: 'jdbc:phoenix:hostname:port/dbname', + }, { + text: 'HP Vertica', + databaseType: 'hp-vertica', + driver: 'com.vertica.jdbc.Driver', + url: 'jdbc:vertica://ip:port/databaseName', + }, { + text: 'Hsql', + databaseType: 'hsql', + driver: 'com.fr.third.org.hsqldb.jdbcDriver', + url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]', + }, { + text: 'IBM DB2', + databaseType: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + url: 'jdbc:db2://hostname:port/dbname', + }, { + text: 'INFORMIX', + databaseType: 'informix', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, { + text: 'KINGBASE', + databaseType: 'kingbase', + driver: 'com.kingbase.Driver', + url: 'jdbc:kingbase://hostname:port', + }, { + text: 'Microsoft SQL Server', + databaseType: 'sql-server', + driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + url: 'jdbc:sqlserver://localhost:1433;databaseName=', + }, { + text: 'MySQL', + databaseType: 'mysql', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], + url: 'jdbc:mysql://localhost/dbname', + }, + { + text: 'Oracle', + databaseType: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + url: 'jdbc:oracle:thin:@localhost:1521:databaseName', + }, + { + text: 'Pivotal Greenplum Database', + databaseType: 'pivotal-greenplum-database', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Postgresql', + databaseType: 'postgresql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Presto', + databaseType: 'presto', + driver: 'com.facebook.presto.jdbc.PrestoDriver', + url: 'jdbc:presto://host:port/catalog', + }, { + text: 'SAP HANA', + databaseType: 'sap-hana', + driver: 'com.sap.db.jdbc.Driver', + url: 'jdbc:sap://hostname:port?reconnect=true', + }, { + text: 'SAP Sybase', + databaseType: 'sap-sybase', + driver: 'com.sybase.jdbc4.jdbc.SybDriver', + url: 'jdbc:sybase:Tds:hostname:2638/databasename', + }, { + text: 'SPARK', + databaseType: 'spark', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: 'Sqlite', + databaseType: 'sqlite', + driver: 'org.sqlite.JDBC', + url: 'jdbc:sqlite:[PATH_TO_DB_FILES]', + }, { + text: 'TeraData', + databaseType: 'teradata', + driver: 'com.ncr.teradata.TeraDriver', + url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT', + }, { + text: 'TRANSWARP INCEPTOR', + databaseType: 'transwarp-inceptor', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: JNDI_CONNECT, + }, +]; + +export const JNDI_FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; + +export const OTHER_ATTRIBUTES = [ + { + 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 CONNECT_CHARSET = [ + { + 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', + }, +]; diff --git a/src/app/app.component.scss b/src/app/app.component.scss index 84bed04..b6cfed3 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -326,4 +326,7 @@ .delete-font .b-font:before { content: "\e6c4"; color: inherit; +} +.jndi-notice{ + color: red; } \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c0806e2..96b5730 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,9 +4,6 @@ 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 '../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'; diff --git a/src/app/app.constant.ts b/src/app/app.constant.ts index 0c25e29..fa584b2 100644 --- a/src/app/app.constant.ts +++ b/src/app/app.constant.ts @@ -1,5 +1,4 @@ export const ConstantName = 'dec.constant.database.conf.connect.list'; -export const links = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200']; BI.constant(ConstantName, [ ]); export default ConstantName; diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts index ac0f912..2ce1b2b 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link-set.model.ts @@ -1,7 +1,8 @@ import {ModelType} from '@ui/index'; import {LinkType} from '@ui/type'; import {deleteConnection, testConnection} from '@shared/crud/crud.request'; -import {databaseTyle, getCnnectionName} from './select/select.service'; +import {getCnnectionName} from './select/select.service'; +import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; import {saveConnection} from './link-set.service'; @@ -78,7 +79,7 @@ const Model: ModelType = { const newCopy = { ...data, isSelected: true, - connectionName:name, + connectionName: name, connectionId: '', }; this.model.linkList = [ @@ -124,7 +125,7 @@ const Model: ModelType = { } }, setNewLink(value: string) { - if (!databaseTyle.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { + if (!DATA_BASE_TYPE.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find')); return; @@ -136,14 +137,14 @@ const Model: ModelType = { _setNewLink(value: string) { const name = getCnnectionName(this.model.linkList, value); let data = {}; - databaseTyle.forEach(item => { + DATA_BASE_TYPE.forEach(item => { if (item.text === value) { data = item; } }); this.model.linkList = [ { - connectionName:name, + connectionName: name, isSelected: true, ...data, text: value, @@ -152,13 +153,13 @@ const Model: ModelType = { ]; this.model.linkSelected = { ...data, - connectionName:name, + connectionName: name, isSelected: true, text: value, }; this.model.linkUpdate = { ...data, - connectionName:name, + connectionName: name, text: value, }; }, diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 8644906..32fbc90 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -1,5 +1,5 @@ import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; -import {databaseTyle} from '../select/select.service'; +import {DATA_BASE_TYPE} from '@private/constants'; import MoreLinkItem from './more.link.item.component'; const className = 'fr.component.linkSet.morelink'; let morkLinkItem: any = null; @@ -34,7 +34,7 @@ const Widget: WidgetType = { this._renderItems(); }, _renderItems(text = '') { - const databaseLink = databaseTyle.slice(12, 12 + 33); + const databaseLink = DATA_BASE_TYPE.slice(12, 12 + 33); const items: any[] = []; const that = this; databaseLink.forEach(item => { diff --git a/src/plugins/jndi/jdni.typing.d.ts b/src/app/link_set/right/right.typing.d.ts similarity index 100% rename from src/plugins/jndi/jdni.typing.d.ts rename to src/app/link_set/right/right.typing.d.ts diff --git a/src/app/link_set/right/right_detail/right.detail.component.ts b/src/app/link_set/right/right_detail/right.detail.component.ts index c801ea1..ed73d26 100644 --- a/src/app/link_set/right/right_detail/right.detail.component.ts +++ b/src/app/link_set/right/right_detail/right.detail.component.ts @@ -1,53 +1,31 @@ import {WidgetType, Vertical} from '@ui/index'; import Model from '../../link-set.model'; -import Title from '../right_title/right.title.component'; -import RightShow from '../right_show/right.show.component'; -import RightEdit from '../right_edit/right.edit.component'; -import RightEditMysql from '../right_edit/right.edit.mysql.component'; +import {renderEdit} from './right.detail.service'; import {LinkType} from '@ui/type'; -import pluginListConstant from '../../../app.constant'; + const className = 'fr.component.right.detail'; -let rightDetail: any = null; -const renderEdit = (linkSelected: LinkType): void => { - const plugins: string[] = BI.Constants.getConstant(pluginListConstant); - const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); - let typeEdit = linkSelected.databaseType === 'mysql' ? RightEditMysql : RightEdit; - if (isPlugin) { - typeEdit = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); - } - const showPage = !isPlugin ? RightShow : BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); - rightDetail.populate(BI.createItems([ - { - type: Title, - isEdit: linkSelected.isSelected, - linkSelected, - }, { - type: linkSelected.isSelected ? typeEdit : showPage, - linkSelected, - }, - ])); -}; + const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { linkSelected(linkSelected: LinkType) { - renderEdit(linkSelected); + renderEdit(this.rightDetail, linkSelected); }, }, render() { return { type: Vertical, - cls:'right-content', - ref(_ref: any) { - rightDetail = _ref; + cls: 'right-content', + ref: _ref => { + this.rightDetail = _ref; }, }; }, mounted() { const linkSelected: LinkType = this.model.linkSelected; - renderEdit(linkSelected); + renderEdit(this.rightDetail, linkSelected); }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_set/right/right_detail/right.detail.service.ts b/src/app/link_set/right/right_detail/right.detail.service.ts new file mode 100644 index 0000000..b1b2dd5 --- /dev/null +++ b/src/app/link_set/right/right_detail/right.detail.service.ts @@ -0,0 +1,43 @@ +import Title from '../right_title/right.title.component'; +import RightShow from '../right_show/right.show.component'; +import RightShowJndi from '../right_show/right.show.jndi.component'; +import RightEdit from '../right_edit/right.edit.component'; +import RightEditMysql from '../right_edit/right.edit.mysql.component'; +import RightEditJndi from '../right_edit/right.edit.jndi.component'; +import {LinkType} from '@ui/type'; +import pluginListConstant from '../../../app.constant'; +import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; + +export const renderEdit = (rightDetail, linkSelected: LinkType): void => { + const plugins: string[] = BI.Constants.getConstant(pluginListConstant); + const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); + let editPage = null; + let showPage = null; + switch (linkSelected.text) { + case (MYSQL_CONNECT): + editPage = RightEditMysql; + showPage = RightShow; + break; + case (JNDI_CONNECT): + editPage = RightEditJndi; + showPage = RightShowJndi; + break; + default: + editPage = RightEdit; + showPage = RightShow; + } + if (isPlugin) { + editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); + showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); + } + rightDetail.populate(BI.createItems([ + { + type: Title, + isEdit: linkSelected.isSelected, + linkSelected, + }, { + type: linkSelected.isSelected ? editPage : showPage, + linkSelected, + }, + ])); +}; diff --git a/src/app/link_set/right/right_edit/right.edit.component.ts b/src/app/link_set/right/right_edit/right.edit.component.ts index 539cccc..0b943bd 100644 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.component.ts @@ -1,6 +1,6 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; +import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; @@ -119,7 +119,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: '', }, - ...BI.Constants.getConstant(charset), + ...CONNECT_CHARSET, ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, diff --git a/src/app/link_set/right/right_edit/right.edit.constant.ts b/src/app/link_set/right/right_edit/right.edit.constant.ts deleted file mode 100644 index 27c3754..0000000 --- a/src/app/link_set/right/right_edit/right.edit.constant.ts +++ /dev/null @@ -1,38 +0,0 @@ -export const ConstantName = 'bi.constant.database.conf.charset.list'; - -export const Constant = BI.constant(ConstantName, [ - { - 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', - }, -]); - -export default ConstantName; diff --git a/src/plugins/jndi/jndi.edit.ts b/src/app/link_set/right/right_edit/right.edit.jndi.component.ts similarity index 83% rename from src/plugins/jndi/jndi.edit.ts rename to src/app/link_set/right/right_edit/right.edit.jndi.component.ts index a4283f3..02d0e76 100644 --- a/src/plugins/jndi/jndi.edit.ts +++ b/src/app/link_set/right/right_edit/right.edit.jndi.component.ts @@ -1,16 +1,13 @@ import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; -import {FACTORYS, OTHER_ATTRIBUTES, ORIGINAL_CHARSET_NAMES} 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', -}; +import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; +import {AttributeType} from '../right.typing'; -const classNameEdit = 'dec.plugin.jndi.edit'; +const classNameEdit = 'fr.component.right.edit.jndi'; const Widget = BI.inherit(BI.Widget, { render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + return { type: Vertical, cls: 'right-show', @@ -23,7 +20,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.connectionName, + value: connectionName, }, }, { @@ -45,8 +42,8 @@ const Widget = BI.inherit(BI.Widget, { type: TextValueCombo, cls: 'bi-border', width: 300, - value: form.factory, - items: BI.map(FACTORYS, (index: number, item: string) => { + value: factory, + items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { return { text: item, value: item, @@ -63,7 +60,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.url, + value: url, }, }, { @@ -75,7 +72,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.principal, + value: principal, }, }, { @@ -87,7 +84,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.credentials, + value: credentials, }, }, { @@ -130,7 +127,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form[item.name], + value: this.options[item.name], }, }; }), @@ -166,9 +163,9 @@ const Widget = BI.inherit(BI.Widget, { width: 300, items: [{ text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: form.originalCharsetName, + value: originalCharsetName, }, - ...ORIGINAL_CHARSET_NAMES, + ...CONNECT_CHARSET, ], }, }, @@ -181,7 +178,3 @@ const Widget = BI.inherit(BI.Widget, { }); 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); diff --git a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts index 7b65bd5..b7b55a5 100644 --- a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts @@ -1,6 +1,6 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; +import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; @@ -91,7 +91,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: '', }, - ...BI.Constants.getConstant(charset), + ...CONNECT_CHARSET, ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, diff --git a/src/plugins/jndi/jndi.preview.ts b/src/app/link_set/right/right_show/right.show.jndi.component.ts similarity index 79% rename from src/plugins/jndi/jndi.preview.ts rename to src/app/link_set/right/right_show/right.show.jndi.component.ts index 5000f20..b102726 100644 --- a/src/plugins/jndi/jndi.preview.ts +++ b/src/app/link_set/right/right_show/right.show.jndi.component.ts @@ -1,14 +1,13 @@ -import {Vertical, Label, TextButton} from '@ui'; +import {Vertical, TextButton, Label} from '@ui'; import FormItem from '@shared/components/form.item.component'; -import {FormType, AttributeType} from './jdni.typing'; -import {OTHER_ATTRIBUTES} from './jndi.service'; +import {OTHER_ATTRIBUTES} from '@private/constants'; +import {AttributeType} from '../right.typing'; -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, { +const className = 'fr.component.right.show.jndi'; +const Widget = BI.inherit(BI.Widget, { render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + return { type: Vertical, cls: 'right-show', @@ -18,7 +17,7 @@ const jndiWidget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), form: { type: Label, - text: jndiForm.connectionName, + text: connectionName, }, }, { @@ -38,7 +37,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.factory, + text: factory, }, }, { @@ -47,7 +46,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.url, + text: url, }, }, { @@ -56,7 +55,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.principal, + text: principal, }, }, { @@ -65,7 +64,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.credentials, + text: credentials, }, }, { @@ -105,7 +104,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm[item.name], + text: this.options[item.name], }, }; }), @@ -128,12 +127,12 @@ const jndiWidget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: Label, - text: jndiForm.originalCharsetName ? jndiForm.originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), }, }, ], }; }, }); -BI.shortcut(JndiPreview, jndiWidget); -BI.constant('dec.constant.database.conf.connect.form.jndi.preview', JndiPreview); +BI.shortcut(className, Widget); +export default className; diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.component.ts index cf3d65f..243dc04 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.component.ts @@ -1,7 +1,8 @@ import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui'; import selectModel from '../link-set.model'; import {moreLink} from '../more/more.link.service'; -import connectList, {links} from '../../app.constant'; +import connectList from '../../app.constant'; +import {DATA_LINKS} from '@private/constants'; const className = 'fr.linkset.select'; const Widget: WidgetType = { _store() { @@ -12,7 +13,7 @@ const Widget: WidgetType = { return { type: Combo, - cls:'select', + cls: 'select', trigger: 'click', adjustYOffset: 4, el: { @@ -23,8 +24,8 @@ const Widget: WidgetType = { popup: { el: { type: ButtonGroup, - cls:'database-link-items', - items: [...BI.map([...links, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { + cls: 'database-link-items', + items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { return { type: TextItem, height: 24, @@ -56,7 +57,7 @@ const Widget: WidgetType = { }, maxHeight: 400, }, - listeners:[{ + listeners: [{ eventName: 'EVENT_CHANGE', action: (v: string) => { if (v === 'more') { diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index 99c5d9c..0e11c16 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -1,266 +1,5 @@ import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -import {OTHER_CONNECT} from '@private/constants'; - -export const databaseTyle = [ - { - text:'APACHE KYLIN', - databaseType: 'apache-kylin', - driver: 'org.apache.kylin.jdbc.Driver', - url: 'jdbc:kylin://:/', - }, - { - text:'DERBY', - databaseType: 'derby', - driver: 'org.apache.derby.jdbc.ClientDriver', - url: 'jdbc:derby://localhost:1527/', - }, - { - text:'HP Vertica', - databaseType: 'hp-vertica', - driver: 'com.vertica.jdbc.Driver', - url: 'jdbc:vertica://ip:port/databaseName', - }, - { - text:'IBM DB2', - databaseType: 'ibm-db2', - driver: 'com.ibm.db2.jcc.DB2Driver', - url: 'jdbc:db2://hostname:port/dbname', - }, - { - text:'INFORMIX', - databaseType: 'informix', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, - { - text:'Microsoft SQL Server', - databaseType: 'sql-server', - driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - url: 'jdbc:sqlserver://localhost:1433;databaseName=', - }, - { - text:'Oracle', - databaseType: 'oracle', - driver: 'oracle.jdbc.driver.OracleDriver', - url: 'jdbc:oracle:thin:@localhost:1521:databaseName', - }, - { - text:'Privotal Greenplum Database', - databaseType: 'pivotal-greenplum-database', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'Postgresql', - databaseType: 'postgresql', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'GaussDB 200', - databaseType: 'hw-libr-a', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'MySQL', - databaseType: 'mysql', - driver: 'com.mysql.jdbc.Driver', - drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], - url: 'jdbc:mysql://localhost/dbname', - }, - { - text: OTHER_CONNECT, - databaseType: 'other', - driver: 'org.h2.Driver', - drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], - url: 'jdbc:h2://${ENV_HOME}/../databaseName', - }, - { - text:'ADS', - databaseType:'ads', - driver:'com.mysql.jdbc.Driver', - url:'jdbc:mysql://hostname:port/my_ads_db', - }, - { - text:'Amazon Redshift', - databaseType:'amazon-redshift', - driver: 'com.amazon.redshift.jdbc4.Driver', - drivers:['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], - url:'jdbc:redshift://endpoint:port/database', - }, - { - text:'APACHE IMPALA', - databaseType:'apache-impala', - driver:'com.cloudera.impala.jdbc41.Driver', - url:'jdbc:impala://hostname:port/_impala_builtins', - }, - { - text:'APACHE KYLIN', - databaseType:'apache-kylin', - driver:'org.apache.kylin.jdbc.Driver', - url:'jdbc:kylin://:/', - }, - { - text:'APACHE Phoenix', - databaseType: 'apache-phoenix', - driver: 'org.apache.phoenix.jdbc.PhoenixDriver', - url: 'jdbc:phoenix:hostname:port/dbname', - }, - { - text:'DERBY', - databaseType: 'derby', - driver: 'org.apache.derby.jdbc.ClientDriver', - url: 'jdbc:derby://localhost:1527/', - }, - { - text:'Gbase 8A', - databaseType: 'gbase-8a', - driver: 'com.gbase.jdbc.Driver', - url: 'jdbc:gbase://hostname:port/dbname', - }, - { - text:'Gbase 8S', - databaseType: 'gbase-8s', - driver: 'com.gbasedbt.jdbc.IfxDriver', - url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}', - }, - { - text:'Gbase 8T', - databaseType: 'gbase-8t', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, - { - text:'H2', - databaseType: 'h2', - driver: 'org.h2.Driver', - url: 'jdbc:h2://${ENV_HOME}/../databaseName', - }, - { - text:'华为云DWS', - databaseType: 'hw-dws', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'FusionInsight elk', - databaseType: 'hw-elk', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'FusionInsight HD', - databaseType: 'hw-fusioninsight-hd', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;', - }, - { - text:'GaussDB 200', - databaseType: 'hw-libr-a', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Hadoop Hive', - databaseType: 'hadoop-hive', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, { - text:'Hbase', - databaseType: 'hbase', - driver: 'org.apache.phoenix.jdbc.PhoenixDriver', - url: 'jdbc:phoenix:hostname:port/dbname', - }, { - text:'HP Vertica', - databaseType: 'hp-vertica', - driver: 'com.vertica.jdbc.Driver', - url: 'jdbc:vertica://ip:port/databaseName', - }, { - text:'Hsql', - databaseType: 'hsql', - driver: 'com.fr.third.org.hsqldb.jdbcDriver', - url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]', - }, { - text:'IBM DB2', - databaseType: 'ibm-db2', - driver: 'com.ibm.db2.jcc.DB2Driver', - url: 'jdbc:db2://hostname:port/dbname', - }, { - text:'INFORMIX', - databaseType: 'informix', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, { - text:'KINGBASE', - databaseType: 'kingbase', - driver: 'com.kingbase.Driver', - url: 'jdbc:kingbase://hostname:port', - }, { - text:'Microsoft SQL Server', - databaseType: 'sql-server', - driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - url: 'jdbc:sqlserver://localhost:1433;databaseName=', - }, { - text:'MySQL', - databaseType: 'mysql', - driver: 'com.mysql.jdbc.Driver', - drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], - url: 'jdbc:mysql://localhost/dbname', - }, - { - text:'Oracle', - databaseType: 'oracle', - driver: 'oracle.jdbc.driver.OracleDriver', - url: 'jdbc:oracle:thin:@localhost:1521:databaseName', - }, - { - text:'Pivotal Greenplum Database', - databaseType: 'pivotal-greenplum-database', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Postgresql', - databaseType: 'postgresql', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Presto', - databaseType: 'presto', - driver: 'com.facebook.presto.jdbc.PrestoDriver', - url: 'jdbc:presto://host:port/catalog', - }, { - text:'SAP HANA', - databaseType: 'sap-hana', - driver: 'com.sap.db.jdbc.Driver', - url: 'jdbc:sap://hostname:port?reconnect=true', - }, { - text:'SAP Sybase', - databaseType: 'sap-sybase', - driver: 'com.sybase.jdbc4.jdbc.SybDriver', - url: 'jdbc:sybase:Tds:hostname:2638/databasename', - }, { - text:'SPARK', - databaseType: 'spark', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, { - text:'Sqlite', - databaseType: 'sqlite', - driver: 'org.sqlite.JDBC', - url: 'jdbc:sqlite:[PATH_TO_DB_FILES]', - }, { - text:'TeraData', - databaseType: 'teradata', - driver: 'com.ncr.teradata.TeraDriver', - url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT', - }, { - text:'TRANSWARP INCEPTOR', - databaseType: 'transwarp-inceptor', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, -]; export const getCnnectionName = (links: LinkType[], name: string): string => { const plugins: string[] = BI.Constants.getConstant(pluginListConstant); diff --git a/src/plugins/jndi/jdni.scss b/src/plugins/jndi/jdni.scss deleted file mode 100644 index a3294bb..0000000 --- a/src/plugins/jndi/jdni.scss +++ /dev/null @@ -1,3 +0,0 @@ -.jndi-notice{ - color: red; -} \ No newline at end of file diff --git a/src/plugins/jndi/jndi.pool.ts b/src/plugins/jndi/jndi.pool.ts deleted file mode 100644 index ba12135..0000000 --- a/src/plugins/jndi/jndi.pool.ts +++ /dev/null @@ -1,54 +0,0 @@ -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); diff --git a/src/plugins/jndi/jndi.service.ts b/src/plugins/jndi/jndi.service.ts deleted file mode 100644 index d1ff6d0..0000000 --- a/src/plugins/jndi/jndi.service.ts +++ /dev/null @@ -1,87 +0,0 @@ -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 OTHER_ATTRIBUTES: 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 ORIGINAL_CHARSET_NAMES = [ - { - 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', - }, -] -;