diff --git a/ui/src/main.js b/ui/src/main.js index 873e6f1..b70af1f 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -72,6 +72,14 @@ const changeLoading = ref(false); const changeApplying = ref(false); const changeError = ref(""); + const proposalSummary = ref(""); + const proposalTarget = ref("10-systems/new-document.md"); + const proposalReason = ref(""); + const proposalContent = ref( + "---\nowner: gmikcon\nstatus: draft\nlast_reviewed: 2026-05-09\nreview_interval: 90d\nconfidence: medium\nsource_of_truth: manual\n---\n\n# New Document\n\n" + ); + const proposalRunning = ref(false); + const proposalError = ref(""); const gitStatus = ref(null); const selectedCommitFiles = ref([]); const commitSummary = ref(""); @@ -263,6 +271,34 @@ } }; + const proposeDocChange = async () => { + if (!proposalSummary.value.trim() || !proposalTarget.value.trim() || !proposalContent.value.trim()) { + proposalError.value = "Summary, target, and content are required"; + return; + } + proposalRunning.value = true; + proposalError.value = ""; + try { + const created = await apiPost("/changes", { + kind: "doc", + target: proposalTarget.value.trim(), + summary: proposalSummary.value.trim(), + reason: proposalReason.value.trim(), + payload: { + content: proposalContent.value + } + }); + changes.value = await apiGet("/changes"); + await loadChange(created.id); + proposalSummary.value = ""; + proposalReason.value = ""; + } catch (caught) { + proposalError.value = caught instanceof Error ? caught.message : "Failed to propose change"; + } finally { + proposalRunning.value = false; + } + }; + const commitSelectedFiles = async () => { if (!commitCanRun.value) { return; @@ -372,6 +408,13 @@ loadInventoryType, loading, overview, + proposalContent, + proposalError, + proposalReason, + proposalRunning, + proposalSummary, + proposalTarget, + proposeDocChange, selectedInventoryId, selectedInventoryRecord, selectedInventoryRecordJson, @@ -509,47 +552,74 @@