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

Function setRegistrationConfigToForm

static/js/app.js:827–895  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

825}
826
827function setRegistrationConfigToForm(config) {
828 const registrationConfig = config || {};
829 const emailServiceType = registrationConfig.email_service_type || 'tempmail';
830 const emailServiceId = registrationConfig.email_service_id;
831 const serviceValue = emailServiceType === 'outlook_batch'
832 ? 'outlook_batch:all'
833 : `${emailServiceType}:${emailServiceId ?? 'default'}`;
834
835 elements.emailService.value = serviceValue;
836 handleServiceChange({ target: elements.emailService });
837
838 elements.autoUploadCpa.checked = !!registrationConfig.auto_upload_cpa;
839 elements.cpaServiceSelectGroup.style.display = elements.autoUploadCpa.checked ? 'block' : 'none';
840 elements.autoUploadSub2api.checked = !!registrationConfig.auto_upload_sub2api;
841 elements.sub2apiServiceSelectGroup.style.display = elements.autoUploadSub2api.checked ? 'block' : 'none';
842 if (elements.autoUploadCodex2api) {
843 elements.autoUploadCodex2api.checked = !!registrationConfig.auto_upload_codex2api;
844 }
845 if (elements.codex2apiServiceSelectGroup && elements.autoUploadCodex2api) {
846 elements.codex2apiServiceSelectGroup.style.display = elements.autoUploadCodex2api.checked ? 'block' : 'none';
847 }
848 if (elements.autoUploadNewApi) {
849 elements.autoUploadNewApi.checked = !!registrationConfig.auto_upload_new_api;
850 }
851 if (elements.newApiServiceSelectGroup && elements.autoUploadNewApi) {
852 elements.newApiServiceSelectGroup.style.display = elements.autoUploadNewApi.checked ? 'block' : 'none';
853 }
854 if (elements.filterOnlyAccessTokenAccounts) {
855 elements.filterOnlyAccessTokenAccounts.checked = registrationConfig.filter_only_access_token_accounts !== false;
856 }
857
858 setSelectedServiceIds(elements.cpaServiceSelect, registrationConfig.cpa_service_ids || []);
859 setSelectedServiceIds(elements.sub2apiServiceSelect, registrationConfig.sub2api_service_ids || []);
860 setSelectedServiceIds(elements.codex2apiServiceSelect, registrationConfig.codex2api_service_ids || []);
861 setSelectedServiceIds(elements.newApiServiceSelect, registrationConfig.new_api_service_ids || []);
862
863 if (emailServiceType === 'outlook_batch') {
864 isOutlookBatchMode = true;
865 elements.outlookBatchSection.style.display = 'block';
866 elements.regModeGroup.style.display = 'none';
867 elements.batchCountGroup.style.display = 'none';
868 elements.batchOptions.style.display = 'none';
869 if (Array.isArray(registrationConfig.service_ids) && registrationConfig.service_ids.length) {
870 const selectedSet = new Set(registrationConfig.service_ids.map(item => parseInt(item)));
871 document.querySelectorAll('.outlook-account-checkbox').forEach(cb => {
872 cb.checked = selectedSet.has(parseInt(cb.value));
873 });
874 }
875 elements.outlookSkipRegistered.checked = registrationConfig.skip_registered !== false;
876 elements.outlookIntervalMin.value = registrationConfig.interval_min || 5;
877 elements.outlookIntervalMax.value = registrationConfig.interval_max || 30;
878 elements.outlookConcurrencyCount.value = registrationConfig.concurrency || 3;
879 elements.outlookConcurrencyMode.value = registrationConfig.mode || 'pipeline';
880 handleConcurrencyModeChange(elements.outlookConcurrencyMode, elements.outlookConcurrencyHint, elements.outlookIntervalGroup);
881 return;
882 }
883
884 isOutlookBatchMode = false;

Callers 3

loadAvailableServicesFunction · 0.85
loadScheduledJobsFunction · 0.85
editScheduledJobFunction · 0.85

Calls 4

handleServiceChangeFunction · 0.85
setSelectedServiceIdsFunction · 0.85
handleModeChangeFunction · 0.85

Tested by

no test coverage detected