Skip to content

Commit 01759dc

Browse files
authored
Merge pull request #45 from oslabs-beta/configpagechanges
fix: commit to github button fixed on dashboard page
2 parents ef643de + 05bc0fa commit 01759dc

File tree

4 files changed

+10
-159
lines changed

4 files changed

+10
-159
lines changed

client/src/App.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import ConnectPage from "./pages/ConnectPage";
44
import ConfigurePage from "./pages/ConfigurePage";
55
import SecretsPage from "./pages/SecretsPage";
66
import DashboardPage from "./pages/DashboardPage";
7-
import Jenkins from "./routes/Jenkins";
87
import { useRepoStore } from "./store/useRepoStore";
98
import { usePipelineStore } from "./store/usePipelineStore";
109

@@ -56,7 +55,6 @@ export default function App() {
5655
<NavLink to="/configure">2 Configure</NavLink>
5756
<NavLink to="/secrets">3 Secrets</NavLink>
5857
<NavLink to="/dashboard">4 Dashboard</NavLink>
59-
<NavLink to="/jenkins">5 Jenkins</NavLink>
6058
</nav>
6159
</header>
6260

@@ -90,7 +88,6 @@ export default function App() {
9088
</NeedRepo>
9189
}
9290
/>
93-
<Route path="/jenkins" element={<Jenkins />} />
9491
</Routes>
9592
</main>
9693
</BrowserRouter>

client/src/lib/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { usePipelineStore } from "../store/usePipelineStore";
2+
13
// In dev: talk to Vite dev server proxy at /api
24
// In prod: use the real backend URL from VITE_API_BASE (e.g. https://api.autodeploy.app)
35
const DEFAULT_API_BASE =

client/src/pages/DashboardPage.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function formatDate(iso: string) {
1919
}
2020

2121
export default function DashboardPage() {
22-
const { repo } = useRepoStore();
22+
const { repo, branch: selectedBranch } = useRepoStore();
2323
const { result, setResultYaml } = usePipelineStore();
2424
const cfg = useConfigStore();
2525

@@ -36,7 +36,8 @@ export default function DashboardPage() {
3636
}, [clear]);
3737

3838
const repoFullName = result?.repo || repo || "";
39-
const branch = (result as any)?.branch || "main";
39+
const branchName =
40+
(result as any)?.branch || selectedBranch || "main";
4041

4142
const [versions, setVersions] = useState<PipelineVersion[]>([]);
4243
const [loadingHistory, setLoadingHistory] = useState(false);
@@ -65,7 +66,7 @@ export default function DashboardPage() {
6566
try {
6667
const rows = await api.getPipelineHistory({
6768
repoFullName,
68-
branch,
69+
branch: branchName,
6970
limit: 20,
7071
});
7172
if (!cancelled) {
@@ -87,11 +88,11 @@ export default function DashboardPage() {
8788
cancelled = true;
8889
};
8990
// eslint-disable-next-line react-hooks/exhaustive-deps
90-
}, [repoFullName, branch]);
91+
}, [repoFullName, branchName]);
9192

9293
async function handleRollback(version: PipelineVersion) {
9394
if (!version?.id) return;
94-
const confirmMsg = `Rollback ${repoFullName}@${branch} to version created at ${formatDate(
95+
const confirmMsg = `Rollback ${repoFullName}@${branchName} to version created at ${formatDate(
9596
version.created_at
9697
)}?`;
9798
if (!window.confirm(confirmMsg)) return;
@@ -119,7 +120,7 @@ export default function DashboardPage() {
119120
function handleCommitClick() {
120121
const repoFullNameLocal = result?.repo || repo;
121122
const yaml = result?.generated_yaml;
122-
const branchLocal = result?.branch || "main";
123+
const branchLocal = (result as any)?.branch || branchName || "main";
123124
const environment = cfg.env || "dev";
124125
const provider = "aws";
125126
const path = `.github/workflows/${environment}-deploy.yml`;
@@ -146,7 +147,7 @@ export default function DashboardPage() {
146147
<h1 className="text-2xl font-semibold">Pipeline Dashboard</h1>
147148
{repoFullName ? (
148149
<p className="text-sm text-muted-foreground">
149-
{repoFullName} @ <span className="font-mono">{branch}</span>
150+
{repoFullName} @ <span className="font-mono">{branchName}</span>
150151
</p>
151152
) : (
152153
<p className="text-sm text-orange-600">

client/src/routes/Jenkins.tsx

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)