From ff74e559443c15a9f40fff54e72aa756c8475454 Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Thu, 11 Apr 2024 15:02:30 +0800 Subject: [PATCH] =?UTF-8?q?style(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=88=A0=E9=99=A4=E6=96=87=E6=A1=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/UserController.java | 2 +- .../system/dto/sdk/BasePageRequest.java | 19 +++++++++++++++++++ .../scenario/components/scenarioTable.vue | 13 ++++++++++++- .../views/api-test/scenario/locale/en-US.ts | 5 +++-- .../views/api-test/scenario/locale/zh-CN.ts | 4 +++- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java index d77950a138..86a34264eb 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/UserController.java @@ -90,7 +90,7 @@ public class UserController { @RequiresPermissions(PermissionConstants.SYSTEM_USER_READ) public Pager> list(@Validated @RequestBody BasePageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), - StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); + StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "create_time desc,id desc"); return PageUtils.setPageInfo(page, userService.list(request)); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/BasePageRequest.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/BasePageRequest.java index b2399d7f50..aa668b8c15 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/BasePageRequest.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/sdk/BasePageRequest.java @@ -41,4 +41,23 @@ public class BasePageRequest extends BaseCondition { } return sb.substring(0, sb.length() - 1); } + + public String getSortString(String defaultColumn) { + if (sort == null || sort.isEmpty()) { + return null; + } + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : sort.entrySet()) { + String column = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey()); + sb.append(column) + .append(StringUtils.SPACE) + .append(StringUtils.equalsIgnoreCase(entry.getValue(), "DESC") ? "DESC" : "ASC") + .append(",") + .append(defaultColumn) + .append(StringUtils.SPACE) + .append(StringUtils.equalsIgnoreCase(entry.getValue(), "DESC") ? "DESC" : "ASC"); + return sb.toString(); + } + return null; + } } diff --git a/frontend/src/views/api-test/scenario/components/scenarioTable.vue b/frontend/src/views/api-test/scenario/components/scenarioTable.vue index 97dabe9121..b4caace910 100644 --- a/frontend/src/views/api-test/scenario/components/scenarioTable.vue +++ b/frontend/src/views/api-test/scenario/components/scenarioTable.vue @@ -1084,10 +1084,21 @@ }); selectIds = tableSelected.value as string[]; } + let content = t('api_scenario.table.deleteScenarioTip'); + if (isBatch) { + content = `${t('api_scenario.table.deleteScenarioTip.schedule1')}${t( + 'api_scenario.table.deleteScenarioTip.schedule2' + )}`; + } else if (record?.scheduleConfig) { + content = `${t('api_scenario.table.deleteScenarioTip.schedule1')}${t( + 'api_scenario.table.deleteScenarioTip.schedule2' + )}`; + } + openModal({ type: 'error', title, - content: t('api_scenario.table.deleteScenarioTip'), + content, okText: t('common.confirmDelete'), cancelText: t('common.cancel'), okButtonProps: { diff --git a/frontend/src/views/api-test/scenario/locale/en-US.ts b/frontend/src/views/api-test/scenario/locale/en-US.ts index 2f1529a5fd..1751ae5048 100644 --- a/frontend/src/views/api-test/scenario/locale/en-US.ts +++ b/frontend/src/views/api-test/scenario/locale/en-US.ts @@ -57,8 +57,9 @@ export default { 'api_scenario.table.valueRequired': 'Attribute value cannot be empty', 'api_scenario.table.deleteScenarioTipTitle': 'Confirm Delete {name}?', 'api_scenario.table.batchDeleteScenarioTip': 'Confirm delete {count} selected scenarios?', - 'api_scenario.table.deleteScenarioTip': - 'Deleting may cause failure in resources referencing this scenario. Proceed with caution!', + 'api_scenario.table.deleteScenarioTip': 'Scenarios are putted in recycle bin, please be cautious!', + 'api_scenario.table.deleteScenarioTip.schedule1': 'Scenarios are putted in recycle bin;', + 'api_scenario.table.deleteScenarioTip.schedule2': 'Scheduled task will stop and delete, please be cautious!', 'api_scenario.table.apiStatus': 'Status', 'api_scenario.table.status.underway': 'Underway', 'api_scenario.table.status.completed': 'Completed', diff --git a/frontend/src/views/api-test/scenario/locale/zh-CN.ts b/frontend/src/views/api-test/scenario/locale/zh-CN.ts index c3fcd54139..30d9e934b9 100644 --- a/frontend/src/views/api-test/scenario/locale/zh-CN.ts +++ b/frontend/src/views/api-test/scenario/locale/zh-CN.ts @@ -56,7 +56,9 @@ export default { 'api_scenario.table.valueRequired': '属性值不能为空', 'api_scenario.table.deleteScenarioTipTitle': '确认删除 {name} 吗?', 'api_scenario.table.batchDeleteScenarioTip': '确认删除已选中的 {count} 条场景吗?', - 'api_scenario.table.deleteScenarioTip': '删除后,可能导致引用该场景的资源执行失败,请谨慎操作!', + 'api_scenario.table.deleteScenarioTip': '删除后,场景将放入回收站,可在回收站内进行数据恢复,请谨慎操作!', + 'api_scenario.table.deleteScenarioTip.schedule1': '删除后,场景将放入回收站,可在回收站内进行数据恢复;', + 'api_scenario.table.deleteScenarioTip.schedule2': '定时任务将停止并删除,请谨慎操作!', 'api_scenario.table.apiStatus': '状态', 'api_scenario.table.status.underway': '进行中', 'api_scenario.table.status.completed': '已完成',