fix(接口测试): 修复导入的接口没有日志的缺陷

--bug=1037852 --user=王孝刚 【接口测试】接口定义,导入swagger接口没有日志
https://www.tapd.cn/55049933/s/1484561
This commit is contained in:
wxg0103 2024-03-30 16:32:37 +08:00 committed by Craftsman
parent 6e41a8e16e
commit 68afead5d5
9 changed files with 60 additions and 89 deletions

View File

@ -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);

View File

@ -46,7 +46,7 @@
</div>
</a-radio>
<a-radio :value="RequestExtractResultMatchingRule.SPECIFIC">
<div class="flex items-center">
<div class="flex items-center text-[14px]">
{{ t('apiTestDebug.specifyMatch') }}
<a-tooltip :content="t('apiTestDebug.specifyMatchTip')" :content-style="{ maxWidth: '400px' }">
<icon-question-circle

View File

@ -1577,8 +1577,9 @@
}
onBeforeMount(() => {
if (props.isCase) return;
initLocalConfig();
if (!props.isCase) {
initLocalConfig();
}
});
onMounted(() => {

View File

@ -153,28 +153,22 @@
const shareTime = ref<string>('');
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(() => {

View File

@ -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';

View File

@ -33,7 +33,7 @@
<template #content>
<a-doption>
<span>{{ t('report.detail.api.copyLink') }}</span
><span>{{ t('report.detail.api.copyLinkTimeEnd', { time: shareTime }) }}</span>
><span>{{ t('report.detail.api.copyLinkTimeEnd', { time: props.shareTime }) }}</span>
</a-doption>
</template>
</a-dropdown>
@ -84,6 +84,7 @@
tableData: any[];
pagination: MsPaginationI;
pageChange: (page: number) => Promise<void>;
shareTime: string;
}>();
const emit = defineEmits<{
@ -180,35 +181,6 @@
console.log(error);
}
}
const shareTime = ref<string>('');
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) {

View File

@ -33,7 +33,7 @@
<template #content>
<a-doption>
<span>{{ t('report.detail.api.copyLink') }}</span
><span>{{ t('report.detail.api.copyLinkTimeEnd', { time: shareTime }) }}</span>
><span>{{ t('report.detail.api.copyLinkTimeEnd', { time: props.shareTime }) }}</span>
</a-doption>
</template>
</a-dropdown>
@ -87,6 +87,7 @@
pagination: MsPaginationI;
pageChange: (page: number) => Promise<void>;
isShare?: boolean;
shareTime?: string;
}>();
const emit = defineEmits<{
@ -189,36 +190,6 @@
console.log(error);
}
}
const shareTime = ref<string>('');
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();
});
/**
* 导出
*/

View File

@ -141,6 +141,7 @@
:page-change="propsEvent.pageChange"
:pagination="propsRes.msPagination!"
:show-type="showType"
:share-time="shareTime"
/>
<CaseReportDrawer
v-model:visible="showCaseDetailDrawer"
@ -150,6 +151,7 @@
:page-change="propsEvent.pageChange"
:pagination="propsRes.msPagination!"
:show-type="activeCaseReportType"
:share-time="shareTime"
/>
</div>
</template>
@ -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<string>('');
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) => {

View File

@ -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 {