From 9bcf6f49c9c563cdf8d5d22025be0987ffbde4d2 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 3 Jun 2021 16:25:36 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E6=BA=90=E4=B8=8D=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/controller/DatasourceController.java | 2 +- .../io/dataease/datasource/service/DatasourceService.java | 8 +++++++- backend/src/main/resources/i18n/messages_en_US.properties | 3 ++- backend/src/main/resources/i18n/messages_zh_CN.properties | 3 ++- backend/src/main/resources/i18n/messages_zh_TW.properties | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java b/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java index fe2dbc8da8..d84b3e0cc4 100644 --- a/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java +++ b/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java @@ -49,7 +49,7 @@ public class DatasourceController { } @PostMapping("/delete/{datasourceID}") - public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) { + public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception { datasourceService.deleteDatasource(datasourceID); } diff --git a/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java b/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java index 8a2eee16a5..a8351668fd 100644 --- a/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java +++ b/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java @@ -76,7 +76,13 @@ public class DatasourceService { return extDataSourceMapper.query(gridExample); } - public void deleteDatasource(String datasourceId) { + public void deleteDatasource(String datasourceId) throws Exception { + DatasetTableExample example = new DatasetTableExample(); + example.createCriteria().andDataSourceIdEqualTo(datasourceId); + List datasetTables = datasetTableMapper.selectByExample(example); + if(CollectionUtils.isNotEmpty(datasetTables)){ + throw new Exception(datasetTables.size() + Translator.get("i18n_datasource_not_allow_delete_msg")); + } datasourceMapper.deleteByPrimaryKey(datasourceId); } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 0a378bdf4d..b2334f10f8 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -245,4 +245,5 @@ i18n_ds_name_exists=Datasource name exists i18n_sync_job_exists=There is already a synchronization task running, please try again later i18n_datasource_check_fail=Invalid,please check config i18n_not_find_user=Can not find user. -i18n_sql_not_empty=SQL can not be empty. \ No newline at end of file +i18n_sql_not_empty=SQL can not be empty. +i18n_datasource_not_allow_delete_msg= datasets are using this data source and cannot be deleted \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 46259d26ec..ae5e27a5e6 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -247,4 +247,5 @@ i18n_ds_name_exists=数据源名称已存在 i18n_sync_job_exists=已经有同步任务在运行,稍后重试 i18n_datasource_check_fail=校验失败,请检查配置信息 i18n_not_find_user=未找到用户 -i18n_sql_not_empty=SQL 不能为空 \ No newline at end of file +i18n_sql_not_empty=SQL 不能为空 +i18n_datasource_not_allow_delete_msg= 个数据集正在使用此数据源,无法删除 \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index fd650136bf..6e9048d929 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -247,4 +247,5 @@ i18n_ds_name_exists=數據源名稱已存在 i18n_sync_job_exists=已經有同步任務在運行,稍後重試 i18n_datasource_check_fail=校驗失敗,請檢查配置信息 i18n_not_find_user=未找到用戶 -i18n_sql_not_empty=SQL 不能為空 \ No newline at end of file +i18n_sql_not_empty=SQL 不能為空 +i18n_datasource_not_allow_delete_msg= 個數據集正在使用此數據源,無法刪除 \ No newline at end of file From 45e304f13224c1f4405d45b40cc16cfbb5d91a2a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sun, 6 Jun 2021 07:53:48 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E3=80=90ID1004132=E3=80=91=E3=80=90?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=91=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E6=95=B0=E6=8D=AE=E5=88=97=E8=A1=A8=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E5=8A=A0=E4=B8=AA=E5=8A=A0=E8=BD=BD=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/panel/filter/filterDialog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/panel/filter/filterDialog.vue b/frontend/src/views/panel/filter/filterDialog.vue index bf47ec0b71..32aa133318 100644 --- a/frontend/src/views/panel/filter/filterDialog.vue +++ b/frontend/src/views/panel/filter/filterDialog.vue @@ -1,6 +1,6 @@