From b119c2141087602dfc095648ff674508c5e45a93 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 5 Jun 2020 15:29:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5key=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=80=89=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.xml | 5 +++-- .../db/redis/core/RedisDatabaseConnection.java | 10 +++++++++- .../db/redis/ui/RedisDBConnectionChosePane.java | 14 +++++++++++++- .../com/fr/plugin/db/redis/locale/redis.properties | 1 + .../plugin/db/redis/locale/redis_en_US.properties | 1 + .../plugin/db/redis/locale/redis_zh_CN.properties | 9 +++++---- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/plugin.xml b/plugin.xml index 5596c51..de73740 100755 --- a/plugin.xml +++ b/plugin.xml @@ -3,12 +3,13 @@ com.fr.solution.plugin.db.redis.v10 yes - 7.3.1 + 7.3.2 10.0 - 2019-03-29 + 2020-01-20 richie [2020-04-26]修复插件被标记为需要付费的问题。
[2020-04-21]修复redis集群下的一个问题。
[2019-10-30]适配新服务器数据集接口,在决策平台可以直接定义
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java index 5946fd5..b8b2eea 100755 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java @@ -9,6 +9,7 @@ import com.fanruan.api.util.StringKit; import com.fanruan.api.util.TypeKit; import com.fr.config.holder.Conf; import com.fr.data.impl.Connection; +import com.fr.plugin.db.redis.core.accessor.EmbedRedis; import com.fr.plugin.db.redis.core.emb.Redis; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; @@ -79,7 +80,14 @@ public class RedisDatabaseConnection extends BaseConnection { return ArrayKit.EMPTY_STRING_ARRAY; } else { Redis redis = createRedisClient(); - Set keys = redis.getClient().keys(args[0]); + EmbedRedis embedRedis = redis.getClient(); + int len = ArrayKit.getLength(args); + if (len > 1) { + int dbIndex = Integer.parseInt(args[1]); + embedRedis.select(dbIndex); + } + + Set keys = embedRedis.keys(args[0]); String[] array = keys.toArray(new String[0]); redis.close(); return array; diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java index adfcc13..e921713 100755 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java @@ -1,5 +1,7 @@ package com.fr.plugin.db.redis.ui; +import com.fanruan.api.design.ui.component.UIIntNumberField; +import com.fanruan.api.design.ui.component.UILabel; import com.fanruan.api.design.work.ConnectionComboBoxPanel; import com.fr.data.impl.Connection; import com.fr.data.operator.DataOperator; @@ -29,6 +31,7 @@ public class RedisDBConnectionChosePane extends BasicPane { private DefaultListModel listModel = new DefaultListModel(); private List listeners = new ArrayList(); private UIPlaceholderTextField keysPatternTextField; + private UIIntNumberField dbIndexNumberField; public RedisDBConnectionChosePane() { setLayout(new BorderLayout(4, 4)); @@ -51,6 +54,10 @@ public class RedisDBConnectionChosePane extends BasicPane { keysPatternTextField = new UIPlaceholderTextField(10); keysPatternTextField.setPlaceholder(DesignKit.i18nText("Plugin-Redis_Keys_Pattern")); + dbIndexNumberField = new UIIntNumberField(); + dbIndexNumberField.setColumns(2); + dbIndexNumberField.setInt(0); + JPanel centerPane = new JPanel(new BorderLayout()); UIButton searchButton = new UIButton(DesignKit.i18nText("Plugin-Redis_Keys_Pattern_Search")); @@ -63,6 +70,10 @@ public class RedisDBConnectionChosePane extends BasicPane { centerPane.add(GUICoreKit.createBorderLayoutPane( keysPatternTextField, BorderLayout.CENTER, + GUICoreKit.createBorderLayoutPane( + new UILabel(DesignKit.i18nText("Plugin-Redis_DB_Simple_Index")), BorderLayout.WEST, + dbIndexNumberField, BorderLayout.CENTER + ), BorderLayout.WEST, searchButton, BorderLayout.EAST), BorderLayout.NORTH); centerPane.add(list, BorderLayout.CENTER); @@ -97,7 +108,8 @@ public class RedisDBConnectionChosePane extends BasicPane { if (StringKit.isEmpty(keysPattern)) { return ArrayKit.EMPTY_STRING_ARRAY; } else { - return DataOperator.getInstance().getTableSummary(connection, keysPattern); + String dbIndex = String.valueOf(dbIndexNumberField.getInt()); + return DataOperator.getInstance().getTableSummary(connection, keysPattern, dbIndex); } } diff --git a/src/main/resources/com/fr/plugin/db/redis/locale/redis.properties b/src/main/resources/com/fr/plugin/db/redis/locale/redis.properties index 2d83961..2bf454e 100755 --- a/src/main/resources/com/fr/plugin/db/redis/locale/redis.properties +++ b/src/main/resources/com/fr/plugin/db/redis/locale/redis.properties @@ -9,6 +9,7 @@ Plugin-Redis_Help=Help Doc Plugin-Redis_Keys_Pattern=Keys Pattern Plugin-Redis_Keys_Pattern_Search=Search Plugin-Redis_DB_Index=DB Index +Plugin-Redis_DB_Simple_Index=Index Plugin-Redis_Preview=Preview Plugin-Redis_Refresh=Refresh Plugin-Redis_Formula=Formula diff --git a/src/main/resources/com/fr/plugin/db/redis/locale/redis_en_US.properties b/src/main/resources/com/fr/plugin/db/redis/locale/redis_en_US.properties index 2f69c39..9267e27 100755 --- a/src/main/resources/com/fr/plugin/db/redis/locale/redis_en_US.properties +++ b/src/main/resources/com/fr/plugin/db/redis/locale/redis_en_US.properties @@ -9,6 +9,7 @@ Plugin-Redis_Help=Help Doc Plugin-Redis_Keys_Pattern=Keys Pattern Plugin-Redis_Keys_Pattern_Search=Search Plugin-Redis_DB_Index=DB Index +Plugin-Redis_DB_Simple_Index=Index Plugin-Redis_Preview=Preview Plugin-Redis_Refresh=Refresh Plugin-Redis_Formula=Formula diff --git a/src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties b/src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties index 8d4a260..f3f8453 100755 --- a/src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties +++ b/src/main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties @@ -9,6 +9,7 @@ Plugin-Redis_Help=\u5E2E\u52A9\u6587\u6863 Plugin-Redis_Keys_Pattern=\u952E\u503C\u7684\u6B63\u5219\u8868\u8FBE\u5F0F Plugin-Redis_Keys_Pattern_Search=\u641C\u7D22 Plugin-Redis_DB_Index=\u6570\u636E\u5E93\u7F16\u53F7 +Plugin-Redis_DB_Simple_Index=\u7F16\u53F7 Plugin-Redis_Preview=\u9884\u89C8 Plugin-Redis_Refresh=\u5237\u65B0 Plugin-Redis_Formula=\u516C\u5F0F @@ -38,9 +39,9 @@ Plugin-Redis_Cluster_Config_Description=1\u3001\u4F7F\u7528\u9017\u53F7\u5206\u5 Plugin-Redis_Script_Engine_Type=\u811A\u672C\u5F15\u64CE Plugin-Redis_Script_Engine_Type_Default=\u9ED8\u8BA4 Plugin-Redis_Script_Engine_Type_V8=V8\u9AD8\u901F\u5F15\u64CE -Plugin-Redis_Proxy_Private_Key_Path_Mark=\u8bf7\u8f93\u5165\u670d\u52a1\u5668\u6587\u4ef6\u8def\u5f84 -Plugin-Redis_Connection_Form_OriginalCharsetName= \u7f16\u7801 -Plugin-Redis_Check_Integer=\u8bf7\u8f93\u5165\u4e0d\u5c0f\u4e8e\u0030\u7684\u6574\u6570 +Plugin-Redis_Proxy_Private_Key_Path_Mark=\u8BF7\u8F93\u5165\u670D\u52A1\u5668\u6587\u4EF6\u8DEF\u5F84 +Plugin-Redis_Connection_Form_OriginalCharsetName= \u7F16\u7801 +Plugin-Redis_Check_Integer=\u8BF7\u8F93\u5165\u4E0D\u5C0F\u4E8E0\u7684\u6574\u6570 Plugin-Redis_Parameter_Insert=\u63D2\u5165 Plugin-Redis_Parameter_Delete=\u5220\u9664 Plugin-Redis_Parameter_Move_Up=\u4E0A\u79FB @@ -57,5 +58,5 @@ Plugin-Redis_Parameter_Type_Boolean=\u5E03\u5C14\u578B Plugin-Redis_Parameter_Type_Formula=\u516C\u5F0F Plugin-Redis_Parameter_Delete_Confirm=\u4F60\u786E\u5B9A\u51B3\u5B9A\u5220\u9664\u9009\u4E2D\u7684\u9879\uFF1F Plugin-Redis_Parameter_Delete_Alert=\u5F53\u524D\u5217\u8868\u4E3A\u7A7A\u6216\u8005\u4F60\u6CA1\u6709\u9009\u4E2D\u4EFB\u4F55\u9879 -Plugin-Redis_View=\u89c6\u56fe +Plugin-Redis_View=\u89C6\u56FE Plugin-Redis_Table=\u8868 \ No newline at end of file