perf: 站点监控增加是否自动同步IP开关

This commit is contained in:
xiaojunnuo
2026-01-09 01:20:04 +08:00
parent 1a29541140
commit 52689049ae
6 changed files with 24 additions and 11 deletions
@@ -281,6 +281,7 @@ export default {
lastCheckTime: "Last Check Time", lastCheckTime: "Last Check Time",
disabled: "Enable/Disable", disabled: "Enable/Disable",
ipCheck: "Enable IP Check", ipCheck: "Enable IP Check",
ipSyncAuto: "Enable IP Sync Auto",
selectRequired: "Please select", selectRequired: "Please select",
ipCheckConfirm: "Are you sure to {status} IP check?", ipCheckConfirm: "Are you sure to {status} IP check?",
ipCount: "IP Count", ipCount: "IP Count",
@@ -285,6 +285,7 @@ export default {
lastCheckTime: "上次检查时间", lastCheckTime: "上次检查时间",
disabled: "禁用启用", disabled: "禁用启用",
ipCheck: "开启IP检查", ipCheck: "开启IP检查",
ipSyncAuto: "自动同步IP",
selectRequired: "请选择", selectRequired: "请选择",
ipCheckConfirm: "确定{status}IP检查?", ipCheckConfirm: "确定{status}IP检查?",
ipCount: "IP数量", ipCount: "IP数量",
@@ -651,14 +651,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
} as ColumnCompositionProps, } as ColumnCompositionProps,
ipCount: { ipSyncAuto: {
title: t("certd.monitor.ipCount"), title: t("certd.monitor.ipSyncAuto"),
search: { type: "dict-switch",
show: false, dict: dict({
}, data: [
type: "text", { label: t("common.enabled"), value: true, color: "green" },
{ label: t("common.disabled"), value: false, color: "gray" },
],
}),
form: { form: {
show: false, value: true,
show: compute(({ form }) => {
return form.ipCheck;
}),
}, },
column: { column: {
width: 100, width: 100,
@@ -1,4 +1,4 @@
ALTER TABLE cd_site_info ADD COLUMN ip_scan boolean DEFAULT (0); ALTER TABLE cd_site_info ADD COLUMN ip_sync_auto boolean DEFAULT (0);
ALTER TABLE pi_pipeline ADD COLUMN webhook_key varchar(100); ALTER TABLE pi_pipeline ADD COLUMN webhook_key varchar(100);
ALTER TABLE pi_pipeline ADD COLUMN trigger_count integer DEFAULT (0); ALTER TABLE pi_pipeline ADD COLUMN trigger_count integer DEFAULT (0);
@@ -46,8 +46,8 @@ export class SiteInfoEntity {
@Column({ name: 'ip_check', comment: '是否检查IP' }) @Column({ name: 'ip_check', comment: '是否检查IP' })
ipCheck: boolean; ipCheck: boolean;
@Column({ name: 'ip_scan', comment: '是否自动获取IP' }) @Column({ name: 'ip_sync_auto', comment: '是否自动同步IP' })
ipScan: boolean; ipSyncAuto: boolean;
@Column({ name: 'ip_count', comment: 'ip数量' }) @Column({ name: 'ip_count', comment: 'ip数量' })
ipCount: number ipCount: number
@@ -237,7 +237,12 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
logger.error("send notify error", e); logger.error("send notify error", e);
} }
}; };
await this.siteIpService.syncAndCheck(site, retryTimes,onFinished); if (!site.ipSyncAuto) {
await this.siteIpService.checkAll(site, retryTimes,onFinished);
}else{
await this.siteIpService.syncAndCheck(site, retryTimes,onFinished);
}
} }
/** /**