From 4165ca4ff1e5df0c173349d1b16061791ad42603 Mon Sep 17 00:00:00 2001 From: Afly Date: Tue, 3 Jan 2023 17:21:17 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20perf:=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=99=E6=96=87=E4=BB=B6=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.xml | 3 +- .../repository/core/S3ResourceRepository.java | 91 +++++++++++++------ 2 files changed, 63 insertions(+), 31 deletions(-) diff --git a/plugin.xml b/plugin.xml index 29af249..b9c5b3f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,12 +5,13 @@ com.fanruan.fs yes no - 1.3.5 + 1.3.6 10.0~10.0 2021-03-11 richie [2022-09-22]第三方组件升级。
[2022-07-25]修复http无法连接,而https和缺省的时候正常
[2022-06-30]新增enablePathStyleAccess、signerOverride后台配置
diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java index a99b34a..ae4833a 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java @@ -119,17 +119,6 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public void write(String path, byte[] data) { - - List paths = getAllNecessaryPath(path); - for (int i = paths.size() - 1; i > 0; i--) { - String parent = paths.get(i); - PutObjectRequest req = new PutObjectRequest(bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); - try { - s3.putObject(req); - } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); - } - } ObjectMetadata metadata; try { metadata = s3.getObjectMetadata(bucket, path); @@ -150,16 +139,16 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean createFile(String path) { - List paths = getAllNecessaryPath(path); - for (int i = paths.size() - 1; i >= 0; i--) { - String parent = paths.get(i); - PutObjectRequest req = new PutObjectRequest(bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); - try { - s3.putObject(req); - } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); - return false; - } + String parent = path.substring(0, path.lastIndexOf(DELIMITER) + 1); + if (!dirExist(parent)) { + createDirectory(parent); + } + PutObjectRequest req = new PutObjectRequest(bucket, path, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); + try { + s3.putObject(req); + } catch (Exception e) { + LogKit.error("[S3] Failed to create file path {}", path); + return false; } return true; } @@ -170,17 +159,23 @@ public class S3ResourceRepository extends BaseResourceRepository { if (!path.endsWith(DELIMITER)) { path += DELIMITER; } - List paths = getAllNecessaryPath(path); - for (int i = paths.size() - 1; i >= 0; i--) { - String parent = paths.get(i); - PutObjectRequest req = new PutObjectRequest(bucket, parent, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); - try { - s3.putObject(req); - } catch (Exception e) { - LogKit.error("[S3] Failed to create parent path {}", parent); + String temp = path.substring(0, path.length() - 1); + String parent = temp.substring(0, temp.lastIndexOf(DELIMITER) + 1); + if (StringUtils.isEmpty(parent)) { + return true; + } + if (!dirExist(parent)) { + if (!createDirectory(parent)) { return false; } } + PutObjectRequest req = new PutObjectRequest(bucket, path, new ByteArrayInputStream(new byte[0]), buildEmptyMetadata()); + try { + s3.putObject(req); + } catch (Exception e) { + LogKit.error("[S3] Failed to create parent path {}", path); + return false; + } return true; } @@ -214,13 +209,49 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean exist(String path) { + return fileExist(path) || (!path.endsWith(DELIMITER) && dirExist(path)) || isParentPathAbsent(path); + } + + private boolean fileExist(String path) { try { - return s3.doesObjectExist(bucket, path) || s3.doesObjectExist(bucket, path + DELIMITER); + return s3.doesObjectExist(bucket, path); } catch (Exception e) { return false; } } + private boolean dirExist(String path) { + if (StringUtils.equals(path, DELIMITER)) { + return true; + } + if (!path.endsWith(DELIMITER)) { + path += DELIMITER; + } + return fileExist(path); + } + + /** + * 如果存在文件创建了,但是其父目录没有创建的场景,为其递归创建对象,返回创建结果 + */ + private boolean isParentPathAbsent(String path) { + if (path.startsWith(DELIMITER)) { + path = path.substring(1); + } + if (path.endsWith(DELIMITER)) { + path = path.substring(0, path.length() - 1); + } + ObjectListing objectListing = s3.listObjects( + new ListObjectsRequest() + .withBucketName(bucket) + .withPrefix(path)); + for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { + if (summary.getKey().startsWith(path + DELIMITER)) { + return createDirectory(path); + } + } + return false; + } + @Override public String[] list(String dir, final Filter filter) { List result = new ArrayList<>(); From df2938534351c1ef9b626564ee978e1178c4f819 Mon Sep 17 00:00:00 2001 From: Afly Date: Tue, 10 Jan 2023 14:19:25 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-88094=20fix:=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E8=BE=83=E5=A4=9A=E6=97=B6=EF=BC=8ClistEntry?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fs/s3/repository/core/S3ResourceRepository.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java index ae4833a..66f907e 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java @@ -87,6 +87,15 @@ public class S3ResourceRepository extends BaseResourceRepository { ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket) .withPrefix(dir).withDelimiter(DELIMITER); ObjectListing objectListing = s3.listObjects(listObjectsRequest); + collectFileEntry(result, objectListing); + while (objectListing.isTruncated()) { + objectListing = s3.listNextBatchOfObjects(objectListing); + collectFileEntry(result, objectListing); + } + return result.toArray(new FineFileEntry[0]); + } + + private void collectFileEntry(List result, ObjectListing objectListing) { for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { String key = summary.getKey(); if (!key.endsWith(DELIMITER)) { @@ -98,8 +107,6 @@ public class S3ResourceRepository extends BaseResourceRepository { entry.setDirectory(true); result.add(entry); } - - return result.toArray(new FineFileEntry[0]); } @Override From 255207d5ba7a227a308726452fc28ceb957f60e1 Mon Sep 17 00:00:00 2001 From: Afly Date: Tue, 10 Jan 2023 14:26:27 +0800 Subject: [PATCH 3/5] REPORT-88094 fix: change-notes --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index b9c5b3f..20e7f27 100644 --- a/plugin.xml +++ b/plugin.xml @@ -11,7 +11,7 @@ richie + [2023-01-03]优化写文件性能; 修复文件太多显示不全的问题。
[2022-09-22]第三方组件升级。
[2022-07-25]修复http无法连接,而https和缺省的时候正常
[2022-06-30]新增enablePathStyleAccess、signerOverride后台配置
From 434779e0302004cb598807edc3387c0559fd2723 Mon Sep 17 00:00:00 2001 From: Freddy Date: Wed, 4 Jan 2023 14:46:01 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-87924=20feat:=E9=80=82=E9=85=8DS3?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=89=8D=E5=8F=B0=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit c4cfbc803368f67db2d94c144c6b1ab8b9d4db7d) --- .../fs/s3/repository/locale/s3.properties | 3 +- .../s3/repository/locale/s3_en_US.properties | 3 +- .../s3/repository/locale/s3_ja_JP.properties | 3 +- .../s3/repository/locale/s3_ko_KR.properties | 3 +- .../s3/repository/locale/s3_zh_CN.properties | 3 +- .../s3/repository/locale/s3_zh_TW.properties | 3 +- .../fanruan/fs/s3/repository/web/js/bundle.js | 78 ++++++++++++++++++- 7 files changed, 89 insertions(+), 7 deletions(-) diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties index 9eca906..bb9eeae 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties @@ -4,4 +4,5 @@ Plugin-S3_Region=Region Plugin-S3_Access_Key_Id=AccessKeyId Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket -Dec-Error_Start_With_Slash_Or_End_Without_Slash=The path cannot start with "/", but must end with "/" \ No newline at end of file +Dec-Error_Start_With_Slash_Or_End_Without_Slash=The path cannot start with "/", but must end with "/" +Plugin-S3_Other_Config= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties index 9e212ba..35e3481 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties @@ -4,4 +4,5 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=Please input -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Other_Config= diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties index 0276339..be3f170 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties @@ -4,4 +4,5 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Other_Config= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties index 6380db9..f45b72a 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties @@ -4,4 +4,5 @@ Plugin-S3_Access_Key_Secret= Plugin-S3_Bucket= Plugin-S3_End_Point= Plugin-S3_Input= -Plugin-S3_Region= \ No newline at end of file +Plugin-S3_Region= +Plugin-S3_Other_Config= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties index 91b6745..14a7ba8 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties @@ -4,4 +4,5 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8BF7\u8F93\u5165 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Other_Config=\u66f4\u591a\u8bbe\u7f6e \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties index 019e745..b0e1426 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties @@ -4,4 +4,5 @@ Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8ACB\u8F38\u5165 -Plugin-S3_Region=Region \ No newline at end of file +Plugin-S3_Region=Region +Plugin-S3_Other_Config= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js index d47df6d..8375b2a 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js +++ b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js @@ -137,7 +137,66 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { ref: function (_ref) { self.filePathRow = _ref; }, - }], + }, { + type: "bi.vertical_adapt", + items: [{ + type: "bi.icon_change_button", + iconCls: this.model.isOpen ? "expander-down-font" : "expander-right-font", + ref: (_ref) => { + this.OtherConfigButton = _ref; + }, + handler: () => { + this.store.setIsOpen(!this.model.isOpen); + this.OtherConfigButton.setIcon(this.model.isOpen ? "expander-down-font" : "expander-right-font"); + } + }, { + type: "bi.text_button", + cls: "bi-high-light", + text: BI.i18nText('Plugin-S3_Other_Config'), + handler: () => { + this.store.setIsOpen(!this.model.isOpen); + this.OtherConfigButton.setIcon(this.model.isOpen ? "expander-down-font" : "expander-right-font"); + } + }] + }, { + type: 'bi.vertical', + invisible: () => !this.model.isOpen, + items: [{ + type: "dec.label.editor.item", + textWidth: LABEL_WIDTH, + editorWidth: EDITOR_WIDTH, + watermark: BI.i18nText("Plugin-S3_Input"), + text: "PathStyleAccess", + value: this.model.enablePathStyleAccess, + el: { + disabled: !o.editable, + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + self.store.setEnablePathStyleAccess(this.getValue()); + } + }] + }, { + type: "dec.label.editor.item", + textWidth: LABEL_WIDTH, + editorWidth: EDITOR_WIDTH, + watermark: BI.i18nText("Plugin-S3_Input"), + text: "SignerOverride", + value: this.model.signerOverride, + el: { + disabled: !o.editable, + }, + tgap: 15, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + self.store.setSignerOverride(this.getValue()); + } + }] + }], + } + ] }; }, @@ -149,6 +208,8 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { password: this.passwordRow.getCipher(), bucket: this.model.bucket, workRoot: this.filePathRow.getValue(), + enablePathStyleAccess: this.model.enablePathStyleAccess, + signerOverride: this.model.signerOverride, }; }, @@ -189,6 +250,9 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { password: val.password, bucket: val.bucket, workRoot: val.workRoot, + isOpen: false, + enablePathStyleAccess: false, + signerOverride: "", }; }, @@ -218,6 +282,18 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { setBucket: function (v) { this.model.bucket = v; }, + + setEnablePathStyleAccess: function (v) { + this.model.enablePathStyleAccess = v; + }, + + setSignerOverride: function (v) { + this.model.signerOverride = v; + }, + + setIsOpen: function (v) { + this.model.isOpen = v; + }, }, }); BI.model("dec.model.intelligence.cluster.file.s3", Model); From eac1c7f9fcabb35dc46ae234fb5141978123dd3a Mon Sep 17 00:00:00 2001 From: Freddy Date: Wed, 4 Jan 2023 18:04:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-87924=20fix:=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 39f1bea676d9ccc00e3b44eac2e75fcb63bcdeed) --- .../fs/s3/repository/locale/s3.properties | 3 ++- .../fs/s3/repository/locale/s3_en_US.properties | 1 + .../fs/s3/repository/locale/s3_ja_JP.properties | 3 ++- .../fs/s3/repository/locale/s3_ko_KR.properties | 3 ++- .../fs/s3/repository/locale/s3_zh_CN.properties | 3 ++- .../fs/s3/repository/locale/s3_zh_TW.properties | 3 ++- .../fanruan/fs/s3/repository/web/js/bundle.js | 17 ++++++++++++++--- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties index bb9eeae..68d23b5 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3.properties @@ -5,4 +5,5 @@ Plugin-S3_Access_Key_Id=AccessKeyId Plugin-S3_Access_Key_Secret=AccessKeySecret Plugin-S3_Bucket=Bucket Dec-Error_Start_With_Slash_Or_End_Without_Slash=The path cannot start with "/", but must end with "/" -Plugin-S3_Other_Config= \ No newline at end of file +Plugin-S3_Other_Config= +Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties index 35e3481..672a96a 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_en_US.properties @@ -6,3 +6,4 @@ Plugin-S3_End_Point=Endpoint Plugin-S3_Input=Please input Plugin-S3_Region=Region Plugin-S3_Other_Config= +Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties index be3f170..7219376 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties @@ -5,4 +5,5 @@ Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002 Plugin-S3_Region=Region -Plugin-S3_Other_Config= \ No newline at end of file +Plugin-S3_Other_Config= +Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties index f45b72a..6f1388f 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties @@ -5,4 +5,5 @@ Plugin-S3_Bucket= Plugin-S3_End_Point= Plugin-S3_Input= Plugin-S3_Region= -Plugin-S3_Other_Config= \ No newline at end of file +Plugin-S3_Other_Config= +Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties index 14a7ba8..bc49f24 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_CN.properties @@ -5,4 +5,5 @@ Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8BF7\u8F93\u5165 Plugin-S3_Region=Region -Plugin-S3_Other_Config=\u66f4\u591a\u8bbe\u7f6e \ No newline at end of file +Plugin-S3_Other_Config=\u66f4\u591a\u8bbe\u7f6e +Plugin-S3_EnablePathStyleAccess_Error_Tip=\u8bf7\u8f93\u5165true\u6216false \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties index b0e1426..876d58a 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_zh_TW.properties @@ -5,4 +5,5 @@ Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u8ACB\u8F38\u5165 Plugin-S3_Region=Region -Plugin-S3_Other_Config= \ No newline at end of file +Plugin-S3_Other_Config= +Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file diff --git a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js index 8375b2a..af8b1bd 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js +++ b/src/main/resources/com/fanruan/fs/s3/repository/web/js/bundle.js @@ -151,7 +151,6 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { } }, { type: "bi.text_button", - cls: "bi-high-light", text: BI.i18nText('Plugin-S3_Other_Config'), handler: () => { this.store.setIsOpen(!this.model.isOpen); @@ -168,6 +167,9 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { watermark: BI.i18nText("Plugin-S3_Input"), text: "PathStyleAccess", value: this.model.enablePathStyleAccess, + ref: function (_ref) { + self.enablePathStyleAccessRow = _ref; + }, el: { disabled: !o.editable, }, @@ -201,6 +203,11 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { }, getValue: function () { + var enablePathStyleAccess = false; + if (this.model.enablePathStyleAccess === 'true') { + enablePathStyleAccess = true; + } + return { endPoint: this.model.endPoint, region: this.model.region, @@ -208,7 +215,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { password: this.passwordRow.getCipher(), bucket: this.model.bucket, workRoot: this.filePathRow.getValue(), - enablePathStyleAccess: this.model.enablePathStyleAccess, + enablePathStyleAccess, signerOverride: this.model.signerOverride, }; }, @@ -228,6 +235,10 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { this.filePathRow.showError(BI.i18nText("Dec-Error_Null")); valid = false; } + if (!(this.model.enablePathStyleAccess === 'false' || this.model.enablePathStyleAccess === 'true')) { + this.enablePathStyleAccessRow.showError(BI.i18nText("Plugin-S3_EnablePathStyleAccess_Error_Tip")); + valid = false; + } return valid; }, @@ -251,7 +262,7 @@ BI.config("dec.constant.intelligence.cluster.file.server", function (items) { bucket: val.bucket, workRoot: val.workRoot, isOpen: false, - enablePathStyleAccess: false, + enablePathStyleAccess: 'false', signerOverride: "", }; },