Forge
csharp3407750f
1using AgentForge.Data.Entities;
2using AgentForge.Models;
3
4namespace AgentForge.Plugin.View.Components.Iop;
5
6internal static class ForgeViewIopMrActions
7{
8 internal static string Render(string repoName, ForgeMergeRequestEntity mergeRequest, ForgeRepoEntity repo, bool showActions)
9 {
10 if (!showActions)
11 return "";
12
13 var acceptAction = $"/view/repos/{ForgeRepoNames.ToUrlPath(repoName)}/merge-requests/{mergeRequest.Number}/accept";
14 var rejectAction = $"/view/repos/{ForgeRepoNames.ToUrlPath(repoName)}/merge-requests/{mergeRequest.Number}/reject";
15
16 var hint = repo.DriveMode == DriveMode.AgentDriven
17 ? ForgeHtml.P("iop-meta",
18 ForgeHtml.Text("Agent-driven: actor with "),
19 ForgeHtml.Code("write"),
20 ForgeHtml.Text(" may accept."))
21 : ForgeHtml.P("iop-meta",
22 ForgeHtml.Text("Human-driven: accept needs "),
23 ForgeHtml.Code("accept_merge"),
24 ForgeHtml.Text("."));
25
26 return ForgeHtml.Fragment(
27 ForgeHtml.Div("iop-actions",
28 ForgeHtml.Form("post", acceptAction, "iop-inline-form",
29 ForgeHtml.Button("submit", "Approve merge", "btn-approve")),
30 ForgeHtml.Form("post", rejectAction, "iop-inline-form",
31 ForgeHtml.Button("submit", "Reject", "btn-reject"))),
32 hint);
33 }
34}
35
View only · write via MCP/CIDE