From c1398046b7d85dcb0d1494b79da5713e583bb22a Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Sat, 9 Mar 2024 23:12:07 +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=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/api-test/report.ts | 18 ++ frontend/src/config/pathMap.ts | 7 + frontend/src/enums/reportEnum.ts | 90 ++++++ .../api-test/report/component/reportList.vue | 288 ++++++++++++++++++ .../report/component/reportStatus.vue | 103 +++++++ frontend/src/views/api-test/report/index.vue | 45 ++- .../src/views/api-test/report/locale/en-US.ts | 22 +- .../src/views/api-test/report/locale/zh-CN.ts | 103 ++----- 8 files changed, 582 insertions(+), 94 deletions(-) create mode 100644 frontend/src/api/modules/api-test/report.ts create mode 100644 frontend/src/enums/reportEnum.ts create mode 100644 frontend/src/views/api-test/report/component/reportList.vue create mode 100644 frontend/src/views/api-test/report/component/reportStatus.vue diff --git a/frontend/src/api/modules/api-test/report.ts b/frontend/src/api/modules/api-test/report.ts new file mode 100644 index 0000000000..679c246ae7 --- /dev/null +++ b/frontend/src/api/modules/api-test/report.ts @@ -0,0 +1,18 @@ +import MSR from '@/api/http'; +import * as orgUrl from '@/api/requrls/setting/organizationAndProject'; + +import type { TableQueryParams } from '@/models/common'; +// 报告列表 +export function reportList(data: TableQueryParams) { + return MSR.post({ url: orgUrl.postProjectTableUrl, data }); +} +// 删除报告 +export function reportDelete(id: string) {} + +// 重命名 +export function reportRename(id: string, reportName: string) {} + +// 批量删除 +export function reportBathDelete(ids: Array) {} + +export default {}; diff --git a/frontend/src/config/pathMap.ts b/frontend/src/config/pathMap.ts index 8411b0beba..d4151a1ee4 100644 --- a/frontend/src/config/pathMap.ts +++ b/frontend/src/config/pathMap.ts @@ -65,6 +65,13 @@ export const pathMap: PathMapItem[] = [ permission: [], level: MENU_LEVEL[2], }, + { + key: 'API_TEST_REPORT', // 接口测试-接口测试报告 + locale: 'menu.apiTest.report', + route: RouteEnum.API_TEST_REPORT, + permission: [], + level: MENU_LEVEL[2], + }, ], }, { diff --git a/frontend/src/enums/reportEnum.ts b/frontend/src/enums/reportEnum.ts new file mode 100644 index 0000000000..18ba68e342 --- /dev/null +++ b/frontend/src/enums/reportEnum.ts @@ -0,0 +1,90 @@ +// 模板展示字段icon +export enum ReportEnum { + API_SCENARIO_REPORT = 'API_SCENARIO_REPORT', + API_REPORT = 'API_REPORT', +} + +export enum ReportType { + ALL = 'ALL', + COLLECTION = 'COLLECTION', + INDEPENDENT = 'INDEPENDENT', +} + +export enum TriggerModeLabel { + SCHEDULE = 'project.taskCenter.scheduledTask', // 定时任务 + MANUAL = 'project.taskCenter.manualExecution', // 手动执行 + API = 'project.taskCenter.interfaceCall', // 接口调用 + BATCH = 'project.taskCenter.batchExecution', // 批量执行 +} + +export const ReportStatus = { + [ReportEnum.API_REPORT]: { + SUCCESS: { + icon: 'icon-icon_succeed_colorful', + label: 'report.successful', + }, + ERROR: { + icon: 'icon-icon_close_colorful', + label: 'report.failure', + }, + FAKE_ERROR: { + icon: 'icon-icon_warning_colorful', + label: 'report.falseAlarm', + }, + STOPPED: { + icon: 'icon-icon_block_filled', + label: 'report.stop', + color: '!var(--color-text-input-border)', + }, + RUNNING: { + icon: 'icon-icon_testing', + label: 'report.inExecution', + color: '!text-[rgb(var(--link-6))]', + }, + RERUNNING: { + icon: 'icon-icon_testing', + label: 'report.rerun', + color: '!text-[rgb(var(--link-6))]', + }, + PENDING: { + icon: 'icon-icon_wait', + label: 'report.queuing', + color: '!text-[rgb(var(--link-6))]', + }, + }, + [ReportEnum.API_SCENARIO_REPORT]: { + SUCCESS: { + icon: 'icon-icon_succeed_colorful', + label: 'report.successful', + }, + ERROR: { + icon: 'icon-icon_close_colorful', + label: 'report.failure', + }, + FAKE_ERROR: { + icon: 'icon-icon_warning_colorful', + label: 'report.falseAlarm', + }, + STOPPED: { + icon: 'icon-icon_block_filled', + label: 'report.stop', + color: 'var(--color-text-input-border)', + }, + RUNNING: { + icon: 'icon-icon_testing', + label: 'report.inExecution', + color: '!text-[rgb(var(--link-6))]', + }, + RERUNNING: { + icon: 'icon-icon_testing', + label: 'report.rerun', + color: '!text-[rgb(var(--link-6))]', + }, + PENDING: { + icon: 'icon-icon_wait', + label: 'report.queuing', + color: '!text-[rgb(var(--link-6))]', + }, + }, +}; +export default {}; diff --git a/frontend/src/views/api-test/report/component/reportList.vue b/frontend/src/views/api-test/report/component/reportList.vue new file mode 100644 index 0000000000..c012116727 --- /dev/null +++ b/frontend/src/views/api-test/report/component/reportList.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/frontend/src/views/api-test/report/component/reportStatus.vue b/frontend/src/views/api-test/report/component/reportStatus.vue new file mode 100644 index 0000000000..e1365f7f6c --- /dev/null +++ b/frontend/src/views/api-test/report/component/reportStatus.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/frontend/src/views/api-test/report/index.vue b/frontend/src/views/api-test/report/index.vue index 265540121c..a1730eab3f 100644 --- a/frontend/src/views/api-test/report/index.vue +++ b/frontend/src/views/api-test/report/index.vue @@ -1,22 +1,49 @@ - + diff --git a/frontend/src/views/api-test/report/locale/en-US.ts b/frontend/src/views/api-test/report/locale/en-US.ts index ff8b4c5632..9beb31ca42 100644 --- a/frontend/src/views/api-test/report/locale/en-US.ts +++ b/frontend/src/views/api-test/report/locale/en-US.ts @@ -1 +1,21 @@ -export default {}; +export default { + 'report.api.case': 'Case report', + 'report.api.scenario': 'Scenario report', + 'report.all': 'All', + 'report.independent': 'Independent report', + 'report.collection': 'Collection report', + 'report.name': 'Report name', + 'report.type': 'Report type', + 'report.result': 'Report result', + 'report.trigger.mode': 'Trigger mode', + 'report.operator': 'Create User', + 'report.operating': 'Create time', + 'report.batch.delete': 'Batch delete', + 'report.successful': 'Successful', + 'report.failure': 'failure', + 'report.fake.error': 'Fake error', + 'report.status.running': 'Running', + 'report.status.rerunning': 'Rerunning', + 'report.status.pending': 'Pending', + 'report.stopped': 'Stopped', +}; diff --git a/frontend/src/views/api-test/report/locale/zh-CN.ts b/frontend/src/views/api-test/report/locale/zh-CN.ts index 9bcb576743..0dc56511bd 100644 --- a/frontend/src/views/api-test/report/locale/zh-CN.ts +++ b/frontend/src/views/api-test/report/locale/zh-CN.ts @@ -1,86 +1,21 @@ export default { - 'apiTestManagement.newApi': '新建接口', - 'apiTestManagement.importApi': '导入接口', - 'apiTestManagement.fileImport': '文件导入', - 'apiTestManagement.timeImport': '定时导入', - 'apiTestManagement.addSubModule': '添加子模块', - 'apiTestManagement.allApi': '全部接口', - 'apiTestManagement.searchTip': '请输入模块/接口名称', - 'apiTestManagement.moveSearchTip': '请输入模块名称搜索', - 'apiTestManagement.noMatchModule': '暂无匹配的模块/接口', - 'apiTestManagement.execute': '执行', - 'apiTestManagement.share': '分享 API', - 'apiTestManagement.shareModule': '分享模块', - 'apiTestManagement.doc': '文档', - 'apiTestManagement.closeAll': '关闭全部tab', - 'apiTestManagement.closeOther': '关闭其他tab', - 'apiTestManagement.showSubdirectory': '显示子目录用例', - 'apiTestManagement.searchPlaceholder': '输入 ID/名称/api路径搜索', - 'apiTestManagement.apiName': '接口名称', - 'apiTestManagement.apiType': '请求类型', - 'apiTestManagement.apiStatus': '状态', - 'apiTestManagement.responsiblePerson': '责任人', - 'apiTestManagement.path': '路径', - 'apiTestManagement.version': '版本', - 'apiTestManagement.createTime': '创建时间', - 'apiTestManagement.updateTime': '更新时间', - 'apiTestManagement.deprecate': '已废弃', - 'apiTestManagement.processing': '进行中', - 'apiTestManagement.debugging': '联调中', - 'apiTestManagement.done': '已完成', - 'apiTestManagement.deleteApiTipTitle': '确认删除 {name} 吗?', - 'apiTestManagement.deleteApiTip': '删除后,接口将放入回收站,可在回收站内进行数据恢复', - 'apiTestManagement.batchDeleteApiTip': '确认删除已选中的 {count} 个接口吗?', - 'apiTestManagement.batchModalSubTitle': '(已选 {count} 个接口)', - 'apiTestManagement.chooseAttr': '选择属性', - 'apiTestManagement.attrRequired': '属性不能为空', - 'apiTestManagement.batchUpdate': '批量更新为', - 'apiTestManagement.valueRequired': '属性值不能为空', - 'apiTestManagement.batchMoveConfirm': '移动至所选模块', - 'apiTestManagement.belongModule': '所属模块', - 'apiTestManagement.importMode': '导入模式', - 'apiTestManagement.importModeTip1': '覆盖:', - 'apiTestManagement.importModeTip2': '1.同一接口请求类型+路径一致,请求参数内容不一致则覆盖', - 'apiTestManagement.importModeTip3': '2.同一接口请求类型+路径一致,请求参数内容一致不做变更', - 'apiTestManagement.importModeTip4': '3.非同一接口,请求类型+路径一致,则新增', - 'apiTestManagement.importModeTip5': '不覆盖:', - 'apiTestManagement.importModeTip6': '1.同一接口请求类型+路径一致,则不做变更', - 'apiTestManagement.importModeTip7': '2.非同一接口请求类型+路径一致,则新增', - 'apiTestManagement.cover': '覆盖', - 'apiTestManagement.uncover': '不覆盖', - 'apiTestManagement.moreSetting': '更多设置', - 'apiTestManagement.importType': '导入方式', - 'apiTestManagement.urlImport': 'URL 导入', - 'apiTestManagement.syncImportCase': '同步导入接口用例', - 'apiTestManagement.syncUpdateDirectory': '同步更新接口所在目录', - 'apiTestManagement.importSwaggerFileTip1': '支持 Swagger 3.0 版本的 json 文件,', - 'apiTestManagement.importSwaggerFileTip2': '2.0 的文件建议自行在官网转换成 3.0 再进行导入', - 'apiTestManagement.importSwaggerFileTip3': ',大小不超过 50M', - 'apiTestManagement.urlImportPlaceholder': '请输入OpenAPI/Swagger URL', - 'apiTestManagement.swaggerURLRequired': 'SwaggerURL 不能为空', - 'apiTestManagement.basicAuth': 'Basic Auth 认证', - 'apiTestManagement.account': '账号', - 'apiTestManagement.accountRequired': '账号不能为空', - 'apiTestManagement.password': '密码', - 'apiTestManagement.passwordRequired': '密码不能为空', - 'apiTestManagement.taskName': '任务名称', - 'apiTestManagement.taskNamePlaceholder': '请输入任务名称', - 'apiTestManagement.taskNameRequired': '任务名称不能为空', - 'apiTestManagement.syncFrequency': '同步频率', - 'apiTestManagement.timeTaskList': '定时任务列表', - 'apiTestManagement.timeTaskHour': '(每小时)', - 'apiTestManagement.timeTaskSixHour': '(每 6 小时)', - 'apiTestManagement.timeTaskTwelveHour': '(每 12 小时)', - 'apiTestManagement.timeTaskDay': '(每天)', - 'apiTestManagement.customFrequency': '自定义频率', - 'apiTestManagement.case': '用例', - 'apiTestManagement.definition': '定义', - 'apiTestManagement.addDependency': '添加依赖关系', - 'apiTestManagement.preDependency': '前置依赖', - 'apiTestManagement.addPreDependency': '添加前置依赖', - 'apiTestManagement.postDependency': '后置依赖', - 'apiTestManagement.addPostDependency': '添加后置依赖', - 'apiTestManagement.saveAsCase': '保存为新用例', - 'apiTestManagement.apiNamePlaceholder': '请输入接口名称', - 'apiTestManagement.apiNameRequired': '接口名称不能为空', + 'report.api.case': '用例报告', + 'report.api.scenario': '场景报告', + 'report.all': '全部', + 'report.independent': '独立报告', + 'report.collection': '集合报告', + 'report.name': '报告名称', + 'report.type': '报告类型', + 'report.result': '报告结果', + 'report.trigger.mode': '触发方式', + 'report.operator': '创建人', + 'report.operating': '创建时间', + 'report.batch.delete': '批量删除', + 'report.successful': '成功', + 'report.failure': '失败', + 'report.fake.error': '误报', + 'report.status.running': '执行中', + 'report.status.rerunning': '重跑中', + 'report.status.pending': '排队中', + 'report.stopped': '停止', };