diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 5c76dbf18..76b11b2ff 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -13,7 +13,7 @@ import com.fr.design.gui.NameInspector; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.design.upm.database.UniverseDatabaseOpener; +import com.fr.design.dcm.UniversalDatabaseOpener; import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; import com.fr.transaction.CallBackAdaptor; @@ -61,7 +61,7 @@ public class ConnectionListAction extends UpdateAction { */ public void actionPerformed(ActionEvent evt) { if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) { - UniverseDatabaseOpener.showUniverseDatabaseDialog(); + UniversalDatabaseOpener.showUniverseDatabaseDialog(); } else { openDesignDatabaseManager(); } diff --git a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java similarity index 62% rename from designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java rename to designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java index 106b1a0aa..3410af044 100644 --- a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java @@ -1,4 +1,4 @@ -package com.fr.design.upm.database; +package com.fr.design.dcm; import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.Atom; @@ -12,22 +12,22 @@ import com.fr.web.struct.impl.FineUI; * @version 10.0 * Created by richie on 2019-05-16 */ -public class UniverseDatabaseComponent extends AssembleComponent { +public class UniversalDatabaseComponent extends AssembleComponent { - public static final UniverseDatabaseComponent KEY = new UniverseDatabaseComponent(); + public static final UniversalDatabaseComponent KEY = new UniversalDatabaseComponent(); - private UniverseDatabaseComponent() { + private UniversalDatabaseComponent() { } @Override public ScriptPath script(RequestClient req) { - return ScriptPath.build("/com/fr/design/upm/database/database.js"); + return ScriptPath.build("/com/fr/design/dcm/index.js"); } @Override public StylePath style(RequestClient req) { - return StylePath.EMPTY; + return StylePath.build("/com/fr/design/dcm/style.css"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java similarity index 74% rename from designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java rename to designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java index 1fe983ea7..1a01a8641 100644 --- a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java @@ -1,4 +1,4 @@ -package com.fr.design.upm.database; +package com.fr.design.dcm; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; @@ -12,15 +12,15 @@ import java.awt.*; * @version 10.0 * Created by richie on 2019-05-16 */ -public class UniverseDatabaseDialog extends UIDialog { +public class UniversalDatabaseDialog extends UIDialog { - public UniverseDatabaseDialog(Frame frame, BasicPane pane) { + public UniversalDatabaseDialog(Frame frame, BasicPane pane) { super(frame); setUndecorated(true); JPanel panel = (JPanel) getContentPane(); panel.setLayout(new BorderLayout()); add(pane, BorderLayout.CENTER); - setSize(new Dimension(800, 500)); + setSize(new Dimension(1000, 600)); GUICoreUtils.centerWindow(this); setResizable(false); } diff --git a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java similarity index 74% rename from designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java rename to designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java index dee5de0f5..9239b9d4d 100644 --- a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java @@ -1,4 +1,4 @@ -package com.fr.design.upm.database; +package com.fr.design.dcm; import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.DesignerContext; @@ -10,7 +10,7 @@ import javax.swing.*; * @version 10.0 * Created by richie on 2019-05-16 */ -public class UniverseDatabaseOpener { +public class UniversalDatabaseOpener { private static UIDialog dialog = null; @@ -19,9 +19,9 @@ public class UniverseDatabaseOpener { } public static void showUniverseDatabaseDialog() { - UniverseDatabasePane upmPane = new UniverseDatabasePane(); + UniversalDatabasePane upmPane = new UniversalDatabasePane(); if (dialog == null) { - dialog = new UniverseDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane); + dialog = new UniversalDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane); } dialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java similarity index 72% rename from designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java rename to designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java index ac53d9426..e29a9f669 100644 --- a/designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java @@ -1,4 +1,4 @@ -package com.fr.design.upm.database; +package com.fr.design.dcm; import com.fr.design.dialog.BasicPane; import com.fr.design.ui.ModernUIPane; @@ -13,7 +13,7 @@ import java.awt.*; * @version 10.0 * Created by richie on 2019-05-16 */ -public class UniverseDatabasePane extends BasicPane { +public class UniversalDatabasePane extends BasicPane { private ModernUIPane modernUIPane; @@ -22,14 +22,15 @@ public class UniverseDatabasePane extends BasicPane { return "Database"; } - public UniverseDatabasePane() { + public UniversalDatabasePane() { setLayout(new BorderLayout()); - modernUIPane = new ModernUIPane.Builder() - .withComponent(UniverseDatabaseComponent.KEY) + modernUIPane = new ModernUIPane.Builder<>() + .withComponent(UniversalDatabaseComponent.KEY) .prepare(new ScriptContextAdapter() { @Override public void onScriptContextCreated(ScriptContextEvent event) { JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser())); } }) .build(); diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java new file mode 100644 index 000000000..577acada9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java @@ -0,0 +1,34 @@ +package com.fr.design.dcm; + +import com.fr.decision.webservice.bean.BaseBean; +import com.fr.design.bridge.exec.JSBridge; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.JSObject; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-05-17 + * 桥接Java和JavaScript的类 + */ +public class UniversalDcmBridge { + + public static UniversalDcmBridge getBridge(Browser browser) { + return new UniversalDcmBridge(browser); + } + + private JSObject window; + + private UniversalDcmBridge(Browser browser) { + this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); + } + + /** + * 获取所有的数据连接 + * @return 数据连接集合 + */ + @JSBridge + public BaseBean getConnections() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index 1e4d6a743..b5d9d247c 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -2,6 +2,7 @@ package com.fr.design.upm; import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; +import com.fr.config.ServerPreferenceConfig; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSCallback; @@ -61,6 +62,20 @@ public class UpmBridge { this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); } + /** + * 更新插件管理中心资源文件,这个方法仅仅是为了语义上的作用(更新) + * @param callback 安装完成后的回调函数 + */ + @JSBridge + public void update(final JSFunction callback) { + startDownload(callback); + } + + /** + * 下载并安装插件管理中心的资源文件 + * @param callback 安装完成后的回调函数 + */ + @JSBridge public void startDownload(final JSFunction callback) { new SwingWorker(){ @@ -76,10 +91,10 @@ public class UpmBridge { protected void done() { try { get(); - callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); } catch (Exception e) { - callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); FineLoggerFactory.getLogger().error(e.getMessage(), e); EventDispatcher.fire(DownloadEvent.ERROR, "error"); } @@ -87,6 +102,15 @@ public class UpmBridge { }.execute(); } + /** + * 获取upm的版本信息 + * @return 版本信息 + */ + @JSBridge + public String getVersion() { + return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion(); + } + @JSBridge public String i18nText(String key) { return Toolkit.i18nText(key); diff --git a/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java b/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java deleted file mode 100644 index 93857dc8b..000000000 --- a/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.design.upm.loader; - -import com.fr.decision.webservice.bean.plugin.store.ProjectInfoBean; -import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2019-04-18 - */ -public class UpmDesignResourceLoader extends BaseResourceLoader { - - @Override - public String getPluginPath() { - return "upm/plugin_design.html"; - } - - @Override - public void checkResourceExist(ProjectInfoBean projectInfoBean) throws Exception { - - } - - @Override - public String getDownloadPath() throws Exception { - return "http://fanruan-market.oss-cn-shanghai.aliyuncs.com/upm/1.0/upm-10.0.zip"; - } -} diff --git a/designer-base/src/main/resources/com/fr/design/dcm/index.js b/designer-base/src/main/resources/com/fr/design/dcm/index.js new file mode 100644 index 000000000..5f6220c74 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/dcm/index.js @@ -0,0 +1,2 @@ +!function(e){var t={};function i(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(s,o,function(t){return e[t]}.bind(null,o));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){BI.DOM.ready(()=>{const e=i(5).default;BI.createWidget({type:e,element:"body"})})},function(e,t,i){},function(e,t){const i=BI.Constants.getConstant("dec.constant.database.conf.connect.form.redis.value"),s=BI.inherit(BI.Widget,{render:()=>({type:"bi.vertical",cls:"bi-plugin-redis",bgap:10,items:[{type:"bi.left",height:30,items:[{type:"bi.label",text:"数据库地址:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:i.url,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"端口:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:i.port,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"密码:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:"********",height:24}]}]})});BI.shortcut("fr.plugin.redis.preview",s),BI.constant("dec.constant.database.conf.connect.form.redis.preview","fr.plugin.redis.preview")},function(e,t){const i=BI.inherit(BI.Widget,{render(){const{maxActive:e,maxIdle:t,numActive:i,numIdle:s}=this.options;return{type:"bi.left",items:[{type:"bi.left",cls:"right-status-item",items:[{type:"bi.vertical",cls:"right-status-board",items:[{type:"bi.vertical",cls:"right-status-board-item",items:[{type:"bi.label",cls:"right-status-text",extraCls:"card-font1",text:i},{type:"bi.label",cls:"right-status-text",text:"/"},{type:"bi.label",cls:"right-status-text",text:e}]},{type:"bi.label",text:"Redis连接数"}]}]}]}}});BI.shortcut("fr.plugin.redis.pool",i),BI.constant("dec.constant.database.conf.connect.form.redis.pool","fr.plugin.redis.pool")},function(e,t,i){},function(e,t,i){"use strict";i.r(t);const s="bi.icon_label",o="bi.label",r="bi.button",n="bi.editor",l="bi.vtape",a="bi.htape",c="bi.layout",d="bi.vertical",h="bi.left",p=[],m={childContext:["tab","linkList","linkSelected","linkUpdate","moreLinkSelected","statusSelected","connectionNameErr"],state:()=>({tab:"数据连接管理",linkList:p,linkSelected:{},linkUpdate:{},moreLinkSelected:"",statusSelected:"",connectionNameErr:""}),computed:{},actions:{setLinkList(e){this.model.linkList=e}}};BI.model("fr.model.main",BI.inherit(Fix.Model,m));const b=BI.inherit(Fix.Model,{context:["tab"],actions:{setTab(e){this.model.tab=e}}});BI.model("fr.model.title.item",b);function u(e,t){return e===t?{color:"#3685f2","border-bottom":"solid 2px #3685f2"}:{color:"#3d4d66","border-bottom":"none"}}const g=BI.inherit(BI.Widget,{props:{text:""},_store:()=>BI.Models.getModel("fr.model.title.item"),watch:{tab(e){const{text:t}=this.options;this.element.css(u(t,e))}},render(){const{text:e}=this.options;return{type:o,cls:"title-item",text:e}},mounted(){const{text:e}=this.options;this.element.css(u("数据连接管理",e)),this.element.on("click",()=>{this.store.setTab(e)})}});BI.shortcut("fr.title.item",g);const y={data:[{connectionId:"8c1c52f1-3d0a-429e-b35f-ee1e085a8b72",database:"",connectionName:"FRDemo",driver:"org.sqlite.JDBC",url:"jdbc:sqlite://${ENV_HOME}/../help/FRDemo.db",user:"",password:"",queryType:"",newCharsetName:"null",originalCharsetName:"",validationQuery:"",schema:"",testOnBorrow:!0,maxActive:50,options:"null",port:0,authType:"",creator:"designer",principal:"",keyPath:"",databaseType:"designer",privilegeDetailBeanList:"null"}]},f=window.parent.Dec,v=window.PluginHelper;const x=["数据连接管理","连接池状态"],I={render(){return{type:h,cls:"title",items:[...BI.map(x,(e,t)=>({type:"fr.title.item",text:t})),{type:"bi.icon_button",cls:"close-button",handler(){!function(){if(v)return v.closeWindow();console.log("关闭窗口")}()},invisible:!0,ref:e=>{this.CloseButton=e}}]}},mounted(){v&&v.isDesigner()&&this.CloseButton.setVisible(!0)}};BI.shortcut("fr.title",BI.inherit(BI.Widget,I));const k="dec.constant.database.conf.connect.list",B=["APACHE KYLIN","DERBY","HP Vertica","IBM DB2","INFORMIX","Microsoft SQL Server","MySQL","Oracle","Privotal Greenplum Database","Postgresql","GaussDB 200"];BI.constant(k,[]);var E=k;const w=[{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:"其他",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"}],N=(e,t)=>{const i=BI.Constants.getConstant(E);let s=0;const o=t.replace(/[0-9]/g,""),r=BI.some(i,(e,t)=>t===o)?o:"数据连接";return e.forEach(e=>{if(e.isSelected=!1,e.connectionName.startsWith(r)){const t=e.connectionName.replace(r,"0"),i=parseInt(t,10)+1;i>s&&(s=i)}}),`${r}${s>0?s:""}`};var T=new class{confirm(e,t){const i=BI.UUID();return BI.Popovers.create(i,{type:"bi.bar_popover",size:"normal",header:"提示",width:450,height:220,body:{type:"bi.left",cls:"comfirm-content",items:[{type:"bi.layout",cls:"comfirm-icon",width:50,height:50},{type:"bi.label",text:e}]},listeners:[{eventName:"EVENT_CONFIRM",action(){t&&t(!0)}},{eventName:"EVENT_CANCEL",action(){t&&t(!1)}}]}).open(i),i}loading(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"loading-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t)}success(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"success-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t,1e3)}error(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"error-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t,2e3)}linkFail(e,t,i){let s=null,n=null;const l=BI.UUID(),a=this,p={type:d,items:[{type:"bi.center_adapt",cls:"show-content",tgap:10,items:[{type:d,items:[{type:c,cls:"error-icon",width:100,height:100},{type:o,text:e},{type:h,cls:"buttons",items:[{type:r,text:"详细信息",level:"ignore",handler(){const e="详细信息"===this.getText();s.element.css({height:e?"290":"220"}),n.setVisible(e),this.setText(e?"收起信息":"详细信息")}},{type:r,text:"返回",level:"ignore",handler(){a.close(l)}},{type:r,text:"重新连接",handler(){a.close(l),i&&i()}}]}]}]},{type:o,cls:"show-more",text:t,invisible:!0,ref(e){n=e}}]};return BI.Popovers.create(l,{type:"bi.popover",cls:"popover-notitle",extraCls:"bi-custom-show",size:"normal",width:450,height:220,body:p,ref(e){s=e}}).open(l),l}close(e){BI.Popovers.close(e)}show(e,t=0){const i=BI.UUID();return BI.Popovers.create(i,{type:"bi.popover",cls:"popover-notitle",extraCls:"bi-custom-show",size:"normal",width:450,height:220,body:e}).open(i),t>0&&setTimeout(()=>{this.close(i)},t),i}};function C(e){return e.connectionId?new Promise((t,i)=>{try{!function(e,t){console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqPost("/v10/config/connection",e,e=>{t(e.data)}):t("success")}(e,e=>{t(e)})}catch(e){i(e)}}):new Promise((t,i)=>{try{!function(e,t){console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqPut("/v10/config/connection",e,e=>{t(e.data)}):t("success")}(e,e=>{t(e)})}catch(e){i(e)}})}const S={context:["tab","linkList","linkSelected","linkUpdate","connectionNameErr"],actions:{setLinkSelected(e){this.noSaveConfirm(()=>{this._setLinkSelected(e)})},_setLinkSelected(e){this.model.linkList.forEach(t=>{t.isSelected=t.connectionName===e,t.connectionName===e&&(this.model.linkSelected=Object.assign({},t,{isSelected:!1}))}),this.model.linkList=[...this.model.linkList],this.model.linkUpdate=this.model.linkSelected},onIconClick(e,t){switch(e){case"删除":!function(e,t){console.log("%cid: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqDeleta(`/v10/config/connection/${e}`,e=>{t(e.data)}):t("success")}(t,()=>{this.model.linkList=[...this.model.linkList.filter(e=>e.connectionId!==t)],this.model.linkSelected={},this.model.linkUpdate={}});break;case"测试连接":this._textLink(t);break;case"复制":this.noSaveConfirm(()=>{this.copyLink(t)})}},_textLink(e){const t=T.loading("正在测试连接,请稍候..."),i=this.model.linkList.find(t=>t.connectionId===e);var s,o;s=i,o=(s=>{T.close(t),s&&s.errorCode?T.linkFail(`${i.connectionName}测试连接失败`,s.errorMsg,()=>{this._textLink(e)}):T.success("连接成功")}),console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",s),f?f.reqPost("/v10/config/connection/test",s,e=>{o(e)}):setTimeout(()=>{o({errorCode:"500",errorMsg:"createConnectionThread not start!"})},2e3)},copyLink(e){const t=BI.find(this.model.linkList,(t,i)=>i.connectionId===e).connectionName,i=N(this.model.linkList,t);let s={};this.model.linkList.forEach(t=>{t.connectionId===e&&(s=t)});const o=Object.assign({},s,{isSelected:!0,connectionName:i,connectionId:""});this.model.linkList=[o,...this.model.linkList],this.model.linkSelected=Object.assign({},o),this.model.linkUpdate=Object.assign({},o)},setLinkUpdate(e){this.model.linkUpdate=e},setEdit(e){this.model.linkSelected=Object.assign({},this.model.linkSelected,{isSelected:e}),this.model.linkUpdate=this.model.linkSelected},setCancel(){const e=this.model.linkSelected,t=this.model.linkList;e.connectionId?this.setEdit(!1):(this.model.linkList=[...t.filter(e=>!!e.connectionId)],this.model.linkList.length>0?(this.model.linkList[0].isSelected=!0,this.model.linkSelected=Object.assign({},this.model.linkList[0],{isSelected:!1})):this.model.linkSelected={},this.model.linkUpdate=this.model.linkSelected)},setNewLink(e){w.some(t=>t.text===e)||BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.toLowerCase()}.edit`)?this.noSaveConfirm(()=>{this._setNewLink(e)}):T.error("找不到该连接的配置信息")},_setNewLink(e){const t=N(this.model.linkList,e);let i={};w.forEach(t=>{t.text===e&&(i=t)}),this.model.linkList=[Object.assign({connectionName:t,isSelected:!0},i,{text:e}),...this.model.linkList],this.model.linkSelected=Object.assign({},i,{connectionName:t,isSelected:!0,text:e}),this.model.linkUpdate=Object.assign({},i,{connectionName:t,text:e})},setConnectionNameErr(e){this.model.connectionNameErr=e},noSaveConfirm(e){this.model.linkSelected&&this.model.linkSelected.isSelected?T.confirm("当前设置尚未保存,是否保存?",t=>{t?this.saveLink():this.setCancel(),e()}):e()},saveLink(){const e=this.model.linkUpdate.text?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`):{};C(Object.assign({},this.model.linkUpdate,e)).then(()=>{this.setEdit(!1)})}}};BI.model("fr.model.linkset",BI.inherit(Fix.Model,S));var j="fr.model.linkset";const _={_store:()=>BI.Models.getModel(j),render(){const{cls:e,title:t,id:i}=this.options,o=this;let r=null,n=null;return"删除"===t?{type:"bi.bubble_combo",direction:"bottom",ref(){n=this},el:{type:s,cls:e,extraCls:"action-icon",height:24,width:26,title:t,ref(e){r=e}},popup:{type:"bi.text_bubble_bar_popup_view",text:"确定删除该数据连接?",listeners:[{eventName:BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,action(e){n.hideView(),e&&o.store.onIconClick(t,i)}}]},listeners:[{eventName:BI.BubbleCombo.EVENT_EXPAND,action(){r.element.css({visibility:"visible"})}},{eventName:BI.BubbleCombo.EVENT_AFTER_HIDEVIEW,action(){r.element.css({visibility:"hidden"})}}]}:{type:s,cls:e,extraCls:"action-icon",height:24,width:26,title:t}},mounted(){const{title:e,id:t}=this.options;"删除"!==e?this.element.on("click",i=>{i.stopPropagation(),this.store.onIconClick(e,t)}):this.element.on("click",e=>{e.stopPropagation()})}};BI.shortcut("fr.component.linkSet.left.item.icon",BI.inherit(BI.Widget,_));const L={props:{title:"",id:"",creator:""},_store:()=>BI.Models.getModel(j),render(){const{title:e,extraCls:t,creator:i,text:r,id:n}=this.options;return{type:h,cls:"left-item",extraCls:t,items:[{type:s,cls:"link-font",height:24,width:26,text:"连接",title:e},{type:o,cls:"link-title",textAlign:"left",text:e,title:e},{type:h,cls:"icons",items:[{type:"fr.component.linkSet.left.item.icon",cls:"link-text-font",title:"测试连接",id:n},{type:"fr.component.linkSet.left.item.icon",cls:"copy-font",title:"复制",id:n},{type:"fr.component.linkSet.left.item.icon",cls:"info-font",title:`类型:${"DESIGNER"===r?"其他":r} \r\n创建者:${i}`,id:n},{type:"fr.component.linkSet.left.item.icon",cls:"delete-font",title:"删除",id:n}]}]}},mounted(){const{title:e}=this.options;this.element.on("click",()=>{this.store.setLinkSelected(e)})}};BI.shortcut("fr.component.linkSet.left.item",BI.inherit(BI.Widget,L));let D=null;const A={_store:()=>BI.Models.getModel(j),watch:{linkList(e){D.populate(BI.createItems((e=>{const t=[];return e.forEach(e=>{t.push({type:"fr.component.linkSet.left.item",extraCls:e.isSelected?"left-item-selected":"",title:e.connectionName,id:e.connectionId,creator:e.creator,text:e.text?e.text:"默认"})}),t})(e)))}},render:()=>({type:d,ref(e){D=e}})};BI.shortcut("fr.component.linkset.left",BI.inherit(BI.Widget,A));const M={render(){const{text:e,name:t,selected:i}=this.options;return{type:d,cls:"link-item",width:120,height:117,items:[{type:"bi.img",width:120,height:90,src:`./img/${t}.jpg`},{type:c,cls:"selected",invisible:!i,width:30,height:30},{type:o,cls:"text",text:e}]}},mounted(){const{text:e}=this.options;this.element.on("click",()=>{this.fireEvent("EVENT_SELECT",e)})}};BI.shortcut("fr.component.linkSet.morelink.item",BI.inherit(BI.Widget,M));let O=null;const U={render:()=>({type:l,cls:"more-link",items:[{el:{type:d,items:[{type:"bi.search_editor",width:300,watermark:"搜索"}]},height:30},{type:h,cls:"more-link-item",ref(e){O=e}}]}),mounted(){this._renderItems()},_renderItems(e=""){const t=w.slice(12,45),i=[],s=this;t.forEach(t=>{i.push({type:"fr.component.linkSet.morelink.item",text:t.text,name:t.databaseType,selected:e===t.text,listeners:[{eventName:"EVENT_SELECT",action(e){s._renderItems(e),s.fireEvent("EVENT_SELECT",e)}}]})}),O.populate(BI.createItems(i))}};BI.shortcut("fr.component.linkSet.morelink",BI.inherit(BI.Widget,U));let q=null,V="";const P={_store:()=>BI.Models.getModel(j),render(){let e=null;return{type:"bi.combo",cls:"select",trigger:"click",adjustYOffset:4,el:{type:"bi.button",text:"新建数据连接",height:24},popup:{el:{type:"bi.button_group",cls:"database-link-items",items:[...BI.map([...B,...BI.Constants.getConstant(E)],(e,t)=>({type:"bi.text_item",height:24,width:152,text:t,title:t,value:t})),{type:"bi.text_item",cls:"link-item",height:24,width:152,text:"更多数据连接...",title:"更多数据连接...",value:"more"},{type:"bi.text_item",cls:"link-item",height:24,width:152,text:"其他",title:"其他",value:"其他"}],layouts:[{type:d}]},maxHeight:400},listeners:[{eventName:"EVENT_CHANGE",action:t=>{"more"===t?(e=>{const t=BI.UUID();let i=null;BI.Popovers.create(t,{type:"bi.bar_popover",size:"normal",header:"更多数据连接",width:550,height:500,body:{type:"fr.component.linkSet.morelink",listeners:[{eventName:"EVENT_SELECT",action(e){V=e,q.setEnable(!0)}}]},footer:{type:"bi.right_vertical_adapt",lgap:10,items:[{type:"bi.button",text:"取消",value:1,level:"ignore",handler(e){i.close(e)}},{type:"bi.button",text:"确定",disabled:!0,value:0,ref(e){q=e},handler(t){i.close(t),e&&e(V)}}]},ref(e){i=e}}).open(t)})(e=>{this.store.setNewLink(e)}):this.store.setNewLink(t),e.hideView()}}],ref(){e=this}}}};BI.shortcut("fr.linkset.select",BI.inherit(BI.Widget,P));const H={render:()=>({type:"bi.center_adapt",items:[{type:d,width:260,height:180,items:[{type:c,cls:"data-connection-background",width:260,height:130},{type:o,cls:"bi-tips",height:20,text:"请选择左侧数据连接或点击新建数据连接"},{type:o,cls:"bi-tips",height:20,text:"平台仅支持使用JDBC的数据连接的管理"}]}]})};BI.shortcut("fr.component.right.nothing",BI.inherit(BI.Widget,H));const R={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected,t=this.model.linkList,i=this,{isEdit:s}=this.options;return{type:h,height:40,cls:"right-title",items:[{type:o,cls:"right-title-text",text:`数据连接(${e.text?e.text:"默认"})`},{type:r,cls:"right-title-button",invisible:s,text:"编辑",handler(){i.store.setEdit(!0)}},{type:r,cls:"right-title-button",invisible:!s,text:"保存",handler(){BI.find(t,(e,t)=>i.model.linkUpdate.connectionName===t.connectionName&&t.connectionId!==i.model.linkUpdate.connectionId)?i.store.setConnectionNameErr("数据连接名已存在"):i.store.saveLink()}},{type:r,cls:"right-title-button",invisible:!s,level:"ignore",text:"取消",handler(){i.store.setCancel()}}]}}};BI.shortcut("fr.component.right.title",BI.inherit(BI.Widget,R));const G="fr.shared.component.both.side",W={render(){const{leftText:e,rightText:t}=this.options;return{type:a,cls:"both-side",height:24,items:[{el:{type:o,cls:"left",textAlign:"left",text:e},width:115},{type:o,textAlign:"left",text:t}]}}};BI.shortcut(G,BI.inherit(BI.Widget,W));var F=G;const $={render(){const{text:e}=this.options;return{type:o,cls:"shared-component-title",textAlign:"left",text:e}}};BI.shortcut("fr.shared.component.title",BI.inherit(BI.Widget,$));const Q={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected;return{type:d,cls:"right-show",items:[{type:F,leftText:"数据连接名",rightText:e.connectionName},{type:F,leftText:"驱动器",rightText:e.driver},{type:F,leftText:"URL",rightText:e.url},{type:F,leftText:"编码",rightText:""===e.originalCharsetName?"自动":e.originalCharsetName},{type:F,leftText:"用户名",rightText:e.user},{type:F,leftText:"密码",rightText:e.password},{type:"fr.shared.component.title",text:"连接池属性"},{type:F,leftText:"SQL验证查询",rightText:e.validationQuery},{type:F,leftText:"获取连接前校验",rightText:e.testOnBorrow?"是":"否"},{type:F,leftText:"最大连接数量",rightText:e.maxActive}]}}};BI.shortcut("fr.component.right.show",BI.inherit(BI.Widget,Q));BI.constant("bi.constant.database.conf.charset.list",[{text:"自动",value:""},{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 z={render(){const{text:e,form:t,hint:i,height:s}=this.options;return{type:a,cls:"both-side",height:s||24,items:[{el:{type:o,cls:"left",textAlign:"left",text:e},width:115},t,{type:o,cls:"hint",textAlign:"left",text:i}]}}};BI.shortcut("fr.shared.component.form.item",BI.inherit(BI.Widget,z));var K="fr.shared.component.form.item";function X(e){const t=[];return e.drivers&&e.drivers.length>0?e.drivers.forEach(e=>{t.push({text:e,value:e})}):t.push({text:e.driver,value:e.driver}),t}let Y=null;const J={_store:()=>BI.Models.getModel(j),watch:{connectionNameErr(e){e?BI.Bubbles.show("singleBubble",e,Y,{level:"error"}):BI.Bubbles.hide("singleBubble")}},render(){const e=this.model.linkSelected,t=this;return{type:d,cls:"right-show",items:[{type:K,text:"数据连接名",hint:"*修改数据连接名会影响相关数据表和仪表板",form:{type:n,cls:"bi-border",width:300,value:e.connectionName,ref(e){Y=e},listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{connectionName:this.getValue()}))}},{eventName:BI.Editor.EVENT_FOCUS,action(){t.store.setConnectionNameErr("")}}]}},{type:K,text:"第一步",height:400,form:{type:d,cls:"right-form",items:[{type:K,text:"驱动器",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:e.driver,items:X(e),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{driver:this.getValue()[0]}))}}]}},{type:K,text:"URL",form:{type:n,cls:"bi-border",watermark:"请输入",width:300,value:e.url,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{url:this.getValue()}))}}]}},{type:K,text:"编码",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:""===e.originalCharsetName?"自动":e.originalCharsetName,items:BI.Constants.getConstant("bi.constant.database.conf.charset.list"),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{originalCharsetName:this.getValue()[0]}))}}]}},{type:K,text:"用户名",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,value:e.user,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{user:this.getValue()}))}}]}},{type:K,text:"密码",form:{type:n,cls:"bi-border",inputType:"password",allowBlank:!0,watermark:"请输入",width:300,value:e.password,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{password:this.getValue()}))}}]}},{type:"fr.shared.component.title",text:"连接池属性"},{type:K,text:"SQL验证查询",height:100,form:{type:"bi.textarea_editor",cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,height:100,value:e.validationQuery,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{validationQuery:this.getValue()}))}}]}},{type:K,text:"获取连接前校验",form:{type:"bi.multi_select_item",text:"是",selected:e.testOnBorrow,width:60,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{testOnBorrow:this.isSelected()}))}}]}},{type:K,text:"最大活动连接数",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:60,value:e.maxActive,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{maxActive:this.getValue()}))}}]}}]}},{type:K,text:"第二步",form:{type:r,text:"测试连接",level:"ignore"}},{type:K,text:"第三步",form:{type:K,text:"模式",form:{type:n,cls:"bi-border",width:300,disabled:!0}}}]}}};BI.shortcut("fr.component.right.edit",BI.inherit(BI.Widget,J));const Z={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected,t=this;return{type:d,cls:"right-show",items:[{type:K,text:"数据连接名",hint:"*修改数据连接名会影响相关数据表和仪表板",form:{type:n,cls:"bi-border",width:300,value:e.connectionName,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{connectionName:this.getValue()}))}}]}},{type:K,text:"驱动器",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:e.driver,items:X(e),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{driver:this.getValue()[0]}))}}]}},{type:K,text:"URL",form:{type:n,cls:"bi-border",watermark:"请输入",width:300,value:e.url,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{url:this.getValue()}))}}]}},{type:K,text:"编码",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:""===e.originalCharsetName?"自动":e.originalCharsetName,items:BI.Constants.getConstant("bi.constant.database.conf.charset.list"),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{originalCharsetName:this.getValue()[0]}))}}]}},{type:K,text:"用户名",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,value:e.user,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{user:this.getValue()}))}}]}},{type:K,text:"密码",form:{type:n,cls:"bi-border",inputType:"password",allowBlank:!0,watermark:"请输入",width:300,value:e.password,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{password:this.getValue()}))}}]}},{type:"fr.shared.component.title",text:"连接池属性"},{type:K,text:"SQL验证查询",height:100,form:{type:"bi.textarea_editor",cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,height:100,value:e.validationQuery,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{validationQuery:this.getValue()}))}}]}},{type:K,text:"获取连接前校验",form:{type:"bi.multi_select_item",text:"是",selected:e.testOnBorrow,width:60,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{testOnBorrow:this.isSelected()}))}}]}},{type:K,text:"最大活动连接数",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:60,value:e.maxActive,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{maxActive:this.getValue()}))}}]}},{type:K,text:"测试连接",form:{type:r,text:"测试连接",level:"ignore"}}]}}};BI.shortcut("fr.component.right.edit.mysql",BI.inherit(BI.Widget,Z));let ee=null;const te=e=>{const t=BI.Constants.getConstant(E),i=BI.some(t,(t,i)=>i===e.text);let s="mysql"===e.databaseType?"fr.component.right.edit.mysql":"fr.component.right.edit";i&&(s=BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.text.toLowerCase()}.edit`));const o=i?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.text.toLowerCase()}.preview`):"fr.component.right.show";ee.populate(BI.createItems([{type:"fr.component.right.title",isEdit:e.isSelected,linkSelected:e},{type:e.isSelected?s:o,linkSelected:e}]))},ie={_store:()=>BI.Models.getModel(j),watch:{linkSelected(e){te(e)}},render:()=>({type:d,cls:"right-content",ref(e){ee=e}}),mounted(){const e=this.model.linkSelected;te(e)}};BI.shortcut("fr.component.right.detail",BI.inherit(BI.Widget,ie));let se=null;const oe={_store:()=>BI.Models.getModel(j),watch:{linkSelected(e){se.populate(BI.createItems([{type:e&&e.connectionName?"fr.component.right.detail":"fr.component.right.nothing"}]))}},render:()=>({type:d,cls:"database-right",ref(e){se=e}}),mounted(){se.populate(BI.createItems([{type:"fr.component.right.nothing"}]))}};BI.shortcut("fr.component.right",BI.inherit(BI.Widget,oe));const re={_store:()=>BI.Models.getModel(j),watch:{tab(e){this.setVisible("数据连接管理"===e)}},render:()=>({type:a,cls:"linkset",items:[{el:{type:l,cls:"database-left",items:[{el:{type:h,cls:"select-group",items:[{type:"fr.linkset.select"}]},height:40},{type:"fr.component.linkset.left",cls:"left-list"}]},width:280},{type:"fr.component.right"}]})};BI.shortcut("fr.linkset",BI.inherit(BI.Widget,re));BI.model("fr.model.linkstatus",BI.inherit(Fix.Model,{context:["tab","linkList"],actions:{}}));const ne={context:["tab","linkList","statusSelected"],state:()=>({selected:""}),actions:{setStatusSelected(e){this.model.statusSelected=e}}};BI.model("fr.model.linkstatus.left",BI.inherit(Fix.Model,ne));const le={props:{title:"",id:"",creator:""},_store:()=>BI.Models.getModel("fr.model.linkstatus.left"),render(){const{title:e,extraCls:t,creator:i,text:s,id:r}=this.options;return{type:h,cls:"left-item",extraCls:t,items:[{type:o,cls:"link-title",textAlign:"left",text:e,title:e}]}},mounted(){const{title:e}=this.options;this.element.on("click",()=>{this.store.setStatusSelected(e)})}};BI.shortcut("fr.component.linkStatus.left.item",BI.inherit(BI.Widget,le));let ae=null;const ce={_store:()=>BI.Models.getModel("fr.model.linkstatus.left"),watch:{linkList(e){const t=e.length>0?e[0].connectionName:"";this.store.setStatusSelected(t)},statusSelected(e){const t=this.model.linkList;ae.populate(BI.createItems(((e,t="")=>{const i=[];return e.forEach(e=>{i.push({type:"fr.component.linkStatus.left.item",extraCls:e.connectionName===t?"left-item-selected":"",title:e.connectionName,id:e.connectionId,creator:e.creator,text:e.text?e.text:"默认"})}),i})(t,e)))}},render:()=>({type:d,ref(e){ae=e}})};BI.shortcut("fr.component.linkStatus.left",BI.inherit(BI.Widget,ce));const de={context:["linkList","statusSelected"],state:()=>({selected:""}),actions:{}};BI.model("fr.model.linkstatus.right",BI.inherit(Fix.Model,de));const he={render(){const{maxActive:e,maxIdle:t,numActive:i,numIdle:s}=this.options;return{type:h,items:[{type:h,cls:"right-status-item",items:[{type:d,cls:"right-status-board",items:[{type:d,cls:"right-status-board-item",items:[{type:o,cls:"right-status-text",extraCls:"card-font1",text:i},{type:o,cls:"right-status-text",text:"/"},{type:o,cls:"right-status-text",text:e}]},{type:o,height:20,text:"活动连接数"}]}]},{type:h,cls:"right-status-right",items:[{type:d,cls:"right-status-board",items:[{type:d,cls:"right-status-board-item",items:[{type:o,cls:"right-status-text",extraCls:"card-font2",text:s},{type:o,cls:"right-status-text",text:"/"},{type:o,cls:"right-status-text",text:t}]},{type:o,height:20,text:"空闲连接数"}]}]}]}}};BI.shortcut("fr.component.linkStatus.right.card",BI.inherit(BI.Widget,he));let pe=null,me=null;const be={_store:()=>BI.Models.getModel("fr.model.linkstatus.right"),watch:{statusSelected(e){const t=BI.find(this.model.linkList,(t,i)=>i.connectionName===e),i=BI.Constants.getConstant(E),s=t.text&&BI.some(i,(e,i)=>i===t.text)?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${t.text.toLowerCase()}.pool`):"fr.component.linkStatus.right.card";!function(e,t){console.log("%cname: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqDeleta(`/v10/config/connection/pool/info?connectionName=${e}`,e=>{t(e.data)}):t({maxActive:50,maxIdle:10,numActive:0,numIdle:0})}(name,e=>{me.populate(BI.createItems([Object.assign({type:s},e)]))}),pe.setText(`数据连接(${e})`)}},render:()=>({type:d,cls:"database-right",items:[{type:h,height:40,cls:"right-status-title",items:[{type:o,text:"数据连接"}],ref(e){pe=e}},{type:d,cls:"right-status-body",ref(e){me=e}}]}),mounted(){}};BI.shortcut("fr.component.linkStatus.right",BI.inherit(BI.Widget,be));const ue={_store:()=>BI.Models.getModel("fr.model.linkstatus"),watch:{tab(e){this.setVisible("连接池状态"===e)}},render:()=>({type:a,cls:"linkStatus",items:[{el:{type:l,cls:"database-left",items:[{el:{type:h,cls:"select-group",items:[{type:o,cls:"status-title",text:"数据连接"}]},height:40},{type:"fr.component.linkStatus.left",cls:"left-list"}]},width:280},{type:"fr.component.linkStatus.right"}]}),mounted(){this.setVisible(!1)}};BI.shortcut("fr.linkstatus",BI.inherit(BI.Widget,ue));i(1);const ge={url:"192.168.1.22",port:6379,password:"123456"},ye=BI.inherit(BI.Widget,{render:()=>({type:"bi.vertical",cls:"bi-plugin-redis",bgap:10,items:[{type:"bi.left",height:30,items:[{type:"bi.label",text:"数据库地址:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",watermark:"数据库地址",value:ge.url,allowBlank:!0,width:300,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"端口:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",watermark:"端口",allowBlank:!0,width:300,height:24,value:ge.port,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e)}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"密码:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",inputType:"password",value:ge.password,allowBlank:!0,width:300,height:24}]}]})});BI.shortcut("fr.plugin.redis.edit",ye);BI.config("dec.constant.database.conf.connect.list",e=>[...e,"Redis"]),BI.constant("dec.constant.database.conf.connect.form.redis.value",ge),BI.constant("dec.constant.database.conf.connect.form.redis.edit","fr.plugin.redis.edit");i(2),i(3),i(4);const fe=BI.inherit(BI.Widget,{_store:()=>BI.Models.getModel("fr.model.main"),render:()=>({type:l,cls:"database-connection-layout",items:[{el:{type:"fr.title"},height:40},{type:"fr.linkset"},{type:"fr.linkstatus"}]}),mounted(){var e;e=(e=>{this.store.setLinkList(e)}),f?f.reqGet("/v10/config/connection/list","getInstalledPlugins",t=>{e(t.data)}):e(y.data)}});BI.shortcut("fr.main",fe);t.default="fr.main"}]); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/dcm/style.css b/designer-base/src/main/resources/com/fr/design/dcm/style.css new file mode 100644 index 000000000..5208edfa3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/dcm/style.css @@ -0,0 +1,276 @@ +.bi-plugin-redis { + padding: 20px; } + +.database-connection-layout { + width: 100%; + height: 100%; + background-color: #f7f8fa; } + .database-connection-layout .title { + background-color: #fff; + border-bottom: 1px solid #e8eaed; } + .database-connection-layout .title .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; } + .database-connection-layout .title .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; } + .database-connection-layout .linkset { + margin: 10px; + bottom: 0px; + background-color: #ffffff; } + .database-connection-layout .linkStatus { + margin: 10px; + top: 40px; + background-color: #ffffff; } + +.database-left { + border-right: 1px solid #e8eaed; } + .database-left .select-group { + border-bottom: 1px solid #e8eaed; } + .database-left .select-group .select { + margin: 10px; } + .database-left .select-group .select .database-link-items { + padding-left: 10px; } + .database-left .select-group .select .database-link-items .link-item { + border-top: 1px solid #e8eaed; } + .database-left .select-group .status-title { + font-weight: 700; + margin-left: 12px; + margin-top: 12px; } + .database-left .left-list { + margin: 10px; } + .database-left .left-list .left-item { + height: 24px; + line-height: 24px; + cursor: pointer; } + .database-left .left-list .left-item:hover { + background-color: rgba(54, 133, 242, 0.05); } + .database-left .left-list .left-item:hover .icons .action-icon { + visibility: visible !important; } + .database-left .left-list .left-item .icons { + float: right !important; } + .database-left .left-list .left-item .icons .action-icon { + visibility: hidden; } + .database-left .left-list .left-item .icons .b-font { + font-size: 16px; } + .database-left .left-list .left-item-selected { + background-color: rgba(54, 133, 242, 0.05); } + .database-left .left-list .left-item-selected .link-title { + color: #3685f2; } + +.database-right { + min-width: 400px; + overflow: auto; } + .database-right .bi-flex-center-adapt-layout { + height: 100%; } + .database-right .bi-flex-center-adapt-layout .data-connection-background { + background: url(./img/resources.png) center center no-repeat; + background-size: contain; } + .database-right .right-status-title { + border-bottom: 1px solid #e8eaed; + color: #3d4d66; + line-height: 40px; + padding-left: 10px; + font-weight: 700; } + .database-right .right-status-body { + margin: 10px 30px 0px 30px; + height: 50%; } + .database-right .right-status-body .right-status-item { + height: 150px; + width: 50%; + top: 0; + left: 0; + position: absolute !important; } + .database-right .right-status-body .right-status-item .right-status-board { + margin-left: 25px; + position: relative !important; + left: -25px; } + .database-right .right-status-body .right-status-right { + height: 150px; + width: 50%; + top: 0; + right: 0; + position: absolute !important; } + .database-right .right-status-body .right-status-right .right-status-board { + margin-right: 25px; + position: relative !important; + left: 25px; } + .database-right .right-status-body .right-status-board { + background-color: #f7f8fa; + color: #3d4d66; + width: 100%; + height: 100%; } + .database-right .right-status-body .right-status-board .right-status-board-item { + text-align: center; + margin-top: 38px; } + .database-right .right-status-body .right-status-board .right-status-board-item .right-status-text { + display: inline-block; } + .database-right .right-status-body .right-status-board .right-status-board-item .card-font1 { + color: #13CD66; + font-size: 32px; } + .database-right .right-status-body .right-status-board .right-status-board-item .card-font2 { + color: #3685F2; + font-size: 32px; } + .database-right .right-content { + height: 100%; } + .database-right .right-content .right-title { + border-bottom: 1px solid #e8eaed; + color: #3d4d66; + line-height: 40px; + padding-left: 10px; } + .database-right .right-content .right-title .right-title-text { + font-weight: 700; } + .database-right .right-content .right-title .right-title-button { + float: right !important; + margin-right: 10px; + margin-top: 8px; } + .database-right .right-content .right-show { + margin: 10px; } + .database-right .right-content .right-show .right-form { + width: 100%; } + +.both-side { + line-height: 24px; + margin-bottom: 10px; } + .both-side .left { + white-space: nowrap; + text-overflow: ellipsis; + position: relative; + flex-shrink: 0; + font-weight: 700; } + .both-side .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-content .comfirm-icon { + background-image: url(./img/warning.png); + background-size: contain; + margin-right: 12px; } + .comfirm-content .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; } + .more-link .more-link-item .link-item { + margin-left: 10px; + margin-bottom: 10px; + cursor: pointer; + border: solid 1px #fff; } + .more-link .more-link-item .link-item:hover { + border: solid 1px #3480f2; } + .more-link .more-link-item .link-item .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; } + .more-link .more-link-item .link-item .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; } + +.popover-notitle .bi-absolute-layout { + top: 0px !important; } + +.bi-custom-show .show-content { + text-align: center; } + .bi-custom-show .show-content .loading-icon { + display: block; + background: url(./img/loading.gif) center center no-repeat; + background-size: contain; + margin: 0 auto; + margin-bottom: 18px; } + .bi-custom-show .show-content .success-icon { + display: block; + background: url(./img/success.png) center center no-repeat; + background-size: contain; + margin: 0 auto; + margin-bottom: 18px; } + .bi-custom-show .show-content .error-icon { + display: block; + background: url(./img/error.png) center center no-repeat; + background-size: contain; + margin: 0 auto; + margin-bottom: 18px; } + .bi-custom-show .show-content .buttons { + margin-top: 18px; } + .bi-custom-show .show-content .buttons div { + margin: 0 4px; } + +.bi-custom-show .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; } + + +/*# sourceMappingURL=style.css.map*/ \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/upm/database/database.js b/designer-base/src/main/resources/com/fr/design/upm/database/database.js deleted file mode 100644 index 529aa92ff..000000000 --- a/designer-base/src/main/resources/com/fr/design/upm/database/database.js +++ /dev/null @@ -1,57 +0,0 @@ -window.addEventListener("load", function (ev) { - var combo1 = BI.createWidget({ - type: "bi.vertical", - items: [ - { - type: "bi.text_value_combo", - text: "选项1", - width: 300, - items: [ - { - el: { - type: "bi.single_select_radio_item", - width: 290, - text: "选项1", - value: 1 - }, - text: "选项1", - value: 1, - lgap: 10 - }, - { - el: { - type: "bi.single_select_radio_item", - width: 290, - text: "选项2", - value: 2 - }, - lgap: 10, - text: "选项2", - value: 2 - }, - { - el: { - type: "bi.single_select_radio_item", - width: 290, - text: "选项3", - value: 3 - }, - lgap: 10, - text: "选项3", - value: 3 - } - ] - } - ] - }); - - BI.createWidget({ - type:"bi.absolute", - element: "body", - items: [{ - el: combo1, - left: 100, - top: 100 - }] - }); -}); \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/upm/warn.js b/designer-base/src/main/resources/com/fr/design/upm/warn.js index 1eb5fb640..be4b06909 100644 --- a/designer-base/src/main/resources/com/fr/design/upm/warn.js +++ b/designer-base/src/main/resources/com/fr/design/upm/warn.js @@ -4,7 +4,7 @@ window.onload = function () { text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"), height: 30 }); - let callback = function(text) { + let callback = function(status, text) { download.setValue(text); }; let buttonOK = BI.createWidget({