From bc1d906ae6bf0d144ce040e25d6c41b23b0e68e9 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 2 Aug 2024 18:31:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E8=B0=83=E6=95=B4&diff=E6=8A=BD=E5=B1=89=E8=B0=83?= =?UTF-8?q?=E6=95=B4&=E7=BC=96=E8=BE=91=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=96=B0=E5=A2=9E=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/pure/ms-detail-card/index.vue | 2 - frontend/src/enums/routeEnum.ts | 1 + frontend/src/router/routes/modules/apiTest.ts | 20 + .../src/views/api-test/components/config.ts | 76 ++++ .../management/api/preview/detail.vue | 50 ++- .../management/case/apiCaseDetail.vue | 416 ++++++++++++++++++ .../components/management/case/caseDetail.vue | 27 ++ .../components/management/case/caseTable.vue | 18 +- .../case/createAndEditCaseDrawer.vue | 26 +- .../management/case/differentDrawer.vue | 26 +- .../views/api-test/management/locale/en-US.ts | 8 +- .../views/api-test/management/locale/zh-CN.ts | 8 +- .../detail/component/system-card/summary.vue | 2 +- 13 files changed, 636 insertions(+), 44 deletions(-) create mode 100644 frontend/src/views/api-test/management/components/management/case/apiCaseDetail.vue diff --git a/frontend/src/components/pure/ms-detail-card/index.vue b/frontend/src/components/pure/ms-detail-card/index.vue index 7eddc34c05..83ec70136d 100644 --- a/frontend/src/components/pure/ms-detail-card/index.vue +++ b/frontend/src/components/pure/ms-detail-card/index.vue @@ -100,9 +100,7 @@ .ms-detail-card { @apply relative flex flex-col; - padding: 16px; border-radius: var(--border-radius-small); - background-color: var(--color-text-n9); gap: 8px; .ms-detail-card-title { @apply flex items-center justify-between overflow-hidden; diff --git a/frontend/src/enums/routeEnum.ts b/frontend/src/enums/routeEnum.ts index 6121fb7a64..66b0573de5 100644 --- a/frontend/src/enums/routeEnum.ts +++ b/frontend/src/enums/routeEnum.ts @@ -3,6 +3,7 @@ export enum ApiTestRouteEnum { API_TEST_DEBUG_MANAGEMENT = 'apiTestDebug', API_TEST_MANAGEMENT = 'apiTestManagement', API_TEST_MANAGEMENT_RECYCLE = 'apiTestManagementRecycle', + API_TEST_MANAGEMENT_CASE_DETAIL = 'apiTestManagementCaseDetail', API_TEST_SCENARIO = 'apiTestScenario', API_TEST_SCENARIO_RECYCLE = 'apiTestScenarioRecycle', API_TEST_REPORT = 'apiTestReport', diff --git a/frontend/src/router/routes/modules/apiTest.ts b/frontend/src/router/routes/modules/apiTest.ts index 67e57619f3..aa0f8c09c2 100644 --- a/frontend/src/router/routes/modules/apiTest.ts +++ b/frontend/src/router/routes/modules/apiTest.ts @@ -64,6 +64,26 @@ const ApiTest: AppRouteRecordRaw = { ], }, }, + // 接口定义-API-用例-用例列表详情 + { + path: 'caseDetail', + name: ApiTestRouteEnum.API_TEST_MANAGEMENT_CASE_DETAIL, + component: () => import('@/views/api-test/management/components/management/case/apiCaseDetail.vue'), + meta: { + locale: 'case.apiCaseDetail', + roles: ['PROJECT_API_DEFINITION:READ'], + breadcrumbs: [ + { + name: ApiTestRouteEnum.API_TEST_MANAGEMENT, + locale: 'case.apiCaseList', + }, + { + name: ApiTestRouteEnum.API_TEST_MANAGEMENT_CASE_DETAIL, + locale: 'case.apiCaseDetail', + }, + ], + }, + }, { path: 'scenario', name: ApiTestRouteEnum.API_TEST_SCENARIO, diff --git a/frontend/src/views/api-test/components/config.ts b/frontend/src/views/api-test/components/config.ts index 950d1c8e0e..4d6f8b99f8 100644 --- a/frontend/src/views/api-test/components/config.ts +++ b/frontend/src/views/api-test/components/config.ts @@ -1,6 +1,7 @@ import { cloneDeep } from 'lodash-es'; import { EQUAL } from '@/components/pure/ms-advance-filter'; +import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue'; import { useI18n } from '@/hooks/useI18n'; @@ -18,14 +19,18 @@ import type { MockParams } from '@/models/apiTest/mock'; import { FullResponseAssertionType, RequestAssertionCondition, + RequestAuthType, RequestBodyFormat, RequestCaseStatus, + RequestComposition, RequestContentTypeEnum, + RequestDefinitionStatus, RequestExtractEnvType, RequestExtractExpressionEnum, RequestExtractExpressionRuleType, RequestExtractResultMatchingRule, RequestExtractScope, + RequestMethods, RequestParamsType, ResponseBodyFormat, ResponseBodyXPathAssertionFormat, @@ -432,3 +437,74 @@ export const lastReportStatusListOptions = computed(() => { }; }); }); + +// api下的创建用例弹窗也用到了defaultCaseParams +const initDefaultId = `case-${Date.now()}`; +export const defaultCaseParams: RequestParam = { + id: initDefaultId, + type: 'case', + moduleId: '', + protocol: 'HTTP', + tags: [], + description: '', + priority: 'P0', + status: RequestDefinitionStatus.PROCESSING, + url: '', + activeTab: RequestComposition.HEADER, + closable: true, + method: RequestMethods.GET, + headers: [], + body: cloneDeep(defaultBodyParams), + query: [], + rest: [], + polymorphicName: '', + name: '', + path: '', + projectId: '', + uploadFileIds: [], + linkFileIds: [], + authConfig: { + authType: RequestAuthType.NONE, + basicAuth: { + userName: '', + password: '', + }, + digestAuth: { + userName: '', + password: '', + }, + }, + children: [ + { + polymorphicName: 'MsCommonElement', // 协议多态名称,写死MsCommonElement + assertionConfig: { + enableGlobal: true, + assertions: [], + }, + postProcessorConfig: { + enableGlobal: true, + processors: [], + }, + preProcessorConfig: { + enableGlobal: true, + processors: [], + }, + }, + ], + otherConfig: { + connectTimeout: 60000, + responseTimeout: 60000, + certificateAlias: '', + followRedirects: true, + autoRedirects: false, + }, + responseActiveTab: ResponseComposition.BODY, + response: cloneDeep(defaultResponse), + responseDefinition: [cloneDeep(defaultResponseItem)], + isNew: true, + unSaved: false, + executeLoading: false, + preDependency: [], // 前置依赖 + postDependency: [], // 后置依赖 + errorMessageInfo: {}, +}; diff --git a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue index 49a8ab4029..a56b5d03b2 100644 --- a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue +++ b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue @@ -2,14 +2,29 @@
@@ -258,13 +273,13 @@