diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 6509988..13c2e30 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -30,7 +30,7 @@ Dec-Dcm_Connection_Option_Cannot_Find= 找不到该连接的配置信息 Dec-Dcm_Connection_Config_No_Save= 当前设置尚未保存,是否保存? Dec-Dcm_Connection_New= 新建数据连接 Dec-Dcm_Connection_More= 更多数据连接... -Dec-Dcm_Connection_More-Title= 更多数据连接 +Dec-Dcm_Connection_More_Title= 更多数据连接 Dec-Dcm_Connection_Other= 其他 Dec-Dcm_Connection_Plase_Add_One= 请选择左侧数据连接或点击新建数据连接 Dec-Dcm_Connection_Is_Existence= 数据连接名已存在 @@ -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= 重新连接 \ No newline at end of file +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= 收起 \ No newline at end of file diff --git a/package.json b/package.json index 716314e..8c5a597 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "eslint": "^5.16.0", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", + "less": "^3.9.0", + "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.6.0", "node-sass": "^4.11.0", "path": "^0.12.7", @@ -29,5 +31,8 @@ "webpack-cli": "^3.3.0", "webpack-dev-server": "^3.2.1", "webpack-stream": "^5.2.1" + }, + "optionalDependencies": { + "fineui": "git+ssh://git@cloud.finedevelop.com:7999/visual/fineui.git" } } diff --git a/private/constants.ts b/private/constants.ts index 69ddc79..f882542 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,366 @@ 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_OTHER = [ + { + 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 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', + }, + ...DATA_BASE_TYPE_OTHER, + { + 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', + }, +]; + + +const DecDcm = { + TEST_STATUS_WAITING: 1, + TEST_STATUS_SUCCESS: 2, + TEST_STATUS_FAIL: 3, +}; + +export default DecDcm; diff --git a/private/i18n.ts b/private/i18n.ts index 3f234ea..03caabc 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -31,7 +31,7 @@ export default { 'Dec-Dcm_Connection_Config_No_Save': '当前设置尚未保存,是否保存?', 'Dec-Dcm_Connection_New': '新建数据连接', 'Dec-Dcm_Connection_More': '更多数据连接...', - 'Dec-Dcm_Connection_More-Title': '更多数据连接', + 'Dec-Dcm_Connection_More_Title': '更多数据连接', 'Dec-Dcm_Connection_Other': '其他', 'Dec-Dcm_Connection_Plase_Add_One': '请选择左侧数据连接或点击新建数据连接', 'Dec-Dcm_Connection_Is_Existence': '数据连接名已存在', @@ -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目录下.', }; diff --git a/src/app/app.component.scss b/src/app/app.component.scss deleted file mode 100644 index 84bed04..0000000 --- a/src/app/app.component.scss +++ /dev/null @@ -1,329 +0,0 @@ -.database-connection-layout{ - width: 100%; - height: 100%; - background-color: #f7f8fa; - .title{ - background-color: #fff; - border-bottom: 1px solid #e8eaed; - .dec-title-item{ - height: 39px; - line-height: 39px; - padding-left: 15px; - padding-right: 15px; - text-align: center; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - position: relative; - flex-shrink: 0; - font-weight: 700; - cursor: pointer; - } - .dec-title-item-selected{ - color: #3685f2; - border-bottom: solid 2px #3685f2; - } - .close-button { - position: absolute !important; - right: 5px; - top: 5px; - width: 30px; - height: 30px; - cursor: pointer; - background-image: url("../img/icon_close9x9_normal.png"); - background-repeat: no-repeat; - background-position: center; - } - } - .linkset{ - margin: 10px; - bottom: 0px; - background-color: #ffffff; - } - .linkStatus{ - margin: 10px; - top: 40px; - background-color: #ffffff; - } -} - -.database-left{ - border-right: 1px solid #e8eaed; - .select-group{ - border-bottom: 1px solid #e8eaed; - .select{ - margin: 10px; - .database-link-items{ - padding-left:10px; - .link-item{ - border-top: 1px solid #e8eaed; - } - } - } - .status-title{ - font-weight: 700; - margin-left: 12px; - margin-top: 12px; - } - } - .left-list{ - margin: 10px; - .left-item{ - height: 24px; - line-height: 24px; - cursor: pointer; - &:hover{ - background-color: rgba(54,133,242,.05); - .icons{ - .action-icon{ - visibility: visible !important; - } - - } - } - .icons{ - float: right !important; - .action-icon{ - visibility: hidden; - } - .b-font{ - font-size: 16px; - } - } - } - .left-item-selected{ - background-color: rgba(54,133,242,.05); - .link-title{ - color: #3685f2; - } - } - } -} -.database-right{ - min-width: 400px; - overflow: auto; - .bi-flex-center-adapt-layout{ - height: 100%; - .data-connection-background{ - background: url(../img/resources.png) center center no-repeat; - background-size: contain; - } - } - .right-status-title{ - border-bottom: 1px solid #e8eaed; - color: #3d4d66; - line-height: 40px; - padding-left: 10px; - font-weight: 700; - } - .right-status-body{ - margin: 10px 30px 0px 30px; - height: 50%; - .right-status-item{ - height: 150px; - width: 50%; - top: 0; left: 0; - position: absolute !important; - .right-status-board { margin-left: 25px; position: relative !important; left: -25px;} - } - .right-status-right{ - height: 150px; - width: 50%; - top: 0; right:0; - position: absolute !important; - .right-status-board { margin-right: 25px; position: relative !important; left: 25px; } - } - .right-status-board{ - background-color: #f7f8fa; - color: #3d4d66; - width: 100%; - height: 100%; - .right-status-board-item{ - text-align: center; - margin-top: 38px; - .right-status-text{ - display: inline-block; - } - .card-font1{ - color: #13CD66; - font-size: 32px; - } - .card-font2{ - color: #3685F2; - font-size: 32px; - } - } - - } - } - .right-content{ - height: 100%; - .right-title{ - border-bottom: 1px solid #e8eaed; - color: #3d4d66; - line-height: 40px; - padding-left: 10px; - .right-title-text{ - font-weight: 700; - } - .right-title-button{ - float: right !important; - margin-right: 10px; - margin-top: 8px; - } - } - .right-show{ - margin: 10px; - .right-form{ - width: 100%; - } - } - } -} -.both-side{ - line-height: 24px; - margin-bottom: 10px; - .left{ - white-space: nowrap; - text-overflow: ellipsis; - position: relative; - flex-shrink: 0; - font-weight: 700; - } - .hint{ - padding-left: 5px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - position: relative; - flex-shrink: 0; - margin-left: 5px; - color: #9ea6b2; - } -} -.shared-component-title{ - height: 24px; - line-height: 24px; - margin-bottom: 10px; - color: #9ea6b2; - border-bottom: 1px solid #e8eaed; -} -.comfirm-content{ - margin-top: 40px; - margin-left: 20px; - .comfirm-icon{ - background-image: url("../img/warning.png"); - background-size: contain; - margin-right: 12px; - } - .bi-text{ - height: 50px; - line-height: 50px; - margin-left: 12px; - } -} -.more-link{ - .more-link-item{ - width: 538px; - overflow: hidden auto; - left: -10px !important; - right: 0px; - top: 10px; - bottom: 0px; - position: absolute; - height: 380px; - .link-item{ - margin-left: 10px; - margin-bottom: 10px; - cursor: pointer; - border: solid 1px #fff; - &:hover{ - border: solid 1px #3480f2; - } - .selected{ - position: absolute !important; - right: -1px; - top: -1px; - height: 30px; - width: 30px; - background: url(../img/database-selected.png) center center no-repeat; - background-size: contain; - } - .text{ - height: 27px; - line-height: 27px; - padding-left: 2px; - padding-right: 2px; - text-align: center; - white-space: nowrap; - background: #F0F3F7; - } - } - - } -} -.popover-notitle{ - .bi-header-background{ - display: none; - } - .bi-absolute-layout{ - top:0px !important; - } -} -.bi-custom-show{ - .show-content{ - text-align: center; - .loading-icon{ - display: block; - background: url(../img/loading.gif) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .success-icon{ - display: block; - background: url(../img/success.png) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .error-icon{ - display: block; - background: url(../img/error.png) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .buttons{ - margin-top: 18px; - div{ - margin: 0 4px; - } - } - } - .show-more{ - text-align: left !important; - height: 73px; - background: #F2F4F7; - margin-bottom: 10px; - padding: 5px; - margin-top: 10px; - } -} - -.link-font .b-font:before { - content: "\e759"; - color: inherit; -} -.link-text-font .b-font:before { - content: "\e763"; - color: inherit; -} -.info-font .b-font:before { - content: "\e63c"; - color: inherit; -} -.delete-font .b-font:before { - content: "\e6c4"; - color: inherit; -} \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts deleted file mode 100644 index 2a42856..0000000 --- a/src/app/app.component.ts +++ /dev/null @@ -1,48 +0,0 @@ -import {Vtape} from '../ui/index'; -import {LinkType} from '@ui/type'; -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 {fetchLinkList} from '../shared/crud/crud.request'; -import './app.component.scss'; - -const className = 'fr.main'; -const Widget = BI.inherit(BI.Widget, { - _store() { - return BI.Models.getModel(appModel); - }, - render() { - return { - type: Vtape, - cls: 'database-connection-layout', - items: [{ - el: { - type: title, - }, - height: 40, - }, - { - type: linkSet, - }, - { - type: linkStatus, - }, - ], - }; - }, - mounted() { - /** - * 获取数据连接列表 - */ - fetchLinkList((linkList: LinkType[]) => { - this.store.setLinkList(linkList); - }); - }, -}); -BI.shortcut(className, Widget); - -export default className; 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/app.model.ts b/src/app/app.model.ts index 761035a..0698887 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -1,13 +1,16 @@ -const className = 'fr.model.main'; +const className = 'dec.dcm.model.main'; import {ModelType} from '@ui'; import {LinkType} from '@ui/type'; +import {fetchLinkList} from '../shared/crud/crud.request'; +import {TAB_LINK_SET} from '@private/constants'; + const linkList: LinkType[] = []; const Model: ModelType = { childContext: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'moreLinkSelected', 'statusSelected', 'connectionNameErr'], state () { return { - tab: BI.i18nText('Dec-Dcm_Connection_Management'), + tab: '', linkList, linkSelected: {}, linkUpdate: {}, @@ -17,12 +20,16 @@ const Model: ModelType = { }; }, computed: { - + }, actions: { - setLinkList(value: LinkType[]) { - this.model.linkList = value; + initData(callback: Function) { + fetchLinkList((linkList: LinkType[]) => { + this.model.linkList = linkList; + this.model.tab = TAB_LINK_SET; + callback(); + }); }, }, }; diff --git a/src/app/app.ts b/src/app/app.ts new file mode 100644 index 0000000..de16680 --- /dev/null +++ b/src/app/app.ts @@ -0,0 +1,55 @@ +import {Vtape, Absolute, LinearSegment} from '../ui/index'; +import appModel from './app.model'; +import title from './title/title'; +import linkSet from './connection/link_set'; +import linkStatus from './status/link_status'; +import '../less/index.less'; + +const className = 'dec.dcm.main'; +const Widget = BI.inherit(BI.Widget, { + props: { + baseCls: 'dec-webui-dcm-layout bi-background', + }, + _store() { + return BI.Models.getModel(appModel); + }, + beforeInit (callback) { + this.store.initData(callback); + }, + render() { + return { + type: Vtape, + items: [ + { + el: { + type: title, + }, + height: 40, + }, + { + type: Absolute, + items: [{ + el: { + type: linkSet, + }, + left: 10, + top: 10, + right: 10, + bottom: 10, + }, { + el: { + type: linkStatus, + }, + left: 10, + top: 10, + right: 10, + bottom: 10, + }], + }, + ], + }; + }, +}); +BI.shortcut(className, Widget); + +export default className; diff --git a/src/app/connection/left/item/left_item.less b/src/app/connection/left/item/left_item.less new file mode 100644 index 0000000..a3d0766 --- /dev/null +++ b/src/app/connection/left/item/left_item.less @@ -0,0 +1,4 @@ +@import '../../../../less/index.less'; +.dec-webui-dcm-connection-left-item{ + .hover-visible(link-item-icon); +} \ No newline at end of file diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts new file mode 100644 index 0000000..4e88046 --- /dev/null +++ b/src/app/connection/left/item/left_item.ts @@ -0,0 +1,77 @@ +import './left_item.less'; +import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui'; +import ItemIcon from './left_item_icon'; +import ItemDelete from './left_item_delete'; +import Model from '../../link_set.model'; +import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; +const className = 'dec.dcm.component.linkSet.left.item'; +const Widget: WidgetType = { + props: { + title: '', + id: '', + creator: '', + baseCls: 'dec-webui-dcm-connection-left-item bi-list-item-active', + }, + _store() { + return BI.Models.getModel(Model); + }, + render() { + const {title, creator, text, id} = this.options; + + return { + type: LeftRightVerticalAdapt, + items: { + left: [ + { + type: Icon, + cls: 'dcm-link-font', + height: 25, + width: 25, + text: BI.i18nText('Dec-Dcm_Connections'), + title, + }, + { + type: TextButton, + text: title, + title, + }, + ], + right: [ + { + type: ItemIcon, + cls: 'link-item-icon dcm-test-font', + title: BI.i18nText('Dec-Dcm_Test_Connection'), + value: ACTION_TEST, + id, + }, + { + type: ItemIcon, + cls: 'link-item-icon copy-font', + title: BI.i18nText('Dec-Dcm_Copy'), + value: ACTION_COPY, + id, + }, + { + type: ItemIcon, + cls: 'link-item-icon dcm-info-font', + title: `${BI.i18nText('Dec-Dcm_Type')}:${text === DEFAULT_INFO ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, + id, + }, + { + type: ItemDelete, + cls: 'link-item-icon dcm-delete-font', + title: BI.i18nText('Dec-Dcm_Delete'), + value: ACTION_DELETE, + id, + }, + ], + }, + }; + }, + doClick() { + const {title} = this.options; + this.store.setLinkSelected(title); + }, +}; +BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); +export default className; diff --git a/src/app/connection/left/item/left_item_delete.ts b/src/app/connection/left/item/left_item_delete.ts new file mode 100644 index 0000000..ad56b54 --- /dev/null +++ b/src/app/connection/left/item/left_item_delete.ts @@ -0,0 +1,43 @@ +import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView} from '@ui'; +import Model from '../../link_set.model'; + +const className = 'dec.dcm.component.linkSet.left.item.icon.delete'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + render() { + const {title, id} = this.options; + const that = this; + + return { + type: BubbleCombo, + stopPropagation: true, + direction: 'bottom', + ref: _ref => { + this.combo = _ref; + }, + el: { + type: Icon, + height: 25, + width: 25, + title, + }, + popup: { + type: TextBubblePopupBarView, + text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'), + listeners: [{ + eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, + action (type: boolean) { + that.combo.hideView(); + if (type) { + that.store.onIconClick(title, id); + } + }, + }], + }, + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts new file mode 100644 index 0000000..d16ed76 --- /dev/null +++ b/src/app/connection/left/item/left_item_icon.ts @@ -0,0 +1,26 @@ +import {WidgetType, IconButton} from '@ui'; +import Model from '../../link_set.model'; + +const className = 'dec.dcm.component.linkSet.left.item.icon'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + render() { + const {title} = this.options; + + return { + type: IconButton, + height: 25, + width: 25, + stopPropagation: true, + title, + handler: () => { + const {id, title} = this.options; + this.store.onIconClick(title, id); + }, + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/left/left.ts b/src/app/connection/left/left.ts new file mode 100644 index 0000000..dd4b5a1 --- /dev/null +++ b/src/app/connection/left/left.ts @@ -0,0 +1,39 @@ +import {WidgetType, ListView} from '@ui'; +import Model from '../link_set.model'; +import {LinkType} from '@ui/type'; +import LeftItem from './item/left_item'; + +const className = 'dec.dcm.component.linkset.left'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + linkList(linkList: LinkType[]) { + this.leftContent.populate(BI.createItems(this._renderItems(linkList))); + }, + }, + render() { + return { + type: ListView, + ref: _ref => { + this.leftContent = _ref; + }, + items: this._renderItems(this.model.linkList), + }; + }, + _renderItems(linkList: LinkType[]) { + return BI.map(linkList, (index: number, item: LinkType) => { + return { + type: LeftItem, + selected: item.isSelected, + title: item.connectionName, + id: item.connectionId, + creator: item.creator, + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), + }; + }); + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/link_set.mixin.ts b/src/app/connection/link_set.mixin.ts new file mode 100644 index 0000000..45f487d --- /dev/null +++ b/src/app/connection/link_set.mixin.ts @@ -0,0 +1,50 @@ +import {LinkType} from '@ui/type'; +import {saveConnection} from './link_set.service'; + +const mixinName = 'dec.dcm.minxin.linkset'; +const Mixin = { + setConnectionNameErr(err: string) { + this.model.connectionNameErr = err; + }, + setEdit(type: boolean) { + this.model.linkSelected = { + ...this.model.linkSelected, + isSelected: type, + }; + this.model.linkUpdate = this.model.linkSelected; + }, + setCancel() { + const linkSelected: LinkType = this.model.linkSelected; + const linkList: LinkType[] = this.model.linkList; + if (linkSelected.connectionId) { + this.setEdit(false); + } else { + this.model.linkList = [ + ...linkList.filter(item => !!item.connectionId), + ]; + if (this.model.linkList.length > 0) { + this.model.linkList[0].isSelected = true; + this.model.linkSelected = { + ...this.model.linkList[0], + isSelected: false, + }; + } else { + this.model.linkSelected = {}; + } + this.model.linkUpdate = this.model.linkSelected; + } + }, + saveLink() { + const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {}; + const update = { + ...this.model.linkUpdate, + ...pluginData, + }; + saveConnection(update).then(() => { + this.setEdit(false); + }); + }, +}; + +Fix.mixin(mixinName, Mixin); +export default mixinName; diff --git a/src/app/connection/link_set.model.ts b/src/app/connection/link_set.model.ts new file mode 100644 index 0000000..f61bd13 --- /dev/null +++ b/src/app/connection/link_set.model.ts @@ -0,0 +1,154 @@ +import {LinkType} from '@ui/type'; +import {deleteConnection, testConnection} from '@shared/crud/crud.request'; +import {getCnnectionName} from './select/select.service'; +import {DATA_BASE_TYPE} from '@private/constants'; +import dialog from '@shared/service/dialog.service'; +import Mixin from './link_set.mixin'; +const className = 'dec.dcm.model.linkset'; +const Model = { + context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], + mixins: [Mixin], + actions: { + /** + * 左侧点击链接选中 + * @param name + */ + setLinkSelected(name: string) { + this._noSaveConfirm(() => { + this._setLinkSelected(name); + }); + }, + onIconClick(title: string, id: string) { + switch (title) { + case BI.i18nText('Dec-Dcm_Delete'): + deleteConnection(id, () => { + this.model.linkList = [...this.model.linkList.filter((item: LinkType) => item.connectionId !== id)]; + this.model.linkSelected = {}; + this.model.linkUpdate = {}; + }); + break; + case BI.i18nText('Dec-Dcm_Test_Connection'): + this._textLink(id); + break; + case BI.i18nText('Dec-Dcm_Copy'): + this._noSaveConfirm(() => { + this.copyLink(id); + }); + break; + default: + break; + } + }, + copyLink(id: string) { + const connectionName = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionId === id).connectionName; + const name = getCnnectionName(this.model.linkList, connectionName); + let data = {}; + this.model.linkList.forEach((item: LinkType) => { + if (item.connectionId === id) { + data = item; + } + }); + const newCopy = { + ...data, + isSelected: true, + connectionName: name, + connectionId: '', + }; + this.model.linkList = [ + newCopy, + ...this.model.linkList, + ]; + this.model.linkSelected = { + ...newCopy, + }; + this.model.linkUpdate = { + ...newCopy, + }; + }, + setLinkUpdate(value: any) { + this.model.linkUpdate = value; + }, + setNewLink(value: string) { + 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; + } + this._noSaveConfirm(() => { + this._setNewLink(value); + }); + }, + }, + _setLinkSelected(name: string) { + this.model.linkList.forEach((item: LinkType) => { + item.isSelected = item.connectionName === name; + if (item.connectionName === name) { + this.model.linkSelected = { + ...item, + isSelected: false, + }; + } + }); + this.model.linkList = [...this.model.linkList]; + this.model.linkUpdate = this.model.linkSelected; + }, + _textLink(id: string) { + const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); + const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); + testConnection(link, (res: any) => { + dialog.remove(loadingId); + if (res && res.errorCode) { + dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { + this._textLink(id); + }); + } else { + dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success')); + } + }); + }, + _setNewLink(value: string) { + const name = getCnnectionName(this.model.linkList, value); + let data = {}; + DATA_BASE_TYPE.forEach(item => { + if (item.text === value) { + data = item; + } + }); + this.model.linkList = [ + { + connectionName: name, + isSelected: true, + ...data, + text: value, + }, + ...this.model.linkList, + ]; + this.model.linkSelected = { + ...data, + connectionName: name, + isSelected: true, + text: value, + }; + this.model.linkUpdate = { + ...data, + connectionName: name, + text: value, + }; + }, + _noSaveConfirm(cb: Function) { + if (this.model.linkSelected && this.model.linkSelected.isSelected) { + dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => { + if (isConfirm) { + this.saveLink(); + } else { + this.setCancel(); + } + cb(); + }); + } else { + cb(); + } + }, +}; +BI.model(className, BI.inherit(Fix.Model, Model)); +export default className; diff --git a/src/app/link_set/link-set.service.ts b/src/app/connection/link_set.service.ts similarity index 100% rename from src/app/link_set/link-set.service.ts rename to src/app/connection/link_set.service.ts diff --git a/src/app/link_set/link-set.component.ts b/src/app/connection/link_set.ts similarity index 60% rename from src/app/link_set/link-set.component.ts rename to src/app/connection/link_set.ts index 4795ca7..07b25c7 100644 --- a/src/app/link_set/link-set.component.ts +++ b/src/app/connection/link_set.ts @@ -1,11 +1,14 @@ -import {Htape, WidgetType, Vtape, Left} from '@ui'; -import LeftList from './left/left.component'; -import linkSetModel from './link-set.model'; -import Select from './select/select.component'; -import Right from './right/right.component'; +import {Htape, WidgetType, Vtape, VerticalAdapt} from '@ui'; +import LeftList from './left/left'; +import linkSetModel from './link_set.model'; +import Select from './select/select'; +import Right from './right/right'; import {TAB_LINK_SET} from '@private/constants'; -const className = 'fr.linkset'; +const className = 'dec.dcm.linkset'; const Widget: WidgetType = { + props: { + baseCls: 'bi-card', + }, _store() { return BI.Models.getModel(linkSetModel); }, @@ -17,19 +20,20 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'linkset', items: [{ el: { type: Vtape, - cls: 'database-left', + cls: 'dcm-link-left bi-border-right', items: [ { el: { - type: Left, - cls: 'select-group', + type: VerticalAdapt, + cls: 'bi-border-bottom', items: [ { type: Select, + hgap: 10, + vgap: 10, }, ], }, @@ -37,6 +41,8 @@ const Widget: WidgetType = { }, { type: LeftList, cls: 'left-list', + vgap: 10, + hgap: 10, }, ], }, diff --git a/src/app/connection/more/item/more_link_item.less b/src/app/connection/more/item/more_link_item.less new file mode 100644 index 0000000..fd3ff0f --- /dev/null +++ b/src/app/connection/more/item/more_link_item.less @@ -0,0 +1,6 @@ +@import '../../../../less/index.less'; +.dec-webui-dcm-connection-more-link-item{ + &:hover{ + border-color :@border-color-highlight; + } +} \ No newline at end of file diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts new file mode 100644 index 0000000..23c5628 --- /dev/null +++ b/src/app/connection/more/item/more_link_item.ts @@ -0,0 +1,68 @@ +import './more_link_item.less'; +import {WidgetType, Img, Label, Layout, Absolute, Vtape} from '@ui/index'; +import ModelName from './more_link_litem.model'; + +const className = 'dec.dcm.component.linkSet.morelink.item'; +const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-connection-more-link-item bi-border', + height: 120, + width: 120, + }, + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + otherSelected(otherSelected: string) { + const {text} = this.options; + this.selected.setVisible(text === otherSelected); + }, + }, + render() { + const {text, name} = this.options; + + return { + type: Vtape, + items: [ + { + type: Absolute, + items: [ + { + el: { + type: Img, + src: this._buildResourceUrl(name), + }, + }, + { + el: { + type: Layout, + cls: 'dcm-link-more-selected', + invisible: true, + width: 30, + height: 30, + ref: _ref => { + this.selected = _ref; + }, + }, + right: 0, + }, + ], + }, + { + el: { + type: Label, + cls: 'bi-header-background', + text, + }, + height: 30, + }, + ], + }; + }, + _buildResourceUrl(name: string) { + // TODO: 目前不知道生产环境下的图片的绝对地址,先这样写用于测试。 + return `img/${name}.jpg`; + }, +}; +BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); +export default className; diff --git a/src/app/connection/more/item/more_link_litem.model.ts b/src/app/connection/more/item/more_link_litem.model.ts new file mode 100644 index 0000000..599711f --- /dev/null +++ b/src/app/connection/more/item/more_link_litem.model.ts @@ -0,0 +1,6 @@ +const className = 'dec.dcm.model.link_set.more_link_item'; +export const Model = BI.inherit(Fix.Model, { + context: ['otherSelected'], +}); +BI.model(className, Model); +export default className; diff --git a/src/app/connection/more/more_link.model.ts b/src/app/connection/more/more_link.model.ts new file mode 100644 index 0000000..c9c1e13 --- /dev/null +++ b/src/app/connection/more/more_link.model.ts @@ -0,0 +1,16 @@ +const className = 'dec.dcm.model.link_set.more_link'; +export const Model = BI.inherit(Fix.Model, { + childContext: ['otherSelected'], + state() { + return { + otherSelected: '', + }; + }, + actions: { + setOtherSelected(name: string) { + this.model.otherSelected = name; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/more/more.link.service.ts b/src/app/connection/more/more_link.service.ts similarity index 64% rename from src/app/link_set/more/more.link.service.ts rename to src/app/connection/more/more_link.service.ts index cf2c654..c10489c 100644 --- a/src/app/link_set/more/more.link.service.ts +++ b/src/app/connection/more/more_link.service.ts @@ -1,14 +1,13 @@ -import MoreLink from './more.link.component'; -let SubbitButton: any = null; +import MoreLink from './more_link'; +let subbitButton = null; let selectKey = ''; export const moreLink = (onConfirm?: Function): void => { const id = BI.UUID(); - let Popovers: any = null; BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: BI.i18nText('Dec-Dcm_Connection_More-Title'), - width: 550, + header: BI.i18nText('Dec-Dcm_Connection_More_Title'), + width: 560, height: 500, body: { type: MoreLink, @@ -17,12 +16,12 @@ export const moreLink = (onConfirm?: Function): void => { eventName: 'EVENT_SELECT', action (text: string) { selectKey = text; - SubbitButton.setEnable(true); + subbitButton.setEnable(true); }, }, ], }, - footer:{ + footer: { type: 'bi.right_vertical_adapt', lgap: 10, items: [{ @@ -30,25 +29,22 @@ export const moreLink = (onConfirm?: Function): void => { text: BI.i18nText('BI-Basic_Cancel'), value: 1, level: 'ignore', - handler (v: any) { - Popovers.close(v); + handler () { + BI.Popovers.close(id); }, }, { type: 'bi.button', text: BI.i18nText('BI-Basic_Sure'), disabled: true, value: 0, - ref(ref: any) { - SubbitButton = ref; + ref: _ref => { + subbitButton = _ref; }, - handler (v: any) { - Popovers.close(v); + handler () { + BI.Popovers.close(id); onConfirm ? onConfirm(selectKey) : null; }, }], }, - ref(ref: any) { - Popovers = ref; - }, }).open(id); }; diff --git a/src/app/connection/more/more_link.ts b/src/app/connection/more/more_link.ts new file mode 100644 index 0000000..4d21a1a --- /dev/null +++ b/src/app/connection/more/more_link.ts @@ -0,0 +1,52 @@ +import {WidgetType, SearchEditor, Left, Vtape, VerticalAdapt} from '@ui/index'; +import {DATA_BASE_TYPE_OTHER} from '@private/constants'; +import MoreLinkItem from './item/more_link_item'; +import ModelName from './more_link.model'; +const className = 'dec.dcm.component.linkSet.morelink'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(ModelName); + }, + render() { + return { + type: Vtape, + items: [ + { + el: { + type: VerticalAdapt, + items: [{ + type: SearchEditor, + width: 300, + watermark: BI.i18nText('Dec-Dcm_Search'), + }], + }, + height: 30, + }, + { + type: Left, + scrolly: true, + tgap: 2, + rgap: 2, + bgap: 2, + lgap: 2, + items: this._createItems(), + }, + ], + }; + }, + _createItems() { + return BI.map(DATA_BASE_TYPE_OTHER, (index: number, item) => { + return { + type: MoreLinkItem, + text: item.text, + name: item.databaseType, + handler: () => { + this.store.setOtherSelected(item.text); + this.fireEvent('EVENT_SELECT', item.text); + }, + }; + }); + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/link_set/right/nothing.component.ts b/src/app/connection/right/nothing.ts similarity index 50% rename from src/app/link_set/right/nothing.component.ts rename to src/app/connection/right/nothing.ts index d3d4343..4840ead 100644 --- a/src/app/link_set/right/nothing.component.ts +++ b/src/app/connection/right/nothing.ts @@ -1,27 +1,27 @@ -import {WidgetType, CenterAdapt, Vertical, Layout, Label} from '@ui/index'; -const className = 'fr.component.right.nothing'; +import {WidgetType, Layout, Label, HorizotalAdapt, Vtape} from '@ui/index'; +const className = 'dec.dcm.component.right.nothing'; const Widget: WidgetType = { render() { return { - type: CenterAdapt, + type: HorizotalAdapt, + top: 200, items: [{ - type: Vertical, + type: Vtape, width: 260, - height: 180, - items:[ + height: 150, + items: [ { - type: Layout, - cls: 'data-connection-background', - width: 260, + el: { + type: Layout, + cls: 'data-connection-background', + }, height: 130, }, { - type:Label, - height: 20, + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, ], - }], }; }, diff --git a/src/app/connection/right/right.ts b/src/app/connection/right/right.ts new file mode 100644 index 0000000..905be56 --- /dev/null +++ b/src/app/connection/right/right.ts @@ -0,0 +1,33 @@ +import {WidgetType, ListView} from '@ui'; +import {LinkType} from '@ui/type'; +import Nothing from './nothing'; +import RightDetail from './right_detail/right_detail'; +import Model from '../link_set.model'; +const className = 'dec.dcm.component.right'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + linkSelected(linkSelected: LinkType) { + this.rightContent.populate(BI.createItems([ + { + type: (linkSelected && linkSelected.connectionName) ? RightDetail : Nothing, + }, + ])); + }, + }, + render() { + return { + type: ListView, + ref: _ref => { + this.rightContent = _ref; + }, + items: [{ + type: Nothing, + }], + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/right/right.typing.d.ts b/src/app/connection/right/right.typing.d.ts new file mode 100644 index 0000000..060bd1a --- /dev/null +++ b/src/app/connection/right/right.typing.d.ts @@ -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; +} diff --git a/src/app/connection/right/right_detail/right_detail.model.ts b/src/app/connection/right/right_detail/right_detail.model.ts new file mode 100644 index 0000000..5a61555 --- /dev/null +++ b/src/app/connection/right/right_detail/right_detail.model.ts @@ -0,0 +1,6 @@ +const className = 'dec.dcm.model.link.set.right.detail'; +export const Model = BI.inherit(Fix.Model, { + context: ['linkSelected'], +}); +BI.model(className, Model); +export default className; diff --git a/src/app/connection/right/right_detail/right_detail.ts b/src/app/connection/right/right_detail/right_detail.ts new file mode 100644 index 0000000..d41547c --- /dev/null +++ b/src/app/connection/right/right_detail/right_detail.ts @@ -0,0 +1,74 @@ +import {WidgetType, ListView} from '@ui/index'; +import Model from './right_detail.model'; +import {LinkType} from '@ui/type'; +import Title from '../right_title/right_title'; +import RightShow from '../right_show/right_show'; +import RightShowJndi from '../right_show/right_show_jndi'; +import RightEdit from '../right_edit/right_edit'; +import RightEditMysql from '../right_edit/right_edit_mysql'; +import RightEditJndi from '../right_edit/right_edit_jndi'; +import pluginListConstant from '../../../app.constant'; +import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; + +const className = 'dec.dcm.component.right.detail'; + +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + linkSelected(linkSelected: LinkType) { + const showPage = this._createItems(linkSelected); + this.rightDetail.populate(BI.createItems(showPage)); + }, + }, + render() { + const linkSelected = this.model.linkSelected; + + return { + type: ListView, + ref: _ref => { + this.rightDetail = _ref; + }, + items: this._createItems(linkSelected), + }; + }, + _createItems(linkSelected: LinkType) { + 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`); + } + + return [ + { + type: Title, + isEdit: linkSelected.isSelected, + linkSelected, + }, { + type: linkSelected.isSelected ? editPage : showPage, + vgap: 10, + hgap: 10, + linkSelected, + }, + ]; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/right/right_edit/right_edit.model.ts b/src/app/connection/right/right_edit/right_edit.model.ts new file mode 100644 index 0000000..21f99ed --- /dev/null +++ b/src/app/connection/right/right_edit/right_edit.model.ts @@ -0,0 +1,20 @@ +export const className = 'dec.dcm.model.components.right.edit'; +export const Model = BI.inherit(Fix.Model, { + state() { + return { + isCollapse: false, + }; + }, + + computed: { + + }, + + actions: { + setIsCollapse(status: boolean) { + this.model.isCollapse = status; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/right/right_edit/right.edit.service.ts b/src/app/connection/right/right_edit/right_edit.service.ts similarity index 100% rename from src/app/link_set/right/right_edit/right.edit.service.ts rename to src/app/connection/right/right_edit/right_edit.service.ts diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts new file mode 100644 index 0000000..edaf66a --- /dev/null +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -0,0 +1,373 @@ +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index'; +import {LinkType} from '@ui/type'; +import {CONNECT_CHARSET} from '@private/constants'; +import Model from '../../link_set.model'; +import Title from '@shared/components/title'; +import {getDrivers, connectNameChecker} from './right_edit.service'; +let connectionName: any = null; +const className = 'dec.dcm.component.right.edit'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + connectionNameErr(msg: string) { + if (msg) { + BI.Bubbles.show('singleBubble', msg, connectionName, { + level: 'error', + }); + } else { + BI.Bubbles.hide('singleBubble'); + } + }, + }, + render() { + const linkSelected: LinkType = this.model.linkSelected; + const that = this; + + return { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), + }, + { + type: TextEditor, + width: 300, + value: linkSelected.connectionName, + ref(ref: any) { + connectionName = ref; + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + connectionName: this.getValue(), + }); + }, + }, { + eventName: BI.Editor.EVENT_FOCUS, + action() { + that.store.setConnectionNameErr(''); + }, + }], + }, + { + type: Label, + cls: 'bi-water-mark', + lgap: 5, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_First_Step'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.driver, + items: getDrivers(linkSelected), + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + driver: this.getValue()[0], + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), + }, + { + type: TextEditor, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.url, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + url: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...CONNECT_CHARSET, + ], + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + originalCharsetName: this.getValue()[0], + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.user, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + user: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + }, + { + type: TextEditor, + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.password, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + password: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: Title, + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), + }, + { + type: TextAreaEditor, + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + height: 100, + value: linkSelected.validationQuery, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + validationQuery: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), + }, + { + type: MultiSelectItem, + text: BI.i18nText('Dec-Dcm_Yes'), + selected: linkSelected.testOnBorrow, + width: 60, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + testOnBorrow: this.isSelected(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 60, + value: linkSelected.maxActive, + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), + validationChecker: connectNameChecker, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + maxActive: this.getValue(), + }); + }, + }], + }, + ], + }, + ], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Second_Step'), + }, + { + type: Button, + width: 80, + text: BI.i18nText('Dec-Dcm_Test_Connection'), + level: 'ignore', + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Third_Step'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), + }, + { + type: TextEditor, + width: 300, + disabled: true, + }, + ], + }, + ], + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts new file mode 100644 index 0000000..8c56730 --- /dev/null +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -0,0 +1,226 @@ +import {Vertical, TextValueCombo, TextButton, Label, TextEditor, VerticalAdapt} from '@ui'; +import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; +import {AttributeType} from '../right.typing'; +import ModelName from './right_edit.model'; + +const classNameEdit = 'dec.dcm.component.right.edit.jndi'; +const Widget = BI.inherit(BI.Widget, { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + isCollapse(isCollapse) { + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); + }, + }, + render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + + return { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: connectionName, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'INTIAL_CONTEXT_FACTORY', + }, + { + type: TextValueCombo, + width: 300, + value: factory, + items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { + return { + text: item, + value: item, + }; + }), + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'PROVIDER_URL', + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: url, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_PRINCIPAL', + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: principal, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_CREDENTIALS', + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: credentials, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 480, + textAlign: 'right', + ref: _ref => { + this.collapseRef = _ref; + }, + handler: () => { + this.store.setIsCollapse(!this.model.isCollapse); + }, + }, + ], + }, + { + type: Vertical, + invisible: true, + ref: _ref => { + this.otherAttributesRef = _ref; + }, + items: this._getOtherItems(), + }, + ], + }, + ], + }, + { + type: Label, + cls: 'bi-error', + lgap: 10, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: TextValueCombo, + width: 300, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: originalCharsetName, + }, + ...CONNECT_CHARSET, + ], + }, + ], + }, + ], + }; + }, + _getOtherItems() { + return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { + return { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: item.text, + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: this.options[item.name], + }, + ], + }; + }); + }, +}); +BI.shortcut(classNameEdit, Widget); +export default classNameEdit; diff --git a/src/app/connection/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts new file mode 100644 index 0000000..0d36f01 --- /dev/null +++ b/src/app/connection/right/right_edit/right_edit_mysql.ts @@ -0,0 +1,325 @@ +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index'; +import {LinkType} from '@ui/type'; +import {CONNECT_CHARSET} from '@private/constants'; +import Model from '../../link_set.model'; +import Title from '@shared/components/title'; +import {getDrivers, connectNameChecker} from './right_edit.service'; +let connectionName: any = null; +const className = 'dec.dcm.component.right.edit.mysql'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + connectionNameErr(msg: string) { + if (msg) { + BI.Bubbles.show('singleBubble', msg, connectionName, { + level: 'error', + }); + } else { + BI.Bubbles.hide('singleBubble'); + } + }, + }, + render() { + const linkSelected: LinkType = this.model.linkSelected; + const that = this; + + return { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), + }, + { + type: TextEditor, + width: 300, + value: linkSelected.connectionName, + ref(ref: any) { + connectionName = ref; + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + connectionName: this.getValue(), + }); + }, + }, { + eventName: BI.Editor.EVENT_FOCUS, + action() { + that.store.setConnectionNameErr(''); + }, + }], + }, + { + type: Label, + cls: 'bi-water-mark', + lgap: 5, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), + }, + ], + }, + + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.driver, + items: getDrivers(linkSelected), + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + driver: this.getValue()[0], + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), + }, + { + type: TextEditor, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.url, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + url: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...CONNECT_CHARSET, + ], + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + originalCharsetName: this.getValue()[0], + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.user, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + user: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + }, + { + type: TextEditor, + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.password, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + password: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: Title, + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), + }, + { + type: TextAreaEditor, + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + height: 100, + value: linkSelected.validationQuery, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + validationQuery: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), + }, + { + type: MultiSelectItem, + text: BI.i18nText('Dec-Dcm_Yes'), + selected: linkSelected.testOnBorrow, + width: 60, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + testOnBorrow: this.isSelected(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 60, + value: linkSelected.maxActive, + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), + validationChecker: connectNameChecker, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + maxActive: this.getValue(), + }); + }, + }], + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Button, + width: 80, + text: BI.i18nText('Dec-Dcm_Test_Connection'), + level: 'ignore', + }, + ], + }, + ], + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/right/right_show/right_show.model.ts b/src/app/connection/right/right_show/right_show.model.ts new file mode 100644 index 0000000..4209415 --- /dev/null +++ b/src/app/connection/right/right_show/right_show.model.ts @@ -0,0 +1,20 @@ +export const className = 'dec.dcm.model.components.right.show'; +export const Model = BI.inherit(Fix.Model, { + state() { + return { + isCollapse: false, + }; + }, + + computed: { + + }, + + actions: { + setIsCollapse(status: boolean) { + this.model.isCollapse = status; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/right/right_show/right.show.component.ts b/src/app/connection/right/right_show/right_show.ts similarity index 90% rename from src/app/link_set/right/right_show/right.show.component.ts rename to src/app/connection/right/right_show/right_show.ts index 74d293f..590efe1 100644 --- a/src/app/link_set/right/right_show/right.show.component.ts +++ b/src/app/connection/right/right_show/right_show.ts @@ -1,9 +1,9 @@ import {WidgetType, Vertical} from '@ui/index'; -import RightShowModel from '../../link-set.model'; -import BothSide from '@shared/components/both.side.component'; -import Title from '@shared/components/title.component'; +import RightShowModel from '../../link_set.model'; +import BothSide from '@shared/components/both_side'; +import Title from '@shared/components/title'; import {LinkType} from '@ui/type'; -const className = 'fr.component.right.show'; +const className = 'dec.dcm.component.right.show'; const Widget: WidgetType = { _store() { return BI.Models.getModel(RightShowModel); @@ -13,7 +13,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: BothSide, diff --git a/src/app/connection/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts new file mode 100644 index 0000000..d4db6e1 --- /dev/null +++ b/src/app/connection/right/right_show/right_show_jndi.ts @@ -0,0 +1,203 @@ +import {Vertical, TextButton, Label, VerticalAdapt} from '@ui'; +import {OTHER_ATTRIBUTES} from '@private/constants'; +import {AttributeType} from '../right.typing'; +import ModelName from './right_show.model'; + +const className = 'dec.dcm.component.right.show.jndi'; +const Widget = BI.inherit(BI.Widget, { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + isCollapse(isCollapse) { + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); + }, + }, + render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + + return { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + }, + { + type: Label, + text: connectionName, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'INTIAL_CONTEXT_FACTORY', + }, + { + type: Label, + text: factory, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'PROVIDER_URL', + }, + { + type: Label, + text: url, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_PRINCIPAL', + }, + { + type: Label, + value: principal, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_CREDENTIALS', + }, + { + type: Label, + value: credentials, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 480, + textAlign: 'right', + ref: _ref => { + this.collapseRef = _ref; + }, + handler: () => { + this.store.setIsCollapse(!this.model.isCollapse); + }, + }, + ], + }, + { + type: Vertical, + invisible: true, + ref: _ref => { + this.otherAttributesRef = _ref; + }, + items: this._getOtherItems(), + }, + ], + }, + ], + }, + { + type: Label, + cls: 'bi-error', + lgap: 10, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: Label, + text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + }, + ], + }, + ], + }; + }, + _getOtherItems() { + return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { + return { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: item.text, + }, + { + type: Label, + value: this.options[item.name], + }, + ], + }; + }); + }, +}); +BI.shortcut(className, Widget); +export default className; diff --git a/src/app/connection/right/right_title/right_title.model.ts b/src/app/connection/right/right_title/right_title.model.ts new file mode 100644 index 0000000..6c54731 --- /dev/null +++ b/src/app/connection/right/right_title/right_title.model.ts @@ -0,0 +1,20 @@ +import LinksetMixin from '../../link_set.mixin'; +import {LinkType} from '@ui/type'; +const modelName = 'dec.dcm.model.component.right.title'; +export const Model = BI.inherit(Fix.Model, { + context: ['linkSelected', 'linkList', 'linkUpdate'], + mixins: [LinksetMixin], + actions: { + onSave() { + const linkList: LinkType[] = this.model.linkList; + const result = BI.find(linkList, (idx: number, value: LinkType) => this.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== this.model.linkUpdate.connectionId); + if (result) { + this.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); + } else { + this.saveLink(); + } + }, + }, +}); +BI.model(modelName, Model); +export default modelName; diff --git a/src/app/connection/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts new file mode 100644 index 0000000..f3995f3 --- /dev/null +++ b/src/app/connection/right/right_title/right_title.ts @@ -0,0 +1,66 @@ +import {WidgetType, Label, Button, LeftRightVerticalAdapt} from '@ui/index'; +import RightTitleModel from './right_title.model'; +import {LinkType} from '@ui/type'; +import {OTHER_CONNECT} from '@private/constants'; +const className = 'dec.dcm.component.right.title'; +const Widget: WidgetType = { + props: { + baseCls: 'bi-border-bottom', + }, + _store() { + return BI.Models.getModel(RightTitleModel); + }, + render() { + const linkSelected: LinkType = this.model.linkSelected; + const that = this; + const {isEdit} = this.options; + const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; + + return { + type: LeftRightVerticalAdapt, + height: 40, + items: { + left: [ + { + type: Label, + cls: 'bi-font-bold', + hgap: 10, + text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`, + }, + ], + right: [ + { + type: Button, + hgap: 10, + invisible: isEdit, + text: BI.i18nText('Dec-Dcm_Edit'), + handler() { + that.store.setEdit(true); + }, + }, + { + type: Button, + hgap: 10, + invisible: !isEdit, + level: 'ignore', + text: BI.i18nText('BI-Basic_Cancel'), + handler() { + that.store.setCancel(); + }, + }, + { + type: Button, + hgap: 10, + invisible: !isEdit, + text: BI.i18nText('Dec-Dcm_Save'), + handler() { + that.store.onSave(); + }, + }, + ], + }, + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/select/select.service.ts b/src/app/connection/select/select.service.ts new file mode 100644 index 0000000..0e11c16 --- /dev/null +++ b/src/app/connection/select/select.service.ts @@ -0,0 +1,23 @@ +import {LinkType} from '@ui/type'; +import pluginListConstant from '../../app.constant'; + +export const getCnnectionName = (links: LinkType[], name: string): string => { + const plugins: string[] = BI.Constants.getConstant(pluginListConstant); + let nameIndex = 0; + const title = name.replace(/[0-9]/g, ''); + const isPlugin = BI.some(plugins, (index: number, item: string) => item === title); + const startWith = isPlugin ? title : BI.i18nText('Dec-Dcm_Data_Connections'); + + links.forEach(link => { + link.isSelected = false; + if (link.connectionName.startsWith(startWith)) { + const name = link.connectionName.replace(startWith, '0'); + const index = parseInt(name, 10) + 1; + if (index > nameIndex) { + nameIndex = index; + } + } + }); + + return `${startWith}${nameIndex > 0 ? nameIndex : ''}`; +}; diff --git a/src/app/link_set/select/select.component.ts b/src/app/connection/select/select.ts similarity index 73% rename from src/app/link_set/select/select.component.ts rename to src/app/connection/select/select.ts index cf3d65f..10dd883 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/connection/select/select.ts @@ -1,51 +1,49 @@ 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'; -const className = 'fr.linkset.select'; +import selectModel from '../link_set.model'; +import {moreLink} from '../more/more_link.service'; +import connectList from '../../app.constant'; +import {DATA_LINKS} from '@private/constants'; +const className = 'dec.dcm.linkset.select'; const Widget: WidgetType = { _store() { return BI.Models.getModel(selectModel); }, render() { - let combo: any = null; - return { type: Combo, - cls:'select', trigger: 'click', adjustYOffset: 4, el: { type: 'bi.button', text: BI.i18nText('Dec-Dcm_Connection_New'), - height: 24, }, popup: { el: { type: ButtonGroup, - cls:'database-link-items', - items: [...BI.map([...links, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { + items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { return { type: TextItem, height: 24, width: 152, + textLgap: 10, text: item, title: item, value: item, }; }), { type: TextItem, - cls: 'link-item', height: 24, width: 152, + textLgap: 10, text: BI.i18nText('Dec-Dcm_Connection_More'), title: BI.i18nText('Dec-Dcm_Connection_More'), value: 'more', }, { type: TextItem, - cls: 'link-item', + cls: 'bi-border-top', height: 24, width: 152, + textLgap: 10, text: BI.i18nText('Dec-Dcm_Connection_Other'), title: BI.i18nText('Dec-Dcm_Connection_Other'), value: 'other', @@ -56,7 +54,7 @@ const Widget: WidgetType = { }, maxHeight: 400, }, - listeners:[{ + listeners: [{ eventName: 'EVENT_CHANGE', action: (v: string) => { if (v === 'more') { @@ -66,11 +64,11 @@ const Widget: WidgetType = { } else { this.store.setNewLink(v); } - combo.hideView(); + this.combo.hideView(); }, }], - ref () { - combo = this; + ref: _ref => { + this.combo = _ref; }, }; }, diff --git a/src/app/link_set/left/left.component.ts b/src/app/link_set/left/left.component.ts deleted file mode 100644 index 0d4c53a..0000000 --- a/src/app/link_set/left/left.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {WidgetType, Vertical} from '@ui'; -import Model from '../link-set.model'; -import {LinkType} from '@ui/type'; -import {getLinks} from './left.service'; -const className = 'fr.component.linkset.left'; -let leftContent: any = null; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - watch:{ - linkList(linkList: LinkType[]) { - leftContent.populate(BI.createItems(getLinks(linkList))); - }, - }, - render() { - return { - type: Vertical, - ref(_ref: any) { - leftContent = _ref; - }, - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/left/left.service.ts b/src/app/link_set/left/left.service.ts deleted file mode 100644 index 8f792c4..0000000 --- a/src/app/link_set/left/left.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {LinkType} from '@ui/type'; -import LeftItem from './left_item/left.item.component'; - -export const getLinks = (linkList: LinkType[]): any => { - const links: any[] = []; - linkList.forEach((item: LinkType) => { - links.push({ - type: LeftItem, - extraCls: item.isSelected ? 'left-item-selected' : '', - title: item.connectionName, - id: item.connectionId, - creator: item.creator, - text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), - }); - }); - - return links; -}; diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left.item.component.ts deleted file mode 100644 index 660d803..0000000 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -import {WidgetType, Left, Label, Icon, TextButton} from '@ui'; -import ItemIcon from './left.item.icon.component'; -import Model from '../../link-set.model'; -import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; -const className = 'fr.component.linkSet.left.item'; -const Widget: WidgetType = { - props: { - title: '', - id: '', - creator: '', - }, - _store() { - return BI.Models.getModel(Model); - }, - render() { - const {title, extraCls, creator, text, id} = this.options; - - return { - type: Left, - cls: 'left-item', - extraCls, - items: [ - { - type: Icon, - cls: 'link-font', - height: 24, - width: 26, - text: BI.i18nText('Dec-Dcm_Connections'), - title, - }, - { - type: TextButton, - cls: 'link-title', - textAlign: 'left', - text: title, - title, - handler: () => { - this.store.setLinkSelected(title); - }, - }, - { - type: Left, - cls: 'icons', - items: [ - { - type: ItemIcon, - cls: 'link-text-font', - title: BI.i18nText('Dec-Dcm_Test_Connection'), - value: ACTION_TEST, - id, - }, - { - type: ItemIcon, - cls: 'copy-font', - title: BI.i18nText('Dec-Dcm_Copy'), - value: ACTION_COPY, - id, - }, - { - type: ItemIcon, - cls: 'info-font', - title: `${BI.i18nText('Dec-Dcm_Type')}:${text === DEFAULT_INFO ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, - id, - }, - { - type: ItemIcon, - cls: 'delete-font', - title: BI.i18nText('Dec-Dcm_Delete'), - value: ACTION_DELETE, - id, - }, - ], - }, - - ], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/left/left_item/left.item.icon.component.ts b/src/app/link_set/left/left_item/left.item.icon.component.ts deleted file mode 100644 index 3079d35..0000000 --- a/src/app/link_set/left/left_item/left.item.icon.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui/index'; -import Model from '../../link-set.model'; -import {ACTION_DELETE} from '@private/constants'; - -const className = 'fr.component.linkSet.left.item.icon'; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - render() { - const {cls, title, id, value} = this.options; - const that = this; - let iconContent: any = null; - let combo: any = null; - if (value === ACTION_DELETE) { - return { - type: BubbleCombo, - direction: 'bottom', - ref () { - combo = this; - }, - el: { - type: Icon, - cls, - baseCls: 'action-icon', - height: 24, - width: 26, - title, - ref (ref: any) { - iconContent = ref; - }, - }, - popup: { - type: TextBubblePopupBarView, - text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'), - listeners: [{ - eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, - action (type: boolean) { - combo.hideView(); - if (type) { - that.store.onIconClick(title, id); - } - }, - }], - }, - listeners: [{ - eventName: BI.BubbleCombo.EVENT_EXPAND, - action () { - iconContent.element.css({ - visibility: 'visible', - }); - }, - }, { - eventName: BI.BubbleCombo.EVENT_AFTER_HIDEVIEW, - action () { - iconContent.element.css({ - visibility: 'hidden', - }); - }, - }], - }; - } - - return { - type: IconButton, - cls, - extraCls: 'action-icon', - height: 24, - width: 26, - title, - handler: () => { - const {value, id, title} = this.options; - if (value !== ACTION_DELETE) { - this.store.onIconClick(title, id); - } - }, - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts deleted file mode 100644 index ac0f912..0000000 --- a/src/app/link_set/link-set.model.ts +++ /dev/null @@ -1,195 +0,0 @@ -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 dialog from '@shared/service/dialog.service'; -import {saveConnection} from './link-set.service'; - -const className = 'fr.model.linkset'; -const Model: ModelType = { - context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], - actions: { - /** - * 左侧点击链接选中 - * @param name - */ - setLinkSelected(name: string) { - this.noSaveConfirm(() => { - this._setLinkSelected(name); - }); - }, - _setLinkSelected(name: string) { - this.model.linkList.forEach((item: LinkType) => { - item.isSelected = item.connectionName === name; - if (item.connectionName === name) { - this.model.linkSelected = { - ...item, - isSelected: false, - }; - } - }); - this.model.linkList = [...this.model.linkList]; - this.model.linkUpdate = this.model.linkSelected; - }, - onIconClick(title: string, id: string) { - switch (title) { - case BI.i18nText('Dec-Dcm_Delete'): - deleteConnection(id, () => { - this.model.linkList = [...this.model.linkList.filter((item: LinkType) => item.connectionId !== id)]; - this.model.linkSelected = {}; - this.model.linkUpdate = {}; - }); - break; - case BI.i18nText('Dec-Dcm_Test_Connection'): - this._textLink(id); - break; - case BI.i18nText('Dec-Dcm_Copy'): - this.noSaveConfirm(() => { - this.copyLink(id); - }); - break; - default: - break; - } - }, - _textLink(id: string) { - const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); - const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); - testConnection(link, (res: any) => { - dialog.close(loadingId); - if (res && res.errorCode) { - dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { - this._textLink(id); - }); - } else { - dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success')); - } - }); - }, - copyLink(id: string) { - const connectionName = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionId === id).connectionName; - const name = getCnnectionName(this.model.linkList, connectionName); - let data = {}; - this.model.linkList.forEach((item: LinkType) => { - if (item.connectionId === id) { - data = item; - } - }); - const newCopy = { - ...data, - isSelected: true, - connectionName:name, - connectionId: '', - }; - this.model.linkList = [ - newCopy, - ...this.model.linkList, - ]; - this.model.linkSelected = { - ...newCopy, - }; - this.model.linkUpdate = { - ...newCopy, - }; - }, - setLinkUpdate(value: any) { - this.model.linkUpdate = value; - }, - setEdit(type: boolean) { - this.model.linkSelected = { - ...this.model.linkSelected, - isSelected: type, - }; - this.model.linkUpdate = this.model.linkSelected; - }, - setCancel() { - const linkSelected: LinkType = this.model.linkSelected; - const linkList: LinkType[] = this.model.linkList; - if (linkSelected.connectionId) { - this.setEdit(false); - } else { - this.model.linkList = [ - ...linkList.filter(item => !!item.connectionId), - ]; - if (this.model.linkList.length > 0) { - this.model.linkList[0].isSelected = true; - this.model.linkSelected = { - ...this.model.linkList[0], - isSelected: false, - }; - } else { - this.model.linkSelected = {}; - } - this.model.linkUpdate = this.model.linkSelected; - } - }, - setNewLink(value: string) { - if (!databaseTyle.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; - } - this.noSaveConfirm(() => { - this._setNewLink(value); - }); - }, - _setNewLink(value: string) { - const name = getCnnectionName(this.model.linkList, value); - let data = {}; - databaseTyle.forEach(item => { - if (item.text === value) { - data = item; - } - }); - this.model.linkList = [ - { - connectionName:name, - isSelected: true, - ...data, - text: value, - }, - ...this.model.linkList, - ]; - this.model.linkSelected = { - ...data, - connectionName:name, - isSelected: true, - text: value, - }; - this.model.linkUpdate = { - ...data, - connectionName:name, - text: value, - }; - }, - setConnectionNameErr(err: string) { - this.model.connectionNameErr = err; - }, - noSaveConfirm(cb: Function) { - if (this.model.linkSelected && this.model.linkSelected.isSelected) { - dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => { - if (isConfirm) { - this.saveLink(); - } else { - this.setCancel(); - } - cb(); - }); - } else { - cb(); - } - }, - saveLink() { - const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {}; - const update = { - ...this.model.linkUpdate, - ...pluginData, - }; - saveConnection(update).then(() => { - this.setEdit(false); - }); - }, - }, -}; -BI.model(className, BI.inherit(Fix.Model, Model)); -export default className; diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts deleted file mode 100644 index 8644906..0000000 --- a/src/app/link_set/more/more.link.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; -import {databaseTyle} from '../select/select.service'; -import MoreLinkItem from './more.link.item.component'; -const className = 'fr.component.linkSet.morelink'; -let morkLinkItem: any = null; -const Widget: WidgetType = { - render() { - return { - type: Vtape, - cls: 'more-link', - items: [ - { - el: { - type: Vertical, - items: [{ - type: SearchEditor, - width: 300, - watermark: BI.i18nText('Dec-Dcm_Search'), - }], - }, - height: 30, - }, - { - type: Left, - cls: 'more-link-item', - ref(ref: any) { - morkLinkItem = ref; - }, - }, - ], - }; - }, - mounted() { - this._renderItems(); - }, - _renderItems(text = '') { - const databaseLink = databaseTyle.slice(12, 12 + 33); - const items: any[] = []; - const that = this; - databaseLink.forEach(item => { - items.push({ - type: MoreLinkItem, - text: item.text, - name: item.databaseType, - selected: text === item.text, - handler: () => { - that._renderItems(item.text); - that.fireEvent('EVENT_SELECT', item.text); - }, - }); - }); - morkLinkItem.populate(BI.createItems(items)); - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/more/more.link.item.component.ts b/src/app/link_set/more/more.link.item.component.ts deleted file mode 100644 index 0b2724f..0000000 --- a/src/app/link_set/more/more.link.item.component.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {WidgetType, Vertical, Img, Label, Layout} from '@ui/index'; -const className = 'fr.component.linkSet.morelink.item'; -const Widget: WidgetType = { - render() { - const {text, name, selected} = this.options; - - return { - type: Vertical, - cls:'link-item', - width: 120, - height: 117, - items:[ - { - type: Img, - width: 120, - height: 90, - src:`./img/${name}.jpg`, - }, { - type: Layout, - cls: 'selected', - invisible: !selected, - width:30, - height: 30, - }, { - type: Label, - cls:'text', - text, - }, - ], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); -export default className; diff --git a/src/app/link_set/right/right.component.ts b/src/app/link_set/right/right.component.ts deleted file mode 100644 index 060a7fd..0000000 --- a/src/app/link_set/right/right.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import {WidgetType, Vertical} from '@ui'; -import {LinkType} from '@ui/type'; -import Nothing from './nothing.component'; -import RightDetail from './right_detail/right.detail.component'; -import Model from '../link-set.model'; -let rightContent: any = null; -const className = 'fr.component.right'; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - watch:{ - linkSelected(linkSelected: LinkType) { - rightContent.populate(BI.createItems([ - { - type: (linkSelected && linkSelected.connectionName) ? RightDetail : Nothing, - }, - ])); - }, - }, - render() { - return { - type:Vertical, - cls:'database-right', - ref(_ref: any) { - rightContent = _ref; - }, - }; - }, - mounted() { - rightContent.populate(BI.createItems([ - { - type: Nothing, - }, - ])); - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; 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 deleted file mode 100644 index c801ea1..0000000 --- a/src/app/link_set/right/right_detail/right.detail.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -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 {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:{ - linkSelected(linkSelected: LinkType) { - renderEdit(linkSelected); - }, - }, - render() { - return { - type: Vertical, - cls:'right-content', - ref(_ref: any) { - rightDetail = _ref; - }, - }; - }, - mounted() { - const linkSelected: LinkType = this.model.linkSelected; - renderEdit(linkSelected); - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; 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 deleted file mode 100644 index 539cccc..0000000 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ /dev/null @@ -1,278 +0,0 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; -import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; -import Model from '../../link-set.model'; -import FormItem from '@shared/components/form.item.component'; -import Title from '@shared/components/title.component'; -import {getDrivers, connectNameChecker} from './right.edit.service'; -let ConnectionName: any = null; -const className = 'fr.component.right.edit'; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - watch: { - connectionNameErr(msg: string) { - if (msg) { - BI.Bubbles.show('singleBubble', msg, ConnectionName, { - level: 'error', - }); - } else { - BI.Bubbles.hide('singleBubble'); - } - }, - }, - render() { - const linkSelected: LinkType = this.model.linkSelected; - const that = this; - - return { - type: Vertical, - cls: 'right-show', - items: [ - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), - hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form: { - type: Editor, - cls: 'bi-border', - width: 300, - value: linkSelected.connectionName, - ref(ref: any) { - ConnectionName = ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - connectionName: this.getValue(), - }); - }, - }, { - eventName: BI.Editor.EVENT_FOCUS, - action() { - that.store.setConnectionNameErr(''); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_First_Step'), - height: 400, - form: { - type: Vertical, - cls: 'right-form', - items: [ - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form: { - type: TextValueCombo, - cls: 'bi-border', - width: 300, - text: linkSelected.driver, - items: getDrivers(linkSelected), - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - driver: this.getValue()[0], - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form: { - type: Editor, - cls: 'bi-border', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.url, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - url: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form: { - type: TextValueCombo, - cls: 'bi-border', - width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, - items: [ - { - text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: '', - }, - ...BI.Constants.getConstant(charset), - ], - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - originalCharsetName: this.getValue()[0], - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form: { - type: Editor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.user, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - user: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form: { - type: Editor, - cls: 'bi-border', - inputType: 'password', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.password, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - password: this.getValue(), - }); - }, - }], - }, - }, - { - type: Title, - text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - height: 100, - form: { - type: TextAreaEditor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - height: 100, - value: linkSelected.validationQuery, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - validationQuery: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form: { - type: MultiSelectItem, - text: BI.i18nText('Dec-Dcm_Yes'), - selected: linkSelected.testOnBorrow, - width: 60, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - testOnBorrow: this.isSelected(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form: { - type: Editor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 60, - value: linkSelected.maxActive, - errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), - validationChecker: connectNameChecker, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - maxActive: this.getValue(), - }); - }, - }], - }, - }, - ], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Second_Step'), - form: { - type: Button, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - level: 'ignore', - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Third_Step'), - form: { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), - form: { - type: Editor, - cls: 'bi-border', - width: 300, - disabled: true, - }, - }, - }, - ], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; 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/app/link_set/right/right_edit/right.edit.mysql.component.ts b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts deleted file mode 100644 index 7b65bd5..0000000 --- a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts +++ /dev/null @@ -1,233 +0,0 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; -import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; -import Model from '../../link-set.model'; -import FormItem from '@shared/components/form.item.component'; -import Title from '@shared/components/title.component'; -import {getDrivers, connectNameChecker} from './right.edit.service'; -const className = 'fr.component.right.edit.mysql'; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - render() { - const linkSelected: LinkType = this.model.linkSelected; - const that = this; - - return { - type: Vertical, - cls: 'right-show', - items: [ - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), - hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form: { - type: Editor, - cls: 'bi-border', - width: 300, - value: linkSelected.connectionName, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - connectionName: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form: { - type: TextValueCombo, - cls: 'bi-border', - width: 300, - text: linkSelected.driver, - items: getDrivers(linkSelected), - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - driver: this.getValue()[0], - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form: { - type: Editor, - cls: 'bi-border', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.url, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - url: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form: { - type: TextValueCombo, - cls: 'bi-border', - width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, - items: [ - { - text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: '', - }, - ...BI.Constants.getConstant(charset), - ], - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - originalCharsetName: this.getValue()[0], - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form: { - type: Editor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.user, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - user: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form: { - type: Editor, - cls: 'bi-border', - inputType: 'password', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.password, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - password: this.getValue(), - }); - }, - }], - }, - }, - { - type: Title, - text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - height: 100, - form: { - type: TextAreaEditor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - height: 100, - value: linkSelected.validationQuery, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - validationQuery: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form: { - type: MultiSelectItem, - text: BI.i18nText('Dec-Dcm_Yes'), - selected: linkSelected.testOnBorrow, - width: 60, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - testOnBorrow: this.isSelected(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form: { - type: Editor, - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 60, - value: linkSelected.maxActive, - errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), - validationChecker: connectNameChecker, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - maxActive: this.getValue(), - }); - }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - form: { - type: Button, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - level: 'ignore', - }, - }, - ], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts deleted file mode 100644 index 5a1281f..0000000 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {WidgetType, Left, Label, Button} from '@ui/index'; -import RightTitleModel from '../../link-set.model'; -import {LinkType} from '@ui/type'; -import {OTHER_CONNECT} from '@private/constants'; -const className = 'fr.component.right.title'; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(RightTitleModel); - }, - render() { - const linkSelected: LinkType = this.model.linkSelected; - const linkList: LinkType[] = this.model.linkList; - const that = this; - const {isEdit} = this.options; - const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; - - return { - type: Left, - height: 40, - cls: 'right-title', - items: [ - { - type: Label, - cls: 'right-title-text', - text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`, - }, - { - type: Button, - cls:'right-title-button', - invisible: isEdit, - text: BI.i18nText('Dec-Dcm_Edit'), - handler() { - that.store.setEdit(true); - }, - }, - { - type: Button, - cls:'right-title-button', - invisible: !isEdit, - text: BI.i18nText('Dec-Dcm_Save'), - handler() { - const result = BI.find(linkList, (idx: number, value: LinkType) => that.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== that.model.linkUpdate.connectionId); - if (result) { - that.store.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); - } else { - that.store.saveLink(); - } - }, - }, - { - type: Button, - cls:'right-title-button', - invisible: !isEdit, - level: 'ignore', - text: BI.i18nText('BI-Basic_Cancel'), - handler() { - that.store.setCancel(); - }, - }, - ], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts deleted file mode 100644 index 99c5d9c..0000000 --- a/src/app/link_set/select/select.service.ts +++ /dev/null @@ -1,284 +0,0 @@ -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); - let nameIndex = 0; - const title = name.replace(/[0-9]/g, ''); - const isPlugin = BI.some(plugins, (index: number, item: string) => item === title); - const startWith = isPlugin ? title : BI.i18nText('Dec-Dcm_Data_Connections'); - - links.forEach(link => { - link.isSelected = false; - if (link.connectionName.startsWith(startWith)) { - const name = link.connectionName.replace(startWith, '0'); - const index = parseInt(name, 10) + 1; - if (index > nameIndex) { - nameIndex = index; - } - } - }); - - return `${startWith}${nameIndex > 0 ? nameIndex : ''}`; -}; diff --git a/src/app/link_status/left/left.component.ts b/src/app/link_status/left/left.component.ts deleted file mode 100644 index 0ce0fdf..0000000 --- a/src/app/link_status/left/left.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import {WidgetType, Vertical} from '@ui'; -import Model from './left.model'; -import {LinkType} from '@ui/type'; -import {getLinks} from './left.service'; -const className = 'fr.component.linkStatus.left'; -let leftContent: any = null; -const Widget: WidgetType = { - _store() { - return BI.Models.getModel(Model); - }, - watch: { - linkList(linkList: LinkType[]) { - const title = linkList.length > 0 ? linkList[0].connectionName : ''; - this.store.setStatusSelected(title); - }, - statusSelected(title: string) { - const linkList = this.model.linkList; - leftContent.populate(BI.createItems(getLinks(linkList, title))); - }, - }, - render() { - return { - type: Vertical, - ref(_ref: any) { - leftContent = _ref; - }, - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/app/link_status/left/left.service.ts b/src/app/link_status/left/left.service.ts deleted file mode 100644 index 2bfdf88..0000000 --- a/src/app/link_status/left/left.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {LinkType} from '@ui/type'; -import LeftItem from './left.item.component'; - -export const getLinks = (linkList: LinkType[], selectTitle = ''): any => { - const links: any[] = []; - linkList.forEach((item: LinkType) => { - links.push({ - type: LeftItem, - extraCls: item.connectionName === selectTitle ? 'left-item-selected' : '', - title: item.connectionName, - id: item.connectionId, - creator: item.creator, - text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), - }); - }); - - return links; -}; diff --git a/src/app/link_status/left/left.model.ts b/src/app/status/left/left.model.ts similarity index 87% rename from src/app/link_status/left/left.model.ts rename to src/app/status/left/left.model.ts index d2633ef..fb06170 100644 --- a/src/app/link_status/left/left.model.ts +++ b/src/app/status/left/left.model.ts @@ -1,5 +1,5 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus.left'; +const className = 'dec.dcm.model.linkstatus.left'; const Model: ModelType = { context: ['tab', 'linkList', 'statusSelected'], state () { diff --git a/src/app/status/left/left.ts b/src/app/status/left/left.ts new file mode 100644 index 0000000..d16451d --- /dev/null +++ b/src/app/status/left/left.ts @@ -0,0 +1,44 @@ +import {WidgetType, ListView} from '@ui'; +import Model from './left.model'; +import {LinkType} from '@ui/type'; +import LeftItem from './left_item'; + +const className = 'dec.dcm.component.linkStatus.left'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + watch: { + linkList(linkList: LinkType[]) { + const title = linkList.length > 0 ? linkList[0].connectionName : ''; + this.store.setStatusSelected(title); + }, + statusSelected(title: string) { + const linkList = this.model.linkList; + this.leftContent.populate(BI.createItems(this._renderItems(linkList, title))); + }, + }, + render() { + return { + type: ListView, + ref: _ref => { + this.leftContent = _ref; + }, + items: this._renderItems(this.model.linkList, this.model.statusSelected), + }; + }, + _renderItems(linkList: LinkType[], selectTitle = '') { + return BI.map(linkList, (index: number, item: LinkType) => { + return { + type: LeftItem, + selected: item.connectionName === selectTitle, + title: item.connectionName, + id: item.connectionId, + creator: item.creator, + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), + }; + }); + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/link_status/left/left.item.component.ts b/src/app/status/left/left_item.ts similarity index 55% rename from src/app/link_status/left/left.item.component.ts rename to src/app/status/left/left_item.ts index b568ab8..0a4ee89 100644 --- a/src/app/link_status/left/left.item.component.ts +++ b/src/app/status/left/left_item.ts @@ -1,36 +1,39 @@ -import {WidgetType, Left, Label, TextButton} from '@ui'; +import {WidgetType, TextButton, VerticalAdapt} from '@ui'; import Model from './left.model'; -const className = 'fr.component.linkStatus.left.item'; +const className = 'dec.dcm.component.linkStatus.left.item'; const Widget: WidgetType = { props: { title: '', id: '', creator: '', + baseCls: 'bi-list-item-active', }, _store() { return BI.Models.getModel(Model); }, render() { - const {title, extraCls, creator, text, id} = this.options; + const {title} = this.options; return { - type: Left, - cls: 'left-item', - extraCls, + type: VerticalAdapt, + cls: 'bi-list-item-active', + height: 30, items: [ { type: TextButton, cls: 'link-title', + lgap: 10, textAlign: 'left', text: title, title, - handler: () => { - this.store.setStatusSelected(title); - }, }, ], }; }, + doClick() { + const {title} = this.options; + this.store.setStatusSelected(title); + }, }; BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); export default className; diff --git a/src/app/link_status/link_status.model.ts b/src/app/status/link_status.model.ts similarity index 80% rename from src/app/link_status/link_status.model.ts rename to src/app/status/link_status.model.ts index ecdda3c..c4e7467 100644 --- a/src/app/link_status/link_status.model.ts +++ b/src/app/status/link_status.model.ts @@ -1,5 +1,5 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus'; +const className = 'dec.dcm.model.linkstatus'; const Model: ModelType = { context: ['tab', 'linkList'], actions: { diff --git a/src/app/link_status/link_status.component.ts b/src/app/status/link_status.ts similarity index 60% rename from src/app/link_status/link_status.component.ts rename to src/app/status/link_status.ts index c68caaf..bf50a07 100644 --- a/src/app/link_status/link_status.component.ts +++ b/src/app/status/link_status.ts @@ -1,36 +1,44 @@ -import {WidgetType, Htape, Vtape, Left, Label} from '@ui'; +import {WidgetType, Htape, Vtape, Label, VerticalAdapt} from '@ui'; import linkStatusModel from './link_status.model'; -import LeftList from './left/left.component'; -import Right from './right/right.component'; +import LeftList from './left/left'; +import Right from './right/right'; import {TAB_LINK_POOL} from '@private/constants'; -const className = 'fr.linkstatus'; +const className = 'dec.dcm.linkstatus'; const Widget: WidgetType = { + props: { + baseCls: 'bi-card', + }, _store() { return BI.Models.getModel(linkStatusModel); }, watch: { tab(tab: string) { - this.setVisible(tab === TAB_LINK_POOL); + this.linkStatus.setVisible(tab === TAB_LINK_POOL); }, }, render() { return { type: Htape, - cls: 'linkStatus', + invisible: true, + ref: _ref => { + this.linkStatus = _ref; + }, items: [{ el: { type: Vtape, - cls: 'database-left', + cls: 'dcm-link-left', items: [ { el: { - type: Left, - cls: 'select-group', + type: VerticalAdapt, + cls: 'bi-border-bottom', items: [ { type: Label, - cls: 'status-title', + cls: 'bi-font-bold', + hgap: 6, + vgap: 6, text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], @@ -45,12 +53,10 @@ const Widget: WidgetType = { width: 280, }, { type: Right, + cls: 'bi-border-left', }], }; }, - mounted() { - this.setVisible(false); - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_status/right/right.model.ts b/src/app/status/right/right.model.ts similarity index 76% rename from src/app/link_status/right/right.model.ts rename to src/app/status/right/right.model.ts index aa49c71..d5f06a8 100644 --- a/src/app/link_status/right/right.model.ts +++ b/src/app/status/right/right.model.ts @@ -1,10 +1,10 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus.right'; +const className = 'dec.dcm.model.linkstatus.right'; const Model: ModelType = { context: ['linkList', 'statusSelected'], state () { return { - selected:'', + selected: '', }; }, actions: { diff --git a/src/app/link_status/right/right.component.ts b/src/app/status/right/right.ts similarity index 56% rename from src/app/link_status/right/right.component.ts rename to src/app/status/right/right.ts index c5da67c..71c1cd9 100644 --- a/src/app/link_status/right/right.component.ts +++ b/src/app/status/right/right.ts @@ -1,65 +1,68 @@ -import {WidgetType, Vertical, Left, Label} from '@ui/index'; +import {WidgetType, Label, ListView, VerticalAdapt, Vtape} from '@ui/index'; import Model from './right.model'; import {info} from '@shared/crud/crud.request'; -import RightCard from './right.card.component'; +import RightCard from './right_card'; import {InfoType} from './right.typings'; import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -const className = 'fr.component.linkStatus.right'; -let Title: any = null; -let Group: any = null; +const className = 'dcm-link-form'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', + }, _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { statusSelected(title: string) { const link = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionName === title); const plugins: string[] = BI.Constants.getConstant(pluginListConstant); const isPlugin = link.text && BI.some(plugins, (index: number, item: string) => item === link.text); const Pool = isPlugin ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${link.text.toLowerCase()}.pool`) : RightCard; info(name, (res: InfoType) => { - Group.populate(BI.createItems([{ + this.statusGroup.populate(BI.createItems([{ type: Pool, ...res, }])); }); - Title.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`); + this.statusTitle.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`); }, }, render() { return { - type:Vertical, - cls:'database-right', - items:[ + type: Vtape, + items: [ { - type: Left, - height: 40, - cls: 'right-status-title', - items:[ - { - type: Label, - text:BI.i18nText('Dec-Dcm_Data_Connections'), + el: { + type: VerticalAdapt, + cls: 'bi-border-bottom', + items: [ + { + type: Label, + cls: 'bi-font-bold', + lgap: 10, + text: BI.i18nText('Dec-Dcm_Data_Connections'), + }, + ], + ref: _ref => { + this.statusTitle = _ref; }, - ], - ref(ref: any) { - Title = ref; }, + height: 40, }, { - type: Vertical, + type: ListView, cls: 'right-status-body', - ref(ref: any) { - Group = ref; + vgap: 10, + hgap: 10, + ref: _ref => { + this.statusGroup = _ref; }, }, ], }; }, - mounted() { - - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_status/right/right.typings.d.ts b/src/app/status/right/right.typings.d.ts similarity index 100% rename from src/app/link_status/right/right.typings.d.ts rename to src/app/status/right/right.typings.d.ts diff --git a/src/app/status/right/right_card.less b/src/app/status/right/right_card.less new file mode 100644 index 0000000..6b121b9 --- /dev/null +++ b/src/app/status/right/right_card.less @@ -0,0 +1,9 @@ +@import '../../../less/index.less'; +.dec-webui-dcm-status-right-card{ + .card-font-success{ + font-size: @font-size-30; + } + .card-font-heighlight{ + font-size: @font-size-30; + } +} \ No newline at end of file diff --git a/src/app/link_status/right/right.card.component.ts b/src/app/status/right/right_card.ts similarity index 51% rename from src/app/link_status/right/right.card.component.ts rename to src/app/status/right/right_card.ts index fc73314..3894c95 100644 --- a/src/app/link_status/right/right.card.component.ts +++ b/src/app/status/right/right_card.ts @@ -1,88 +1,86 @@ -import {WidgetType, Left, Label, Vertical} from '@ui/index'; -const className = 'fr.component.linkStatus.right.card'; +import './right_card.less'; +import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt, VerticalAdapt} from '@ui/index'; +const className = 'dec.dcm.component.linkStatus.right.card'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-status-right-card', + }, render() { const {maxActive, maxIdle, numActive, numIdle} = this.options; return { - type: Left, + type: FloatCenter, + height: 150, + hgap: 20, items: [ { - type: Left, - cls: 'right-status-item', + type: Vertical, + cls: 'bi-background', items: [ { - type: Vertical, - cls:'right-status-board', + type: CenterAdapt, + cls: 'right-status-board-item', + tgap: 40, items: [ { - type: Vertical, - cls:'right-status-board-item', + type: VerticalAdapt, items: [ { type: Label, - cls: 'right-status-text', - extraCls: 'card-font1', + cls: 'bi-high-light card-font-success', text: numActive, }, { type: Label, - cls: 'right-status-text', text: '/', }, { type: Label, - cls: 'right-status-text', text: maxActive, }, ], }, - { - type: Label, - height: 20, - text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), - }, ], }, + { + type: Label, + text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), + }, ], }, { - type: Left, - cls: 'right-status-right', + type: Vertical, + cls: 'bi-background', items: [ { - type: Vertical, - cls:'right-status-board', + type: CenterAdapt, + tgap: 40, + cls: 'right-status-board-item', items: [ { - type: Vertical, - cls:'right-status-board-item', + type: VerticalAdapt, items: [ { type: Label, - cls: 'right-status-text', - extraCls: 'card-font2', + cls: 'bi-high-light card-font-heighlight', text: numIdle, }, { type: Label, - cls: 'right-status-text', text: '/', }, { type: Label, - cls: 'right-status-text', text: maxIdle, }, ], }, - { - type: Label, - height: 20, - text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), - }, ], }, + { + type: Label, + text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), + }, ], }, ], diff --git a/src/app/title/title.component.ts b/src/app/title/title.component.ts deleted file mode 100644 index 7a7afb6..0000000 --- a/src/app/title/title.component.ts +++ /dev/null @@ -1,57 +0,0 @@ -import {Left, WidgetType, IconButton} from '@ui/index'; -import TitleItem from './title_item/title_item.component'; -import {isDesigner, closeWindow} from '@shared/crud/crud.request'; -import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; -const className = 'fr.title'; -const Widget: WidgetType = { - render() { - return { - type: Left, - cls: 'title', - items: [ - { - type: TitleItem, - cls: 'dec-title-item-selected', - text: BI.i18nText('Dec-Dcm_Connection_Management'), - value: TAB_LINK_SET, - ref: _ref => { - this.ConnectSet = _ref; - }, - handler: () => { - this.ConnectSet.select(); - }, - }, - { - type: TitleItem, - text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), - value: TAB_LINK_POOL, - ref: _ref => { - this.ConnectPool = _ref; - }, - handler: () => { - this.ConnectPool.select(); - }, - }, - { - type: IconButton, - cls: 'close-button', - handler() { - closeWindow(); - }, - invisible: true, - ref: _ref => { - this.CloseButton = _ref; - }, - }, - ], - }; - }, - mounted() { - if (isDesigner()) { - this.CloseButton.setVisible(true); - } - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); - -export default className; diff --git a/src/app/title/title.less b/src/app/title/title.less new file mode 100644 index 0000000..83f12f1 --- /dev/null +++ b/src/app/title/title.less @@ -0,0 +1,8 @@ +@import '../../less/index.less'; +.dec-webui-dcm-title{ + .title-item-selected{ + color: @background-color-highlight; + border-bottom-color:@border-color-highlight; + border-bottom-width: 2px; + } +} \ No newline at end of file diff --git a/src/app/title/title_item/title_item.model.ts b/src/app/title/title.model.ts similarity index 81% rename from src/app/title/title_item/title_item.model.ts rename to src/app/title/title.model.ts index f8d1923..97efd09 100644 --- a/src/app/title/title_item/title_item.model.ts +++ b/src/app/title/title.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.title.item'; +const className = 'dec.dcm.model.title.item'; const Model = BI.inherit(Fix.Model, { context: ['tab'], actions: { diff --git a/src/app/title/title.ts b/src/app/title/title.ts new file mode 100644 index 0000000..1a31ea0 --- /dev/null +++ b/src/app/title/title.ts @@ -0,0 +1,61 @@ +import './title.less'; +import {WidgetType, IconButton, LeftRightVerticalAdapt, LinearSegment} from '@ui/index'; +import Model from './title.model'; +import {isDesigner, closeWindow} from '@shared/crud/crud.request'; +import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; +const className = 'dec.dcm.title'; +const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', + }, + _store() { + return BI.Models.getModel(Model); + }, + render() { + const showCloseButton = isDesigner(); + const that = this; + + return { + type: LeftRightVerticalAdapt, + items: { + left: [ + { + type: LinearSegment, + cls: 'bi-card', + height: 40, + width: 200, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Management'), + value: TAB_LINK_SET, + selected: true, + }, { + text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + value: TAB_LINK_POOL, + }], + listeners: [{ + eventName: 'EVENT_CHANGE', + action () { + that.store.setTab(this.getValue()[0]); + }, + }], + }, + ], + right: [ + showCloseButton ? { + type: IconButton, + cls: 'close-ha-font', + width: 30, + height: 30, + rgap: 10, + handler() { + closeWindow(); + }, + } : null, + ], + }, + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); + +export default className; diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts deleted file mode 100644 index 84b0981..0000000 --- a/src/app/title/title_item/title_item.component.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {Label} from '@ui'; -import tableItemModel from './title_item.model'; -import {getSelectStyle} from './title_item.service'; -const className = 'fr.title.item'; -const Widget = BI.inherit(BI.BasicButton, { - props: { - text: '', - }, - _store() { - return BI.Models.getModel(tableItemModel); - }, - watch: { - tab(tab: string) { - const {value} = this.options; - this.element.css(getSelectStyle(value, tab)); - }, - }, - render() { - const {text} = this.options; - - return { - type: Label, - cls: 'dec-title-item', - text, - }; - }, - select() { - const {value} = this.options; - this.store.setTab(value); - }, -}); -BI.shortcut(className, Widget); - -export default className; diff --git a/src/app/title/title_item/title_item.service.ts b/src/app/title/title_item/title_item.service.ts deleted file mode 100644 index 2bb4109..0000000 --- a/src/app/title/title_item/title_item.service.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function getSelectStyle(status: string, nowStatus: string): any { - if (status === nowStatus) { - return { - color: '#3685f2', - 'border-bottom': 'solid 2px #3685f2', - }; - } - - return { - color: '#3d4d66', - 'border-bottom': 'none', - }; -} diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index 31e8802..8824963 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -1,4 +1,5 @@ import './style.scss'; +import {TextEditor, Vertical, Left, Label} from '@ui/index'; const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value'; const form = { url: '192.168.1.22', @@ -6,28 +7,27 @@ const form = { password: '123456', }; -const classNameEdit = 'fr.plugin.redis.edit'; +const classNameEdit = 'dec.dcm.plugin.redis.edit'; const Widget = BI.inherit(BI.Widget, { render() { return { - type: 'bi.vertical', + type: Vertical, cls: 'bi-plugin-redis', bgap: 10, items: [ { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), value: form.url, allowBlank: true, @@ -36,19 +36,18 @@ const Widget = BI.inherit(BI.Widget, { }], }, { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), allowBlank: true, width: 300, @@ -61,19 +60,18 @@ const Widget = BI.inherit(BI.Widget, { }], }, { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, inputType: 'password', value: form.password, allowBlank: true, diff --git a/src/demo/plugin.redis.preview.ts b/src/demo/plugin.redis.preview.ts index 9dfd4df..b90b318 100644 --- a/src/demo/plugin.redis.preview.ts +++ b/src/demo/plugin.redis.preview.ts @@ -1,4 +1,4 @@ -const classNamePreview = 'fr.plugin.redis.preview'; +const classNamePreview = 'dec.dcm.plugin.redis.preview'; const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value'; const form = BI.Constants.getConstant(RedisConstantName); diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 26410b3..8ce7df5 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -1,4 +1,4 @@ -const classNamePool = 'fr.plugin.redis.pool'; +const classNamePool = 'dec.dcm.plugin.redis.pool'; const WidgetPool = BI.inherit(BI.Widget, { render() { @@ -22,7 +22,6 @@ const WidgetPool = BI.inherit(BI.Widget, { { type: 'bi.label', cls: 'right-status-text', - extraCls: 'card-font1', text: numActive, }, { diff --git a/src/index.ts b/src/index.ts index 6c892fe..ceb3a40 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ import i18n from '../private/i18n'; BI.DOM.ready(() => { - const app = require('./app/app.component').default; + const app = require('./app/app').default; // TODO: 先采用这种方式方便前端调试 BI.addI18n(i18n); BI.createWidget({ - type:app, + type: app, element: 'body', }); }); diff --git a/src/less/index.less b/src/less/index.less new file mode 100644 index 0000000..9d67e74 --- /dev/null +++ b/src/less/index.less @@ -0,0 +1,4 @@ +@import "lib/background"; +@import "lib/color"; +@import "resource/background"; +@import "resource/font"; \ No newline at end of file diff --git a/src/less/lib/background.less b/src/less/lib/background.less new file mode 100644 index 0000000..bff78bf --- /dev/null +++ b/src/less/lib/background.less @@ -0,0 +1,6 @@ +@background-resources: "resources.png"; +@background-warning: "warning.png"; +@background-database-selected: "database-selected.png"; +@background-loading-gif: "loading.gif"; +@background-success: "success.png"; +@background-error: "error.png"; \ No newline at end of file diff --git a/src/less/lib/color.less b/src/less/lib/color.less new file mode 100644 index 0000000..ca1c3a1 --- /dev/null +++ b/src/less/lib/color.less @@ -0,0 +1,2 @@ +@import "../../../node_modules/fineui/src/less/lib/colors"; +@background-color-blue-transparent: @color-bi-blue-5; \ No newline at end of file diff --git a/src/less/lib/font.less b/src/less/lib/font.less new file mode 100644 index 0000000..751359f --- /dev/null +++ b/src/less/lib/font.less @@ -0,0 +1,4 @@ +@font-link: "e759"; +@font-link-test: "e763"; +@font-link-info: "e63c"; +@font-link-delete: "e6c4"; \ No newline at end of file diff --git a/src/less/resource/background.less b/src/less/resource/background.less new file mode 100644 index 0000000..ffec451 --- /dev/null +++ b/src/less/resource/background.less @@ -0,0 +1,23 @@ +@import "../lib/background"; +@import "../var"; + +.data-connection-background { + .image2xPath(@background-resources) +} + +.dcm-comfirm-icon{ + .image2xPath(@background-warning) +} +.dcm-link-more-selected{ + .image2xPath(@background-database-selected) +} + +.dcm-loading-icon{ + .image2xPath(@background-loading-gif) +} +.dcm-success-icon{ + .image2xPath(@background-success) +} +.dcm-error-icon{ + .image2xPath(@background-error) +} \ No newline at end of file diff --git a/src/less/resource/font.less b/src/less/resource/font.less new file mode 100644 index 0000000..9605c6f --- /dev/null +++ b/src/less/resource/font.less @@ -0,0 +1,7 @@ +@import "../../../node_modules/fineui/src/less/image.less"; +@import "../lib/font.less"; + +.font(dcm-link-font, @font-link); +.font(dcm-info-font, @font-link-info); +.font(dcm-test-font, @font-link-test); +.font(dcm-delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/var.less b/src/less/var.less new file mode 100644 index 0000000..a324209 --- /dev/null +++ b/src/less/var.less @@ -0,0 +1,4 @@ +@import "../../node_modules/fineui/src/less/var"; +@import '../../node_modules/fineui/src/less/visual.less'; +@imageUrl: '/img/'; +@image2xUrl: '/img/'; \ No newline at end of file diff --git a/src/shared/components/both.side.component.ts b/src/shared/components/both_side.ts similarity index 81% rename from src/shared/components/both.side.component.ts rename to src/shared/components/both_side.ts index 819f2f9..ff05f20 100644 --- a/src/shared/components/both.side.component.ts +++ b/src/shared/components/both_side.ts @@ -1,17 +1,18 @@ import {WidgetType, Htape, Label} from '@ui/index'; -const BothSide = 'fr.shared.component.both.side'; +const BothSide = 'dec.dcm.shared.component.both.side'; const Widget: WidgetType = { + props: { + height: 24, + }, render() { const {leftText, rightText} = this.options; return { type: Htape, - cls: 'both-side', - height:24, items: [{ el: { type: Label, - cls: 'left', + cls: 'bi-font-bold', textAlign: 'left', text: leftText, }, diff --git a/src/shared/components/form.item.component.ts b/src/shared/components/form.item.component.ts deleted file mode 100644 index bc88f74..0000000 --- a/src/shared/components/form.item.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -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; - - return { - type: Htape, - cls: 'both-side', - height:height ? height : 24, - items: [{ - el: { - type: Label, - cls: 'left', - textAlign: 'left', - text, - }, - width: 115, - }, form, { - type: Label, - cls: 'hint', - textAlign: 'left', - text: hint, - }], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/shared/components/title.component.ts b/src/shared/components/title.ts similarity index 66% rename from src/shared/components/title.component.ts rename to src/shared/components/title.ts index df1bc8a..f1843e2 100644 --- a/src/shared/components/title.component.ts +++ b/src/shared/components/title.ts @@ -1,12 +1,16 @@ import {WidgetType, Label} from '@ui/index'; -const className = 'fr.shared.component.title'; +const className = 'dec.dcm.shared.component.title'; const Widget: WidgetType = { + props: { + baseCls: 'bi-tips bi-border-bottom', + }, render() { const {text} = this.options; return { type: Label, - cls: 'shared-component-title', + height: 24, + bgap: 10, textAlign: 'left', text, }; diff --git a/src/shared/crud/crud.request.ts b/src/shared/crud/crud.request.ts index 63d6495..0eab64d 100644 --- a/src/shared/crud/crud.request.ts +++ b/src/shared/crud/crud.request.ts @@ -82,7 +82,7 @@ export function testConnection(data: LinkType, cb: Function): void{ }); } else { setTimeout(() => { - cb({errorCode:'500', errorMsg:'createConnectionThread not start!'}); + cb({errorCode: '500', errorMsg: 'createConnectionThread not start!'}); }, 2000); } } @@ -125,6 +125,6 @@ export function info(name: string, cb: Function): void{ cb(res.data); }); } else { - cb({maxActive:50, maxIdle:10, numActive:0, numIdle:0}); + cb({maxActive: 50, maxIdle: 10, numActive: 0, numIdle: 0}); } } diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 4f087ae..c7ddb77 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -1,4 +1,4 @@ -import {Label, Vertical, Left, Button, Layout} from '@ui/index'; +import {Label, Vertical, Button, Layout, CenterAdapt, VerticalAdapt} from '@ui/index'; class Dialog { /** * 提示 @@ -16,15 +16,19 @@ class Dialog { body: { type: 'bi.left', cls: 'comfirm-content', + vgap: 40, + hgap: 20, items: [ { type: 'bi.layout', - cls: 'comfirm-icon', + cls: 'dcm-comfirm-icon', width: 50, height: 50, }, { type: 'bi.label', + textHeight: 50, + lgap: 10, text: message, }, ], @@ -50,14 +54,16 @@ class Dialog { public loading(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', + width: 450, + height: 220, items: [ { type: Vertical, items: [ { type: 'bi.layout', - cls: 'loading-icon', + cls: 'dcm-loading-icon', width: 100, height: 100, }, @@ -76,14 +82,14 @@ class Dialog { public success(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', items: [ { type: Vertical, items: [ { type: 'bi.layout', - cls: 'success-icon', + cls: 'dcm-success-icon', width: 100, height: 100, }, @@ -101,14 +107,14 @@ class Dialog { public error(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', items: [ { type: Vertical, items: [ { type: 'bi.layout', - cls: 'error-icon', + cls: 'dcm-error-icon', width: 100, height: 100, }, @@ -125,8 +131,8 @@ class Dialog { } public linkFail(text: string, more: string, cb?: Function): string { - let Popover: any = null; - let More: any = null; + let dialogPopover = null; + let dialogMore = null; const id = BI.UUID(); const that = this; const body = { @@ -134,36 +140,39 @@ class Dialog { items: [ { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', tgap: 10, items: [ { type: Vertical, + vgap: 10, items: [ { type: Layout, - cls: 'error-icon', - width: 100, + cls: 'dcm-error-icon', + width: 270, height: 100, + textAlign: 'center', }, { type: Label, text, }, { - type: Left, + type: VerticalAdapt, cls: 'buttons', + hgap: 5, items: [ { type: Button, text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), level: 'ignore', handler() { - const isHide = !More.isVisible(); - Popover.element.css({ + const isHide = !dialogMore.isVisible(); + dialogPopover.element.css({ height: isHide ? '290' : '220', }); - More.setVisible(isHide); + dialogMore.setVisible(isHide); this.setText(isHide ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information')); }, }, @@ -172,7 +181,7 @@ class Dialog { text: BI.i18nText('Dec-Dcm_Back'), level: 'ignore', handler() { - that.close(id); + that.remove(id); }, }, { @@ -191,28 +200,38 @@ class Dialog { ], }, { type: Label, - cls: 'show-more', + cls: 'bi-header-background', text: more, invisible: true, height: 73, + width: 400, value: false, - ref(ref: any) { - More = ref; + ref: _ref => { + dialogMore = _ref; }, }, ], }; - BI.Popovers.create(id, { - type: 'bi.popover', - cls: 'popover-notitle bi-custom-show', - size: 'normal', - width: 450, - height: 220, - body, - ref(ref: any) { - Popover = ref; + + BI.Maskers.create(id, null, { + render: { + type: CenterAdapt, + cls: 'bi-z-index-mask', + items: [{ + el: { + type: 'bi.center_adapt', + cls: 'bi-card', + width: 450, + height: 220, + items: [body], + ref: _ref => { + dialogPopover = _ref; + }, + }, + }], }, - }).open(id); + }); + BI.Maskers.show(id); return id; } @@ -220,23 +239,32 @@ class Dialog { public close(id: string): void{ BI.Popovers.close(id); } + public remove(id: string): void{ + BI.Maskers.remove(id); + } + + public show(body: any, autoClose = 0): string { - const id = BI.UUID(); - BI.Popovers.create(id, { - type: 'bi.popover', - cls: 'popover-notitle bi-custom-show', - size: 'normal', - width: 450, - height: 220, - body, - }).open(id); + const name = BI.UUID(); + BI.Maskers.create(name, null, { + render: { + type: CenterAdapt, + cls: 'bi-z-index-mask', + items: [{ + el: { + ...body, + }, + }], + }, + }); + BI.Maskers.show(name); if (autoClose > 0) { setTimeout(() => { - this.close(id); + BI.Maskers.remove(name); }, autoClose); } - return id; + return name; } } diff --git a/src/ui/fineui.ts b/src/ui/fineui.ts index b0b7cc3..f40ddad 100644 --- a/src/ui/fineui.ts +++ b/src/ui/fineui.ts @@ -34,7 +34,7 @@ export const TextBubblePopupBarView = 'bi.text_bubble_bar_popup_view'; export const BubbleCombo = 'bi.bubble_combo'; export const SearchEditor = 'bi.search_editor'; export const Img = 'bi.img'; -export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; +export const LinearSegment = 'bi.linear_segment'; // 布局 export const VerticalAdapt = 'bi.vertical_adapt'; @@ -45,3 +45,9 @@ export const Layout = 'bi.layout'; export const Absolute = 'bi.absolute'; export const Vertical = 'bi.vertical'; export const Left = 'bi.left'; +export const Right = 'bi.right'; +export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; +export const VertualGroup = 'bi.virtual_group'; +export const ListView = 'bi.list_view'; +export const FloatCenter = 'bi.float_center'; +export const HorizotalAdapt = 'bi.horizontal_adapt'; diff --git a/webpack.config.js b/webpack.config.js index d62ab3b..128091d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -51,6 +51,19 @@ module.exports = env => { }, 'css-loader','sass-loader' ] + },{ + test:/\.less$/, + exclude: /node_modules/, + use: [ + { + loader: MiniCssExtractPlugin.loader, + options: { + publicPath: './', + hmr: process.env.NODE_ENV === 'development', + }, + }, + 'css-loader','less-loader' + ] },{ test:/(\.jpg|\.png|\.gif|\.svg)$/, exclude: /node_modules/,