([]);
const [loadingHistory, setLoadingHistory] = useState(false);
@@ -65,7 +66,7 @@ export default function DashboardPage() {
try {
const rows = await api.getPipelineHistory({
repoFullName,
- branch,
+ branch: branchName,
limit: 20,
});
if (!cancelled) {
@@ -87,11 +88,11 @@ export default function DashboardPage() {
cancelled = true;
};
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [repoFullName, branch]);
+ }, [repoFullName, branchName]);
async function handleRollback(version: PipelineVersion) {
if (!version?.id) return;
- const confirmMsg = `Rollback ${repoFullName}@${branch} to version created at ${formatDate(
+ const confirmMsg = `Rollback ${repoFullName}@${branchName} to version created at ${formatDate(
version.created_at
)}?`;
if (!window.confirm(confirmMsg)) return;
@@ -119,7 +120,7 @@ export default function DashboardPage() {
function handleCommitClick() {
const repoFullNameLocal = result?.repo || repo;
const yaml = result?.generated_yaml;
- const branchLocal = result?.branch || "main";
+ const branchLocal = (result as any)?.branch || branchName || "main";
const environment = cfg.env || "dev";
const provider = "aws";
const path = `.github/workflows/${environment}-deploy.yml`;
@@ -146,7 +147,7 @@ export default function DashboardPage() {
Pipeline Dashboard
{repoFullName ? (
- {repoFullName} @ {branch}
+ {repoFullName} @ {branchName}
) : (
diff --git a/client/src/routes/Jenkins.tsx b/client/src/routes/Jenkins.tsx
deleted file mode 100644
index 1ffa13e..0000000
--- a/client/src/routes/Jenkins.tsx
+++ /dev/null
@@ -1,149 +0,0 @@
-import { useEffect, useState } from "react";
-import { BASE } from "../lib/api";
-
-const SERVER_BASE = BASE.replace(/\/api$/, "");
-const MCP_URL_FALLBACK = "http://192.168.1.35/mcp-server/mcp";
-const MCP_URL_GENERAL_HINT = "Enter the MCP server URL (e.g. https:///mcp-server/mcp)";
-
-export default function Jenkins() {
- const [question, setQuestion] = useState("");
- const [answer, setAnswer] = useState("");
- const [error, setError] = useState(null);
- const [loading, setLoading] = useState(false);
- const [mcpUrl, setMcpUrl] = useState(MCP_URL_FALLBACK);
- const [jenkinsToken, setJenkinsToken] = useState("");
- const [mcpUrlHint, setMcpUrlHint] = useState(MCP_URL_FALLBACK);
- const [tokenHint, setTokenHint] = useState("");
- const [configError, setConfigError] = useState(null);
-
- useEffect(() => {
- let isMounted = true;
- async function loadHints() {
- try {
- const res = await fetch(`${SERVER_BASE}/jenkins/config`, {
- credentials: "include",
- });
- if (!res.ok) {
- throw new Error(res.statusText);
- }
- const data = await res.json().catch(() => ({}));
- if (!isMounted) return;
- const hintUrl = data?.mcpUrlHint || MCP_URL_FALLBACK;
- const hintToken = data?.tokenHint || "";
- setMcpUrlHint(hintUrl);
- setTokenHint(hintToken);
- setMcpUrl(hintUrl);
- setJenkinsToken(hintToken);
- setConfigError(null);
- } catch (err: any) {
- if (!isMounted) return;
- setConfigError(err?.message || "Unable to load Jenkins defaults");
- }
- }
-
- loadHints();
- return () => {
- isMounted = false;
- };
- }, []);
-
- async function handleAsk() {
- if (!question.trim() || !mcpUrl.trim() || !jenkinsToken.trim()) return;
- setLoading(true);
- setError(null);
- setAnswer("");
- try {
- const res = await fetch(`${SERVER_BASE}/jenkins/ask`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- credentials: "include",
- body: JSON.stringify({
- question: question.trim(),
- mcpUrl: mcpUrl.trim() || undefined,
- token: jenkinsToken.trim() || undefined,
- }),
- });
- const data = await res.json().catch(() => ({}));
- if (!res.ok) throw new Error((data as any)?.error || res.statusText);
- setAnswer(data?.answer ?? "");
- } catch (err: any) {
- setError(err?.message ?? "Request failed");
- } finally {
- setLoading(false);
- }
- }
-
- return (
-
- );
-}