From a06eb32fcce2d07dbe87a48031a8a1eb771e648a Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 10 Apr 2024 13:16:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=B0=83=E6=95=B4&=E8=A1=A5=E5=85=85&?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E5=91=8A=E7=8A=B6=E6=80=81=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/project-management/taskCenter.ts | 4 + .../requrls/project-management/taskCenter.ts | 2 + .../api-test/management/components/import.vue | 2 +- .../report/component/step/stepTree.vue | 5 +- .../api-test/report/component/tiledList.vue | 27 +++++- .../scenario/components/scenarioTable.vue | 2 +- .../taskCenter/component/apiCase.vue | 42 +++++++-- .../taskCenter/component/scheduledTask.vue | 91 +++++++++++++++++-- .../taskCenter/component/utils.ts | 23 +++++ 9 files changed, 172 insertions(+), 26 deletions(-) diff --git a/frontend/src/api/modules/project-management/taskCenter.ts b/frontend/src/api/modules/project-management/taskCenter.ts index 85f7da61c7..7361f41428 100644 --- a/frontend/src/api/modules/project-management/taskCenter.ts +++ b/frontend/src/api/modules/project-management/taskCenter.ts @@ -14,6 +14,7 @@ import { taskOrgRealCenterListUrl, taskProRealCenterListUrl, taskSysRealCenterListUrl, + updateRunRulesUrl, } from '@/api/requrls/project-management/taskCenter'; import type { CommonList, TableQueryParams } from '@/models/common'; @@ -75,4 +76,7 @@ export function deleteScheduleSysTask(id: string) { export function switchSchedule(id: string) { return MSR.get({ url: `${enableSchedule}/${id}` }); } +export function updateRunRules(id: string, data: string) { + return MSR.get({ url: `${updateRunRulesUrl}/${id}`, data }); +} export default {}; diff --git a/frontend/src/api/requrls/project-management/taskCenter.ts b/frontend/src/api/requrls/project-management/taskCenter.ts index bcea69da22..8c84725f31 100644 --- a/frontend/src/api/requrls/project-management/taskCenter.ts +++ b/frontend/src/api/requrls/project-management/taskCenter.ts @@ -36,3 +36,5 @@ export const stopRealSysApiUrl = '/task/center/api/system/stop'; export const stopRealOrdApiUrl = '/task/center/api/org/stop'; // 停止单个任务(项目) export const stopRealProjectApiUrl = '/task/center/api/project/stop'; +// 更新定时任务运行规则 +export const updateRunRulesUrl = '/task/center/schedule/update'; diff --git a/frontend/src/views/api-test/management/components/import.vue b/frontend/src/views/api-test/management/components/import.vue index 3e3e0fcc3d..fbf35c2ce6 100644 --- a/frontend/src/views/api-test/management/components/import.vue +++ b/frontend/src/views/api-test/management/components/import.vue @@ -432,7 +432,7 @@ }); const moduleTree = computed(() => mapTree(props.moduleTree, (node) => ({ ...node, draggable: false }))); const syncFrequencyOptions = [ - { label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ? ' }, + { label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' }, { label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' }, { label: t('apiTestManagement.timeTaskTwelveHour'), value: '0 0 0/12 * * ?' }, { label: t('apiTestManagement.timeTaskDay'), value: '0 0 0 * * ?' }, diff --git a/frontend/src/views/api-test/report/component/step/stepTree.vue b/frontend/src/views/api-test/report/component/step/stepTree.vue index 4e0e46d9ab..46ea0db669 100644 --- a/frontend/src/views/api-test/report/component/step/stepTree.vue +++ b/frontend/src/views/api-test/report/component/step/stepTree.vue @@ -49,10 +49,7 @@ v-if="!(step.children && step.children.length && showApiType.includes(step.stepType))" class="flex cursor-pointer items-center gap-[2px] text-[var(--color-text-4)]" > - + {{ step.children?.length || 0 }} diff --git a/frontend/src/views/api-test/report/component/tiledList.vue b/frontend/src/views/api-test/report/component/tiledList.vue index 139b082579..d034e74920 100644 --- a/frontend/src/views/api-test/report/component/tiledList.vue +++ b/frontend/src/views/api-test/report/component/tiledList.vue @@ -40,6 +40,7 @@ import StepTree from './step/stepTree.vue'; import type { ReportDetail, ScenarioItemType } from '@/models/apiTest/report'; + import { ScenarioStepType } from '@/enums/apiEnum'; import { addFoldField } from '../utils'; @@ -89,6 +90,12 @@ }, { deep: true, immediate: true } ); + const showApiType = ref([ + ScenarioStepType.API, + ScenarioStepType.API_CASE, + ScenarioStepType.CUSTOM_REQUEST, + ScenarioStepType.SCRIPT, + ]); function searchStep() { const splitLevel = props.keyWords.split('-'); @@ -97,20 +104,32 @@ const search = (_data: ScenarioItemType[]) => { const result: ScenarioItemType[] = []; _data.forEach((item) => { + const isStepChildren = item.children && item?.children.length && showApiType.value.includes(item.stepType); if ( stepType.includes(item.stepType) && ((item.status && item.status === stepTypeStatus && stepTypeStatus !== 'scriptIdentifier') || (stepTypeStatus.includes('scriptIdentifier') && item.scriptIdentifier)) ) { - result.push({ ...item, expanded: true }); + const resItem = { + ...item, + expanded: false, + stepChildren: isStepChildren ? cloneDeep(item.children) : [], + children: isStepChildren ? [] : item.children, + }; + result.push(resItem); } else if (item.children) { const filterData = search(item.children); if (filterData.length) { - result.push({ + const filterItem = { ...item, - expanded: true, + expanded: false, children: filterData, - }); + }; + if (isStepChildren) { + filterItem.stepChildren = cloneDeep(item.children); + filterItem.children = []; + } + result.push(filterItem); } } }); diff --git a/frontend/src/views/api-test/scenario/components/scenarioTable.vue b/frontend/src/views/api-test/scenario/components/scenarioTable.vue index 2789d7ec52..fec2fc8c5e 100644 --- a/frontend/src/views/api-test/scenario/components/scenarioTable.vue +++ b/frontend/src/views/api-test/scenario/components/scenarioTable.vue @@ -1126,7 +1126,7 @@ const showScheduleModal = ref(false); const syncFrequencyOptions = [ - { label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ? ' }, + { label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' }, { label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' }, { label: t('apiTestManagement.timeTaskTwelveHour'), value: '0 0 0/12 * * ?' }, { label: t('apiTestManagement.timeTaskDay'), value: '0 0 0 * * ?' }, diff --git a/frontend/src/views/project-management/taskCenter/component/apiCase.vue b/frontend/src/views/project-management/taskCenter/component/apiCase.vue index ccb0ee10b2..f96270b379 100644 --- a/frontend/src/views/project-management/taskCenter/component/apiCase.vue +++ b/frontend/src/views/project-management/taskCenter/component/apiCase.vue @@ -4,7 +4,7 @@ {{ t('project.taskCenter.apiCaseList', { type: props.name }) }} -