MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / handleScheduleSubmit

Function handleScheduleSubmit

static/js/app.js:773–810  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

771}
772
773async function handleScheduleSubmit(e) {
774 e.preventDefault();
775
776 try {
777 const registrationConfig = buildCurrentRegistrationConfig();
778 if (registrationConfig.email_service_type === 'outlook_batch' && (!registrationConfig.service_ids || registrationConfig.service_ids.length === 0)) {
779 toast.error('请至少选择一个 Outlook 账户后再保存计划');
780 return;
781 }
782
783 const { schedule_type, schedule_config } = buildScheduleConfig();
784 const payload = {
785 name: (elements.scheduleName.value || '').trim(),
786 enabled: elements.scheduleEnabled.value === 'true',
787 schedule_type,
788 schedule_config,
789 registration_config: registrationConfig,
790 timezone: 'local',
791 };
792
793 if (!payload.name) {
794 toast.error('请输入计划名称');
795 return;
796 }
797
798 const endpoint = editingScheduleJobUuid
799 ? `/registration/schedules/${editingScheduleJobUuid}`
800 : '/registration/schedules';
801 const method = editingScheduleJobUuid ? 'put' : 'post';
802
803 await api[method](endpoint, payload);
804 toast.success(editingScheduleJobUuid ? '计划任务已更新' : '计划任务已创建');
805 resetScheduleForm();
806 await loadScheduledJobs();
807 } catch (error) {
808 toast.error(error.message);
809 }
810}
811
812function resetScheduleForm() {
813 editingScheduleJobUuid = null;

Callers

nothing calls this directly

Calls 6

buildScheduleConfigFunction · 0.85
resetScheduleFormFunction · 0.85
loadScheduledJobsFunction · 0.85
errorMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected