From 8e6d5436bc8e8b9a2656acaa0dfa03c1f661cfc5 Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 26 May 2021 19:17:06 +0800 Subject: [PATCH 1/3] feat(cron):cron time fix --- .../dataset/DataSetTableTaskController.java | 6 +----- .../service/dataset/DataSetTableTaskService.java | 16 +++++++++++++++- .../resources/i18n/messages_en_US.properties | 2 +- .../resources/i18n/messages_zh_CN.properties | 1 + .../resources/i18n/messages_zh_TW.properties | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java index 03e2496191..7edb03030e 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableTaskController.java @@ -2,7 +2,6 @@ package io.dataease.controller.dataset; import io.dataease.base.domain.DatasetTableTask; import io.dataease.controller.request.dataset.DataSetTaskRequest; -import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.dataset.DataSetTableTaskService; import org.springframework.web.bind.annotation.*; @@ -18,13 +17,10 @@ import java.util.List; public class DataSetTableTaskController { @Resource private DataSetTableTaskService dataSetTableTaskService; - @Resource - private DataSetTableService dataSetTableService; @PostMapping("save") public DatasetTableTask save(@RequestBody DataSetTaskRequest dataSetTaskRequest) throws Exception { - dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig()); - return dataSetTableTaskService.save(dataSetTaskRequest.getDatasetTableTask()); + return dataSetTableTaskService.save(dataSetTaskRequest); } @PostMapping("delete/{id}") diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java index c6b646cd58..d65d6fd833 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableTaskService.java @@ -3,10 +3,13 @@ package io.dataease.service.dataset; import io.dataease.base.domain.DatasetTableTask; import io.dataease.base.domain.DatasetTableTaskExample; import io.dataease.base.mapper.DatasetTableTaskMapper; +import io.dataease.controller.request.dataset.DataSetTaskRequest; import io.dataease.i18n.Translator; import io.dataease.service.ScheduleService; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.quartz.CronExpression; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,14 +30,25 @@ public class DataSetTableTaskService { private DataSetTableTaskLogService dataSetTableTaskLogService; @Resource private ScheduleService scheduleService; + @Resource + @Lazy + private DataSetTableService dataSetTableService; - public DatasetTableTask save(DatasetTableTask datasetTableTask) throws Exception { + public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception { + dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig()); + DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask(); // check if (StringUtils.isNotEmpty(datasetTableTask.getCron())) { if (!CronExpression.isValidExpression(datasetTableTask.getCron())) { throw new RuntimeException(Translator.get("i18n_cron_expression_error")); } } + // check start time and end time + if (ObjectUtils.isNotEmpty(datasetTableTask.getStartTime()) + && ObjectUtils.isNotEmpty(datasetTableTask.getEndTime()) + && datasetTableTask.getStartTime() > datasetTableTask.getEndTime()) { + throw new RuntimeException(Translator.get("i18n_cron_time_error")); + } if (StringUtils.isEmpty(datasetTableTask.getId())) { datasetTableTask.setId(UUID.randomUUID().toString()); datasetTableTask.setCreateTime(System.currentTimeMillis()); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 4193036e14..e5196af829 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -184,7 +184,6 @@ automation_exec_info=There are no test steps to execute authsource_name_already_exists=Authentication source name already exists authsource_name_is_null=Authentication source name cannot be empty authsource_configuration_is_null=Authentication source configuration cannot be empty - 个人信息=Personal Information 仪表盘=Panel 修改密码=Change Password @@ -238,3 +237,4 @@ i18n_panel_list=Panel i18n_processing_data=Processing data now, Refresh later i18n_union_already_exists=Union relation already exists i18n_union_field_exists=The same field can't in two dataset +i18n_cron_time_error=Start time can't greater then end time diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 55cdd90977..07fee22a7e 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -239,3 +239,4 @@ i18n_panel_list=仪表盘 i18n_processing_data=正在处理数据,稍后刷新 i18n_union_already_exists=关联关系已存在 i18n_union_field_exists=两个数据集之间关联不能出现多次相同字段 +i18n_cron_time_error=开始时间不能大于结束时间 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 34752787ac..cbd274ed85 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -239,3 +239,4 @@ i18n_panel_list=仪表盘 i18n_processing_data=正在處理數據,稍後刷新 i18n_union_already_exists=關聯關系已存在 i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字段 +i18n_cron_time_error=開始時間不能大於結束時間 \ No newline at end of file From 5cfc7b0cac30b8c996c5a97f0a66fe9aba860094 Mon Sep 17 00:00:00 2001 From: junjie Date: Thu, 27 May 2021 10:50:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(frontend):=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=8A=A5=E9=94=99fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 4 +++- frontend/src/lang/tw.js | 4 +++- frontend/src/lang/zh.js | 3 ++- frontend/src/views/panel/GrantAuth/dept/index.vue | 4 ++-- frontend/src/views/panel/GrantAuth/index.vue | 2 +- frontend/src/views/panel/GrantAuth/role/index.vue | 4 ++-- frontend/src/views/panel/GrantAuth/user/index.vue | 6 +++--- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 5ce5dfb5ba..5e8218c9f4 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -277,7 +277,9 @@ export default { select_module: 'Select Module', default_module: 'Default Module' }, - datasource: 'Datasource' + datasource: 'Datasource', + char_can_not_more_50: 'Name can not more 50 char', + share_success: 'Share Success' }, documentation: { documentation: 'Documentation', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 8ce56d835c..321ce72041 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -276,7 +276,9 @@ export default { select_module: '選擇模块', default_module: '默认模块' }, - datasource: '數據源' + datasource: '數據源', + char_can_not_more_50: '名稱不能超過50字符', + share_success: '分享成功' }, documentation: { documentation: '文檔', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index d1355b9e8c..ec31d7d3e9 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -278,7 +278,8 @@ export default { default_module: '默认模块' }, datasource: '数据连接', - char_can_not_more_50: '名称不能超过50字符' + char_can_not_more_50: '名称不能超过50字符', + share_success: '分享成功' }, documentation: { documentation: '文档', diff --git a/frontend/src/views/panel/GrantAuth/dept/index.vue b/frontend/src/views/panel/GrantAuth/dept/index.vue index dc2778b9fd..7aa798bee4 100644 --- a/frontend/src/views/panel/GrantAuth/dept/index.vue +++ b/frontend/src/views/panel/GrantAuth/dept/index.vue @@ -158,11 +158,11 @@ export default { return roots }, - save() { + save(msg) { const rows = this.$refs.table.store.states.selection const request = this.buildRequest(rows) saveShare(request).then(res => { - this.$success(this.$t('commons.save_success')) + this.$success(msg) return true }).catch(err => { this.$error(err.message) diff --git a/frontend/src/views/panel/GrantAuth/index.vue b/frontend/src/views/panel/GrantAuth/index.vue index 6cb0b32129..652f15e7ec 100644 --- a/frontend/src/views/panel/GrantAuth/index.vue +++ b/frontend/src/views/panel/GrantAuth/index.vue @@ -58,7 +58,7 @@ export default { this.showSearchInput = false }, save() { - this.$refs[this.activeName].save() + this.$refs[this.activeName].save(this.$t('commons.share_success')) this.$emit('close-grant', 0) }, cancel() { diff --git a/frontend/src/views/panel/GrantAuth/role/index.vue b/frontend/src/views/panel/GrantAuth/role/index.vue index 3167339bda..5bc0429948 100644 --- a/frontend/src/views/panel/GrantAuth/role/index.vue +++ b/frontend/src/views/panel/GrantAuth/role/index.vue @@ -78,11 +78,11 @@ export default { this.setCheckNodes() }) }, - save() { + save(msg) { const rows = this.$refs.table.store.states.selection const request = this.buildRequest(rows) saveShare(request).then(res => { - this.$success(this.$t('commons.save_success')) + this.$success(msg) return true }).catch(err => { this.$error(err.message) diff --git a/frontend/src/views/panel/GrantAuth/user/index.vue b/frontend/src/views/panel/GrantAuth/user/index.vue index 7ee56ffa87..1329b36988 100644 --- a/frontend/src/views/panel/GrantAuth/user/index.vue +++ b/frontend/src/views/panel/GrantAuth/user/index.vue @@ -86,11 +86,11 @@ export default { }) }, - save() { + save(msg) { const rows = this.$refs.table.store.states.selection const request = this.buildRequest(rows) - saveShare(request).then(res => { - this.$success(this.$t('commons.save_success')) + saveShare(request).then(response => { + this.$success(msg) return true }).catch(err => { this.$error(err.message) From d4daade0d30ea9ccf220f731f2a5696f612cb427 Mon Sep 17 00:00:00 2001 From: junjie Date: Thu, 27 May 2021 12:04:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(frontend):1.=E6=93=8D=E4=BD=9Cbutton?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=9B2.=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E6=96=87=E5=AD=97fix=EF=BC=9B3.=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E6=A0=B7=E5=BC=8Ffix=EF=BC=8C=E5=85=88?= =?UTF-8?q?=E7=9C=8B=E7=9C=8B=EF=BC=8C=E5=86=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/tw.js | 2 +- frontend/src/lang/zh.js | 10 +++++----- frontend/src/styles/index.scss | 5 +++-- frontend/src/views/panel/list/PanelList.vue | 6 ++++-- frontend/src/views/panel/list/PanelMain.vue | 16 +++++++++++++++- frontend/src/views/panel/list/PanelViewShow.vue | 2 +- frontend/src/views/system/datasource/index.vue | 2 +- frontend/src/views/system/dept/index.vue | 2 +- frontend/src/views/system/menu/index.vue | 2 +- frontend/src/views/system/role/index.vue | 2 +- frontend/src/views/system/user/index.vue | 4 ++-- 11 files changed, 35 insertions(+), 18 deletions(-) diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 321ce72041..f4217c1f0c 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -704,7 +704,7 @@ export default { custom_data: '自助數據集', pls_slc_tbl_left: '請從左側選擇表', add_db_table: '添加數據庫表', - pls_slc_data_source: '選擇數據源鏈接', + pls_slc_data_source: '請選擇數據源', table: '表', edit: '編輯', create_view: '創建視圖', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index ec31d7d3e9..03bb4f8c7b 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -277,7 +277,7 @@ export default { select_module: '选择模块', default_module: '默认模块' }, - datasource: '数据连接', + datasource: '数据源', char_can_not_more_50: '名称不能超过50字符', share_success: '分享成功' }, @@ -531,7 +531,7 @@ export default { custom_data: '自助数据集', pls_slc_tbl_left: '请从左侧选视图', add_db_table: '添加数据库表', - pls_slc_data_source: '请选择数据库连接', + pls_slc_data_source: '请选择数据源', table: '表', edit: '编辑', create_view: '创建试图', @@ -705,7 +705,7 @@ export default { custom_data: '自助数据集', pls_slc_tbl_left: '请从左侧选择表', add_db_table: '添加数据库表', - pls_slc_data_source: '请选择数据库连接', + pls_slc_data_source: '请选择数据源', table: '表', edit: '编辑', create_view: '创建视图', @@ -795,7 +795,7 @@ export default { }, datasource: { datasource: '数据源', - create: '新建数据连接', + create: '新建数据源', type: '类型', please_choose_type: '请选择数据源类型', data_base: '数据库名称', @@ -808,7 +808,7 @@ export default { please_input_password: '请输入密码', please_input_host: '请输入主机', please_input_port: '请输入端口', - modify: '编辑数据连接', + modify: '编辑数据源', validate_success: '校验成功', validate: '校验', search_by_name: '根据名称搜索', diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index c7cae09c04..41d843c9bc 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -205,8 +205,9 @@ div:focus { color: #37b4aa; } .ds-icon-scene{ - width: 14px; - height: 14px; + width: 13px; + height: 13px; + margin-right: 5px; color: #0a7be0; } .ds-icon-db{ diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index f628a2793c..6b61ff9d27 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -85,10 +85,12 @@ -   {{ $t('panel.groupAdd') }} + + {{ $t('panel.groupAdd') }} -   {{ $t('panel.panelAdd') }} + + {{ $t('panel.panelAdd') }} diff --git a/frontend/src/views/panel/list/PanelMain.vue b/frontend/src/views/panel/list/PanelMain.vue index 185287882e..46bf670826 100644 --- a/frontend/src/views/panel/list/PanelMain.vue +++ b/frontend/src/views/panel/list/PanelMain.vue @@ -1,7 +1,7 @@