diff --git a/frontend/src/api/modules/api-test/management.ts b/frontend/src/api/modules/api-test/management.ts
index 2830cbe44e..50ba1a75cd 100644
--- a/frontend/src/api/modules/api-test/management.ts
+++ b/frontend/src/api/modules/api-test/management.ts
@@ -1,5 +1,6 @@
import MSR from '@/api/http/index';
import {
+ AddCaseUrl,
AddDefinitionScheduleUrl,
AddDefinitionUrl,
AddModuleUrl,
@@ -53,6 +54,7 @@ import {
import { ExecuteRequestParams } from '@/models/apiTest/common';
import {
+ AddApiCaseParams,
ApiCaseBatchEditParams,
ApiCaseBatchParams,
ApiCaseDetail,
@@ -342,3 +344,8 @@ export function batchEditCase(data: ApiCaseBatchEditParams) {
export function dragSort(data: DragSortParams) {
return MSR.post({ url: SortCaseUrl, data });
}
+
+// 添加接口用例
+export function addCase(data: AddApiCaseParams) {
+ return MSR.post({ url: AddCaseUrl, data });
+}
diff --git a/frontend/src/api/requrls/api-test/management.ts b/frontend/src/api/requrls/api-test/management.ts
index 8829515582..393acb561a 100644
--- a/frontend/src/api/requrls/api-test/management.ts
+++ b/frontend/src/api/requrls/api-test/management.ts
@@ -34,6 +34,7 @@ export const ToggleFollowDefinitionUrl = '/api/definition/follow'; // 接口定
export const OperationHistoryUrl = '/api/definition/operation-history'; // 接口定义-变更历史
export const SaveOperationHistoryUrl = '/api/definition/operation-history/save'; // 接口定义-另存变更历史为指定版本
export const RecoverOperationHistoryUrl = '/api/definition/operation-history/recover'; // 接口定义-变更历史恢复
+export const DefinitionReferenceUrl = '/api/definition/get-reference'; // 获取接口引用关系
/**
* Mock
@@ -42,11 +43,6 @@ export const DefinitionMockPageUrl = '/api/definition/mock/page'; // mock列表
export const UpdateMockStatusUrl = '/api/definition/mock/enable/'; // 更新mock状态
export const DeleteMockUrl = '/api/definition/mock/delete'; // 刪除mock
-/**
- * 接口引用关系
- */
-export const DefinitionReferenceUrl = '/api/definition/get-reference'; // 获取接口引用关系
-
/**
* api回收站
*/
@@ -65,3 +61,4 @@ export const DeleteCaseUrl = '/api/case/delete'; // 删除接口用例
export const BatchDeleteCaseUrl = '/api/case/batch/delete'; // 批量删除接口用例
export const BatchEditCaseUrl = '/api/case/batch/edit'; // 批量编辑接口用例
export const SortCaseUrl = '/api/case/edit/pos'; // 接口用例拖拽
+export const AddCaseUrl = '/api/case/add'; // 添加用例
diff --git a/frontend/src/components/business/ms-add-attachment/index.vue b/frontend/src/components/business/ms-add-attachment/index.vue
index f0eda24eb6..24fe0dc217 100644
--- a/frontend/src/components/business/ms-add-attachment/index.vue
+++ b/frontend/src/components/business/ms-add-attachment/index.vue
@@ -243,9 +243,6 @@
});
const buttonDropDownVisible = ref(false);
- watchEffect(() => {
- console.log('innerFileList', innerFileList.value);
- });
onBeforeMount(() => {
// 回显文件
const defaultFiles = innerFileList.value.filter((item) => item) || [];
diff --git a/frontend/src/components/business/ms-params-input/index.vue b/frontend/src/components/business/ms-params-input/index.vue
index 62a24a7586..556c362d84 100644
--- a/frontend/src/components/business/ms-params-input/index.vue
+++ b/frontend/src/components/business/ms-params-input/index.vue
@@ -193,9 +193,6 @@
{{ t('ms.paramsInput.value') }}
-
- {{ t('ms.paramsInput.value') }}
-
{{ innerValue }}
@@ -702,7 +699,7 @@
margin-bottom: 2px;
font-size: 12px;
line-height: 16px;
- color: var(--color-text-4);
+ color: var(--color-text-1);
}
.ms-params-popover-value {
min-width: 100px;
diff --git a/frontend/src/components/pure/ms-detail-card/index.vue b/frontend/src/components/pure/ms-detail-card/index.vue
index 88b1a9f9ce..63f94441e7 100644
--- a/frontend/src/components/pure/ms-detail-card/index.vue
+++ b/frontend/src/components/pure/ms-detail-card/index.vue
@@ -21,7 +21,10 @@
:style="{ width: item.width }"
>
{{ t(item.locale) }}
-
+
{{ item.value || '-' }}
diff --git a/frontend/src/components/pure/ms-split-box/index.vue b/frontend/src/components/pure/ms-split-box/index.vue
index 19587e9dc9..6155a2f95c 100644
--- a/frontend/src/components/pure/ms-split-box/index.vue
+++ b/frontend/src/components/pure/ms-split-box/index.vue
@@ -21,13 +21,13 @@
>
@@ -43,13 +43,13 @@
diff --git a/frontend/src/enums/apiEnum.ts b/frontend/src/enums/apiEnum.ts
index 9755be3f06..458598d10c 100644
--- a/frontend/src/enums/apiEnum.ts
+++ b/frontend/src/enums/apiEnum.ts
@@ -207,3 +207,9 @@ export enum RequestExtractResultMatchingRule {
RANDOM = 'RANDOM', // 随机匹配
SPECIFIC = 'SPECIFIC', // 指定匹配
}
+// 接口用例状态
+export enum RequestCaseStatus {
+ DEPRECATED = 'DEPRECATED',
+ PROCESSING = 'PROCESSING',
+ DONE = 'DONE',
+}
diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts
index 3dd2d2b125..66a8d3ef2b 100644
--- a/frontend/src/locale/en-US/common.ts
+++ b/frontend/src/locale/en-US/common.ts
@@ -131,4 +131,5 @@ export default {
'common.unFollowSuccess': 'Unfollow successfully',
'common.share': 'Share',
'common.notRemind': `Don't remind again`,
+ 'common.status': 'Status',
};
diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts
index 322cb8bd26..7ac3d7d7fc 100644
--- a/frontend/src/locale/zh-CN/common.ts
+++ b/frontend/src/locale/zh-CN/common.ts
@@ -134,4 +134,5 @@ export default {
'common.unFollowSuccess': '取消关注成功',
'common.share': '分享',
'common.notRemind': '不再提醒',
+ 'common.status': '状态',
};
diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts
index ccc054bb2f..d47eea895a 100644
--- a/frontend/src/models/apiTest/management.ts
+++ b/frontend/src/models/apiTest/management.ts
@@ -331,3 +331,11 @@ export interface ApiCaseBatchEditParams extends ApiCaseBatchParams {
environmentId?: string;
type: string;
}
+// 添加用例参数
+export interface AddApiCaseParams extends ExecuteRequestParams {
+ name: string;
+ priority: string;
+ status: string;
+ apiDefinitionId: string | number;
+ tags: string[];
+}
diff --git a/frontend/src/models/projectManagement/environmental.ts b/frontend/src/models/projectManagement/environmental.ts
index 597154e78d..fbecad7e67 100644
--- a/frontend/src/models/projectManagement/environmental.ts
+++ b/frontend/src/models/projectManagement/environmental.ts
@@ -51,6 +51,7 @@ export interface CommonParams {
[key: string]: any;
}
export interface EnvConfig {
+ id?: string;
commonParams?: CommonParams;
commonVariables: EnvConfigItem[];
httpConfig: EnvConfigItem[];
diff --git a/frontend/src/views/api-test/components/condition/content.vue b/frontend/src/views/api-test/components/condition/content.vue
index 8a740dd7db..3730841ec9 100644
--- a/frontend/src/views/api-test/components/condition/content.vue
+++ b/frontend/src/views/api-test/components/condition/content.vue
@@ -273,7 +273,7 @@
@@ -309,7 +310,7 @@
([]);
onBeforeMount(async () => {
try {
+ // TODO:数据从外面传进来
protocolList.value = await getProtocolList(appStore.currentOrgId);
} catch (error) {
+ // eslint-disable-next-line no-console
console.log(error);
}
});
@@ -899,12 +902,6 @@ if (!result){
line-height: 16px;
color: var(--color-text-1);
}
- .param-popover-subtitle {
- margin-bottom: 2px;
- font-size: 12px;
- line-height: 16px;
- color: var(--color-text-4);
- }
.param-popover-value {
min-width: 100px;
max-width: 280px;
diff --git a/frontend/src/views/api-test/components/config.ts b/frontend/src/views/api-test/components/config.ts
index 893cd6e04a..1252f18ad3 100644
--- a/frontend/src/views/api-test/components/config.ts
+++ b/frontend/src/views/api-test/components/config.ts
@@ -5,7 +5,13 @@ import {
KeyValueParam,
ResponseDefinition,
} from '@/models/apiTest/common';
-import { RequestContentTypeEnum, RequestParamsType, ResponseBodyFormat, ResponseComposition } from '@/enums/apiEnum';
+import {
+ RequestCaseStatus,
+ RequestContentTypeEnum,
+ RequestParamsType,
+ ResponseBodyFormat,
+ ResponseComposition,
+} from '@/enums/apiEnum';
// 请求 body 参数表格默认行的值
export const defaultBodyParamsItem: ExecuteRequestFormBodyFormValue = {
@@ -83,3 +89,18 @@ export const defaultKeyValueParamItem: KeyValueParam = {
// 请求的响应 response 的响应状态码集合
export const statusCodes = [200, 201, 202, 203, 204, 205, 400, 401, 402, 403, 404, 405, 500, 501, 502, 503, 504, 505];
+
+// 用例等级选项
+export const casePriorityOptions = [
+ { label: 'P0', value: 'P0' },
+ { label: 'P1', value: 'P1' },
+ { label: 'P2', value: 'P2' },
+ { label: 'P3', value: 'P3' },
+];
+
+// 用例状态选项
+export const caseStatusOptions = [
+ { label: 'apiTestManagement.processing', value: RequestCaseStatus.PROCESSING },
+ { label: 'apiTestManagement.deprecate', value: RequestCaseStatus.DEPRECATED },
+ { label: 'apiTestManagement.done', value: RequestCaseStatus.DONE },
+];
diff --git a/frontend/src/views/api-test/components/paramDescInput.vue b/frontend/src/views/api-test/components/paramDescInput.vue
index d2984e6313..c7d2a97c70 100644
--- a/frontend/src/views/api-test/components/paramDescInput.vue
+++ b/frontend/src/views/api-test/components/paramDescInput.vue
@@ -66,12 +66,6 @@
line-height: 16px;
color: var(--color-text-1);
}
- .param-popover-subtitle {
- margin-bottom: 2px;
- font-size: 12px;
- line-height: 16px;
- color: var(--color-text-4);
- }
.param-popover-value {
min-width: 100px;
max-width: 280px;
diff --git a/frontend/src/views/api-test/components/paramTable.vue b/frontend/src/views/api-test/components/paramTable.vue
index 63b28d3016..60dbcc5e7b 100644
--- a/frontend/src/views/api-test/components/paramTable.vue
+++ b/frontend/src/views/api-test/components/paramTable.vue
@@ -1,5 +1,5 @@
-
+
@@ -341,7 +341,7 @@
- [];
defaultParamItem?: Record; // 默认参数项,用于添加新行时的默认值
columns: ParamTableColumn[];
scroll?: {
@@ -548,7 +547,7 @@
}
);
const emit = defineEmits<{
- (e: 'change', data: any[]): void; // 都触发这个事件以通知父组件参数数组被更改
+ (e: 'change', data: Record[], isInit?: boolean): void; // 都触发这个事件以通知父组件参数数组被更改
(e: 'moreActionSelect', event: ActionsItem, record: Record): void;
(e: 'projectChange', projectId: string): void;
(e: 'treeDelete', record: Record): void;
@@ -557,12 +556,10 @@
const appStore = useAppStore();
const { t } = useI18n();
- const paramsData = ref(props.params);
+ const paramsData = ref[]>([]);
function emitChange(from: string, isInit?: boolean) {
- if (!isInit) {
- emit('change', paramsData.value);
- }
+ emit('change', paramsData.value, isInit);
}
const paramsLength = computed(() => paramsData.value.length);
@@ -659,28 +656,28 @@
const hostVisible = ref(false);
const hostData = ref([]);
- const hostColumn = [
- {
- title: t('project.environmental.http.host'),
- dataIndex: 'host',
- showTooltip: true,
- width: 300,
- },
- {
- title: t('project.environmental.http.desc'),
- dataIndex: 'description',
- },
- ];
+ // const hostColumn = [
+ // {
+ // title: t('project.environmental.http.host'),
+ // dataIndex: 'host',
+ // showTooltip: true,
+ // width: 300,
+ // },
+ // {
+ // title: t('project.environmental.http.desc'),
+ // dataIndex: 'description',
+ // },
+ // ];
const showHostModal = (record: Record) => {
hostVisible.value = true;
hostData.value = record.domain || [];
};
- const hostModalClose = () => {
- hostVisible.value = false;
- hostData.value = [];
- };
+ // const hostModalClose = () => {
+ // hostVisible.value = false;
+ // hostData.value = [];
+ // };
watchEffect(() => {
if (props.columns.some((e) => e.dataIndex === 'projectId')) {
@@ -698,6 +695,7 @@
*/
function addTableLine(rowIndex: number, addLineDisabled?: boolean, isInit?: boolean) {
if (addLineDisabled) {
+ emitChange('addTableLine addLineDisabled', isInit);
return;
}
if (rowIndex === paramsData.value.length - 1) {
@@ -708,8 +706,8 @@
...cloneDeep(props.defaultParamItem), // 深拷贝,避免有嵌套引用类型,数据隔离
enable: true, // 是否勾选
} as any);
- emitChange('addTableLine', isInit);
}
+ emitChange('addTableLine', isInit);
handleMustContainColChange(true);
handleTypeCheckingColChange(true);
}
@@ -920,6 +918,11 @@
});
}
+ function handleFormTableChange(data: any[]) {
+ paramsData.value = [...data];
+ emitChange('handleFormTableChange');
+ }
+
defineExpose({
addTableLine,
});
@@ -942,12 +945,6 @@
line-height: 16px;
color: var(--color-text-1);
}
- .param-popover-subtitle {
- margin-bottom: 2px;
- font-size: 12px;
- line-height: 16px;
- color: var(--color-text-4);
- }
.param-popover-value {
min-width: 100px;
max-width: 280px;
diff --git a/frontend/src/views/api-test/components/requestComposition/body.vue b/frontend/src/views/api-test/components/requestComposition/body.vue
index 478104e699..c50120e894 100644
--- a/frontend/src/views/api-test/components/requestComposition/body.vue
+++ b/frontend/src/views/api-test/components/requestComposition/body.vue
@@ -25,7 +25,7 @@
item.paramType === RequestParamsType.FILE);
- if (resultArr.length < currentTableParams.value.length) {
- currentTableParams.value.splice(0, currentTableParams.value.length - 1, ...files, ...resultArr);
- } else {
+ const filterResult = filterKeyValParams(currentTableParams.value, defaultBodyParamsItem);
+ if (filterResult.lastDataIsDefault) {
currentTableParams.value = [
...files,
...resultArr,
currentTableParams.value[currentTableParams.value.length - 1],
].filter(Boolean);
+ } else {
+ currentTableParams.value = [...files, ...resultArr].filter(Boolean);
}
emit('change');
}
diff --git a/frontend/src/views/api-test/components/requestComposition/header.vue b/frontend/src/views/api-test/components/requestComposition/header.vue
index 795db59bf6..6afcf6abc3 100644
--- a/frontend/src/views/api-test/components/requestComposition/header.vue
+++ b/frontend/src/views/api-test/components/requestComposition/header.vue
@@ -24,10 +24,9 @@
import batchAddKeyVal from '@/views/api-test/components/batchAddKeyVal.vue';
import paramTable, { ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
- import { useI18n } from '@/hooks/useI18n';
-
import { EnableKeyValueParam } from '@/models/apiTest/common';
+ import { filterKeyValParams } from '../utils';
import { defaultHeaderParamsItem } from '@/views/api-test/components/config';
const props = defineProps<{
@@ -41,8 +40,6 @@
(e: 'change'): void; // 数据发生变化
}>();
- const { t } = useI18n();
-
const innerParams = useVModel(props, 'params', emit);
const columns: ParamTableColumn[] = [
@@ -80,10 +77,11 @@
* 批量参数代码转换为参数表格数据
*/
function handleBatchParamApply(resultArr: any[]) {
- if (resultArr.length < innerParams.value.length) {
- innerParams.value.splice(0, innerParams.value.length - 1, ...resultArr);
+ const filterResult = filterKeyValParams(innerParams.value, defaultHeaderParamsItem);
+ if (filterResult.lastDataIsDefault) {
+ innerParams.value = [...resultArr, innerParams.value[innerParams.value.length - 1]].filter(Boolean);
} else {
- innerParams.value = [...resultArr, innerParams.value[innerParams.value.length - 1]];
+ innerParams.value = resultArr.filter(Boolean);
}
emit('change');
}
diff --git a/frontend/src/views/api-test/components/requestComposition/index.vue b/frontend/src/views/api-test/components/requestComposition/index.vue
index ee4cbc5221..7912b08717 100644
--- a/frontend/src/views/api-test/components/requestComposition/index.vue
+++ b/frontend/src/views/api-test/components/requestComposition/index.vue
@@ -114,7 +114,7 @@
- handleSelect('save')">
+ handleSelect('save')">
{{ t('common.save') }}
@@ -138,132 +138,251 @@
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
{
- if (isInitPluginForm) {
- handlePluginFormChange();
- }
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {
+ if (isInitPluginForm) {
+ handlePluginFormChange();
+ }
+ }
+ "
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -285,7 +404,11 @@
:rules="[{ required: true, message: t('apiTestDebug.requestNameRequired') }]"
asterisk-position="end"
>
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue
index e6a3911c4b..5cdea448cd 100644
--- a/frontend/src/views/api-test/management/components/moduleTree.vue
+++ b/frontend/src/views/api-test/management/components/moduleTree.vue
@@ -32,7 +32,8 @@
:content="isExpandApi ? t('apiTestManagement.collapseApi') : t('apiTestManagement.expandApi')"
>
-
+
+
diff --git a/frontend/src/views/api-test/management/index.vue b/frontend/src/views/api-test/management/index.vue
index 0ac5d40793..6cfcb24d94 100644
--- a/frontend/src/views/api-test/management/index.vue
+++ b/frontend/src/views/api-test/management/index.vue
@@ -1,8 +1,8 @@
-
+
-