From 68afead5d55091ef118bdc294681776406804307 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Sat, 30 Mar 2024 16:32:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=97=A5=E5=BF=97=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037852 --user=王孝刚 【接口测试】接口定义,导入swagger接口没有日志 https://www.tapd.cn/55049933/s/1484561 --- .../ApiDefinitionImportUtilService.java | 3 +- .../components/fastExtraction/moreSetting.vue | 2 +- .../components/requestComposition/index.vue | 5 +-- .../management/case/caseReportDrawer.vue | 36 ++++++++----------- .../case/tabContent/tabCaseExecuteHistory.vue | 2 +- .../report/component/caseReportDrawer.vue | 32 ++--------------- .../report/component/reportDetailDrawer.vue | 33 ++--------------- .../api-test/report/component/reportList.vue | 34 +++++++++++++++++- .../taskCenter/component/apiCase.vue | 2 +- 9 files changed, 60 insertions(+), 89 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java index 4bc0e9f9a1..91f45cc8ac 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java @@ -327,7 +327,7 @@ public class ApiDefinitionImportUtilService { project.getOrganizationId(), v.getId(), request.getUserId(), - OperationLogType.IMPORT.name(), + OperationLogType.UPDATE.name(), OperationLogModule.API_TEST_MANAGEMENT_DEFINITION, v.getName()); dto.setHistory(true); @@ -376,6 +376,7 @@ public class ApiDefinitionImportUtilService { dto.setPath("/api/definition/import"); dto.setMethod(HttpMethodConstants.POST.name()); dto.setOriginalValue(JSON.toJSONBytes(apiDefinitionDTO)); + operationLogs.add(dto); ApiDefinitionCaseDTO apiDefinitionCaseDTO = new ApiDefinitionCaseDTO(); BeanUtils.copyBean(apiDefinitionCaseDTO, t); diff --git a/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue b/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue index 3b62edbd40..713f452ce6 100644 --- a/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue +++ b/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue @@ -46,7 +46,7 @@ -
+
{{ t('apiTestDebug.specifyMatch') }} { - if (props.isCase) return; - initLocalConfig(); + if (!props.isCase) { + initLocalConfig(); + } }); onMounted(() => { diff --git a/frontend/src/views/api-test/management/components/management/case/caseReportDrawer.vue b/frontend/src/views/api-test/management/components/management/case/caseReportDrawer.vue index 3e2a21abbb..36512ff4b6 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseReportDrawer.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseReportDrawer.vue @@ -153,28 +153,22 @@ const shareTime = ref(''); async function getTime() { - const res = await getShareTime(appStore.currentProjectId); - const match = res.match(/^(\d+)([MYHD])$/); - if (match) { - const value = parseInt(match[1], 10); // 提取值并将其转换为整数 - const type = match[2]; // 提取类型 - switch (type) { - case 'M': - shareTime.value = value + t('msTimeSelector.month'); - break; - case 'Y': - shareTime.value = value + t('msTimeSelector.year'); - break; - case 'H': - shareTime.value = value + t('msTimeSelector.hour'); - break; - case 'D': - shareTime.value = value + t('msTimeSelector.day'); - break; - default: - shareTime.value = 24 + t('msTimeSelector.hour'); - break; + try { + const res = await getShareTime(appStore.currentProjectId); + const match = res.match(/^(\d+)([MYHD])$/); + if (match) { + const value = parseInt(match[1], 10); + const type = match[2]; + const translations = { + M: t('msTimeSelector.month'), + Y: t('msTimeSelector.year'), + H: t('msTimeSelector.hour'), + D: t('msTimeSelector.day'), + }; + shareTime.value = value + (translations[type] || translations.D); } + } catch (error) { + console.log(error); } } onMounted(() => { diff --git a/frontend/src/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue b/frontend/src/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue index d1179709e7..d7c79f34bd 100644 --- a/frontend/src/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue +++ b/frontend/src/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue @@ -108,7 +108,7 @@ import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import { MsTableColumn } from '@/components/pure/ms-table/type'; import useTable from '@/components/pure/ms-table/useTable'; - import CaseReportDrawer from '@/views/api-test/report/component/caseReportDrawer.vue'; + import CaseReportDrawer from '@/views/api-test/management/components/management/case/caseReportDrawer.vue'; import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue'; import { getApiCaseExecuteHistory } from '@/api/modules/api-test/management'; diff --git a/frontend/src/views/api-test/report/component/caseReportDrawer.vue b/frontend/src/views/api-test/report/component/caseReportDrawer.vue index b841d976d2..70a467e010 100644 --- a/frontend/src/views/api-test/report/component/caseReportDrawer.vue +++ b/frontend/src/views/api-test/report/component/caseReportDrawer.vue @@ -33,7 +33,7 @@ @@ -84,6 +84,7 @@ tableData: any[]; pagination: MsPaginationI; pageChange: (page: number) => Promise; + shareTime: string; }>(); const emit = defineEmits<{ @@ -180,35 +181,6 @@ console.log(error); } } - const shareTime = ref(''); - async function getTime() { - const res = await getShareTime(appStore.currentProjectId); - const match = res.match(/^(\d+)([MYHD])$/); - if (match) { - const value = parseInt(match[1], 10); // 提取值并将其转换为整数 - const type = match[2]; // 提取类型 - switch (type) { - case 'M': - shareTime.value = value + t('msTimeSelector.month'); - break; - case 'Y': - shareTime.value = value + t('msTimeSelector.year'); - break; - case 'H': - shareTime.value = value + t('msTimeSelector.hour'); - break; - case 'D': - shareTime.value = value + t('msTimeSelector.day'); - break; - default: - shareTime.value = 24 + t('msTimeSelector.hour'); - break; - } - } - } - onMounted(() => { - getTime(); - }); // 详情 function loadedReport(detail: ReportDetail) { diff --git a/frontend/src/views/api-test/report/component/reportDetailDrawer.vue b/frontend/src/views/api-test/report/component/reportDetailDrawer.vue index 7636910a8c..876778c27c 100644 --- a/frontend/src/views/api-test/report/component/reportDetailDrawer.vue +++ b/frontend/src/views/api-test/report/component/reportDetailDrawer.vue @@ -33,7 +33,7 @@ @@ -87,6 +87,7 @@ pagination: MsPaginationI; pageChange: (page: number) => Promise; isShare?: boolean; + shareTime?: string; }>(); const emit = defineEmits<{ @@ -189,36 +190,6 @@ console.log(error); } } - const shareTime = ref(''); - async function getTime() { - const res = await getShareTime(appStore.currentProjectId); - const match = res.match(/^(\d+)([MYHD])$/); - if (match) { - const value = parseInt(match[1], 10); // 提取值并将其转换为整数 - const type = match[2]; // 提取类型 - switch (type) { - case 'M': - shareTime.value = value + t('msTimeSelector.month'); - break; - case 'Y': - shareTime.value = value + t('msTimeSelector.year'); - break; - case 'H': - shareTime.value = value + t('msTimeSelector.hour'); - break; - case 'D': - shareTime.value = value + t('msTimeSelector.day'); - break; - default: - shareTime.value = 24 + t('msTimeSelector.hour'); - break; - } - } - } - onMounted(() => { - getTime(); - }); - /** * 导出 */ diff --git a/frontend/src/views/api-test/report/component/reportList.vue b/frontend/src/views/api-test/report/component/reportList.vue index c9a9620fb6..dc96a4d292 100644 --- a/frontend/src/views/api-test/report/component/reportList.vue +++ b/frontend/src/views/api-test/report/component/reportList.vue @@ -141,6 +141,7 @@ :page-change="propsEvent.pageChange" :pagination="propsRes.msPagination!" :show-type="showType" + :share-time="shareTime" />
@@ -169,7 +171,13 @@ import ReportDetailDrawer from './reportDetailDrawer.vue'; import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue'; - import { reportBathDelete, reportDelete, reportList, reportRename } from '@/api/modules/api-test/report'; + import { + getShareTime, + reportBathDelete, + reportDelete, + reportList, + reportRename, + } from '@/api/modules/api-test/report'; import { useI18n } from '@/hooks/useI18n'; import useModal from '@/hooks/useModal'; import { useTableStore } from '@/store'; @@ -472,6 +480,30 @@ } } + const shareTime = ref(''); + async function getTime() { + try { + const res = await getShareTime(appStore.currentProjectId); + const match = res.match(/^(\d+)([MYHD])$/); + if (match) { + const value = parseInt(match[1], 10); + const type = match[2]; + const translations = { + M: t('msTimeSelector.month'), + Y: t('msTimeSelector.year'), + H: t('msTimeSelector.hour'), + D: t('msTimeSelector.day'), + }; + shareTime.value = value + (translations[type] || translations.D); + } + } catch (error) { + console.log(error); + } + } + onMounted(() => { + getTime(); + }); + watch( () => props.moduleType, (val) => { diff --git a/frontend/src/views/project-management/taskCenter/component/apiCase.vue b/frontend/src/views/project-management/taskCenter/component/apiCase.vue index 746a968976..cc81ddbf2f 100644 --- a/frontend/src/views/project-management/taskCenter/component/apiCase.vue +++ b/frontend/src/views/project-management/taskCenter/component/apiCase.vue @@ -96,7 +96,7 @@ import type { BatchActionParams, BatchActionQueryParams, MsTableColumn } from '@/components/pure/ms-table/type'; import useTable from '@/components/pure/ms-table/useTable'; import ExecutionStatus from './executionStatus.vue'; - import CaseReportDrawer from '@/views/api-test/report/component/caseReportDrawer.vue'; + import CaseReportDrawer from '@/views/api-test/management/components/management/case/caseReportDrawer.vue'; import ReportDetailDrawer from '@/views/api-test/report/component/reportDetailDrawer.vue'; import {