From 22e9354a5192a8503c4f781b9b86b8bf3bb8ab6f Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 14 May 2024 17:19:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92table=E8=81=94=E8=B0=83?= =?UTF-8?q?=E5=92=8C=E7=BB=86=E8=8A=82=E5=AE=8C=E5=96=84=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=94=A8=E4=BE=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86=E5=88=97=E8=A1=A8?= =?UTF-8?q?tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/test-plan/testPlan.ts | 28 ++ .../src/api/requrls/test-plan/testPlan.ts | 12 +- frontend/src/config/testPlan.ts | 18 +- frontend/src/locale/en-US/common.ts | 3 + frontend/src/locale/zh-CN/common.ts | 3 + frontend/src/models/testPlan/testPlan.ts | 23 +- .../components/caseDetailDrawer.vue | 2 - .../components/tabContent/tabBug/bugList.vue | 158 ++++++++++ .../tabContent/tabBug/linkDefectDrawer.vue | 12 +- .../tabContent/tabBug/tabDefect.vue | 165 +++-------- .../components/tabContent/tabCaseReview.vue | 1 - .../caseManagementFeature/components/utils.ts | 20 ++ .../components/index/reviewTable.vue | 2 +- .../testPlan/components/actionModal.vue | 10 +- .../testPlan/components/associateDrawer.vue | 3 +- .../testPlan/components/planTable.vue | 196 ++++++++----- .../testPlan/components/statusProgress.vue | 121 ++++---- .../testPlan/createAndEditPlanDrawer.vue | 78 ++++- .../testPlan/detail/bugManagement/index.vue | 4 +- .../detail/featureCase/detail/bug/index.vue | 271 ++++++++++++++++++ .../detail/featureCase/detail/index.vue | 20 +- .../views/test-plan/testPlan/detail/index.vue | 229 +++++++++++++-- .../src/views/test-plan/testPlan/index.vue | 8 +- .../views/test-plan/testPlan/locale/en-US.ts | 7 +- .../views/test-plan/testPlan/locale/zh-CN.ts | 7 +- 25 files changed, 1092 insertions(+), 309 deletions(-) create mode 100644 frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/bugList.vue create mode 100644 frontend/src/views/test-plan/testPlan/detail/featureCase/detail/bug/index.vue diff --git a/frontend/src/api/modules/test-plan/testPlan.ts b/frontend/src/api/modules/test-plan/testPlan.ts index bb04a7e1ed..683cc52e69 100644 --- a/frontend/src/api/modules/test-plan/testPlan.ts +++ b/frontend/src/api/modules/test-plan/testPlan.ts @@ -3,13 +3,17 @@ import { addTestPlanModuleUrl, AddTestPlanUrl, archivedPlanUrl, + associationCaseToPlanUrl, + batchArchivedPlanUrl, batchCopyPlanUrl, batchDeletePlanUrl, BatchDisassociateCaseUrl, batchMovePlanUrl, + copyTestPlanUrl, deletePlanUrl, DeleteTestPlanModuleUrl, DisassociateCaseUrl, + followPlanUrl, GetFeatureCaseModuleCountUrl, GetFeatureCaseModuleUrl, GetPlanDetailFeatureCaseListUrl, @@ -20,6 +24,7 @@ import { GetTestPlanModuleUrl, MoveTestPlanModuleUrl, planDetailBugPageUrl, + planPassRateUrl, updateTestPlanModuleUrl, UpdateTestPlanUrl, } from '@/api/requrls/test-plan/testPlan'; @@ -29,8 +34,11 @@ import type { CommonList, MoveModules, TableQueryParams } from '@/models/common' import { ModuleTreeNode } from '@/models/common'; import type { AddTestPlanParams, + AssociateCaseRequestType, BatchFeatureCaseParams, DisassociateCaseParams, + FollowPlanParams, + PassRateCountDetail, PlanDetailBugItem, PlanDetailFeatureCaseItem, PlanDetailFeatureCaseListQueryParams, @@ -78,6 +86,10 @@ export function getTestPlanList(data: TableQueryParams) { export function addTestPlan(data: AddTestPlanParams) { return MSR.post({ url: AddTestPlanUrl, data }); } +// 创建测试计划 +export function copyTestPlan(data: AddTestPlanParams) { + return MSR.post({ url: copyTestPlanUrl, data }); +} // 获取测试计划详情 export function getTestPlanDetail(id: string) { @@ -112,10 +124,26 @@ export function batchCopyPlan(data: TableQueryParams) { export function batchMovePlan(data: TableQueryParams) { return MSR.post({ url: batchMovePlanUrl, data }); } +// 批量移动测试计划 +export function batchArchivedPlan(data: TableQueryParams) { + return MSR.post({ url: batchArchivedPlanUrl, data }); +} // 计划详情缺陷管理列表 export function planDetailBugPage(data: TableQueryParams) { return MSR.post>({ url: planDetailBugPageUrl, data }); } +// 关注 +export function followPlanRequest(data: FollowPlanParams) { + return MSR.post({ url: followPlanUrl, data }); +} +// 关联用例到测试计划 +export function associationCaseToPlan(data: AssociateCaseRequestType) { + return MSR.post({ url: associationCaseToPlanUrl, data }); +} +// 测试计划通过率执行进度 +export function getPlanPassRate(data: (string | undefined)[]) { + return MSR.post({ url: planPassRateUrl, data }); +} // 计划详情-功能用例列表 export function getPlanDetailFeatureCaseList(data: PlanDetailFeatureCaseListQueryParams) { return MSR.post>({ url: GetPlanDetailFeatureCaseListUrl, data }); diff --git a/frontend/src/api/requrls/test-plan/testPlan.ts b/frontend/src/api/requrls/test-plan/testPlan.ts index f6bb28e33a..c1d48fd4f2 100644 --- a/frontend/src/api/requrls/test-plan/testPlan.ts +++ b/frontend/src/api/requrls/test-plan/testPlan.ts @@ -27,11 +27,21 @@ export const getStatisticalCountUrl = '/test-plan/getCount'; // 归档 export const archivedPlanUrl = '/test-plan/archived'; // 批量复制 -export const batchCopyPlanUrl = '/test-plan/batch/copy'; +export const batchCopyPlanUrl = '/test-plan/batch-copy'; // 批量移动 export const batchMovePlanUrl = '/test-plan/batch/move'; +// 批量移动 +export const batchArchivedPlanUrl = '/test-plan/batch-archived'; // 计划详情缺陷管理列表 export const planDetailBugPageUrl = '/test-plan/bug/page'; +// 关注测试计划 +export const followPlanUrl = '/test-plan/edit/follower'; +// 复制测试计划 +export const copyTestPlanUrl = '/test-plan/copy'; +// 关联测试计划 +export const associationCaseToPlanUrl = '/test-plan/association'; +// 测试计划通过率执行进度 +export const planPassRateUrl = '/test-plan/statistics'; // 计划详情-功能用例列表 export const GetPlanDetailFeatureCaseListUrl = '/test-plan/functional/case/page'; // 计划详情-功能用例-获取模块数量 diff --git a/frontend/src/config/testPlan.ts b/frontend/src/config/testPlan.ts index 19567c9106..7656f9d47a 100644 --- a/frontend/src/config/testPlan.ts +++ b/frontend/src/config/testPlan.ts @@ -1,4 +1,4 @@ -import type { planStatusType, TestPlanDetail } from '@/models/testPlan/testPlan'; +import type { PassRateCountDetail, planStatusType, TestPlanDetail } from '@/models/testPlan/testPlan'; // TODO: 对照后端字段 // 测试计划详情 @@ -23,4 +23,20 @@ export const testPlanDefaultDetail: TestPlanDetail = { underReviewedCount: 0, }; +export const initDetailCount: PassRateCountDetail = { + id: '', + passThreshold: 0, + passRate: 0, + executeRate: 0, + successCount: 0, + errorCount: 0, + fakeErrorCount: 0, + blockCount: 0, + pendingCount: 0, + caseTotal: 0, + functionalCaseCount: 0, + apiCaseCount: 0, + apiScenarioCount: 0, +}; + export default {}; diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index f7bd5922c2..eec8d809d9 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -38,6 +38,7 @@ export default { 'common.editFailed': 'Edit failed', 'common.saveSuccess': 'Save success', 'common.saveFailed': 'Save failed', + 'common.associated': 'Associated', 'common.linkSuccess': 'Link success', 'common.unLinkSuccess': 'Unlink success', 'common.confirmEnable': 'Confirm enable', @@ -168,6 +169,8 @@ export default { 'common.unExecute': 'Not executed', 'common.pass': 'Pass', 'common.unPass': 'Fail pass', + 'common.block': 'block', + 'common.fakeError': 'Fake error', 'common.belongModule': 'Belong module', 'common.moreSetting': 'More settings', }; diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts index 53b66f7dd0..ab89968399 100644 --- a/frontend/src/locale/zh-CN/common.ts +++ b/frontend/src/locale/zh-CN/common.ts @@ -39,6 +39,7 @@ export default { 'common.editFailed': '编辑失败', 'common.saveSuccess': '保存成功', 'common.saveFailed': '保存失败', + 'common.associated': '关联', 'common.linkSuccess': '关联成功', 'common.cancelLink': '取消关联', 'common.unLinkSuccess': '取消关联成功', @@ -168,6 +169,8 @@ export default { 'common.unExecute': '未执行', 'common.pass': '通过', 'common.unPass': '不通过', + 'common.block': '阻塞', + 'common.fakeError': '误报', 'common.belongModule': '所属模块', 'common.moreSetting': '更多设置', 'common.executionResult': '执行结果', diff --git a/frontend/src/models/testPlan/testPlan.ts b/frontend/src/models/testPlan/testPlan.ts index 157ca1efd6..cc8c826027 100644 --- a/frontend/src/models/testPlan/testPlan.ts +++ b/frontend/src/models/testPlan/testPlan.ts @@ -29,8 +29,11 @@ export interface AssociateCaseRequest extends BatchApiParams { apiCaseSelectIds?: string[]; apiScenarioSelectIds?: string[]; totalCount?: number; + testPlanId?: string; } +export type AssociateCaseRequestType = Pick; + export interface AddTestPlanParams { id?: string; name: string; @@ -45,11 +48,12 @@ export interface AddTestPlanParams { repeatCase: boolean; // 是否允许重复添加用例 passThreshold: number; type?: string; - baseAssociateCaseRequest?: AssociateCaseRequest; + baseAssociateCaseRequest?: AssociateCaseRequest | null; groupOption?: boolean; cycle?: number[]; projectId?: string; testPlanId?: string; + functionalCaseCount?: number; } // TODO: 对照后端字段 @@ -66,6 +70,7 @@ export interface TestPlanDetail extends AddTestPlanParams { unPassCount: number; reReviewedCount: number; underReviewedCount: number; + functionalCaseCount?: number; } // 计划分页 @@ -160,4 +165,20 @@ export interface BatchFeatureCaseParams extends BatchActionQueryParams { moduleIds?: string[]; } +export interface PassRateCountDetail { + id: string; + passThreshold: number; + passRate: number; + executeRate: number; + successCount: number; + errorCount: number; + fakeErrorCount: number; + blockCount: number; + pendingCount: number; + caseTotal: number; + functionalCaseCount: number; + apiCaseCount: number; + apiScenarioCount: number; +} + export default {}; diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue index b968cec7fd..2ae7812811 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue @@ -273,7 +273,6 @@ getCaseDetail, getCaseModuleTree, } from '@/api/modules/case-management/featureCase'; - import { postTabletList } from '@/api/modules/project-management/menuManagement'; import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase'; import { useI18n } from '@/hooks/useI18n'; import useModal from '@/hooks/useModal'; @@ -282,7 +281,6 @@ import useUserStore from '@/store/modules/user'; import { characterLimit } from '@/utils'; import { translateTextToPX } from '@/utils/css'; - import { hasAnyPermission } from '@/utils/permission'; import type { CustomAttributes, DetailCase, TabItemType } from '@/models/caseManagement/featureCase'; import { ModuleTreeNode } from '@/models/common'; diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/bugList.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/bugList.vue new file mode 100644 index 0000000000..6a36918ca7 --- /dev/null +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/bugList.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/linkDefectDrawer.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/linkDefectDrawer.vue index 5e2651a156..01fe933a9c 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/linkDefectDrawer.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/linkDefectDrawer.vue @@ -76,7 +76,7 @@ { title: 'caseManagement.featureCase.tableColumnID', dataIndex: 'num', - width: 200, + width: 150, showInTable: true, showTooltip: true, ellipsis: true, @@ -88,7 +88,7 @@ dataIndex: 'name', showInTable: true, showTooltip: true, - width: 300, + width: 200, ellipsis: true, showDrag: false, }, @@ -99,7 +99,7 @@ dataIndex: 'statusName', showInTable: true, showTooltip: true, - width: 300, + width: 200, ellipsis: true, showDrag: false, }, @@ -109,6 +109,7 @@ dataIndex: 'tags', showInTable: true, isTag: true, + width: 300, showDrag: true, }, { @@ -117,7 +118,7 @@ dataIndex: 'handleUserName', showInTable: true, showTooltip: true, - width: 300, + width: 200, ellipsis: true, showDrag: false, }, @@ -127,7 +128,7 @@ dataIndex: 'createUser', showInTable: true, showTooltip: true, - width: 300, + width: 200, ellipsis: true, }, { @@ -146,7 +147,6 @@ columns, tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEFECT, selectable: true, - scroll: { x: 'auto' }, heightUsed: 340, enableDrag: false, }, diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue index c85a7abbd4..5928985753 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue @@ -56,65 +56,17 @@ > - - - - - - - - - + @@ -250,9 +273,11 @@ import { archivedPlan, + batchArchivedPlan, batchCopyPlan, batchDeletePlan, batchMovePlan, + getPlanPassRate, getTestPlanDetail, getTestPlanList, getTestPlanModule, @@ -264,13 +289,15 @@ import { characterLimit } from '@/utils'; import { hasAnyPermission } from '@/utils/permission'; - import type { planStatusType, TestPlanItem } from '@/models/testPlan/testPlan'; + import { ModuleTreeNode } from '@/models/common'; + import type { PassRateCountDetail, planStatusType, TestPlanItem } from '@/models/testPlan/testPlan'; import { TestPlanRouteEnum } from '@/enums/routeEnum'; import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum'; import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { testPlanTypeEnum } from '@/enums/testPlanEnum'; import { planStatusOptions } from '../config'; + import { getModules } from '@/views/case-management/caseManagementFeature/components/utils'; const tableStore = useTableStore(); const appStore = useAppStore(); @@ -284,11 +311,12 @@ offspringIds: string[]; // 当前选中文件夹的所有子孙节点id modulesCount: Record; // 模块数量 nodeName: string; // 选中模块名称 + moduleTree: ModuleTreeNode[]; }>(); const emit = defineEmits<{ (e: 'init', params: any): void; - (e: 'edit', id: string): void; + (e: 'editOrCopy', id: string, isCopy: boolean): void; }>(); const columns: MsTableColumn = [ @@ -355,9 +383,8 @@ }, { title: 'testPlan.testPlanIndex.useCount', - slotName: 'useCount', - dataIndex: 'useCount', - showTooltip: true, + slotName: 'functionalCaseCount', + dataIndex: 'functionalCaseCount', showInTable: true, width: 150, showDrag: true, @@ -373,8 +400,8 @@ }, { title: 'testPlan.testPlanIndex.belongModule', - slotName: 'moduleName', - dataIndex: 'moduleName', + slotName: 'moduleId', + dataIndex: 'moduleId', showInTable: true, showDrag: true, width: 200, @@ -508,34 +535,45 @@ ], }; - const moreActions: ActionsItem[] = [ - { - label: 'common.copy', - eventTag: 'copy', - }, - // TODO 这个版本不上 - // { - // label: 'testPlan.testPlanIndex.createScheduledTask', - // eventTag: 'createScheduledTask', - // }, - // { - // label: 'testPlan.testPlanIndex.configuration', - // eventTag: 'config', - // }, + const archiveActions: ActionsItem[] = [ { label: 'common.archive', eventTag: 'archive', }, + ]; + const copyActions: ActionsItem[] = [ { - isDivider: true, - }, - { - label: 'common.delete', - danger: true, - eventTag: 'delete', + label: 'common.copy', + eventTag: 'copy', }, ]; + function getMoreActions(status: planStatusType, useCount: number) { + const copyAction = useCount > 0 ? copyActions : []; + if (status === 'COMPLETED' || status === 'ARCHIVED') { + return [ + ...copyAction, + { + isDivider: true, + }, + { + label: 'common.delete', + danger: true, + eventTag: 'delete', + }, + ]; + } + return [ + ...copyAction, + ...archiveActions, + { + label: 'common.delete', + danger: true, + eventTag: 'delete', + }, + ]; + } + const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( getTestPlanList, { @@ -607,6 +645,19 @@ }); } + const initDefaultCountDetailMap = ref>({}); + + async function getStatistics(selectedPlanIds: (string | undefined)[]) { + try { + const result = await getPlanPassRate(selectedPlanIds); + result.forEach((item: PassRateCountDetail) => { + initDefaultCountDetailMap.value[item.id] = item; + }); + } catch (error) { + console.log(error); + } + } + async function fetchData() { resetSelector(); await loadPlanList(); @@ -711,7 +762,18 @@ }, onBeforeOk: async () => { try { - const { selectedIds, selectAll, excludeIds } = batchParams.value; + await batchArchivedPlan({ + selectIds: batchParams.value.selectedIds || [], + condition: { + keyword: keyword.value, + filter: propsRes.value.filter, + combine: batchParams.value.condition, + }, + projectId: appStore.currentProjectId, + moduleIds: props.activeFolder === 'all' ? [] : [props.activeFolder, ...props.offspringIds], + type: showType.value, + moduleId: props.activeFolder, + }); Message.success(t('common.batchArchiveSuccess')); fetchData(); } catch (error) { @@ -811,9 +873,9 @@ } } - function deletePlan(record: TestPlanItem) {} - - function copyHandler(record: TestPlanItem) {} + function copyHandler(record: TestPlanItem) { + emit('editOrCopy', record.id as string, true); + } const showScheduledTaskModal = ref(false); function handleScheduledTask() { @@ -821,7 +883,7 @@ } const showStatusDeleteModal = ref(false); - const activeRecord = ref(); + const activeRecord = ref(); function deleteStatusHandler(record: TestPlanItem) { activeRecord.value = cloneDeep(record); showStatusDeleteModal.value = true; @@ -884,19 +946,6 @@ // return expandedKeys.value.includes(record.id) ? 'text-[rgb(var(--primary-5))]' : 'text-[var(--color-text-4)]'; // } - function handleFilterHidden(val: boolean) { - if (!val) { - statusFilterVisible.value = false; - fetchData(); - } - } - - function resetStatusFilter() { - statusFilterVisible.value = false; - statusFilters.value = []; - fetchData(); - } - /** * * 高级检索 */ @@ -926,6 +975,25 @@ fetchData(); }); + const planData = computed(() => { + return propsRes.value.data; + }); + + watch( + () => planData.value, + (val) => { + if (val) { + const selectedPlanIds: (string | undefined)[] = propsRes.value.data.map((e) => e.id) || []; + if (selectedPlanIds.length) { + getStatistics(selectedPlanIds); + } + } + }, + { + immediate: true, + } + ); + defineExpose({ fetchData, emitTableParams, diff --git a/frontend/src/views/test-plan/testPlan/components/statusProgress.vue b/frontend/src/views/test-plan/testPlan/components/statusProgress.vue index a2052be33c..e667640e74 100644 --- a/frontend/src/views/test-plan/testPlan/components/statusProgress.vue +++ b/frontend/src/views/test-plan/testPlan/components/statusProgress.vue @@ -4,18 +4,50 @@ - + + + + + + + + + + + + + + + + + @@ -24,34 +56,7 @@
{{ t('common.unExecute') }}
- - - - - - - - - - - -
-
{{ t('testPlan.testPlanIndex.tolerance') }}
-
- {{ props.statusDetail.tolerance }} +
{{ t('testPlan.testPlanIndex.threshold') }}
{{ detailCount.passThreshold }}%
{{ t('testPlan.testPlanIndex.executionProgress') }}
{{ detailCount.executeRate }}%
+
+
{{ t('common.success') }}
+
- {{ props.statusDetail.executionProgress }} + {{ detailCount.successCount }} +
+
+
{{ t('common.fail') }}
+
+ {{ detailCount.errorCount }} +
+
+
{{ t('common.fakeError') }}
+
+ {{ detailCount.fakeErrorCount }} +
+ +
{{ t('common.block') }}
+
+ {{ detailCount.blockCount }}
- {{ props.statusDetail.UNPENDING }} -
- -
{{ t('common.running') }}
-
- {{ props.statusDetail.RUNNING }} -
-
-
{{ t('common.pass') }}
-
- {{ props.statusDetail.SUCCESS }} -
-
-
{{ t('common.unPass') }}
-
- {{ props.statusDetail.ERROR }} + {{ detailCount.pendingCount }}
@@ -64,35 +69,29 @@ import MsColorLine from '@/components/pure/ms-color-line/index.vue'; + import { initDetailCount } from '@/config/testPlan'; import { useI18n } from '@/hooks/useI18n'; + import type { PassRateCountDetail } from '@/models/testPlan/testPlan'; + const props = defineProps<{ - statusDetail: { - tolerance: number; - UNPENDING: number; - RUNNING: number; - SUCCESS: number; - ERROR: number; - executionProgress: string; - [key: string]: any; - }; + statusDetail: PassRateCountDetail | undefined; height: string; radius?: string; }>(); const { t } = useI18n(); - const getCountTotal = computed(() => { - const { UNPENDING, RUNNING, ERROR, SUCCESS } = props.statusDetail; - return UNPENDING + RUNNING + ERROR + SUCCESS; + const detailCount = ref({ ...initDetailCount }); + watchEffect(() => { + detailCount.value = { + ...initDetailCount, + ...props.statusDetail, + }; }); const colorData = computed(() => { - if ( - props.statusDetail.UNPENDING === 0 && - props.statusDetail.RUNNING === 0 && - props.statusDetail.ERROR === 0 && - props.statusDetail.SUCCESS === 0 - ) { + const { caseTotal, successCount, errorCount, fakeErrorCount, blockCount, pendingCount } = detailCount.value; + if (fakeErrorCount === 0 && blockCount === 0 && errorCount === 0 && successCount === 0 && pendingCount === 0) { return [ { percentage: 100, @@ -100,21 +99,33 @@ }, ]; } + if (detailCount.value.passRate > detailCount.value.passThreshold) { + return [ + { + percentage: 100, + color: 'rgb(var(--success-6))', + }, + ]; + } return [ { - percentage: (props.statusDetail.SUCCESS / getCountTotal.value) * 100, + percentage: (successCount / caseTotal) * 100, color: 'rgb(var(--success-6))', }, { - percentage: (props.statusDetail.ERROR / getCountTotal.value) * 100, + percentage: (errorCount / caseTotal) * 100, color: 'rgb(var(--danger-6))', }, { - percentage: (props.statusDetail.RUNNING / getCountTotal.value) * 100, + percentage: (blockCount / caseTotal) * 100, color: 'rgb(var(--link-6))', }, { - percentage: (props.statusDetail.UNPENDING / getCountTotal.value) * 100, + percentage: (fakeErrorCount / caseTotal) * 100, + color: 'rgb(var(--warning-6))', + }, + { + percentage: (pendingCount / caseTotal) * 100, color: 'var(--color-text-input-border)', }, ]; diff --git a/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue b/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue index e0c643c052..bcc80e9bea 100644 --- a/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue +++ b/frontend/src/views/test-plan/testPlan/createAndEditPlanDrawer.vue @@ -1,10 +1,10 @@