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

Function deleteSelectedTemplate

static/js/payment.js:872–895  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

870}
871
872async function deleteSelectedTemplate() {
873 const selectEl = document.getElementById("billing-template-select");
874 if (!selectEl || !selectEl.value) {
875 toast.warning("请先选择模板");
876 return;
877 }
878
879 const templates = getBillingTemplates();
880 const selected = templates.find((tpl) => tpl.id === selectEl.value);
881 if (!selected) {
882 toast.warning("模板不存在或已删除");
883 refreshBillingTemplateSelect();
884 return;
885 }
886
887 const ok = await confirm(`确认删除模板「${selected.name}」吗?`, "删除模板");
888 if (!ok) return;
889
890 const next = templates.filter((tpl) => tpl.id !== selected.id);
891 saveBillingTemplates(next);
892 refreshBillingTemplateSelect();
893 setInputValue("billing-template-name", "");
894 toast.success(`模板已删除: ${selected.name}`);
895}
896
897function saveBatchProfilesAsTemplates() {
898 if (!billingBatchProfiles.length) {

Callers

nothing calls this directly

Calls 8

getBillingTemplatesFunction · 0.85
confirmFunction · 0.85
saveBillingTemplatesFunction · 0.85
setInputValueFunction · 0.85
warningMethod · 0.80
successMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected