From 7fe9d34b3a656ce48538a4b4455e33f0edccde67 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Fri, 15 Mar 2024 16:58:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF=E5=9B=9E=E6=94=B6=E7=AB=99?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E3=80=81=E5=9C=BA=E6=99=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91=E4=BB=A5=E5=8F=8A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=92=8C=E6=81=A2=E5=A4=8D=E7=9B=B8=E5=85=B3=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scenario/ApiScenarioController.java | 2 +- frontend/src/api/modules/api-test/scenario.ts | 58 +- frontend/src/api/requrls/api-test/scenario.ts | 29 +- frontend/src/locale/zh-CN/index.ts | 1 + frontend/src/router/routes/modules/apiTest.ts | 14 +- .../scenario/components/scenarioTable.vue | 27 +- .../src/views/api-test/scenario/index.vue | 26 +- .../views/api-test/scenario/locale/en-US.ts | 5 + .../views/api-test/scenario/locale/zh-CN.ts | 5 + .../src/views/api-test/scenario/recycle.vue | 170 ++++++ .../scenario/recycle/recycleTable.vue | 508 ++++++++++++++++++ .../api-test/scenario/recycle/recycleTree.vue | 264 +++++++++ .../caseManagementFeature/locale/zh-CN.ts | 2 +- 13 files changed, 1074 insertions(+), 37 deletions(-) create mode 100644 frontend/src/views/api-test/scenario/recycle.vue create mode 100644 frontend/src/views/api-test/scenario/recycle/recycleTable.vue create mode 100644 frontend/src/views/api-test/scenario/recycle/recycleTree.vue diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java index 51bd120d5d..914af22338 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioController.java @@ -144,7 +144,7 @@ public class ApiScenarioController { //需求补充:回收站里的相关操作都不需要发通知 @GetMapping("/recover/{id}") - @Operation(summary = "接口测试-接口场景管理-删除场景到回收站") + @Operation(summary = "接口测试-接口场景管理-恢复场景") @RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_DELETE) @Log(type = OperationLogType.RESTORE, expression = "#msClass.restoreLog(#id)", msClass = ApiScenarioLogService.class) @CheckOwner(resourceId = "#id", resourceType = "api_scenario") diff --git a/frontend/src/api/modules/api-test/scenario.ts b/frontend/src/api/modules/api-test/scenario.ts index b0bb8df65b..4511736d91 100644 --- a/frontend/src/api/modules/api-test/scenario.ts +++ b/frontend/src/api/modules/api-test/scenario.ts @@ -2,17 +2,24 @@ import MSR from '@/api/http/index'; import { AddModuleUrl, BatchCopyScenarioUrl, + BatchDeleteScenarioUrl, BatchEditScenarioUrl, BatchMoveScenarioUrl, + BatchRecoverScenarioUrl, BatchRecycleScenarioUrl, DeleteModuleUrl, + DeleteScenarioUrl, ExecuteHistoryUrl, GetModuleCountUrl, GetModuleTreeUrl, + GetTrashModuleCountUrl, + GetTrashModuleTreeUrl, MoveModuleUrl, + RecoverScenarioUrl, RecycleScenarioUrl, ScenarioHistoryUrl, ScenarioPageUrl, + ScenarioTrashPageUrl, UpdateModuleUrl, UpdateScenarioUrl, } from '@/api/requrls/api-test/scenario'; @@ -30,7 +37,7 @@ import { ScenarioHistoryItem, ScenarioHistoryPageParams, } from '@/models/apiTest/scenario'; -import { AddModuleParams, CommonList, ModuleTreeNode, MoveModules } from '@/models/common'; +import { AddModuleParams, BatchApiParams, CommonList, ModuleTreeNode, MoveModules } from '@/models/common'; // 更新模块 export function updateModule(data: ApiScenarioModuleUpdateParams) { @@ -52,6 +59,16 @@ export function getModuleCount(data: ApiScenarioGetModuleParams) { return MSR.post({ url: GetModuleCountUrl, data }); } +// 获取回收站模块统计数量 +export function getTrashModuleCount(data: ApiScenarioGetModuleParams) { + return MSR.post({ url: GetTrashModuleCountUrl, data }); +} + +// 获取回收站模块树 +export function getTrashModuleTree(data: ApiScenarioGetModuleParams) { + return MSR.post({ url: GetTrashModuleTreeUrl, data }); +} + // 添加模块 export function addModule(data: AddModuleParams) { return MSR.post({ url: AddModuleUrl, data }); @@ -67,6 +84,11 @@ export function getScenarioPage(data: ApiScenarioPageParams) { return MSR.post>({ url: ScenarioPageUrl, data }); } +// 获取回收站的接口场景列表 +export function getTrashScenarioPage(data: ApiScenarioPageParams) { + return MSR.post>({ url: ScenarioTrashPageUrl, data }); +} + // 更新接口场景 export function updateScenario(data: ApiScenarioUpdateDTO) { return MSR.post({ url: UpdateScenarioUrl, data }); @@ -117,3 +139,37 @@ export function getExecuteHistory(data: ExecutePageParams) { export function getScenarioHistory(data: ScenarioHistoryPageParams) { return MSR.post>({ url: ScenarioHistoryUrl, data }); } + +// 恢复场景 +export function recoverScenario(id: string) { + return MSR.get({ url: RecoverScenarioUrl, params: id }); +} + +// 批量恢复场景 +export function batchRecoverScenario(data: { + moduleIds: string[]; + selectAll: boolean; + condition: { keyword: string }; + excludeIds: any[]; + selectIds: any[]; + projectId: string; +}) { + return MSR.post({ url: BatchRecoverScenarioUrl, data }); +} + +// 恢复场景 +export function deleteScenario(id: string) { + return MSR.get({ url: DeleteScenarioUrl, params: id }); +} + +// 批量恢复场景 +export function batchDeleteScenario(data: { + moduleIds: string[]; + selectAll: boolean; + condition: { keyword: string }; + excludeIds: any[]; + selectIds: any[]; + projectId: string; +}) { + return MSR.post({ url: BatchDeleteScenarioUrl, data }); +} diff --git a/frontend/src/api/requrls/api-test/scenario.ts b/frontend/src/api/requrls/api-test/scenario.ts index ba0cd88f71..09b48f84d4 100644 --- a/frontend/src/api/requrls/api-test/scenario.ts +++ b/frontend/src/api/requrls/api-test/scenario.ts @@ -12,27 +12,14 @@ export const BatchMoveScenarioUrl = '/api/scenario/batch-operation/move'; // 批 export const BatchCopyScenarioUrl = '/api/scenario/batch-operation/copy'; // 批量复制接口场景 export const BatchEditScenarioUrl = '/api/scenario/batch-operation/edit'; // 批量编辑接口场景 -// export const GetEnvModuleUrl = '/api/scenario/module/env/tree'; // 获取环境的模块树 -// export const AddDefinitionUrl = '/api/scenario/add'; // 添加接口场景 -// export const GetDefinitionDetailUrl = '/api/scenario/get-detail'; // 获取接口场景详情 -// export const TransferFileUrl = '/api/scenario/transfer'; // 文件转存 -// export const TransferFileModuleOptionUrl = '/api/scenario/transfer/options'; // 文件转存目录 -// export const UploadTempFileUrl = '/api/scenario/upload/temp/file'; // 临时文件上传 -// export const DefinitionMockPageUrl = '/api/scenario/mock/page'; // mock列表 -// export const UpdateMockStatusUrl = '/api/scenario/mock/enable/'; // 更新mock状态 -// export const DeleteDefinitionUrl = '/api/scenario/delete-to-gc'; // 删除接口场景 -// export const ImportDefinitionUrl = '/api/scenario/import'; // 导入接口场景 -// export const SortDefinitionUrl = '/api/scenario/edit/pos'; // 接口场景拖拽 -// export const BatchUpdateDefinitionUrl = '/api/scenario/batch-update'; // 批量更新接口场景 -// export const BatchMoveDefinitionUrl = '/api/scenario/batch-move'; // 批量移动接口场景 - -// export const UpdateDefinitionScheduleUrl = '/api/scenario/schedule/update'; // 接口场景-定时同步-更新 -// export const CheckDefinitionScheduleUrl = '/api/scenario/schedule/check'; // 接口场景-定时同步-检查 url 是否存在 -// export const AddDefinitionScheduleUrl = '/api/scenario/schedule/add'; // 接口场景-定时同步-添加 -// export const SwitchDefinitionScheduleUrl = '/api/scenario/schedule/switch'; // 接口场景-定时同步-开启关闭 -// export const GetDefinitionScheduleUrl = '/api/scenario/schedule/get'; // 接口场景-定时同步-查询 -// export const DeleteDefinitionScheduleUrl = '/api/scenario/schedule/delete'; // 接口场景-定时同步-删除 -// export const DebugDefinitionUrl = '/api/scenario/debug'; // 接口场景-调试 +// 回收站相关 +export const GetTrashModuleTreeUrl = '/api/scenario/module/trash/tree'; +export const GetTrashModuleCountUrl = '/api/scenario/module/trash/count'; +export const ScenarioTrashPageUrl = '/api/scenario/trash/page'; +export const DeleteScenarioUrl = '/api/scenario/delete'; +export const RecoverScenarioUrl = '/api/scenario/recover'; +export const BatchRecoverScenarioUrl = '/api/scenario/batch-operation/recover-gc'; +export const BatchDeleteScenarioUrl = '/api/scenario/batch-operation/delete'; export const ExecuteHistoryUrl = '/api/scenario/execute/page'; // 场景执行历史 export const ScenarioHistoryUrl = '/api/scenario/operation-history/page'; // 场景变更历史 diff --git a/frontend/src/locale/zh-CN/index.ts b/frontend/src/locale/zh-CN/index.ts index 7c5982ad6a..51086d1c14 100644 --- a/frontend/src/locale/zh-CN/index.ts +++ b/frontend/src/locale/zh-CN/index.ts @@ -30,6 +30,7 @@ export default { 'menu.apiTest.management': '定义', 'menu.apiTest.management.definition': '定义', 'menu.apiTest.api': 'API列表', + 'menu.apiTest.apiScenario': '场景', 'menu.apiTest.scenario': '场景', 'menu.apiTest.report': '报告', 'menu.uiTest': 'UI测试', diff --git a/frontend/src/router/routes/modules/apiTest.ts b/frontend/src/router/routes/modules/apiTest.ts index 0b52ede6b3..a270d7eda7 100644 --- a/frontend/src/router/routes/modules/apiTest.ts +++ b/frontend/src/router/routes/modules/apiTest.ts @@ -1,4 +1,4 @@ -import { ApiTestRouteEnum } from '@/enums/routeEnum'; +import { ApiTestRouteEnum, SettingRouteEnum } from '@/enums/routeEnum'; import { DEFAULT_LAYOUT } from '../base'; import type { AppRouteRecordRaw } from '../types'; @@ -78,11 +78,21 @@ const ApiTest: AppRouteRecordRaw = { { path: 'scenarioRecycle', name: ApiTestRouteEnum.API_TEST_SCENARIO_RECYCLE, - component: () => import('@/views/api-test/scenario/index.vue'), + component: () => import('@/views/api-test/scenario/recycle.vue'), meta: { locale: 'menu.apiTest.scenario', roles: ['*'], isTopMenu: false, + breadcrumbs: [ + { + name: ApiTestRouteEnum.API_TEST_SCENARIO, + locale: 'menu.apiTest.apiScenario', + }, + { + name: ApiTestRouteEnum.API_TEST_SCENARIO_RECYCLE, + locale: 'common.recycle', + }, + ], }, }, diff --git a/frontend/src/views/api-test/scenario/components/scenarioTable.vue b/frontend/src/views/api-test/scenario/components/scenarioTable.vue index 9cefb674d6..8ea733c9a7 100644 --- a/frontend/src/views/api-test/scenario/components/scenarioTable.vue +++ b/frontend/src/views/api-test/scenario/components/scenarioTable.vue @@ -97,7 +97,7 @@ -