From abedfece3ce20f0b4ea986a4554f04130b5bad49 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 16 Oct 2024 18:40:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8E=BB=E6=8E=89=E5=90=8C=E6=AD=A5=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/DemandScheduleServiceImpl.java | 5 +-- .../ProjectApplicationControllerTests.java | 2 - .../menuManagement/components/relatedCase.vue | 43 +------------------ 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/DemandScheduleServiceImpl.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/DemandScheduleServiceImpl.java index eb21b6c5f9..8c69a5bc17 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/DemandScheduleServiceImpl.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/DemandScheduleServiceImpl.java @@ -29,11 +29,8 @@ public class DemandScheduleServiceImpl implements BaseDemandScheduleService { public void updateDemandSyncScheduleConfig(List bugSyncConfigs, String projectId, String currentUser) { List syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CRON_EXPRESSION.name())).toList(); List caseEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CASE_ENABLE.name())).toList(); - List syncEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.SYNC_ENABLE.name())).toList(); if (CollectionUtils.isNotEmpty(syncCron)) { - Boolean enableCase = Boolean.valueOf(caseEnable.getFirst().getTypeValue()); - Boolean enableSync = Boolean.valueOf(syncEnable.getFirst().getTypeValue()); - Boolean enable = enableCase && enableSync; + Boolean enable = Boolean.valueOf(caseEnable.getFirst().getTypeValue()); String typeValue = syncCron.getFirst().getTypeValue(); Schedule schedule = scheduleService.getScheduleByResource(projectId, DemandSyncJob.class.getName()); Optional optional = Optional.ofNullable(schedule); diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java index b1df71fcc4..35eb99ad0e 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectApplicationControllerTests.java @@ -466,7 +466,6 @@ public class ProjectApplicationControllerTests extends BaseTest { Map configs = new HashMap<>(); configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig); configs.put("CASE_ENABLE", "true"); - configs.put("SYNC_ENABLE", "true"); configs.put("CRON_EXPRESSION", "0 0 0 * * ?"); return configs; } @@ -476,7 +475,6 @@ public class ProjectApplicationControllerTests extends BaseTest { Map configs = new HashMap<>(); configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig); configs.put("CASE_ENABLE", "false"); - configs.put("SYNC_ENABLE", "true"); configs.put("CRON_EXPRESSION", "0 0 0/1 * * ?"); return configs; } diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue index daa69bcc0b..3f6a376a2c 100644 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue @@ -35,38 +35,8 @@ :form-rule="platformRules" @mounted="handleMounted" /> - - - - - - - {{ t('project.menu.updateSync') }} - - - -
- -
-
-
- + @@ -147,12 +117,10 @@ const form = reactive({ PLATFORM_KEY: '', CASE_ENABLE: 'false', // 关联需求开关 - SYNC_ENABLE: 'false', // 同步开关 + SYNC_ENABLE: 'true', // 同步开关 CRON_EXPRESSION: '0 0 0 * * ?', // 同步频率 }); - const hasChange = ref(false); - const formCreateValue = ref>({}); const okDisabled = computed(() => !form.PLATFORM_KEY); @@ -241,7 +209,6 @@ // 如果平台key存在调用平台change拉取插件字段 await handlePlatformChange(res.platform_key); form.CASE_ENABLE = res.case_enable; - hasChange.value = res.sync_enable === 'true'; form.PLATFORM_KEY = res.platform_key; form.SYNC_ENABLE = res.sync_enable; form.CRON_EXPRESSION = res.cron_expression; @@ -267,12 +234,6 @@ setValue(); } - function handleSwitchChange(value: string | number | boolean) { - if (typeof value === 'string') { - hasChange.value = value === 'true'; - } - } - watch( () => props.visible, (val) => {