refactor(项目管理): 项目设置同步需求去掉同步限制
This commit is contained in:
parent
c2ad5dfa6a
commit
abedfece3c
|
@ -29,11 +29,8 @@ public class DemandScheduleServiceImpl implements BaseDemandScheduleService {
|
||||||
public void updateDemandSyncScheduleConfig(List<ProjectApplication> bugSyncConfigs, String projectId, String currentUser) {
|
public void updateDemandSyncScheduleConfig(List<ProjectApplication> bugSyncConfigs, String projectId, String currentUser) {
|
||||||
List<ProjectApplication> syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CRON_EXPRESSION.name())).toList();
|
List<ProjectApplication> syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CRON_EXPRESSION.name())).toList();
|
||||||
List<ProjectApplication> caseEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CASE_ENABLE.name())).toList();
|
List<ProjectApplication> caseEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.CASE_RELATED_CONFIG.CASE_ENABLE.name())).toList();
|
||||||
List<ProjectApplication> 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)) {
|
if (CollectionUtils.isNotEmpty(syncCron)) {
|
||||||
Boolean enableCase = Boolean.valueOf(caseEnable.getFirst().getTypeValue());
|
Boolean enable = Boolean.valueOf(caseEnable.getFirst().getTypeValue());
|
||||||
Boolean enableSync = Boolean.valueOf(syncEnable.getFirst().getTypeValue());
|
|
||||||
Boolean enable = enableCase && enableSync;
|
|
||||||
String typeValue = syncCron.getFirst().getTypeValue();
|
String typeValue = syncCron.getFirst().getTypeValue();
|
||||||
Schedule schedule = scheduleService.getScheduleByResource(projectId, DemandSyncJob.class.getName());
|
Schedule schedule = scheduleService.getScheduleByResource(projectId, DemandSyncJob.class.getName());
|
||||||
Optional<Schedule> optional = Optional.ofNullable(schedule);
|
Optional<Schedule> optional = Optional.ofNullable(schedule);
|
||||||
|
|
|
@ -466,7 +466,6 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
||||||
Map<String, String> configs = new HashMap<>();
|
Map<String, String> configs = new HashMap<>();
|
||||||
configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig);
|
configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig);
|
||||||
configs.put("CASE_ENABLE", "true");
|
configs.put("CASE_ENABLE", "true");
|
||||||
configs.put("SYNC_ENABLE", "true");
|
|
||||||
configs.put("CRON_EXPRESSION", "0 0 0 * * ?");
|
configs.put("CRON_EXPRESSION", "0 0 0 * * ?");
|
||||||
return configs;
|
return configs;
|
||||||
}
|
}
|
||||||
|
@ -476,7 +475,6 @@ public class ProjectApplicationControllerTests extends BaseTest {
|
||||||
Map<String, String> configs = new HashMap<>();
|
Map<String, String> configs = new HashMap<>();
|
||||||
configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig);
|
configs.put("DEMAND_PLATFORM_CONFIG", jsonConfig);
|
||||||
configs.put("CASE_ENABLE", "false");
|
configs.put("CASE_ENABLE", "false");
|
||||||
configs.put("SYNC_ENABLE", "true");
|
|
||||||
configs.put("CRON_EXPRESSION", "0 0 0/1 * * ?");
|
configs.put("CRON_EXPRESSION", "0 0 0/1 * * ?");
|
||||||
return configs;
|
return configs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,38 +35,8 @@
|
||||||
:form-rule="platformRules"
|
:form-rule="platformRules"
|
||||||
@mounted="handleMounted"
|
@mounted="handleMounted"
|
||||||
/>
|
/>
|
||||||
<a-form-item>
|
|
||||||
<a-tooltip v-if="okDisabled" :content="t('project.menu.defect.enableAfterConfig')">
|
|
||||||
<a-switch size="small" type="line" disabled />
|
|
||||||
</a-tooltip>
|
|
||||||
<a-switch
|
|
||||||
v-else
|
|
||||||
v-model="form.SYNC_ENABLE"
|
|
||||||
checked-value="true"
|
|
||||||
unchecked-value="false"
|
|
||||||
size="small"
|
|
||||||
type="line"
|
|
||||||
@change="handleSwitchChange"
|
|
||||||
/>
|
|
||||||
<span class="ml-[8px] text-[var(--color-text-1)]">
|
|
||||||
{{ t('project.menu.updateSync') }}
|
|
||||||
</span>
|
|
||||||
<a-tooltip position="tl" :content-style="{ maxWidth: '500px' }">
|
|
||||||
<template #content>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<div>{{ t('project.menu.updateSyncTip') }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div>
|
|
||||||
<MsIcon
|
|
||||||
class="ml-[8px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
|
|
||||||
type="icon-icon-maybe_outlined"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-tooltip>
|
|
||||||
</a-form-item>
|
|
||||||
<!-- 同步频率 -->
|
<!-- 同步频率 -->
|
||||||
<a-form-item v-if="hasChange" field="CRON_EXPRESSION" :label="t('project.menu.CRON_EXPRESSION')">
|
<a-form-item field="CRON_EXPRESSION" :label="t('project.menu.CRON_EXPRESSION')">
|
||||||
<MsCronSelect v-model:model-value="form.CRON_EXPRESSION" />
|
<MsCronSelect v-model:model-value="form.CRON_EXPRESSION" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
@ -147,12 +117,10 @@
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
PLATFORM_KEY: '',
|
PLATFORM_KEY: '',
|
||||||
CASE_ENABLE: 'false', // 关联需求开关
|
CASE_ENABLE: 'false', // 关联需求开关
|
||||||
SYNC_ENABLE: 'false', // 同步开关
|
SYNC_ENABLE: 'true', // 同步开关
|
||||||
CRON_EXPRESSION: '0 0 0 * * ?', // 同步频率
|
CRON_EXPRESSION: '0 0 0 * * ?', // 同步频率
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasChange = ref(false);
|
|
||||||
|
|
||||||
const formCreateValue = ref<Record<string, any>>({});
|
const formCreateValue = ref<Record<string, any>>({});
|
||||||
|
|
||||||
const okDisabled = computed(() => !form.PLATFORM_KEY);
|
const okDisabled = computed(() => !form.PLATFORM_KEY);
|
||||||
|
@ -241,7 +209,6 @@
|
||||||
// 如果平台key存在调用平台change拉取插件字段
|
// 如果平台key存在调用平台change拉取插件字段
|
||||||
await handlePlatformChange(res.platform_key);
|
await handlePlatformChange(res.platform_key);
|
||||||
form.CASE_ENABLE = res.case_enable;
|
form.CASE_ENABLE = res.case_enable;
|
||||||
hasChange.value = res.sync_enable === 'true';
|
|
||||||
form.PLATFORM_KEY = res.platform_key;
|
form.PLATFORM_KEY = res.platform_key;
|
||||||
form.SYNC_ENABLE = res.sync_enable;
|
form.SYNC_ENABLE = res.sync_enable;
|
||||||
form.CRON_EXPRESSION = res.cron_expression;
|
form.CRON_EXPRESSION = res.cron_expression;
|
||||||
|
@ -267,12 +234,6 @@
|
||||||
setValue();
|
setValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSwitchChange(value: string | number | boolean) {
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
hasChange.value = value === 'true';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.visible,
|
() => props.visible,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|
Loading…
Reference in New Issue